Work · Case file 03 · Course project with a published model (AAI3008 Large Language Models, Singapore Institute of Technology) · 2026

ClaimLens

5 min readJump to proofJump to limits

At a glance

Result
The fine-tuned NLI model scores 65.8 percent accuracy on 3,000 VitaminC test pairs (95 percent CI 64.0 to 67.5), against 59.4 percent zero-shot. Measuring it exposed a label swap in the app, now fixed.
Problem
Checking a paragraph means splitting it into standalone claims, finding web evidence for each, and deciding whether it supports, refutes or says nothing.
My role
ML engineer in a team of five; the fine-tuned NLI weights are published under my Hugging Face account.Built for AAI3008 Large Language Models at Singapore Institute of Technology. My part is as on my résumé; the README does not split the rest of the work by person.
Stack
LangGraph · DeBERTa-v3 · FastAPI with SSE · Next.js 16

Proof

What try, see and check mean

On this pageThe problem

The problem

Checking a paragraph means splitting it into claims that each stand alone, finding web evidence for every one, and deciding whether that evidence supports, refutes or says nothing about the claim. Each step fails in its own way: compound claims blur the question, search returns pages about a related but different event, one weak source can pass for confirmation, and a general NLI model will read support into text that is merely on topic.

The idea. Run each claim through seven specialised agents in a LangGraph state machine, verify it with a fine-tuned DeBERTa-v3 NLI model that votes over every piece of evidence, and weight each vote by how relevant and how credible its source is before three gates can block a false positive.

Fig. 01 · Seven agents and a weighted vote

1. Decomposition agent

Splits the input text into atomic, checkable claims.

Output
claims[]

Weighted NLI vote

Every evidence piece votes; the label with the largest weighted sum wins.

weighted_score
0.517
Retry
none needed

weighted_score = NLI_confidence × evidence_relevance_score × credibility_score; final_verdict = argmax of the sums per label. At least two distinct source domains must agree.

One claim travels through seven agents; the verifier scores every evidence piece three ways, multiplies them, and the label with the largest sum wins.

How it works

  1. Decompose

    The Decomposition Agent uses GPT-4o-mini with structured output to split text into atomic claims. It removes compound claims, filters subjective language, keeps each claim between 10 and 500 characters, and preserves the source sentence for traceability.

  2. Enrich and frame

    The Context Enrichment Agent adds normalised text, entity aliases, temporal and venue cues and search hints. The Event Frame Agent extracts a {person, action, location, time, context} frame, later compared with each evidence frame and scored match, partial, contradict or insufficient.

  3. Search and scrape

    The Search Architect Agent writes 2 to 5 targeted queries per claim, with a retry mode that changes the queries when evidence is thin. The Scraper Agent runs up to 5 queries concurrently on Tavily or SerpAPI, deduplicates by URL, scores relevance from 0.0 to 1.0 with GPT-4o-mini and keeps the top 5 pieces.

  4. Score credibility

    The Credibility Assessment Agent rates each source on Author Expertise, Recency and Bias Score (weights under Evidence), returning a credibility_score from 0.0 to 1.0 and a high, medium or low label.

  5. Verify with a weighted vote

    The Verifier Agent runs the DeBERTa-v3 NLI model over every evidence piece and combines them: weighted_score = NLI_confidence x evidence_relevance_score x credibility_score, and the final verdict is the argmax of the per-label sums over SUPPORTED, REFUTED and NOT_ENOUGH_INFO. Three gates follow: Event Frame, Direct Match and Cross-Source Agreement (at least two distinct domains must agree). GPT-4o-mini gives a second opinion on three triggers and overrides only at confidence 0.70 or higher, always on the original claim text.

  6. Report and stream

    aggregate_results builds a trust score from claim support ratio, average confidence and evidence quality. FastAPI serves it over POST /verify, an SSE stream at /verify/stream and async jobs, and the Next.js 16 frontend lights up the active graph node and each verdict as it lands.

What was hard

The hard part was deciding what to trust when sources disagree. A single NLI pass over the best snippet is brittle, so the team's pipeline votes across every evidence piece and weights each vote by NLI confidence times relevance times credibility. That stops one confident low-credibility blog from outvoting two cautious expert sources, but it stacks three hand-set weightings with no measured calibration, and the Cross-Source Agreement gate deliberately denies a high-confidence result to any claim that only one domain covers. My part here was fine-tuning the NLI model that casts each vote; the README does not split the rest of the work by person.

Limits. The training data is not documented, so overlap between the training set and the VitaminC benchmark cannot be ruled out. The evaluation scores the NLI model alone on one evidence sentence per claim, not the full pipeline with search, gates and the LLM cross-check, and the gain over zero-shot models comes from real Wikipedia revisions and claims with numbers; on synthetic edits and claims without digits it is level or behind. The label fix and the model card live on the eval-2026-11 branch. The pipeline needs OpenAI and Tavily keys, a GPU is recommended for the default verifier, and the verifier implementations still live in a file named nli_placeholder.py.

Evidence

Commits
35AAI3008_ClaimLens repository
Published model
Zulfhagez/claimlens-deberta-v3-nli, deberta-v2 architecture, 184.4M parameters, safetensors, last updated 6 Mar 2026.https://huggingface.co/Zulfhagez/claimlens-deberta-v3-nli
Measured accuracy
VitaminC test split, random sample of n = 3,000 pairs (seed 42): accuracy 65.8 percent (95 percent CI 64.0 to 67.5), macro F1 0.625 (0.607 to 0.642). The NLI model on its own, one evidence sentence per claim, run on 11 Nov 2026.ClaimLens eval/README.md and eval/results/metrics.json, branch eval-2026-11
Against zero-shot NLI
Same sample: cross-encoder/nli-deberta-v3-base (same size) 59.4 percent and macro F1 0.572; facebook/bart-large-mnli 59.1 percent and 0.561. Gain over the first: 1,973 against 1,783 of 3,000 pairs correct, 65.77 minus 59.43 percent, so 6.33 points, shown as 6.3; paired 95 percent CI plus 4.5 to plus 8.0 points.ClaimLens eval/README.md, section Headline; eval/results/metrics.json
Main failure mode
Over-predicts NOT ENOUGH INFO: 1,173 NEI predictions against 404 true NEI, and 830 of its 1,027 errors are SUPPORTED or REFUTED pairs called NEI. When it commits, precision is 0.89 to 0.90.ClaimLens eval/README.md, section Per-class results; the confusion matrix on this page is drawn from eval/results/metrics.json, and 16 recorded answers from eval/results/predictions.jsonl
Label order fix
The app decoded index 1 as REFUTED and 2 as NEI; the published config.json says 1 NEI, 2 REFUTED. Decoded the app's way, the same 3,000 pairs score 51.1 percent, so the code was wrong. Fixed on branch eval-2026-11: the verifier reads the order from the checkpoint and a test pins it.ClaimLens eval/README.md, section Label order: finding and fix; MODEL_CARD.md
Pipeline
Seven agents, three post-verification gatings, retry of up to 3 iterations when confidence is below 0.7.README sections Agent Pipeline and Configuration ClaimLens README
Weights
Credibility: Author Expertise 40 percent, Recency 20 percent, Bias Score 40 percent. Trust score: claim support ratio 50 percent, average confidence 30 percent, evidence quality 20 percent.README sections Credibility Assessment Agent and Trust Score Calculation ClaimLens README
Tests and limits
Unit tests in tests/test_pipeline.py run with pytest. Input capped at 10,000 characters.README sections Project Structure and Security ClaimLens README
Team and module
Five members. MIT licence.README sections Team and License ClaimLens README

Stack

  • Python 3.11+
  • LangGraph 0.2+ (state machine with retry loop)
  • LangChain and OpenAI SDK (GPT-4o-mini agents)
  • DeBERTa-v3 fine-tuned with Hugging Face Transformers
  • PyTorch 2.1+
  • FastAPI 0.109+ with SSE and async jobs
  • Tavily API or SerpAPI
  • Redis and PostgreSQL (JSONB)
  • Next.js 16, React 19, TypeScript 5
  • Tailwind CSS 4