SmolLM3-3B-FEVER-QLoRA is a fine-tuned adapter for HuggingFaceTB/SmolLM3-3B, adapted for evidence-based claim verification. It was trained using QLoRA on 10,000 balanced examples from the NLI-FEVER dataset.
Given a claim and a passage of supplied evidence, the model predicts one of three labels: SUPPORTED, REFUTED, or NOT_ENOUGH_INFO. It does not retrieve evidence or independently establish whether a claim is true.
the released adapter achieved:
The pretrained base model achieved 69.73% accuracy and 0.6811 macro-F1 on the same validation subset. These are development-set results, not independent test-set results. Token accuracy is a training metric and should not be confused with claim-level validation accuracy.
This model is designed for research and educational tasks involving a claim and accompanying textual evidence, including:
It is intended as an evidence-conditioned classification assistant, not as an autonomous fact-checking service.
This repository provides a LoRA adapter, not a standalone copy of the 3B-parameter base model. Install torch, transformers, peft, accelerate, and bitsandbytes for GPU inference, then load the base model and attach the adapter:
import torch
from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
BASE_MODEL = "HuggingFaceTB/SmolLM3-3B"
ADAPTER_ID = "AhmedYasserEssam/smollm3-3b-fever-qlora-10k"
LABELS = {"SUPPORTED", "REFUTED", "NOT_ENOUGH_INFO"}
SYSTEM_PROMPT = (
"You are an evidence-based fact verification assistant. "
"Determine whether the provided evidence supports, "
"contradicts, or does not provide enough information "
"to verify the claim. "
"Use only the provided evidence. "
"Respond with exactly one of these labels: "
"SUPPORTED, REFUTED, NOT_ENOUGH_INFO."
)
tokenizer = AutoTokenizer.from_pretrained(BASE_MODEL)
if tokenizer.pad_token is None:
tokenizer.pad_token = tokenizer.eos_token
quantization_config = BitsAndBytesConfig(
load_in_4bit=True,
bnb_4bit_quant_type="nf4",
bnb_4bit_use_double_quant=True,
bnb_4bit_compute_dtype=torch.float16,
)
base_model = AutoModelForCausalLM.from_pretrained(
BASE_MODEL,
quantization_config=quantization_config,
device_map="auto",
dtype=torch.float16,
)
model = PeftModel.from_pretrained(base_model, ADAPTER_ID)
model.eval()
def verify(claim: str, evidence: str) -> str:
messages = [
{"role": "system", "content": SYSTEM_PROMPT},
{"role": "user", "content": f"Evidence:\n{evidence}\n\nClaim:\n{claim}"},
]
prompt = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True,
enable_thinking=False,
)
inputs = tokenizer(prompt, return_tensors="pt", add_special_tokens=False)
device = model.get_input_embeddings().weight.device
inputs = {name: tensor.to(device) for name, tensor in inputs.items()}
with torch.inference_mode():
generated = model.generate(
**inputs,
max_new_tokens=16,
do_sample=False,
eos_token_id=tokenizer.eos_token_id,
pad_token_id=tokenizer.pad_token_id,
)
response = tokenizer.decode(
generated[0, inputs["input_ids"].shape[1]:],
skip_special_tokens=True,
clean_up_tokenization_spaces=False,
).strip()
prediction = response.splitlines()[0].strip().upper() if response else ""
return prediction if prediction in LABELS else "INVALID_OUTPUT"
print(verify(
claim="The Eiffel Tower is in Paris.",
evidence="The Eiffel Tower is a landmark located in Paris, France.",
))
The example uses 4-bit inference on a compatible CUDA GPU and follows the prompt format used for fine-tuning, with SmolLM3 thinking mode disabled. Change ADAPTER_ID if the model is hosted under a different namespace.
The base model was loaded in 4-bit NF4 precision and fine-tuned with trainable LoRA adapter weights. Training used 10,000 balanced NLI-FEVER examples, one epoch, and two NVIDIA Tesla T4 GPUs with distributed data parallelism. The effective global batch size was 8, and the run completed 1,250 optimizer steps.
In the dataset used, premise is the claim and hypothesis is the evidence. The numeric label mapping was 0 → SUPPORTED, 1 → NOT_ENOUGH_INFO, and 2 → REFUTED. Target completions contained only the output label followed by an end-of-sequence token.
SFTConfig:
max_length: 768per_device_train_batch_size: 1gradient_accumulation_steps: 4learning_rate: 2e-4num_train_epochs: 1optim: paged_adamw_8bitfp16: Truebf16: Falsecompletion_only_loss: Truepacking: Falsegradient_checkpointing: True (use_reentrant=False)eval_strategy: epochsave_steps: 250seed: 42LoraConfig:
r: 16lora_alpha: 32lora_dropout: 0.05target_modules: all-linearbias: nonetask_type: CAUSAL_LMQuantization: 4-bit NF4 with double quantization and FP16 compute; trainable adapter parameters were maintained in FP32. The adapter has approximately 30.23 million trainable parameters (0.97% of the combined model parameter count).
The published adapter was trained for 1,250 optimizer steps on two NVIDIA Tesla T4 GPUs. The metrics below are the actual recorded values from selected training steps of that single completed run.
| Step | Training Loss | Validation Loss | Entropy | Num Tokens | Mean Token Accuracy |
|---|---|---|---|---|---|
| 200 | 0.143843 | — | 0.128680 | 315,183 | 0.946885 |
| 400 | 0.137101 | — | 0.132149 | 634,240 | 0.939177 |
| 600 | 0.106253 | — | 0.133705 | 949,759 | 0.965804 |
| 800 | 0.140619 | — | 0.135570 | 1,268,415 | 0.941806 |
| 1,000 | 0.107246 | — | 0.105766 | 1,584,152 | 0.955565 |
| 1,200 | 0.194139 | — | 0.127825 | 1,899,761 | 0.936300 |
| 1,250 | 0.133896 | 0.139245 | 0.122348 | 1,977,902 | 0.955040 |
Training-loss fluctuations are expected: Each logged loss summarizes recent mini-batches that may differ in difficulty, so the values need not decrease at every step. The values are reported without modification or smoothing. Validation loss was only measured at the end of the epoch; — indicates that it was not logged at earlier selected steps. Num Tokens is the run's logged cumulative token counter, not the number of distinct dataset tokens.
Experiment tracking: Weights & Biases training run.
Base model: SmolLM3-3B · Dataset: NLI-FEVER · Method: PEFT/LoRA
HuggingFaceTB/SmolLM3-3B