A LoRA adapter fine-tuned on the question-answering (QA) portion of RAGTruth to judge whether a generated answer is fully supported by provided evidence. The model takes a question, evidence passages, and a proposed answer, then generates a binary label: SUPPORTED or UNSUPPORTED.
This repository contains adapter weights, not a standalone 3B-parameter model. Load the original instruction-tuned HuggingFaceTB/SmolLM3-3B backbone and attach this adapter with PEFT. The backbone is not SmolLM3-3B-Base.
This is a specialized evidence-groundedness classifier, not a generally improved chat model, independent fact checker, or guarantee that an answer is correct.
Inputs:
Outputs:
SUPPORTED: no hallucination span was annotated in RAGTruth, operationalized as an answer supported by the supplied evidence.UNSUPPORTED: at least one answer span was annotated as hallucinated (unsupported or conflicting with the evidence).This is response-level, not span-level, prediction. It is specifically about support from the provided evidence, not whether an answer could be true using outside knowledge. A non-answer or refusal may receive SUPPORTED under the dataset's annotation policy. Answers that contain both supported and unsupported claims are labeled UNSUPPORTED.
Recommended use: a flagging or review stage in a retrieval-augmented generation system, preferably with human review or a separate remediation policy for high-stakes applications.
| Item | Details |
|---|---|
| Backbone | HuggingFaceTB/SmolLM3-3B (instruction-tuned) |
| Pinned backbone/tokenizer revision | b49c77130b3407155d9b83b404d9b28b5d1845ae |
| Source dataset | ParticleMedia/RAGTruth, QA task only |
| Source dataset revision | c103204b9ce28d6bbad859304bf30de72b8ed8fe |
| Label mapping | Any original hallucination span → UNSUPPORTED; otherwise → SUPPORTED |
| Training | 4,122 quality-good QA responses, 707 distinct evidence sources |
| Training labels | 2,837 SUPPORTED / 1,285 UNSUPPORTED (natural imbalance, no resampling or class weights) |
| Validation | 729 quality-good QA responses, 125 evidence sources |
| Held-out test | All 900 original official QA test responses, 150 evidence sources; no quality exclusions |
The original RAGTruth train partition was further divided into train and validation by evidence source, so answers associated with the same source do not cross those splits. A candidate-based evidence-overlap review excluded seven potentially overlapping source groups from train/validation; the original official test set was left untouched. This reduces known leakage risks but does not prove that all semantic overlap has been eliminated.
The quality='good' filter was applied to training and validation only. The held-out test retained original annotation-quality categories. Labels were not manually corrected or redefined after auditing.
| Parameter | Value |
|---|---|
| Method | Supervised fine-tuning (SFT) with QLoRA / PEFT |
| Backbone quantization | 4-bit NF4, double quantization, BF16 compute |
| LoRA rank / alpha / dropout | r=8 / alpha=16 / dropout=0.05 |
| Target modules | all-linear; no trainable bias |
| Trainable parameters | 15,114,240 (~0.489% of 3,090,212,864 reported parameters) |
| Epochs | 1 |
| Optimizer / scheduler | AdamW (adamw_torch) / cosine |
| Learning rate | 2e-4; 3% warmup ratio |
| Physical batch / gradient accumulation | 1 / 8 (effective batch approximately 8) |
| Gradient checkpointing | Enabled |
| Maximum full-example length | 1,152 tokens; no truncation or packing |
| Loss | Assistant label completion tokens only; question/evidence/prompt masked |
| Random seed | 42 |
| Training optimizer steps | 516 |
The tokenizer's SmolLM3 chat template was used with enable_thinking=False. All training examples were required to have exactly the same prompt-token prefix as the corresponding inference prompt. Only LoRA adapter parameters were updated; backbone weights were frozen.
Training used a CUDA-enabled Windows laptop GPU (GeForce RTX 4070 Laptop GPU, 8 GB VRAM). The run recovered from an interrupted optimizer checkpoint and completed all 516 planned steps. The final adapter was saved as adapter_model.safetensors with adapter_config.json.
Final selection was frozen before the official QA test was evaluated. The selected adapter and an untrained 4-bit NF4 control were evaluated on the identical 900 original QA test responses (740 SUPPORTED, 160 UNSUPPORTED). Labels were withheld from model prompts. Greedy decoding used max_new_tokens=12; the first non-empty generation line was accepted only if it exactly matched one of the two labels after case normalization. Invalid outputs were counted as errors, not discarded.
| Metric | NF4 backbone, no adapter | NF4 backbone + QLoRA adapter |
|---|---|---|
| Macro-F1 | 0.5336 | 0.8292 |
| Accuracy | 76.33% | 89.89% |
UNSUPPORTED precision |
26.47% | 70.91% |
UNSUPPORTED recall |
16.88% | 73.13% |
UNSUPPORTED F1 |
0.2061 | 0.7200 |
| Invalid generations | 5 / 900 | 0 / 900 |
Adapter confusion matrix (900 held-out responses)
| Actual / predicted | SUPPORTED |
UNSUPPORTED |
|---|---|---|
SUPPORTED (740) |
692 | 48 false alarms |
UNSUPPORTED (160) |
43 missed | 117 |
The held-out macro-F1 difference (adapter minus untrained NF4) was +0.2956. An exploratory paired bootstrap over 150 evidence-source clusters (2,000 resamples; seed 42) yielded a 95% percentile interval of +0.2437 to +0.3429. This expresses uncertainty within this benchmark's sampling structure, not guaranteed performance on unrelated data.
For context, validation macro-F1 was 0.7960 over 729 quality-good QA responses; validation UNSUPPORTED recall was 64.11%. The official test has a lower unsupported prevalence (17.78%) than validation (34.02%), which affects precision and accuracy comparisons.
These are RAGTruth groundedness results, not GSM8K scores or smol-course leaderboard results.
Install dependencies compatible with your CUDA/PyTorch environment: torch, transformers, accelerate, bitsandbytes, and peft. The original experiment used Python 3.11, torch==2.11.0+cu128, transformers==5.22.2, peft==0.21.2, bitsandbytes==0.49.0, and accelerate==1.15.0.
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
from peft import PeftModel
BASE_ID = "HuggingFaceTB/SmolLM3-3B" # instruction-tuned, NOT -Base
BASE_REVISION = "b49c77130b3407155d9b83b404d9b28b5d1845ae"
ADAPTER_ID = "amp1414/ragtruth-smollm3-3b-qlora"
quantization = BitsAndBytesConfig(
load_in_4bit=True,
bnb_4bit_quant_type="nf4",
bnb_4bit_use_double_quant=True,
bnb_4bit_compute_dtype=torch.bfloat16,
)
tokenizer = AutoTokenizer.from_pretrained(BASE_ID, revision=BASE_REVISION)
backbone = AutoModelForCausalLM.from_pretrained(
BASE_ID,
revision=BASE_REVISION,
quantization_config=quantization,
dtype=torch.bfloat16,
device_map={"": 0},
attn_implementation="sdpa",
)
model = PeftModel.from_pretrained(backbone, ADAPTER_ID, is_trainable=False)
model.eval()
question = "Which city hosted the event?"
evidence = "The annual conference was hosted in Toronto in 2025."
answer = "The conference took place in Toronto."
messages = [
{
"role": "system",
"content": (
"You are an evidence-groundedness verifier. Decide whether the answer is "
"fully supported by the supplied evidence, not by outside knowledge. "
"Return exactly one label: SUPPORTED or UNSUPPORTED."
),
},
{
"role": "user",
"content": (
f"Question:\n{question}\n\nEvidence:\n{evidence}\n\n"
f"Answer to verify:\n{answer}"
),
},
]
encoded = tokenizer.apply_chat_template(
messages,
tokenize=True,
return_dict=True,
return_tensors="pt",
add_generation_prompt=True,
enable_thinking=False,
)
inputs = {k: v.to("cuda") for k, v in encoded.items()
if k in ("input_ids", "attention_mask")}
if inputs["input_ids"].shape[-1] > 1152:
raise ValueError("Input exceeds the evaluated context budget; do not silently truncate.")
pad_id = tokenizer.pad_token_id or tokenizer.eos_token_id
with torch.inference_mode():
generated = model.generate(
**inputs,
do_sample=False,
max_new_tokens=12,
use_cache=True,
pad_token_id=pad_id,
)
new_tokens = generated[0, inputs["input_ids"].shape[-1]:]
raw_text = tokenizer.decode(new_tokens, skip_special_tokens=True)
lines = raw_text.strip().splitlines()
label = lines[0].strip().upper() if lines else "INVALID"
if label not in ("SUPPORTED", "UNSUPPORTED"):
label = "INVALID"
print({"label": label, "raw_generation": raw_text})
The repository's standard artifact is the adapter only; the base model must be downloaded separately. The generated label is a model prediction, not a factual guarantee.
This verifier should not be the sole control in medical, legal, financial, or other high-impact decisions.
c103204b9ce28d6bbad859304bf30de72b8ed8fe.HuggingFaceTB/SmolLM3-3B, revision b49c77130b3407155d9b83b404d9b28b5d1845ae.results/milestone_d/experiment_lock.json (recorded lock SHA-256: 9bf44c58b3b09ca0b696c5b5732fad771da12ea8b69f9560ed2841c4afe7507c). This lock refers to the original local artifacts; it is not included in the adapter-only model upload.results/milestone_d/heldout_test/final_comparison/final_test_comparison.json (original local experiment artifact; upload separately if making full reproduction materials public).The adapter-only Hub repository does not by itself contain the complete dataset preparation code, splits, and prediction records. Those would need to be published separately to enable full independent metric reproduction.
This LoRA adapter is released under the Apache License, Version 2.0 (apache-2.0). You may use, modify, and redistribute the adapter, including commercially, subject to that license's terms and notice requirements. The adapter is supplied without warranties.
The underlying HuggingFaceTB/SmolLM3-3B backbone is separately published under Apache-2.0. The RAGTruth source repository is published under MIT. Those upstream works remain attributed to their respective authors; users are responsible for complying with any applicable terms for the backbone and dataset. This repository distributes only the fine-tuned LoRA adapter, not the backbone weights or RAGTruth records.
Dataset citation:
Niu et al., RAGTruth: A Hallucination Corpus for Developing Trustworthy Retrieval-Augmented Language Models (2024). arXiv:2401.00396.
HuggingFaceTB/SmolLM3-3B