Views
No views yet
jhu-clsp/mmBERT-base
following the LettuceDetect recipe,
ported to Spanish.This model measures faithfulness to the provided source, not world truth. A factually correct statement that the context does not support is counted as a hallucination. Do not use it as a general fact-checker.
Llama-3.1-8B-Instruct), and this model is trained on data that includes those
outputs. Use of the Llama materials is governed by the
Llama 3.1 Community License Agreement.
Per section 1(b) of that agreement, an AI model trained on Llama outputs must
carry a name beginning with Llama, which is why this repository is named
Llama-HalluES-detector while the benchmark itself keeps the name Hallu-ES.Qwen2.5-7B-Instruct (Apache 2.0
with additional conditions) and Salamandra-7b-instruct (Apache 2.0).1 is the hallucinated
class; a response is flagged when any of its tokens passes a probability
threshold of 0.5. Context and response are passed as a sentence pair, with
truncation applied to the context only — the response must never be truncated,
since the labels are token-level.1import torch
2from transformers import AutoModelForTokenClassification, AutoTokenizer
3
4MODEL = "Federico6725/Llama-HalluES-detector"
5tok = AutoTokenizer.from_pretrained(MODEL)
6model = AutoModelForTokenClassification.from_pretrained(MODEL).eval()
7
8context = ("La Sagrada Familia es una basílica de Barcelona diseñada por "
9 "Antoni Gaudí. Las obras comenzaron en 1882.")
10response = ("La Sagrada Familia, obra de Gaudí, se empezó a construir en 1882 "
11 "y es el monumento más visitado de España.")
12
13enc = tok(context, response, truncation="only_first", max_length=3072,
14 return_tensors="pt")
15with torch.no_grad():
16 probs = torch.softmax(model(**enc).logits, -1)[0, :, 1]
17
18# keep only the tokens belonging to the response (sequence 1)
19mask = torch.tensor([sid == 1 for sid in enc.sequence_ids(0)])
20resp_probs = probs[mask]
21
22print("hallucinated:", bool((resp_probs >= 0.5).any()))
23print("max token probability:", float(resp_probs.max()))src/predict.py from the
Hallu-ES repository:1python3 src/predict.py input.jsonl output.jsonl
2# defaults to this checkpoint; MODEL_DIR overrides it with a local folder| System | P | R | F1 | κ vs LLM annotator | κ vs human |
|---|---|---|---|---|---|
| TF-IDF + LogReg baseline | 0.801 | 0.817 | 0.809 | 0.615 | — |
| mDeBERTa-v3 (collapsed) | 0.498 | 1.000 | (0.665) | — | — |
| Llama-HalluES-detector | 0.857 | 0.785 | 0.819 | 0.655 | 0.686 |
lettucedetect-large 0.792, Turk-LettuceDetect
0.727) are computed on their own corpora and gold standards and are shown for
context only; the comparison is informative, not symmetric.| Base model | jhu-clsp/mmBERT-base — 307M parameters, 110M non-embedding |
| Task | Token classification, 2 classes (0 = supported, 1 = hallucinated) |
| Training data | 9,516 responses / 10,670 valid spans (Hallu-ES train.jsonl) |
| Max length | 3,072 tokens; context truncated, response never |
| Epochs / lr / warmup | 3 / 1e-5 / 10% |
| Effective batch size | 16 (8 × 2 gradient accumulation) |
| Precision | bf16 (weights published here in fp32) |
| Model selection | Best epoch by F1 on an internal dev set of 400 training responses |
| Seed | 42 |
| Hardware | ≈50 min on a Colab A100 |
transformers >= 5.0. This is not a soft recommendation: the
config stores per-layer-type RoPE settings under the rope_parameters key, and
transformers 4.5x parses it without raising while silently falling back to
the default local_rope_theta = 10000 instead of the 160000 mmBERT uses. Since
15 of the 22 layers are sliding-attention, the model will load, run, and return
degraded predictions with no warning. The checkpoint was saved with
transformers 5.14.1.1@mastersthesis{romiti2026halluees,
2 author = {Romiti, Federico},
3 title = {Hallu-ES: a span-level hallucination benchmark for
4 retrieval-augmented generation in Spanish},
5 school = {Universitat Politècnica de València},
6 year = {2026}
7}