/ Модель

Характеристики

Контекст
512 токенов
Параметры
137 млн
Лицензия
MIT
Архитектура
bert · dense
Базовая модель
gbert-base
Библиотека
transformers
Опубликована
22 ноя 2026

german-clinical-deid-base

Разметка токеновТекст → label3 профессии

BERT-модель для поиска и обезличивания персональных данных в немецких клинических текстах.

137скачиваний за 30 дней1лайквеса обновлены26 ноя 2026

Бенчмарки

Как модель справилась с задачами пользователей ailist и что о ней публикуют открытые лидерборды

Публичные оценки

Из открытых лидербордов. Сравнивайте результаты одного теста при одинаковых условиях — отсутствие оценки не значит, что модель хуже.

В подключённых источниках результатов для этой модели пока нет.

Что умеет модель

Описание составлено по карточке модели и метаданным Hugging Face

Lukas Kunhardt разработал немецкоязычную модель BERT для обнаружения персональных данных в клинических текстах. Она выполняет классификацию токенов и распознаёт 18 типов сведений, включая имена, даты, адреса, телефоны, идентификаторы и названия больниц, чтобы подготовить текст к редактированию или обезличиванию. Модель содержит 137,1 млн параметров по метаданным, принимает текст с контекстом до 512 токенов и доступна в форматах Safetensors и ONNX.

Модель дообучена на deepset/gbert-base и предназначена прежде всего для немецких медицинских писем и записей. Для снижения риска пропусков автор рекомендует считать персональными данными токены с вероятностью от 0,01; обычный вывод pipeline имеет больше утечек. На немецких данных качество проверялось на GraSCCo и MDeID; эффективность заметно ниже на других языках, особенно на текстах с кириллицей, арабской и персидской письменностью. Лицензия — MIT.

Сценарии применения

  • поиск имён пациентов и врачей в медицинских письмах
  • выявление адресов, телефонов и электронных адресов в клинических документах
  • обнаружение идентификаторов и дат для обезличивания медицинских записей
  • подготовка немецких клинических текстов к безопасному обмену и анализу

Ограничения

Модель обучена прежде всего на немецком языке, а на других языках чаще пропускает персональные данные; на кириллице, арабской и персидской письменностях работает особенно плохо. Обычный вывод pipeline имеет заметно больше утечек, чем порог 0,01, а даже при рекомендуемом пороге на немецких тестовых данных сохранялись утечки.

Для каких профессий подходит3

Разделы каталога профессий, в задачах которых используется эта модель

Все профессии

Карточка модели

README от автора на Hugging Face, как он его опубликовал

Открыть на Hugging Face

German Clinical De-identification (base)

A token classifier that finds names, dates, addresses, phone numbers, IDs and other personal information in German clinical text, so that you can redact it. It is the smaller sibling of LukasKunhardt/german-clinical-deid: same task, same 18 types, 109M instead of 335M parameters.

Quick start

pip install transformers torch
from transformers import pipeline

ner = pipeline("token-classification", model="LukasKunhardt/german-clinical-deid-base",
               aggregation_strategy="simple", stride=128)
text = "Herr Max Muster (geb. 03.02.1961) wurde am 12.05.2024 im Klinikum Nord aufgenommen."
for e in ner(text):
    print(e["entity_group"], text[e["start"]:e["end"]], round(float(e["score"]), 2))
NAME_PATIENT Max Muster 1.0
DATE 03.02.1961 1.0
DATE 12.05.2024 1.0
LOCATION_HOSPITAL Klinikum Nord 0.87

The pipeline gives each token its most likely label. It misses identifiers far more often than the reading the model was tuned for: redact every token whose probability of being personal information is at least 0.01 (stored in config.json). If you need few leaks, use that reading through the helper package: pip install german-clinical-deid, then Deidentifier("LukasKunhardt/german-clinical-deid-base").redact(text) (code on GitHub, also Presidio and spaCy).

Browser and Node

onnx/model.onnx (fp32, 438 MB), onnx/model_fp16.onnx (219 MB) and onnx/model_quantized.onnx (int8, 183 MB) run in transformers.js; in my Node test (version 3.8.1) all three gave the same entities. For the browser I recommend the int8 file (dtype: "q8"), for German text.

import { pipeline } from "@huggingface/transformers";

const ner = await pipeline("token-classification", "LukasKunhardt/german-clinical-deid-base", { dtype: "q8" });
const out = await ner("Herr Max Muster (geb. 03.02.1961) wurde am 12.05.2024 im Klinikum Nord aufgenommen.");
console.log(out.map(e => `${e.entity} ${e.word}`).join(", "));
NAME_PATIENT Max, NAME_PATIENT Muster, DATE 03, DATE ., DATE 02, DATE ., DATE 1961, DATE 12, DATE ., DATE 05, DATE ., DATE 202, DATE ##4, LOCATION_HOSPITAL Klinikum, LOCATION_HOSPITAL Nord

transformers.js returns one entry per token, so you join neighbouring tokens yourself.

The int8 file keeps the classifier head and the embeddings in full precision. On German development data at the 0.01 threshold it finds what the fp32 file finds: character F1 0.951 against 0.952 on 22 GraSCCo letters (no leaks in either), 0.948 against 0.949 on 501 SPARCLING letters (21 leaks in both), 0.946 against 0.948 on 235 MDeID notes (20 against 21 leaks). I wrote the rule for this check before running it. On non-German text it agrees less with the fp32 file (99.1 % of tokens over 22 languages, 99.96 % on German), so use it for German. Details: onnx/quantization_check.json.

What it finds

Names (patient, doctor, relative, other person, title, user initials), dates, ages, street, postcode, city, hospital, phone, fax, e-mail, URL, IDs and professions.

Results

I used the 41 test letters of GraSCCo (real letters with hand-replaced identifiers) and the MDeID test split (synthetic notes: 402 German, about 410 in each of six other languages). A document has a leak if a name, ID, phone or fax number, e-mail address or street stays less than half redacted. Strict typed F1 counts a span only if start, end and category match.

Model and readingSizeGraSCCo char F1GraSCCo letters with a leakMDeID German notes with a leakMDeID German strict typed F1
this model, threshold 0.01 (seed 42)109M0.9481 / 4111.2 %0.439
this model, threshold 0.01, mean of 3 seeds109M0.9441 / 4112.0 %0.437
this model, plain pipeline (quick start)109M0.9752 / 4129.1 %not measured
german-clinical-deid (large), threshold 0.01335M0.9602 / 4111.7 %0.475
german-clinical-deid (large), plain pipeline335M0.9803 / 4121.9 %not measured
Ibrahimbaroud/personal-information-detection-german109M0.9735 / 4178.6 %0.300
Horizon-Labs/pii-redactor-base308M0.8328 / 4123.4 %0.363

Notes with a leak on the MDeID German test set against model size

The chart shows each model's best threshold reading against its size (F1 chart); the pipeline rows are not in it. At 0.01 the base model leaks about as often as the large one, and the best of the 19 other open models I tested leaks twice as often. The plain pipeline has a higher F1 but leaks in more than twice as many German notes. PyTorch, onnx/model.onnx and onnx/model_fp16.onnx give the same F1 and leak numbers. I did not measure the int8 file on these test sets; it was checked on development data only (above).

The model is built for German. On the other MDeID test languages it leaks more often (notes with a leak):

Readingdeenesfritnlptall 7
threshold 0.0111.2 %16.8 %23.0 %18.0 %16.8 %30.1 %22.1 %19.7 %
plain pipeline29.1 %55.5 %67.9 %58.0 %59.7 %72.1 %70.8 %59.1 %

Seed and threshold came from development data. The MDeID German set shaped early decisions for the large model, so it is not perfectly clean held-out data. RESULTS.md has every row, seed, rule and every opening of the test sets.

Other languages: MultiGraSCCo

MultiGraSCCo (Baroud et al., 2026, CC BY 4.0) translates the 63 GraSCCo letters into nine languages with the same labels. I scored the same 41 test letters in every language and compared with the authors' open models, one per language, which were trained on about 65 % of the sentences of these letters. Character F1:

Model and readingdeenfritpltrruukarfamean of 9 translations
german-clinical-deid-base, plain pipeline0.9750.8850.8160.8270.8040.7830.5660.5950.1750.0030.606
german-clinical-deid-base, threshold 0.010.9480.8390.7680.7960.7070.6860.5730.5690.1790.0310.572
authors' model for that language (trained on these letters)0.9760.9620.8580.8910.8800.8630.9170.9010.9710.9290.908

The authors' models have the higher F1 in every translated language. In German this model is level with theirs (0.975 against 0.976). This model was trained on German only; in Cyrillic, Arabic and Persian script it fails, because the German vocabulary of its base model does not cover them.

An additional measure of my own, not a standard one: the share of letters in which a name, ID, phone number or street stays readable (less than half redacted).

Model and readingdeenfritpltrruukarfamean of 9 translations
german-clinical-deid-base, threshold 0.012.4 %7.3 %17.1 %36.6 %48.8 %36.6 %95.1 %95.1 %100.0 %100.0 %59.6 %
german-clinical-deid-base, plain pipeline4.9 %24.4 %39.0 %58.5 %70.7 %73.2 %97.6 %97.6 %100.0 %100.0 %73.4 %
authors' model for that language (trained on these letters)14.6 %12.2 %26.8 %26.8 %43.9 %36.6 %26.8 %24.4 %22.0 %31.7 %27.9 %

Development numbers and span F1 are in RESULTS.md.

Limits

  • Use it for German. It is weaker in other languages and fails in Russian, Ukrainian, Arabic and Persian (tables above).
  • Check the output before you share text. The model misses some identifiers and redacts some ordinary words, and its types are less reliable than the redaction.
  • I have not tested it on real hospital letters yet.
  • If you have annotated clinical text, partner_eval.py measures the model at your site and writes only sums (no text): --model LukasKunhardt/german-clinical-deid-base.
  • Removing identifiers is not the same as anonymisation under the GDPR. It is a research tool, not a medical device.

Training

  1. A script rewrote each of the 2,550 letters of LukasKunhardt/synthetic-german-clinical-letters ten more times with new identifiers: 28,050 letters. No language model took part, so the dataset's overlap check against the test sets still holds.
  2. The large model gave class probabilities for every character.
  3. I fine-tuned deepset/gbert-base on 95 % of the letters for one epoch, with half KL divergence to the large model and half cross-entropy on the gold labels.
  4. Of seeds 42, 43 and 44, I kept 42: it had the fewest leaks on held-out MDeID German development data.

One seed takes about 40 minutes on one NVIDIA A10G. The script is distill.py in the GitHub repository.

License

MIT, like deepset/gbert-base and the large teacher model. The training letters are CC BY 4.0; their card lists the licenses of the models that wrote them. GraSCCo (CC BY 4.0) and MDeID (CC BY-NC 4.0) were used for testing only.

Citation

@misc{kunhardt2026germandeidbase,
  author = {Kunhardt, Lukas},
  title  = {German Clinical De-identification (base)},
  year   = {2026},
  url    = {https://huggingface.co/LukasKunhardt/german-clinical-deid-base}
}

Lukas Kunhardt, ORCID 0000-0001-5135-6427. Questions and bug reports are welcome in the Community tab or as GitHub issues.

Versions

  • v1.6: onnx/model_quantized.onnx (int8, 183 MB) for the browser, checked on German development data. Other model files unchanged.
  • v1.5: partner_eval.py in the code repository to measure the model on your own annotated documents. Model files unchanged.
  • v1.4: MultiGraSCCo section now leads with character F1 (the standard measure); the leak share is shown as an additional measure. Model files unchanged.
  • v1.3: the helper package is on PyPI (pip install german-clinical-deid). Model files unchanged.
  • v1.2: MultiGraSCCo results in nine more languages (card and RESULTS.md). Model files unchanged.

Kurz auf Deutsch

Das Modell findet persönliche Angaben in deutschen Arztbriefen, damit man sie schwärzen kann; es ist ein Drittel so groß wie german-clinical-deid. Der normale pipeline-Weg aus dem Schnellstart ist einfach, lässt aber auf dem deutschen MDeID-Test in 29,1 % der Notizen etwas lesbar. Mit der Schwelle 0,01 aus dem Hilfspaket im GitHub-Repository sind es 11,2 %, etwa so oft wie beim großen Modell. Für Browser und Node gibt es onnx/model.onnx, onnx/model_fp16.onnx und die kleine int8-Datei onnx/model_quantized.onnx (183 MB, für deutschen Text geprüft). Das Modell ist für Deutsch gebaut; bitte prüfen Sie die Ausgabe vor der Weitergabe, es ist kein Medizinprodukt.

Как запустить

На своей GPU в ailist. Цена — по текущим предложениям провайдеров

GPU в ailist

Универсальный рантайм · transformers · token-classification

Можно запустить

Подбираем GPU…

Класс архитектуры
BertForTokenClassification
Ревизия весов
5b717dd

0 моделей