runetrust/blame-folketinget-dk
Viewer • Updated • 5.6M • 201 • 1
How to use Lundsfryd/BlameBERT with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-classification", model="Lundsfryd/BlameBERT") # pip install -U transformers accelerate
# Load model directly
from transformers import AutoTokenizer, AutoModelForSequenceClassification
tokenizer = AutoTokenizer.from_pretrained("Lundsfryd/BlameBERT")
model = AutoModelForSequenceClassification.from_pretrained("Lundsfryd/BlameBERT", device_map="auto")BlameBERT is the first model for zero-shot classification of blame in Danish. Blame is defined as a negative utterence with causal attribution.
As it is mmBERT based, it should theoretically generalize across languages, but it has only been tested in Danish.
BlameBERT has been tested against QWEN 3.5:9B in a schema-constrained setting, outperforming it on the test set.
More details can be found in the GitHub for the BlameBERT Project, or arXiv: https://arxiv.org/abs/2609.26346.
The model is ready for use straight out of the box.
Example usage
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
import numpy as np
tokenizer = AutoTokenizer.from_pretrained("Lundsfryd/BlameBERT")
model = AutoModelForMaskedLM.from_pretrained("Lundsfryd/BlameBERT")
def predict(text):
inputs = tokenizer(
text,
padding=True,
truncation=True,
max_length=512, #mmBERT accepts up to 8,192 tokens. For our purposes input was capped at 512.
return_tensors='pt'
)
inputs = {k: v.to(model.device) for k, v in inputs.items()}
with torch.no_grad():
outputs = model(**inputs)
logits = outputs.logits
probabilities = torch.softmax(logits, dim=1)
predicted_class = torch.argmax(probabilities, dim=1).item()
confidence = probabilities[0][predicted_class].item()
return predicted_class, confidence, probabilities[0].cpu().numpy()
texts = [
"Jeg er opmærksom på fængselspersonalets vilkår.",
"Det kommer både de studerende og erhvervslivet til gode.",
"Jeg er enig i, at der er kommet for mange hertil, som ikke vil Danmark, som ikke opfører sig ordentligt, som begår kriminalitet, og som i øvrigt med deres ideologiske tilgang til både religion og politik er med til at undergrave vores demokrati."
]
Please cite the model as follows:
@misc{jensenBlamingAislePolitical2026,
title = {Blaming {{Across}} the {{Aisle}}: {{Political Contrasting}} and {{Blame Attribution}} in the {{Danish Parliament}}},
shorttitle = {Blaming {{Across}} the {{Aisle}}},
author = {Jensen, Markus Lundsfryd and Trust, Rune Egeskov and Enevoldsen, Kenneth Christian and Kolding, Sara},
year = 2026,
month = sep,
number = {arXiv:2609.26346},
eprint = {2609.26346},
primaryclass = {cs.CL},
publisher = {arXiv},
doi = {10.48550/arXiv.2609.26346},
urldate = {2026-09-23},
abstract = {Political discourse is widely perceived to be growing more hostile, yet robust evidence remains scarce. This study examines blame attribution in the Danish Parliament from 1997 to 2026, combining a purpose-built classifier, BlameBERT (F1: 0.80), with multilevel statistical modeling. The classifier is constructed using an annotation-efficient pipeline for blame attribution in low-to-mid resource languages. The results reveal a banana-shaped trajectory, with blame declining until around 2016 before entering a significant and sustained increase in recent years (2019-2026). Government status consistently influenced blame attribution - an effect we term political contrasting - with opposition parties blaming substantially more than governing parties. This effect was moderated by ideology: The blame-dampening effect of governing was less pronounced among right-wing parties, and ideological extremity amplified blame more strongly on the right. In recent years, the interaction between political wing and ideological extremity intensified, suggesting an ideological hardening of the blame rhetoric concentrated on the right of the political spectrum. Taken together, these patterns suggest that the perceived rise in harsh political language reflects not merely a general rhetorical drift, but an ideologically asymmetric hardening of political discourse. A sensitivity analysis showed that the conclusions were robust to varying classification thresholds.},
archiveprefix = {arXiv},
keywords = {Computer Science - Computation and Language},
}
Base model
jhu-clsp/mmBERT-base