truthfulqa/truthful_qa
Viewer • Updated • 1.63k • 104k • 280
How to use Ajith-Bondili/deberta-v3-factuality-small with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-classification", model="Ajith-Bondili/deberta-v3-factuality-small") # Load model directly
from transformers import AutoTokenizer, AutoModelForSequenceClassification
tokenizer = AutoTokenizer.from_pretrained("Ajith-Bondili/deberta-v3-factuality-small")
model = AutoModelForSequenceClassification.from_pretrained("Ajith-Bondili/deberta-v3-factuality-small")Lightweight DeBERTa-v3-Small fine-tuned to detect factual vs. non-factual statements using TruthfulQA and FEVER.
Part of the Army of Safeguards research project
| Property | Value |
|---|---|
| Base model | microsoft/deberta-v3-small |
| Architecture | Encoder-only Transformer (≈ 86 M params) |
| Task | Binary text classification (0 = factual, 1 = non-factual) |
| Language | English |
| Fine-tuning framework | Hugging Face Transformers v4.44 |
| Trained by | Ajith Bondili |
| Hardware | NVIDIA T4 (Google Colab) |
| Epochs | 3 |
| Batch size | 16 |
| Learning rate | 2e-5 |
| Max sequence len | 256 tokens |
Merged and balanced from two open-source datasets:
≈ 20 000 combined examples after cleaning.
| Metric | Base Model (M₀) | Fine-Tuned (M₁) | Δ Change |
|---|---|---|---|
| Accuracy | 0.52 | 0.80 | +0.28 |
| F1 Score | 0.00 | 0.79 | +0.79 |
| Eval Loss | 0.69 → 0.35 | ↓ |
Confusion Matrix
| Pred Factual | Pred Non-Factual | |
|---|---|---|
| True Factual | 838 | 205 |
| True Non-Factual | 204 | 753 |
Acts as a truth-checking critic for large-language-model outputs.
Free-form English text (e.g., an LLM response or claim)
{
"label": "non-factual",
"confidence": 0.81,
"probs": { "supported": 0.19, "non-factual": 0.81 }
}
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch, torch.nn.functional as F
repo = "ajithbondili/deberta-v3-factuality-small"
tok = AutoTokenizer.from_pretrained(repo)
model = AutoModelForSequenceClassification.from_pretrained(repo)
text = "The Moon is made of cheese."
inputs = tok(text, return_tensors="pt", truncation=True, padding=True)
with torch.no_grad():
logits = model(**inputs).logits
probs = F.softmax(logits, dim=-1)
label = torch.argmax(probs).item()
print({"label": label, "probs": probs.tolist()})
@software{bondili_2025_factuality, author = {Ajith Bondili}, title = {DeBERTa-v3-Small Factuality / Misinformation Classifier}, year = {2025}, url = {https://huggingface.co/ajith-bondili/deberta-v3-factuality-small} }