smkrv's picture
fp16 Core ML conversion: ruBert-base Collection3 NER (PER/ORG/LOC), parity 99.98% tokens
0fe9ca9 verified
|
Raw
History Blame Contribute Delete
1.69 kB
---
license: apache-2.0
language:
- ru
tags:
- ner
- token-classification
- coreml
- russian
base_model: ai-forever/ruBert-base
---
# rubert-base-collection3-ner-coreml
Russian NER (PER / ORG / LOC) as a self-contained fp16 Core ML package for on-device
inference on Apple Silicon. Converted for the [Letopis](https://smkrv.net/letopis) macOS app
(on-device PII redaction of call transcripts); usable by any Core ML consumer.
## Lineage
- Base model: [ai-forever/ruBert-base](https://huggingface.co/ai-forever/ruBert-base)
- Fine-tune (Collection3, PER/ORG/LOC): [viktor-shcherb/sberbank-rubert-base-collection3](https://huggingface.co/viktor-shcherb/sberbank-rubert-base-collection3) (Apache-2.0); reported Collection3 test F1 0.948
- This repo: fp16 Core ML conversion of that fine-tune, plus the WordPiece vocab and label map
## Files
- `NERCollection3.mlpackage` - BertForTokenClassification, fp16 mlprogram, fixed shape
(1, 256): inputs `input_ids` + `attention_mask` (int32), output `logits` (1, 256, 7)
- `vocab.txt` - WordPiece vocab (do_lower_case = true, accents stripped per BERT BasicTokenizer)
- `tokenizer_config.json` - reference tokenizer settings
- `config.json` - `id2label`: O, B-PER, I-PER, B-ORG, I-ORG, B-LOC, I-LOC; `seq_len: 256`
- `tokenizer_fixtures.json` - reference tokenizations (ids + char offsets) for porting tokenizers
## Conversion fidelity
Verified against the PyTorch original on 1500 conversational RU sentences (cased and
lowercase/unpunctuated): token-level label agreement 99.98%, entity-span agreement 99.8%.
## License
Apache-2.0, inherited from the fine-tune and base model. Conversion and packaging:
© 2026 Sergey Makarov.