/ Модель

Характеристики

Контекст
8 192 токена
Параметры
307 млн
Лицензия
Apache 2.0
Архитектура
modernbert · dense
Базовая модель
mmBERT-base
Опубликована
22 июн 2026

lettucedect-v2-mmbert-base

Разметка токеновТекст → label8 профессий

Многоязычный классификатор токенов для выделения неподтверждённых фрагментов в ответах RAG, кодовых агентов и выводах инструментов.

8 532скачиваний за 30 дней5лайковвеса обновлены13 авг 2026

Бенчмарки

Как модель справилась с задачами пользователей ailist и что о ней публикуют открытые лидерборды

Публичные оценки

Из открытых лидербордов. Сравнивайте результаты одного теста при одинаковых условиях — отсутствие оценки не значит, что модель хуже.

В подключённых источниках результатов для этой модели пока нет.

Что умеет модель

Описание составлено по карточке модели и метаданным Hugging Face

LettuceDetect v2 mmBERT-base — разработанная KRLabsOrg модель-энкодер для поиска галлюцинаций в ответах, созданных с опорой на контекст, включая RAG, код и вывод инструментов. Это дообученный на базе jhu-clsp/mmBERT-base классификатор токенов: он получает контекст, вопрос и ответ и помечает токены ответа как подтверждённые или неподтверждённые, формируя бинарные фрагменты без категорий и подтипов. Модель содержит 306,9 млн параметров, поддерживает контекст до 8192 токенов и распространяется в формате safetensors.

Модель рассчитана на многоязычное выявление неподтверждённых утверждений в прозе и коде, включая ответы кодовых агентов и результаты RAG. Однопроходный энкодер работает без генерации текста и ориентирован на высокую пропускную способность и низкую стоимость. README приводит результаты на тестах по прозе, коду и многоязычным данным; качество зависит от типа данных, а для типизированных фрагментов предлагается отдельная модель или каскад с таксономической головой.

Лицензия — Apache-2.0. Указанные языки: английский, немецкий, французский, испанский, итальянский, польский и китайский; README также сообщает о многоязычной проверке на 14 языках, но не перечисляет остальные языки.

Сценарии применения

  • поиск неподтверждённых утверждений в ответах RAG
  • выделение галлюцинаций в ответах кодовых агентов
  • проверка фрагментов сгенерированного кода по контексту
  • разметка неподтверждённых частей ответа на вопрос
  • проверка выводов инструментов на соответствие предоставленному контексту

Ограничения

Модель выдаёт только бинарные фрагменты и не определяет их категории или подтипы; для типизированных результатов нужен дополнительный каскад или другая модель. Качество различается между наборами данных и ниже у некоторых специализированных или генеративных вариантов, в частности на задачах с кодовыми агентами.

Для каких профессий подходит8

Разделы каталога профессий, в задачах которых используется эта модель

Все профессии

Также подходит для

Карточка модели

README от автора на Hugging Face, как он его опубликовал

Открыть на Hugging Face

LettuceCode mascot

LettuceDetect goes agentic — span-level hallucination detection across RAG, code, and tool output.

lettucedect-v2-mmbert-base: Encoder Hallucination Span Detection

TL;DR — results

A fast encoder (binary token classifier) for span-level hallucination detection across code, tool output, and prose, single forward pass:

  • Unified test set (10,698): span-F1 0.642, example-F1 0.869, IoU 0.671.
  • Code-agent answers: span-F1 0.508 — close to the generative 2B (0.602) at a fraction of the size, and far above the off-the-shelf detectors and LLM judges we tested (HHEM / Lynx / Granite / MiniCheck / Nemotron-550B / gpt-oss-120b), which sit near chance.
  • Prose: RAGTruth example-F1 74.3 (above GPT-4 63.4 and Luna 65.4); multilingual PsiloQA across 14 languages.
  • Emits binary spans; for typed spans (category + subcategory) use lettucedect-v2-qwen-2b or the taxonomy-head cascade.

The small, fast option when throughput/cost matter and binary spans suffice.

Overview

lettucedect-v2-mmbert-base is a lightweight encoder hallucination detector for Retrieval-Augmented Generation (RAG) and coding-agent settings. It is a token-level classifier built on mmBERT-base: given the context, question, and answer, it labels each answer token as supported (0) or unsupported (1), yielding the spans of the answer not grounded in the context — across prose and code, in many languages.

It is the encoder counterpart to the generative lettucedect-v2-qwen-2b: much smaller and faster, single forward pass, no decoding. It returns binary spans (no category/subtype); for typed spans (category + subcategory) use the generative model, or pair this detector with the taxonomy head as a typing cascade.

Model Details

  • Base model: jhu-clsp/mmBERT-base (ModernBERT-family multilingual encoder)
  • Task: token classification → unsupported-answer spans
  • Input: [CLS] context [SEP] question [SEP] answer [SEP]; context/question tokens masked in the loss, answer tokens labeled 0/1
  • Training: binary token classification on the unified code + prose benchmark
  • Context: long-context (handles full request + retrieved context + answer)
  • Languages: English plus more (multilingual via the PsiloQA portion)

Usage

from lettucedetect.models.inference import HallucinationDetector

detector = HallucinationDetector(method="transformer", model_path="KRLabsOrg/lettucedect-v2-mmbert-base")
spans = detector.predict(context=[context], question=question, answer=answer, output_format="spans")
# [{"start": ..., "end": ..., "text": "...", "confidence": ...}]

Plain transformers (no lettucedetect)

It's a standard token classifier — tokenize (context, answer) as a pair and read the labels over the answer segment (1 = unsupported):

import torch
from transformers import AutoModelForTokenClassification, AutoTokenizer

model_id = "KRLabsOrg/lettucedect-v2-mmbert-base"
tok = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForTokenClassification.from_pretrained(model_id).eval()

context = "France is in Western Europe. Its capital Paris had about 2.1 million people in 2019."
answer = "The capital of France is Paris, with a population of about 4.5 million people."

enc = tok(context, answer, truncation="only_first", max_length=4096,
          return_offsets_mapping=True, return_tensors="pt")
with torch.no_grad():
    preds = model(input_ids=enc.input_ids, attention_mask=enc.attention_mask).logits.argmax(-1)[0]

seq_ids, offsets, spans, cur = enc.sequence_ids(0), enc["offset_mapping"][0].tolist(), [], None
for i, (sid, (a, b)) in enumerate(zip(seq_ids, offsets)):
    if sid != 1 or a == b:                  # keep only answer-segment, non-special tokens
        continue
    if preds[i].item() == 1:                # unsupported
        cur = [a, b] if cur is None else [cur[0], b]
    elif cur:
        spans.append(cur); cur = None
if cur:
    spans.append(cur)
print([{"text": answer[s:e], "start": s, "end": e} for s, e in spans])
# -> [{'text': '4.5 million', 'start': 59, 'end': 70}]

For category/subcategory typing, use the lettucedetect cascade (taxonomy_head=...) or the generative lettucedect-v2-qwen-2b.

Performance

Char-level span metrics on the unified test set (10,698 samples), per source. These are the detector's span numbers (typing is not produced by this model).

datasetnspan-F1span-Pspan-Rexample-F1IoU
ALL106980.6420.6840.6050.8690.671
acl4400.5790.7050.4920.8730.637
code-agent20150.5080.6190.4300.7700.581
readme6410.7510.7890.7160.9000.768
tool-output6170.5880.7360.4900.7630.645
wikipedia13880.7080.7410.6780.9170.768
psiloqa (multi-lang)28970.7140.6960.7330.9430.627
ragtruth27000.5280.6680.4370.7430.724

The generative lettucedect-v2-qwen-2b scores higher on span-F1 (ALL 0.689 vs 0.642) and adds typing, but this encoder is far smaller and faster — a strong choice when throughput or cost matters and binary spans suffice.

Code-agent: vs other detectors

detectorspan-F1example-F1
lettucedect-v2-qwen-2b (generative 2B)0.6020.835
lettucedect-v2-lfm-8b (generative 8B)0.5070.811
lettucedect-v2-mmbert-base (this)0.5080.770
Nemotron-3-Ultra-550B (LLM judge, task-aware)0.2160.700
gpt-oss-120b (LLM judge, task-aware)0.2120.691
HHEM-2.1 / Lynx-8B / Granite-Guardian / MiniCheck—≈ chance (BAcc ~0.50)

This base encoder matches the 8B generative model on code-agent span-F1 and crushes the off-the-shelf detectors and large LLM judges, which over-flag generated code.

Prose benchmarks

RAGTruth (official test, example-level F1): this multilingual+code base encoder scores 74.3 — below the RAGTruth-specialized LettuceDetect-large v1 (79.2) and the generative lettucedect-v2-qwen-2b (81.8), but above prompt-based GPT-4 (63.4) and Luna (65.4). It trades a little RAGTruth-specific accuracy for unified code+tool+multilingual coverage at base size; lettucedect-v2-mmbert-large is stronger.

PsiloQA (14 languages): span-F1 0.714, IoU 0.627 — competitive multilingual span detection from a base encoder (the PsiloQA paper's strongest LLM judge reaches IoU ~0.40 on English; their fine-tuned encoder, trained on PsiloQA only, ~0.71).

Typed spans (optional cascade)

For category + subcategory typing with an encoder pipeline, run this detector to find spans, then type each span with the label-conditioned taxonomy head (see scripts/evaluate_taxonomy_cascade.py). The cascade trails the generative model on typing (typed-F1 0.461 vs 0.585), so prefer lettucedect-v2-qwen-2b when typed output is the goal.

Citing

@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}, 
}

Как запустить

На своей GPU в ailist. Цена — по текущим предложениям провайдеров

GPU в ailist

Универсальный рантайм · token-classification

Можно запустить

Подбираем GPU…

Класс архитектуры
ModernBertForTokenClassification
Ревизия весов
8831ce0

0 моделей