Dev.to AI 🤖 Ai 👁 0 📖 7 min read

An agent that checks its own answers: GraphRAG on TigerGraph for messy, conflicting evidence

Our Round 2 entry for the TigerGraph Agentic GraphRAG Hackathon Code: github.com/Kultzuki/TigerGraphV2 · Live demo: kultzuki.github.io/TigerGraphV2 Round 1 of the hackathon asked for one-field lookups. Round 2 is harde

Our Round 2 entry for the TigerGraph Agentic GraphRAG Hackathon

Code: github.com/Kultzuki/TigerGraphV2 ·
Live demo: kultzuki.github.io/TigerGraphV2

Round 1 of the hackathon asked for one-field lookups. Round 2 is harder, and closer to real data:

  • Answers need several documents.
  • Some sources disagree.
  • Some facts change over time.
  • Some questions have no answer in the corpus at all.

An invented answer scores zero.

This post explains how we built a system that handles that, what worked, and what didn't.

The problem

The corpus has 3,530 documents:

  • Olympic event articles from 1988 to 2026.
  • Films and officeholders.
  • 166 fictional articles about the "LA 2028" Games, including 39 short source records: scoreboard captures, jury decisions, schedules, bulletins, news items, blog posts and emails.

Each LA 2028 source record states who published it and when. Like real sources, some are
provisional, some are out of date and some are simply wrong, and none of them says so about itself.

A typical hard question: who won the bronze in the LA 2028 men's 100 metres?

  • A provisional scoreboard capture at 21:07 shows one athlete in third place.
  • A signed photo-finish jury decision, effective at 22:15 the same evening, gives the bronze to someone else.
  • A spectator blog the next day repeats the provisional order.

A good answer gives the official result, says when it took effect, and explains why the other two
documents differ. Picking the most recent document gives the wrong answer here, and so does
picking the most frequent one.

Our approach: let the model plan, let code decide what is true

Language models are good at deciding what to look up. They are less reliable at stating exact
values, keeping lists complete, and admitting that something is missing. So we split the work:

  • The model plans the lookups and proposes an answer. Each fact it proposes must point at the graph rows that support it.
  • Code checks every proposed fact against those rows. It re-runs every calculation and writes the final answer, explanation and citations itself, from the facts that pass.

The model never gets the last word on a value.

How documents become graph data

The graph runs on TigerGraph 4.2.6 Community Edition in Docker. After loading it holds 133,555
vertices and 298,665 edges, and every relationship is verified by reading it back after the build.

  • Event articles are parsed by code. Infobox podiums (including shared bronzes and vacated medals), participation counts, venues and dates become Event, EventSeries, GamesEdition, MedalAward, Person and NOC vertices.
  • Films and officeholders become credits, money ranges and office terms, with predecessor and successor links.
  • The 39 LA 2028 source records go through one LLM call each, at build time only. The call extracts atomic claims with an exact quote, a source class, a modality (provisional, final, unverified and so on) and publication, observation and effective times.
    • A second pass links claims that supersede, repeat, corroborate or contradict each other.
    • The result is 146 EvidenceClaim vertices, a small bi-temporal claim ledger.
    • The extractions are cached in the repo, so rebuilding the graph needs no model call.
  • Every document is split into 18,971 passages. Passages are linked to the people, films and events they mention, and each one carries a 512-dimension embedding in TigerGraph's native HNSW vector index.

The tools

The agent has nine tools that query TigerGraph through 18 installed GSQL queries:

  • five structured tools: events, medals, athlete results, films and office succession;
  • a hybrid search that combines HNSW vector seeds and lexical seeds with Personalized PageRank over the mention graph, then reranks with a cross-encoder;
  • the claim ledger, a table inspector and a passage reader.

Two more tools don't query the graph: one sets a time policy ("what was known by 2 July?"), and
submit_answer is the only way to finish.

How a question is answered

  1. First turn. The model calls a tool and declares what the question asks for, as a short list.
  2. Fast path. If one structured tool's computed outputs cover every part of the question, code computes the answer (counts, extremes with ties, trends, lists).
    • A short independent review then has to name, for each part of the question, the output field that answers it, and code checks that the field exists.
    • So a list of names can no longer "answer" a question about a score or a reason.
  3. Composer. Otherwise, one model call writes the answer from the rows already fetched. It runs without the tool definitions and without the conversation history, which keeps it cheap.
  4. Agent loop. If the composer can't establish every part of the answer, the agent continues with more searches: passages, tables, the claim ledger, or a corpus-wide search before it may say not_in_corpus.
  5. Validation. Every submitted fact is checked against the rows it cites:
    • every number, name and content word must appear in the support;
    • a number must be stated about the same subject, which catches values swapped between two athletes;
    • code re-runs any computation, including differences between race times like "1:45:01".

Rejected facts go back to the model with the reasons attached.

The status follows from the facts that pass: all established is answered, some is partial,
none is not_in_corpus. Qualifiers the evidence states are kept next to the fact they qualify:
when a decision took effect, what was provisional, what remains unverified.

Conflicting and dated sources

The claim ledger resolves conflicts with five general rules:

  1. Source authority: an official decision outranks an official record, which outranks a schedule, then a provisional display, then secondary media, then informal posts.
  2. Valid time: a claim applies only inside its validity window.
  3. Supersession: a later source of equal or higher authority retires the claim it replaces.
  4. Stale repetition: a low-authority source that repeats superseded data adds no support.
  5. Grouping: claims are resolved per topic and per event, so two different events never get merged into one conflict.

The time policy hides every source not yet published, or not yet in force, at the asked instant.
A notice published before that instant that takes effect later is reported as an announced change,
not as the current value.

Every answer line carries its citations, token counts, latency and a full trace. Each TigerGraph
step in the trace matches an entry in the request log one to one.

Results

All three pipelines use the same model, DeepSeek V4.1 Flash 1017 on Baseten with reasoning off, the
same graph and the same judge. Accuracy is fact-level F1 against the published answers, graded by an
independent model (Gemini 4 Neon) rather than by the model that produced the answers.

Pipeline (public 50 questions) Accuracy Status correct Tokens per question Latency p50 / p95 Cost for 50
RAG: TigerGraph vector search, one LLM call 57.4% 25 / 50 2,217 0.8 / 1.7 s $0.08
GraphRAG: vector + lexical seeds + PageRank + reranking, one LLM call 70.7% 33 / 50 2,699 1.9 / 3.0 s $0.10
Agentic GraphRAG 95.2% 48 / 50 16,185 2.3 / 5.8 s $0.22

The graph adds 13 points over plain vector RAG. The agent adds another 24: structured graph tools,
the claim ledger, the time policy and per-fact validation. A second run of the public set scored
95.3%, with the same answer status on all 50 questions.

Public questions flatter everyone, because that's the set you test against while building.
So we wrote our own dev set: 120 questions, 65 of them new and written from corpus documents,
including trap questions and LA 2028 source scenarios.

  • Every fact is backed by a quote. Code checks that the quote appears verbatim in the document.
  • No overlap with the public set. No new question shares a six-word phrase with a public question.
  • A held-out set. 40 of the new questions are only run at checkpoints.

On those 40 unseen questions the final system scores 92.6%, against 82.9% for our previous version
on the same provider and judge. Latency also dropped: p95 went from 11.8 s to 5.8 s.

What didn't work

Not every idea held up once we measured it. Three that didn't:

  • Letting the composer settle every answer. It halved tokens per question, but the system started giving up too early. The first search often finds the right article but not the right sentence. Now the composer only finishes fully established answers, and everything else goes back to the agent loop.
  • Extra repair rounds. We tried a targeted search turn followed by another composition after a failed answer. It used 5% more tokens and gained no accuracy, so it's switched off.
  • Cutting agent turns. The questions that take four or five turns are also our most accurate ones. Limiting turns would save tokens by giving up exactly those answers.

Tokens per question are still higher than we'd like. Most of them go to the careful multi-turn
questions, and that's a trade we chose on purpose.

Things we'd recommend to anyone building one of these

  • Have code own the facts. A validator that checks each value against its cited rows prevents more errors than any prompt instruction we tried.
  • Store claims, not just documents. When sources disagree, you need publication time, validity time, authority and supersession as data, not as text the model has to reread every time.
  • Grade with a different model, and keep a held-out set that you never tune against. Our public score and our held-out score sometimes moved in opposite directions. The held-out one was the honest signal.
  • Replay before you refactor. We recorded the model's responses and replayed them through refactored code. That turns "no behaviour change" from a hope into a check: in our case, 97 recorded responses, zero mismatches.

Try it

The repo builds and runs with three commands:

./build.sh corpus.jsonl
./run.sh questions_public.jsonl answers_public.jsonl
./serve.sh   # the web app, with the live agent answering new questions

The live demo replays the public run with full traces,
per-fact validation, the pipeline comparison, and the LA 2028 claim ledger, which you can scrub
through time.

Built for the TigerGraph Agentic GraphRAG Hackathon, Round 2. #GraphRAG #TigerGraph #LLM #RAG

📰 Read the original article on Dev.to AI

Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.