Add a decision-model detector backend (Vela 2.0 first): hallucination and safety in one call
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 32/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Ambito
- ai, machine-learning
Direzione di ricerca
Start with the method dispatch in lettucedetect/detectors/factory.py (make_detector, lines 18-31), which currently rejects any method other than transformer, llm and rag_fact_checker. Then read how the existing detectors return spans so the Vela output {label, start, end, text, probability} can be mapped to start, end, text, confidence. Done means HallucinationDetector(method="vela") returns spans with offsets into the answer, the optional extra is wired up, and the 0.3B model reproduces Vela's reported F1 within ±0.01 on the test set.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Problem
Vela 2.0 (vLLM Semantic Router × KR Labs, Apache-2.0) is a family of decision models (0.3B encoder; 0.8B, 4B and 9B decoders) that answer typed questions about a request, a context and an answer in one call. One of those questions is a hallucination span question: "Which spans of the answer are not supported by the context?", returned as spans with character offsets and probabilities. The same call can also return PII spans, prompt-attack and safety scores, and routing decisions.
Vela's own evaluation reports hallucination results on the same 10,698-example test set and on RAGTruth that our models use (EVALUATION.md):
| Model | Hallucination, 10,698 examples (F1) | RAGTruth (F1) |
|---|---|---|
| Vela 2.0 0.3B (encoder, runs on CPU) | 0.848 | 0.706 |
| Vela 2.0 4B | 0.874 | 0.770 |
| Vela 2.0 9B | 0.885 | 0.774 |
| lettucedect-v2-mmbert-base | 0.869 | 0.743 |
| lettucedect-v2-qwen-2b | 0.921 | 0.817 |
LettuceDetect cannot use these models today. Supporting them gives users a detector that runs PII and safety checks in the same pass, and a CPU option (0.3B, 8,192 tokens) between the encoder and generative lines.
Current behavior
lettucedetect/detectors/factory.py:18-31:make_detectorknowstransformer,llmandrag_fact_checker; anything else raisesValueError.- Vela is loaded with
AutoModel.from_pretrained(..., trust_remote_code=True)and called withm.system_one(state=..., questions=...), or served over HTTP asPOST /v1/systemoneby thevela2_serve.pyscript in each model repo. Its interface is the typed-question SystemOne format, so one backend can serve any model that speaks it.
Acceptance criteria
HallucinationDetector(method="vela", model_path="vllm-sr/Vela-2.0-0.3B")runs in-process;method="vela"withbase_url=and an API key calls a SystemOne server instead.predict(..., output_format="spans")returns LettuceDetect spans (start,end,text,confidence) mapped from Vela's{label, start, end, text, probability}, with offsets into the answer.min_confidencefilters on that probability.output_format="tokens"either works or raises a clear error that names the supported format.- No new required dependency: Vela's runtime needs (recent
transformers, optionalflash-linear-attention) sit behind an optional extra, consistent with #69. - A short evaluation note reproduces Vela's reported F1 on the 10,698-example test set with the 0.3B encoder within ±0.01, using LettuceDetect's own evaluator.
- Docs: one section on when to choose Vela (one pass for hallucination plus PII and safety, CPU encoder) versus the LettuceDetect models (best hallucination F1, typed categories).
Follow-ups, not in this issue: a --vela-model mode for the Claude Code hook, and passing LettuceDetect taxonomy labels as Vela span criteria.
Start here
grep -n "method ==" lettucedetect/detectors/factory.py
python -c "from transformers import AutoModel; m = AutoModel.from_pretrained('vllm-sr/Vela-2.0-0.3B', trust_remote_code=True); print(m.system_one(state={'request': 'When does it ship?', 'source': 'Ships Friday.', 'answer': 'Ships Monday.'}, questions={'halu': {'type': 'span', 'instructions': 'Which spans of the answer are not supported by the context?', 'criteria': {'unsupported': 'a claim not supported by the context'}}}))"
- Lingua principale
- Python
- Stelle
- 615
- Fork
- 60
- Merge medio
- 1g 8h
- PR unite (30g)
- 10
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di KRLabsOrg/LettuceDetect
-
Stop-hook --min-confidence drops every --llm-model span (missing confidence treated as 0.0), reporting hallucinated answers as cleanForse già presa @Clannad47 l’ha presa 19 giorni fa. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
KRLabsOrg/LettuceDetect#117 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
KRLabsOrg/LettuceDetect#108 ·
I maintainer di solito rispondono entro 1 giorno
-
documentation
Difficoltà 2/5 Mezza giornata Idoneità per principianti 70/100
KRLabsOrg/LettuceDetect#104 ·
I maintainer di solito rispondono entro 1 giorno
-
ready-for-agent
Difficoltà 3/5 1-2 giorni Idoneità per principianti 68/100
KRLabsOrg/LettuceDetect#181 ·
I maintainer di solito rispondono entro 1 giorno
-
ready-for-agent
Difficoltà 5/5 Più di una settimana Idoneità per principianti 22/100
KRLabsOrg/LettuceDetect#180 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di KRLabsOrg/LettuceDetect
Issue simili
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 79/100
vllm-project/vllm-omni#10051 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Bug Testing
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
SCIInstitute/SCIRun#2931 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 5 giorni
-
Author Page: barom-kangApertaauthor-page correction
Difficoltà 2/5 1-3 ore Idoneità per principianti 64/100
acl-org/acl-anthology#10827 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 91/100
marimo-team/marimo#11768 ·
I maintainer di solito rispondono entro 1 giorno