Downloads · 30 days
11
6% of all-time downloads
tamimmirza/llama-3.2-3b-hallucination-detector
llama-3.2-3b-hallucination-detector is a text classification model from tamimmirza. Use it when you need a label for a piece of text. It is set up for peft. The card lists the license as cc-by-nc-4.0.
A fine-tuned Llama 3.2 3B Instruct model for detecting hallucinations in LLM-generated answers.
Downloads · 30 days
11
6% of all-time downloads
All-time downloads
192
Public
Repo size
35.6 MB
Likes
0
Public
Click a slice to open those files.
.safetensors18.4 MB · 52%
From the Hugging Face model README
A fine-tuned Llama 3.2 3B Instruct model for detecting hallucinations in LLM-generated answers.
Given a question and an answer, the model outputs TRUTHFUL or HALLUCINATED. Confidence scores are extracted from output logits for calibrated deployment.
| Metric | Score |
|---|---|
| F1 Score | 0.9234 |
| Accuracy | 92.34% |
| ROC AUC | 0.9637 |
| Brier Score | 0.1088 |
Validated on 1,592 held-out samples. 0 unparseable predictions.
from transformers import AutoTokenizer, AutoModelForCausalLM
from peft import PeftModel
import torch
model_id = "meta-llama/Llama-3.2-3B-Instruct"
adapter_id = "tamimmirza/llama-3.2-3b-hallucination-detector"
tokenizer = AutoTokenizer.from_pretrained(model_id)
base_model = AutoModelForCausalLM.from_pretrained(
model_id, dtype=torch.bfloat16
)
model = PeftModel.from_pretrained(base_model, adapter_id)
model.eval()
prompt = "Question: Where did fortune cookies originate?
Answer: Fortune cookies originated in China.
Verdict:"
inputs = tokenizer(prompt, return_tensors="pt")
with torch.no_grad():
output = model.generate(**inputs, max_new_tokens=10)
print(tokenizer.decode(output[0], skip_special_tokens=True))
# Output: HALLUCINATED
This model is being used in ongoing research investigating whether retrieval augmentation improves fine-tuned hallucination detection. Early results suggest retrieval may not always help -- full findings pending.
Full code, notebooks, and Docker container: 👉 https://github.com/tamimmirza/llm-lie-detector
CC BY-NC 4.0 -- attribution required, no commercial use without permission.
Development conducted with assistance from Claude (Anthropic).