CoolFace
Modelpublic

KRLabsOrg/LFM2.5-Encoder-350M-hallucination-detector

sourceHugging Faceotherupdated 1mo agoView on Hugging Face
1likes22downloads
Model Card

LFM2.5-Encoder-350M hallucination detector

<p align="center"> <img src="https://huggingface.co/KRLabsOrg/LFM2.5-Encoder-350M-hallucination-detector/resolve/main/mascot.png" alt="LettuceDetect mascot" width="360"/> </p>

A span-level hallucination detector built on LiquidAI/LFM2.5-Encoder-350M: the bidirectional LFM2.5 backbone with a linear token-classification head, fine-tuned to mark the character spans of an answer that are not supported by the given context. Part of the LettuceDetect project.

Trained on the LettuceDetect unified benchmark: coding-agent answers (SWE-bench-derived), developer tool output, structured documents (ACL papers, READMEs, Wikipedia markdown), RAGTruth, and 14-language PsiloQA.

Results

Character-level span metrics on the LettuceDetect unified test split (n=10,698):

groupnspan-F1span-Pspan-Rexample-F1IoU
ALL106980.6030.6690.5490.8540.620
lettucedetect-acl4400.4880.6710.3830.7980.529
lettucedetect-code-agent20150.4430.5820.3570.7440.496
lettucedetect-readme6410.7110.7630.6650.8790.727
lettucedetect-tool-output6170.5250.6880.4240.7190.576
lettucedetect-wikipedia13880.6680.7290.6170.8750.704
psiloqa (14 languages)28970.6900.6840.6960.9450.588
ragtruth27000.4630.6960.3470.7440.702

Comparison

Span-F1 by source against the other LettuceDetect detectors on the same test split:

sourcethis (350M)[mmbert-base](https://huggingface.co/KRLabsOrg/lettucedect-v2-mmbert-base) (307M)[qwen-2b](https://huggingface.co/KRLabsOrg/lettucedect-v2-qwen-2b) (2B)
ALL0.6030.6420.689
acl0.4880.5790.749
code-agent0.4430.5080.602
readme0.7110.7510.866
tool-output0.5250.5880.719
wikipedia0.6680.7080.817
psiloqa (14 languages)0.6900.7140.732
ragtruth0.4630.5280.574

On multilingual example-level detection it matches the mmBERT encoder (PsiloQA example-F1 0.945 vs 0.943). On code-agent answers it remains far above general-purpose LLM judges at a fraction of their size (Nemotron-3-Ultra-550B 0.216, gpt-oss-120b 0.212 span-F1; HHEM-2.1 / Lynx-8B / Granite-Guardian / MiniCheck ≈ chance).

Usage

python
# pip install lettucedetect
from lettucedetect.models.inference import HallucinationDetector

detector = HallucinationDetector(
    method="transformer",
    model_path="KRLabsOrg/LFM2.5-Encoder-350M-hallucination-detector",
    trust_remote_code=True,
)

predictions = detector.predict(
    context=["The Eiffel Tower is 330 metres tall and stands in Paris, France."],
    question="How tall is the Eiffel Tower and where is it?",
    answer="The Eiffel Tower is 330 metres tall and stands in Berlin.",
    output_format="spans",
)
print(predictions)
# [{'start': 49, 'end': 56, 'confidence': 0.92, 'text': ' Berlin'}]

Token-level classification without the LettuceDetect wrapper:

python
import torch
from transformers import AutoTokenizer, AutoModelForTokenClassification

repo = "KRLabsOrg/LFM2.5-Encoder-350M-hallucination-detector"
tokenizer = AutoTokenizer.from_pretrained(repo)
model = AutoModelForTokenClassification.from_pretrained(repo, trust_remote_code=True).eval()

enc = tokenizer("context text ... answer text", return_tensors="pt")
with torch.no_grad():
    labels = model(**enc).logits.argmax(-1)[0]   # 0 = supported, 1 = hallucinated

Training

  • Backbone: LiquidAI/LFM2.5-Encoder-350M (bidirectional), linear head, dropout 0.1
  • 3 epochs on the unified train split (66,368 samples), input [question, context, answer], answer tokens labeled supported/hallucinated, max length 8,192
  • Token-level validation F1 0.635, test F1 0.609

Citation

bibtex
@misc{kovács2026documentgroundingspanlevelhallucination,
      title={Beyond Document Grounding: Span-Level Hallucination Detection over Code, Tool Output, and Documents},
      author={Ádám Kovács and Bowei He and Xue Liu and István Boros and Szilveszter Tóth and Gábor Recski},
      year={2026},
      eprint={2607.00895},
      archivePrefix={arXiv},
      primaryClass={cs.CL},
      url={https://arxiv.org/abs/2607.00895},
}