Downloads · 30 days
12
14% of all-time downloads
jngb-labs/eurovoc-llama3-8b-qlora
eurovoc-llama3-8b-qlora is a text classification model from jngb-labs. Use it when you need a label for a piece of text. It is set up for transformers. The card lists the license as apache-2.0.
A fine-tuned Meta Llama 3 8B model that classifies EU legislation into the 21 top-level EuroVoc thematic domains.
Downloads · 30 days
12
14% of all-time downloads
All-time downloads
87
Public
Parameters
7.5B
9.1 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors9.1 GB · 100%
How the weights are stored.
I87B · 93%
From the Hugging Face model README
A fine-tuned Meta Llama 3 8B model that classifies EU legislation into the 21 top-level EuroVoc thematic domains.
This is the merged full model (not the adapter). Fine-tuned using QLoRA (8-bit quantisation + LoRA rank 32) on 8x Nvidia H100 SXM GPUs.
| Metric | Score |
|---|---|
| F1 micro | 0.892 |
| F1 macro | 0.814 |
| Optimal threshold | 0.30 |
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.
| Method | F1 (micro) | Cost |
|---|---|---|
| bert-base (fine-tuned) | 0.900 | €10 |
| Llama 3.1 8B (this model) | 0.892 | €83 |
| EUBERT (fine-tuned) | 0.891 | free |
| TF-IDF + Logistic Regression | 0.799 | free |
| DeepSeek-R1-70B (zero-shot) | 0.562 | ~€12 |
The key finding: a 110M-parameter BERT model on a free GPU achieved essentially the same score as this 8B-parameter model on eight H100s. Fine-tuning matters. Scale, for this task, does not.
Full write-up: Pimp My LM: A Fine-Tuning Tale of Bling and Basic
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
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
model_name = "jngb-labs/eurovoc-llama3-8b-qlora"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSequenceClassification.from_pretrained(model_name)
model.eval()
text = "Regulation establishing a carbon border adjustment mechanism..."
inputs = tokenizer(text, return_tensors="pt", truncation=True, max_length=2048)
with torch.no_grad():
logits = model(**inputs).logits
probs = torch.sigmoid(logits)
LABELS = [
"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"
]
threshold = 0.30
predictions = [LABELS[i] for i, p in enumerate(probs[0]) if p > threshold]
print(predictions)
id2label mapping in config.json uses generic LABEL_0–LABEL_20 names; refer to the label list above for the actual domain namesApache 2.0 (fine-tuned weights). The base model (Meta Llama 3) is subject to the Meta Llama 3 Community License.