A fine-tuned EUBERT model that classifies EU legislation into the 21 top-level EuroVoc thematic domains.
EUBERT is the European Parliament's own BERT model, pre-trained from scratch on EU legislative texts rather than Wikipedia. This classifier adds a classification head fine-tuned on 64,000 labelled regulations.
Why this exists
The European Parliament published an official EuroVoc classifier on HuggingFace. It ships with mismatched vocabulary and weight dimensions and does not produce usable output. A community report confirmed the issue in 2024. No fix was published. This model is a working replacement.
Performance
Metric
Score
F1 micro
0.891
F1 macro
0.793
Optimal threshold
0.35
Evaluated on 890 held-out EU regulations published between September 2025 and March 2026. Ground truth labels were assigned by professional librarians at the EU Publications Office.
AGRI-FOODSTUFFS, AGRICULTURE FORESTRY AND FISHERIES,
BUSINESS AND COMPETITION, ECONOMICS, EDUCATION AND COMMUNICATIONS,
EMPLOYMENT AND WORKING CONDITIONS, ENERGY, ENVIRONMENT,
EUROPEAN UNION, FINANCE, GEOGRAPHY, INDUSTRY,
INTERNATIONAL ORGANISATIONS, INTERNATIONAL RELATIONS, LAW,
POLITICS, PRODUCTION TECHNOLOGY AND RESEARCH, SCIENCE,
SOCIAL QUESTIONS, TRADE, TRANSPORT
Usage
python
1from transformers import AutoTokenizer, AutoModelForSequenceClassification
2import torch
34model_name ="jngb-labs/eurovoc-eubert"5tokenizer = AutoTokenizer.from_pretrained(model_name)6model = AutoModelForSequenceClassification.from_pretrained(model_name)7model.eval()89text ="Regulation establishing a carbon border adjustment mechanism..."10inputs = tokenizer(text, return_tensors="pt", truncation=True, max_length=512)1112with torch.no_grad():13 logits = model(**inputs).logits
14 probs = torch.sigmoid(logits)1516LABELS =[17"AGRI-FOODSTUFFS","AGRICULTURE, FORESTRY AND FISHERIES",18"BUSINESS AND COMPETITION","ECONOMICS","EDUCATION AND COMMUNICATIONS",19"EMPLOYMENT AND WORKING CONDITIONS","ENERGY","ENVIRONMENT",20"EUROPEAN UNION","FINANCE","GEOGRAPHY","INDUSTRY",21"INTERNATIONAL ORGANISATIONS","INTERNATIONAL RELATIONS","LAW",22"POLITICS","PRODUCTION, TECHNOLOGY AND RESEARCH","SCIENCE",23"SOCIAL QUESTIONS","TRADE","TRANSPORT"24]2526threshold =0.3527predictions =[LABELS[i]for i, p inenumerate(probs[0])if p > threshold]28print(predictions)