/ Модель

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

Контекст
8 192 токена
Параметры
212 млн
Лицензия
Apache 2.0
Архитектура
eurobert · dense
Базовая модель
EuroBERT-210m
Библиотека
transformers
Опубликована
20 мар 2025

german_politic_EuroBERT-210m

Заполнение пропусковТекст → текст4 профессии
113скачиваний за 30 дней1лайквеса обновлены9 ноя 2026

Описание модели

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

Классификатор на базе EuroBERT определяет, относится ли немецкий текст к политике, и рассчитан на обработку длинных документов до 8 192 токенов.

Модель разработал Sinclair Schneider из Research Institute CODE при Университете Бундесвера в Мюнхене. Это классификатор на базе EuroBERT/EuroBERT-210m, дообученный на 234 978 немецких текстах для определения, является ли текст политическим. Модель использует архитектуру EuroBertForSequenceClassification, содержит 211,7 млн параметров и обрабатывает до 8 192 токенов контекста. Она принимает текст и возвращает метку «politic» или «other» с оценкой уверенности.

Модель подходит для предварительной фильтрации длинных немецких статей, докладов и речей перед политическим анализом. На отложенной части обучающих данных автор сообщает точность 99,6%, однако на обычных новостях классификатор часто ошибочно считает политическими материалы о бизнесе, науке, здоровье, СМИ и других темах. Он лучше базовой версии на повседневных текстах, но не предназначен для точного разделения политических и неполитических новостей, определения идеологии или автоматических решений о людях.

Результаты чувствительны к форматированию: жёсткие переносы строк могут сместить предсказание в пользу класса «other», поэтому перед классификацией рекомендуется нормализовать пробелы. Для загрузки требуются совместимые версии Transformers: нативная поддержка EuroBERT доступна начиная с версии 5.3; в версии 4.x нужен remote code. Лицензия модели — Apache-2.0.

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

  • предварительная фильтрация немецких статей перед политическим анализом
  • поиск политических текстов в коллекциях немецких документов
  • классификация немецких докладов и речей как политических или неполитических
  • отбор немецких текстов для последующего анализа политической тематики

Ограничения

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

Публичные бенчмарки

Результаты из открытых лидербордов в сравнении с лидерами каталога

Публичных оценок пока нет

В подключённых источниках результатов этой модели не нашлось. Отсутствие оценки не значит, что модель хуже: её могли просто не проверять.

Источники: Hugging Face Leaderboards, Hugging Face Eval Results, Open LLM v2, MTEB, timm, Open ASR, EvalPlus

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

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

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

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

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

Открыть на Hugging Face

german_politic_EuroBERT-210m

This classifier predicts whether a German text is political (politic) or not (other), reading up to 8,192 tokens of context. It is EuroBERT/EuroBERT-210m fine-tuned on SinclairSchneider/trainset_political_text_yes_no_german, the same 234,978 texts used for german_politic_DeBERTa-v2-base. The DeBERTa model reads at most 512 tokens.

The training script is in this repository: train.py.

Related paper: Ideology Prediction of German Political Texts (Schneider, Steuber, Schneider & Dreo Rodosek, ICWSM 2026). The paper uses the DeBERTa version of this classifier as the pre-filter of its ideology pipeline (threshold 0.8). This EuroBERT model is a long-context alternative trained on the same data.

Summary of results:

  • On a held-out split of its training data, the model reaches 99.6% accuracy / 0.996 weighted F1.
  • On real-world German news (10kGNAD) it misses only 1 of 2,524 political articles.
  • Like the DeBERTa model, it labels most non-political news as political: business, science and panorama 99.8%, media 97%, web/tech 91%.
  • It handles everyday texts (forum posts, reviews, hobbies) much better than the DeBERTa model: 17 of 19 vs. 13 of 19 hand-written examples correct.
  • It reacts strongly to hard line breaks. Text wrapped every ~70 characters is classified as other.
  • See Evaluation.

[!NOTE] Loading. On 2026-11-09 the output layer was renamed from out_proj (its name in the March 2025 EuroBERT code) to classifier (its name in the current EuroBERT code and in native Transformers). The weights are unchanged and give the same predictions as before.

  • Transformers ≥ 5.3 has native EuroBERT support: load the model like any other and don't pass trust_remote_code=True, which fails there with KeyError: 'default'. Tested with 5.15.
  • Transformers 4.x needs trust_remote_code=True and an explicitly loaded tokenizer, see Older Transformers versions. Tested with 4.49.
  • Transformers 5.0–5.2 cannot load it: there is no native EuroBERT yet, and the remote code fails with KeyError: 'default' (tested with 5.2).

Revisions up to b9c36de still call the layer out_proj. Loaded the normal way, they get a randomly initialized output layer without any error, so use the current revision.

[!IMPORTANT] Before using the model, note:

  • Normalize whitespace before classifying. Line breaks are visible to the model, and the other class in training was dominated by hard-wrapped Project Gutenberg paragraphs. Hard-wrapping a political news article at 70 characters flips it to other in 94% of cases. For texts of 20 lines or more it flips nearly always; very short texts are less affected. Text extracted from PDFs, e-mails or poems has the same pattern. " ".join(text.split()) removes the effect.
  • Expect it to over-include non-political news. See Evaluation.

Quick start

Tested with transformers 5.15 and torch 2.13. Any Transformers version from 5.3 on should work.

from transformers import pipeline

political_classifier = pipeline("text-classification", model="SinclairSchneider/german_politic_EuroBERT-210m")

political_classifier("Trump und Putin einigen sich auf begrenzte Waffenruhe")
# [{'label': 'politic', 'score': 0.9991077780723572}]

political_classifier("Franck Ribéry und Arjen Robben feiern beim \"Beckenbauer Cup\" ihr Comeback beim FC Bayern. Sie präsentieren sich wie zu besten Zeiten und wecken eine große Sehnsucht beim Rekordmeister.")
# [{'label': 'other', 'score': 0.9865761995315552}]

political_classifier("Mein Laptop startet seit dem letzten Update nicht mehr richtig, hat jemand eine Idee?")
# [{'label': 'other', 'score': 0.9479537010192871}]

political_classifier("Forscher haben im Regenwald eine neue Froschart entdeckt.")
# [{'label': 'politic', 'score': 0.9884822368621826}]   <- wrong: science news, see "Limitations"

The first two outputs are identical to those the model produced when it was uploaded in March 2025. Scores may differ in the last decimal places on other hardware.

Recommended usage: normalize whitespace, truncate, batch

import textwrap

def normalize(text):
    return " ".join(text.split())          # remove line breaks: hard wraps push the model towards "other"

text = (
    "Die Bundesregierung hat sich nach wochenlangen Verhandlungen auf einen Kompromiss beim Bundeshaushalt geeinigt. "
    "Finanzminister und Kanzler stellten die Eckpunkte am Mittwoch in Berlin vor. Demnach sollen die Ausgaben für "
    "Verteidigung und Infrastruktur steigen, während bei mehreren Förderprogrammen gekürzt wird. Die Schuldenbremse "
    "soll eingehalten werden, allerdings plant die Koalition ein Sondervermögen für die Modernisierung der Bahn. "
    "Die Opposition kritisierte die geplanten Kürzungen bei den Sozialausgaben scharf. Die Fraktionsvorsitzende der "
    "größten Oppositionspartei sprach von einem Haushalt der sozialen Kälte und kündigte an, im Bundestag gegen den "
    "Entwurf zu stimmen. Auch die Länder meldeten Bedenken an, weil sie höhere Kosten bei der Unterbringung von "
    "Geflüchteten befürchten. Innerhalb der Koalition gibt es weiterhin Streit über die Finanzierung der Bundeswehr "
    "und über die Frage, ob Steuererhöhungen für sehr hohe Einkommen ausgeschlossen bleiben sollen. Ökonomen "
    "bewerteten den Kompromiss unterschiedlich: Während einige die Investitionen in Schiene und Digitalisierung "
    "lobten, warnten andere vor zu optimistischen Annahmen über die Steuereinnahmen der kommenden Jahre. Der "
    "Haushaltsausschuss soll den Entwurf nach der Sommerpause beraten, die abschließende Abstimmung im Parlament "
    "ist für Ende November geplant. Bis dahin dürften sich Regierung und Opposition weitere Auseinandersetzungen "
    "über die Prioritäten der Haushaltspolitik liefern, zumal in mehreren Ländern im kommenden Jahr Landtagswahlen anstehen."
)
wrapped = textwrap.fill(text, 70)          # 24 lines, e.g. like text extracted from a PDF

for variant, t in [("hard-wrapped", wrapped), ("normalized", normalize(wrapped))]:
    results = political_classifier([t], truncation=True, top_k=None, batch_size=16)
    p_politic = [{d["label"]: d["score"] for d in r}["politic"] for r in results]
    print(variant, [round(p, 4) for p in p_politic])
# hard-wrapped [0.0018]
# normalized [0.9999]

With truncation=True, inputs are cut at 8,192 tokens, the model's maximum length.

Older Transformers versions

Transformers 4.x has no native EuroBERT, so the model runs on the EuroBERT remote code. On these versions the pipeline doesn't find the tokenizer by itself, so pass it explicitly:

from transformers import AutoTokenizer, pipeline

repo = "SinclairSchneider/german_politic_EuroBERT-210m"
political_classifier = pipeline("text-classification", model=repo,
                                tokenizer=AutoTokenizer.from_pretrained(repo),
                                trust_remote_code=True)

political_classifier("Trump und Putin einigen sich auf begrenzte Waffenruhe")
# [{'label': 'politic', 'score': 0.9991077780723572}]

Tested with transformers 4.49.0, the version the model was trained with.

Model details

Developed bySinclair Schneider, Research Institute CODE, Bundeswehr University Munich (NLP Research Group UniBW)
Model typeEuroBertForSequenceClassification (encoder with mean-pooled token logits)
Base modelEuroBERT/EuroBERT-210m (Boizard et al., 2025)
Parameters212.4 M
LanguageGerman. The base model is multilingual, but the fine-tuning data is German.
Labels0 → other, 1 → politic
Max input length8,192 tokens
Training dataSinclairSchneider/trainset_political_text_yes_no_german
TrainedMarch 2025
LicenseApache-2.0 (same as the base model)
DOI10.57967/hf/9334
PaperIdeology Prediction of German Political Texts (ICWSM 2026)

Uses

Direct use

  • Pre-filtering long German documents before political analysis, e.g. full articles, reports and speeches, when missing political texts is worse than including non-political ones.
  • Mixed collections that include everyday texts, where it makes fewer errors than the DeBERTa model. It is still not precise on general news.

Downstream use

  • Fine-tuning on a target domain. Adding modern non-political negatives (economy, science, health, culture, regional news) would likely fix the main weakness.

Out-of-scope use

  • Precise separation of political and non-political news without further validation.
  • Political stance, ideology or party detection.
  • Automated decisions about individuals without human review.
  • Non-German text, which is untested.

Training data

This is the same dataset as for the DeBERTa model:

LabelSourceRows
politictaz.de, articles tagged Politik80,663
politicbpb.de (Federal Agency for Civic Education)31,282
politicFOCUS online, section politik5,544
otherProject Gutenberg, paragraphs of German books (hard-wrapped, historical spelling)85,983
othertaz.de, Sport/Film/Musik13,710
otherChefkoch.de recipe instructions9,009
otherFOCUS online, sport/auto/digital/reisen8,787

The dataset card lists composition, duplicates and artifacts.

Training procedure

Preprocessing

The raw text column was used without cleaning. It was tokenized with the EuroBERT tokenizer (Llama-3-style byte-level BPE; line breaks are kept as tokens) and truncated to 8,192 tokens, and batches were padded dynamically. The data was split randomly 80/20 with train_test_split(0.2) and no seed, giving 187,982 train / 46,996 eval texts.

Training hyperparameters

HyperparameterValue
OptimizerAdamW (adamw_torch)
Learning rate1e-5, linear decay to 0, no warm-up
Weight decay0.01
Epochs4 (46,996 steps, 11,749 per epoch)
Batch size4 per GPU × 4 GPUs = 16
Max sequence length8,192
Precisionweights loaded in bfloat16 (bf16/fp16 flags off)
Classifier poolinglate: per-token logits averaged over non-padding tokens
Model selectionbest eval loss → epoch 4 (step 46,996) was published
Seed (Trainer)42

Speeds, sizes, times

Hardware4 × NVIDIA RTX 6000 Ada Generation (48 GB)
Training time38,959 s ≈ 10.8 h, at 19.3 samples/s
Mean training loss0.0180
Total training FLOPs2.74 × 10¹⁸
Inference throughput (single GPU)≈ 68 news articles/s (fp32, batch 16, length-sorted 10kGNAD articles, median 298 words), vs. ≈ 108/s for the DeBERTa model
Checkpoint size849 MB (float32 safetensors)
SoftwarePython 3.10.12, PyTorch 2.6.0, Transformers 4.49.0 (with EuroBERT remote code), Datasets 3.0.1, Tokenizers 0.21.0

Evaluation

1. In-distribution: held-out 20% of the training data (46,996 texts)

EpochEval lossAccuracyWeighted F1Weighted precisionWeighted recall
10.025020.99460.99460.99460.9946
20.021640.99550.99550.99550.9955
30.021040.99570.99570.99570.9957
4 (published)0.020990.99570.99570.99570.9957

These are same-source eval texts, with possible duplicates across the split. The numbers mostly reflect how easy it is to tell the training sources apart.

2. Out-of-domain: 10kGNAD (derStandard.at)

Setup. 10kGNAD contains 10,273 articles from the Austrian newspaper DER STANDARD (2015–2016), sorted into 9 sections by the newspaper's moderators. 10,271 articles remain after removing duplicates. Inland (1,014) and International (1,510) count as politic, and the other 7 sections as other (7,747). The articles have no line breaks.

InputAccuracyPrecision (politic)Recall (politic)F1 (politic)Macro F1ROC-AUC
Full article (up to 8,192 tokens)0.3750.2820.99960.4400.3660.860
Truncated to 512 tokens0.3830.2850.9990.4430.3760.863
First 100 words0.3940.2880.9990.4470.3880.861
First sentence0.3960.2830.9510.4360.3930.709

Confusion matrix, full article at 0.5: TN 1,327 · FP 6,420 · FN 1 · TP 2,523.

Share of each section predicted as politic (full article)

ThresholdInlandInternationalWirtschaftWissenschaftPanoramaEtat (media)WebKulturSport
0.5100%99.9%99.8%99.8%99.8%96.6%91.4%76.4%14.6%
0.8100%99.9%99.7%99.5%99.6%96.1%89.3%72.2%12.2%
0.9999.9%99.9%99.3%99.1%99.2%92.1%82.6%62.5%7.2%
0.99999.4%99.3%91.1%95.8%95.5%79.5%63.1%47.9%2.0%

Threshold sweep

Full articles:

ThresholdAccuracyPrecisionRecallF1 (politic)Macro F1
0.50.3750.2821.0000.4400.366
0.80.3840.2851.0000.4440.377
0.90.3890.2870.9990.4460.383
0.990.4100.2940.9990.4540.406
0.9990.4820.3210.9930.4850.482

Observations

  • It over-includes non-political news even more than DeBERTa does (accuracy 0.375 vs. 0.415, AUC 0.860 vs. 0.866). The two models agree on 93.3% of the decisions, and the correlation of their scores is r = 0.79.
  • Some of these errors come from noisy section labels. derStandard filed much of the 2015 refugee and Greek-debt coverage under Panorama and Wirtschaft. Science, web and media articles that clearly aren't political are also labeled politic, though.
  • Only one political article was missed: a football report filed under International.
  • Long context brings no gain here. On the 3,804 articles with more than 380 words, reading the full article gives AUC 0.813, compared with 0.822 when truncated to 512 tokens. 98 decisions change.
  • The scores are overconfident. 91.9% of predictions have a confidence ≥ 0.99, but only 35.8% of those are correct.

3. Short sentences and everyday texts

These are hand-written examples, not drawn from any dataset. 17 of 19 are correct at 0.5; the DeBERTa model gets 13 of 19.

TextGoldP(politic)DeBERTa
Der Senat hat die neue Verfassungsrichterin bestätigt.politic0.9970.051 ✗
Der Premierminister kündigte für nächsten Monat Neuwahlen an.politic0.9990.99998
Die Abgeordneten debattieren über eine Erhöhung des Mindestlohns.politic0.9990.99998
Der Präsident legte sein Veto gegen den Verteidigungshaushalt ein.politic0.9960.997
Die NATO-Außenminister berieten in Brüssel über Sanktionen gegen Russland.politic0.99960.99999
Die Opposition wirft der Regierung Korruption vor.politic0.9980.99998
Der Bundestag hat das Gesetz mit den Stimmen der Koalition verabschiedet.politic0.9990.99998
Trump und Putin einigen sich auf begrenzte Waffenruhepolitic0.9990.99997
Ich gehe gerne ins Fitnessstudio.other0.2370.009
Für dieses Rezept braucht man zwei Tassen Mehl und eine Prise Salz.other0.00030.00001
Der Stürmer traf zweimal, die Heimmannschaft gewann 3:1.other0.0110.00004
Das neue Smartphone hat einen größeren Akku und eine bessere Kamera.other0.1650.007
Die Band kündigte eine Welttournee ab März an.other0.0790.953 ✗
Forscher haben im Regenwald eine neue Froschart entdeckt.other0.988 ✗0.916 ✗
Ausreichend Wasser zu trinken ist wichtig für die Gesundheit.other0.996 ✗0.002
Unser Hotel hatte einen wunderschönen Blick auf den Strand.other0.0060.979 ✗
Mein Laptop startet seit dem letzten Update nicht mehr richtig, hat jemand eine Idee?other0.0520.9997 ✗
Seit geraumer Zeit passiert es immer häufiger, dass das Tachodisplay beim Aufsperren als auch Starten des Fahrzeugs schwarz bleibt. …other0.0130.9996 ✗
Franck Ribéry und Arjen Robben feiern beim "Beckenbauer Cup" ihr Comeback beim FC Bayern. …other0.0130.003

Both errors fall into topics that were missing from the training negatives (science, health).

4. Shortcut probes: line breaks and spelling

Surface features of the Project Gutenberg paragraphs, which make up 73% of the training other class, were applied to 10kGNAD articles:

ModificationPolitical articles → politicNon-political articles → politic
None99.96%82.9%
Hard line breaks every 70 characters (Gutenberg style)5.8%2.9%
Line breaks every 300 characters (control)99.9%–
dass → daß (old spelling; 1,631 political articles)99.9% → 99.9%–
Old spelling + hard line breaks1.2%–
First 100 words only99.9%–
First sentence only95.1%–

The effect grows with the number of wrapped lines. Share of political articles still classified as politic after hard-wrapping:

Lines after wrapping< 88–1112–1920–39≥ 40
Articles59624238901,090
Still politic75–86%24%15%2.6%0%

Short, hard-wrapped lines are a decisive cue for other. The model learned this from the Gutenberg paragraphs, and the old spelling has no effect. The DeBERTa model is immune because its tokenizer turns line breaks into spaces. Normalize whitespace before classifying (see Recommended usage).

Bias, risks, and limitations

  • Old revisions. Revisions up to b9c36de store the output layer as out_proj. Loaded the normal way, they give a random output layer and meaningless predictions, without any error message. See Loading.
  • Formatting sensitivity. Hard line breaks (PDF extracts, e-mails, poems, subtitles) push predictions towards other, independent of content.
  • The definition of "political" is narrow on the negative side. The training negatives were sport, film, music, cars, tech gadgets, travel, recipes and historical literature. Most modern news on economy, science, health, media and panorama is labeled political.
  • Overconfidence. Scores near 1.0 are typical for any news-like text.
  • Domain and time. The training news comes from German outlets, 2010s–2023. Austrian news (10kGNAD) shows the same pattern of errors.
  • Training data copyright. The training texts are partly copyrighted news articles (license unknown).

Recommendations

  1. After loading, check a known example: "Trump und Putin einigen sich auf begrenzte Waffenruhe" should give politic 0.9991.
  2. Normalize whitespace (" ".join(text.split())) before classifying.
  3. Use the model as a high-recall filter, and add a second stage if precision on news matters.
  4. Validate the threshold on a labeled sample of your own data.

Environmental impact

  • Hardware: 4 × NVIDIA RTX 6000 Ada (300 W TDP each), on-premise university GPU server.
  • Time: ≈ 10.8 h.
  • Energy: at most ≈ 13 kWh for the GPUs.
  • Carbon emitted: ≈ 5.2 kg CO₂eq, assuming ~0.4 kg CO₂eq/kWh (Lacoste et al., 2019).

Technical specifications

  • Encoder: EuroBERT-210m with 12 layers, hidden size 768, 12 attention heads, intermediate size 3,072, SiLU activation, RMSNorm and rotary position embeddings (θ = 250,000). It reads up to 8,192 tokens, and its byte-level BPE vocabulary has 128,256 tokens.
  • Classification head (late pooling): dense 768→768 + GELU + linear 768→2, applied to every token. The logits are averaged over the non-padding tokens.
  • Objective: softmax cross-entropy.

Citation

Related paper:

@article{schneider2026ideology,
  title     = {Ideology Prediction of German Political Texts},
  author    = {Schneider, Sinclair and Steuber, Florian and Schneider, Jo{\~a}o A. G. and Dreo Rodosek, Gabi},
  journal   = {Proceedings of the International AAAI Conference on Web and Social Media},
  volume    = {20},
  number    = {1},
  pages     = {2006--2021},
  year      = {2026},
  doi       = {10.1609/icwsm.v20i1.42735},
  url       = {https://doi.org/10.1609/icwsm.v20i1.42735}
}

This model:

@misc{schneider_german_politic_eurobert_210m,
  author       = {Schneider, Sinclair},
  title        = {german\_politic\_EuroBERT-210m: a long-context classifier for detecting political text in German},
  year         = {2025},
  publisher    = {Hugging Face},
  doi          = {10.57967/hf/9334},
  howpublished = {\url{https://huggingface.co/SinclairSchneider/german_politic_EuroBERT-210m}}
}

Base model:

@misc{boizard2025eurobert,
  title         = {EuroBERT: Scaling Multilingual Encoders for European Languages},
  author        = {Boizard, Nicolas and Gisserot-Boukhlef, Hippolyte and Alves, Duarte M. and Martins, Andr{\'e} and Hammal, Ayoub and Corro, Caio and Hudelot, C{\'e}line and Malherbe, Emmanuel and Malaboeuf, Etienne and Jourdan, Fanny and Hautreux, Gabriel and Alves, Jo{\~a}o and El Haddad, Kevin and Faysse, Manuel and Peyrard, Maxime and Guerreiro, Nuno M. and Fernandes, Patrick and Rei, Ricardo and Colombo, Pierre},
  year          = {2025},
  eprint        = {2503.05500},
  archivePrefix = {arXiv}
}

Out-of-domain evaluation data (10kGNAD is derived from the One Million Posts Corpus):

@inproceedings{schabus2017onemillion,
  title     = {One Million Posts: A Data Set of German Online Discussions},
  author    = {Schabus, Dietmar and Skowron, Marcin and Trapp, Martin},
  booktitle = {Proceedings of the 40th International ACM SIGIR Conference on Research and Development in Information Retrieval},
  pages     = {1241--1244},
  year      = {2017},
  doi       = {10.1145/3077136.3080711}
}

Model card authors and contact

Sinclair Schneider, Research Institute CODE, Bundeswehr University Munich. Questions and issues are welcome in the Community tab.

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

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

GPU в ailist

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

Нельзя запустить

Модели нужен код из репозитория; запуск откроется после проверки совместимости.

Класс архитектуры
EuroBertForSequenceClassification
Ревизия весов
2810163

0 моделей