Instructions to use OEGtech/oeg-pii-ru-lite with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use OEGtech/oeg-pii-ru-lite with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("token-classification", model="OEGtech/oeg-pii-ru-lite")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForTokenClassification tokenizer = AutoTokenizer.from_pretrained("OEGtech/oeg-pii-ru-lite") model = AutoModelForTokenClassification.from_pretrained("OEGtech/oeg-pii-ru-lite", device_map="auto") - Notebooks
- Google Colab
- Kaggle
OEG PII RU Lite 0.1.0 (preview)
English
A lightweight early release of the OEG model for removing personal data from Russian text.
It finds personal data in call transcripts (numbers spoken as words, no punctuation) and in
messy chat text, and replaces it with reversible placeholders such as [ТЕЛЕФОН_1].
Fine-tuned by OEG from redmadrobot-rnd/rubert-base-pii-ner (Apache 2.0). This is a preview: please read the limitations before use.
Code for training, evaluation and masking: github.com/Open-Engineering-Group/oeg-pii-ru.
What it finds
28 types: 21 inherited from the base model and 7 added in this release (in bold).
| Group | Types |
|---|---|
| People | FIRST_NAME, LAST_NAME, MIDDLE_NAME, DATE_OF_BIRTH |
| Addresses | COUNTRY, REGION, DISTRICT, CITY, STREET, HOUSE |
| Contacts | PHONE, EMAIL, URL, IP_ADDRESS, TG_NICK (Telegram), MAX_NICK (MAX messenger) |
| Documents | PASSPORT, INN, SNILS, OMS, DRIVER_LICENSE, MILITARY_ID, BIRTH_CERTIFICATE, CREDIT_CARD |
| Bank details | BANK_ACCOUNT, CORR_ACCOUNT, BIK, KPP |
Quick start
# pip install torch transformers
from oeg_pii_mask import PiiMasker # oeg_pii_mask.py is in this repository
masker = PiiMasker("oegtech/oeg-pii-ru-lite")
masked, mapping = masker.mask("алло это ирина соколова телефон восемь девятьсот шестнадцать пятьсот пятьдесят пять двенадцать тридцать четыре")
print(masked) # алло это [ИМЯ_1] [ФАМИЛИЯ_1] телефон [ТЕЛЕФОН_1]
print(masker.restore(masked, mapping)) # the original text
Keep mapping on your side: it holds the real values. The model labels whole words, so
oeg_pii_mask.py splits the text into words itself; the standard pipeline with sub-token
aggregation gives less accurate results. Placeholders are in Russian.
Results
Metrics are computed per word. "Found" is the share of real entities touched by at least one label of any type (for masking, a miss matters, not the exact type). "Precision" is the share of labels that land on a real entity. None of these sets was used for training or model selection.
| Test | Base model: found / precision | OEG PII RU Lite: found / precision |
|---|---|---|
| pii_benchmark, normal text (5,614 entities) | 95.46% / 98.48% | 96.96% / 96.09% |
| pii_benchmark, no punctuation, lower case | 83.29% / 98.41% | 95.06% / 96.01% |
| pii_benchmark, simulated call (numbers as words) | 42.41% / 98.57% | 95.79% / 92.20% |
| OEG handmade test (102 entities, 108 lines) | 54.37% / 94.92% | 88.24% / 96.77% |
Values never seen in training only: on the simulated calls the model finds 94.85% (base model 36.35%), on normal text 96.78% (base model 93.58%).
Our scoring protocol differs from the one in the base model's card, so numbers from the two cards cannot be compared directly. The table above scores both models the same way.
Limitations (important)
- Bank details with capitalised cues. "БИК 044525225", "КПП 231001001", "к/сч …" are mostly missed on the handmade test (KPP and correspondent account 0 of 2, BIK 2 of 4). Lower-case "бик", "кпп", "р/с" work better. To be fixed in 0.2.0.
- Nicknames without a cue ("ник vadim_prokat") and year of birth ("1994 г.р.") are often missed.
- More false alarms than the base model. On normal text, extra labels appeared in 56 of 371 sentences without personal data (13 for the base model).
- Calls are simulated. We rewrote text programmatically (numbers as words, no punctuation, filler words). Quality on real transcripts with speech recognition errors is not yet measured.
- Foreign names in English text and abbreviations ("СПБ") are missed more often than other types.
- The handmade test was written by the team and is small. There is no independent annotation yet.
- The model is one layer of protection. It does not guarantee full anonymisation and does not by itself ensure compliance with Russian law 152-FZ or any other law. Reversible replacement is pseudonymisation: such data may still count as personal data.
Training
- Base:
redmadrobot-rnd/rubert-base-pii-ner(ruBERT-base, 178M parameters). The classifier was extended from 43 to 57 labels; weights of the base labels were kept. - Data (173,193 rows, a third without personal data):
redmadrobot-rnd/pii_train(MIT): source sentences. Document numbers were replaced with new values of the same format, and some names were switched to Latin script.- A fragment of
Den4ikAI/russian_dialogues(MIT): about 106,000 short lines from open Telegram chats. Lines with digits, links, names or talk about personal data were removed by rules and a model filter. The lines serve as background and as examples without personal data. We do not redistribute the set or data derived from it. - All personal data in training is fictional: generated with Faker (MIT) and format generators.
- Text variants: normal, no punctuation, simulated call (numbers as words, filler words, dropped words and typos).
- Settings: 4 epochs, lr 2e-5 with linear decay, batch 32, bf16, class O weight 0.5. Epoch 3 was picked by F1 on a held-out set. Trained on a single laptop (NVIDIA RTX Spark N1X).
- pii_benchmark was not used in training.
License and thanks
Apache 2.0, like the base model. Thanks to Red Mad Robot R&D for the model and datasets, and to
the authors of russian_dialogues and Faker.
Русский
Облегчённая ранняя версия модели OEG для обезличивания персональных данных. Находит их в
русском тексте, включая расшифровки звонков (цифры словами, без пунктуации) и
неформатированные переписки, и помогает заменить метками вида [ТЕЛЕФОН_1] с возможностью
обратного восстановления.
Основана на redmadrobot-rnd/rubert-base-pii-ner (Apache 2.0) и дообучена командой OEG. Это ранняя версия (preview): ограничения ниже нужно прочитать до использования.
Код обучения, оценки и маскирования: github.com/Open-Engineering-Group/oeg-pii-ru.
Что находит
28 типов: 21 унаследован от базовой модели, 7 добавлены в этой версии (выделены).
| Группа | Типы |
|---|---|
| Люди | FIRST_NAME, LAST_NAME, MIDDLE_NAME, DATE_OF_BIRTH |
| Адреса | COUNTRY, REGION, DISTRICT, CITY, STREET, HOUSE |
| Контакты | PHONE, EMAIL, URL, IP_ADDRESS, TG_NICK, MAX_NICK |
| Документы | PASSPORT, INN, SNILS, OMS, DRIVER_LICENSE, MILITARY_ID, BIRTH_CERTIFICATE, CREDIT_CARD |
| Реквизиты | BANK_ACCOUNT, CORR_ACCOUNT, BIK, KPP |
Быстрый старт
# pip install torch transformers
from oeg_pii_mask import PiiMasker # файл oeg_pii_mask.py лежит в этом репозитории
masker = PiiMasker("oegtech/oeg-pii-ru-lite")
masked, mapping = masker.mask("алло это ирина соколова телефон восемь девятьсот шестнадцать пятьсот пятьдесят пять двенадцать тридцать четыре")
print(masked) # алло это [ИМЯ_1] [ФАМИЛИЯ_1] телефон [ТЕЛЕФОН_1]
print(masker.restore(masked, mapping)) # исходный текст
Таблицу mapping храните у себя: в ней настоящие значения. Модель размечает слова целиком,
поэтому oeg_pii_mask.py сам делит текст на слова; стандартный pipeline с агрегацией
подтокенов даёт менее точный результат.
Результаты
Метрики считаются по словам. «Найдено» — доля настоящих сущностей, которых коснулась хоть одна метка любого типа (для маскирования важен пропуск, а не точный тип). «Точность» — доля меток, попавших в настоящую сущность. Ни один из этих наборов не использовался для обучения или выбора модели.
| Тест | Базовая модель: найдено / точность | OEG PII RU Lite: найдено / точность |
|---|---|---|
| pii_benchmark, обычный текст (5 614 сущностей) | 95,46% / 98,48% | 96,96% / 96,09% |
| pii_benchmark, без пунктуации и строчными | 83,29% / 98,41% | 95,06% / 96,01% |
| pii_benchmark, имитация звонка (цифры словами) | 42,41% / 98,57% | 95,79% / 92,20% |
| Ручной тест OEG (102 сущности, 108 строк) | 54,37% / 94,92% | 88,24% / 96,77% |
Только значения, которых не было в обучающих данных: на имитации звонка модель находит 94,85% (базовая модель 36,35%), на обычном тексте 96,78% (базовая 93,58%).
Наш протокол подсчёта отличается от протокола в карточке базовой модели, поэтому цифры из двух карточек напрямую сравнивать нельзя. Таблица выше посчитана одинаково для обеих моделей.
Ограничения (важно)
- Реквизиты с заглавными подсказками. «БИК 044525225», «КПП 231001001», «к/сч …» на ручном тесте почти не находятся (КПП и корр. счёт 0 из 2, БИК 2 из 4). Строчные «бик», «кпп», «р/с» работают лучше. Исправим в 0.2.0.
- Ники без подсказки («ник vadim_prokat») и год рождения («1994 г.р.») часто пропускаются.
- Больше ложных срабатываний, чем у базовой модели. На обычном тексте лишние метки появились в 56 из 371 предложений без персональных данных (у базовой модели в 13).
- Звонки имитированы. Мы переписывали текст программно (цифры словами, без пунктуации, слова-паразиты). На настоящих расшифровках с ошибками распознавания качество не проверено.
- Иностранные имена в английском тексте и сокращения («СПБ») пропускаются чаще остальных.
- Ручной тест написан внутри команды и невелик. Независимой разметки пока нет.
- Модель — один из слоёв защиты. Она не гарантирует полное обезличивание и сама по себе не обеспечивает соответствие 152-ФЗ или другим законам. Обратимая замена по сути является псевдонимизацией: такие данные могут оставаться персональными.
Обучение
- База:
redmadrobot-rnd/rubert-base-pii-ner(ruBERT-base, 178 млн параметров), классификатор расширен с 43 до 57 меток, веса базовых меток сохранены. - Данные (173 193 строки, треть без персональных данных):
redmadrobot-rnd/pii_train(MIT): исходные предложения; номера документов заменены на новые значения того же формата, часть имён переведена на латиницу.- Фрагмент набора
Den4ikAI/russian_dialogues(MIT): около 106 тысяч коротких реплик из открытых Telegram-чатов. Строки с цифрами, ссылками, именами и упоминаниями личных данных удалены правилами и моделью-фильтром; реплики служат фоном и примерами без персональных данных. Сам набор и производные данные мы не распространяем. - Все персональные данные в обучении вымышленные: сгенерированы библиотекой Faker (MIT) и генераторами форматов.
- Варианты текста: обычный, без пунктуации, имитация звонка (цифры словами, слова-паразиты, пропуски и опечатки).
- Параметры: 4 эпохи, lr 2e-5 с линейным спадом, батч 32, bf16, вес класса O 0,5; выбрана эпоха 3 по F1 на отложенной выборке. Обучено на одном ноутбуке (NVIDIA RTX Spark N1X).
- Pii_benchmark при обучении не использовался.
Лицензия и благодарности
Apache 2.0, как и у базовой модели. Спасибо Red Mad Robot R&D за модель и наборы данных,
авторам russian_dialogues и Faker.
Citation
@misc{oeg_pii_ru_lite_2026,
title = {OEG PII RU Lite: Russian PII detection for call transcripts and chats},
author = {OEG},
year = {2026},
howpublished = {\url{https://huggingface.co/oegtech/oeg-pii-ru-lite}},
note = {Fine-tuned from redmadrobot-rnd/rubert-base-pii-ner}
}
- Downloads last month
- 41
Model tree for OEGtech/oeg-pii-ru-lite
Base model
ai-forever/ruBert-base