Back to Case Studies

Benchmark Framework for AI Reasoning over Knowledge Graphs

Proving Non-Deterministic Pipelines Correct Before Production

ProductionEnterprise Software & IT ServicesSep 2026 – PresentNLP, Knowledge Systems & Generative AI
~2x
Extraction F1, from 0.32 to 0.63
50–100
Pilot items before every benchmark
100%
Items traceable to sources and calls
Ongoing
Metrics still rising

My Role

Role
Framework lead, consultant
Independent consulting
Team
3 engineers incl. me, PM, VP Engineering
Stage reached
In active development
Key decisions
  • Record every LLM call for offline replay
  • Sign-test regression harness for prompt changes
  • docling for new PDFs, one job at a time

Approach at a Glance

Details
  1. 1Benchmark Pipeline
  2. 2Reproducible LLM Calls
  3. 3Prompt Regression Harness
  4. 4Plugin Architecture
  5. 5Ingestion and Cross-Source Alignment
  6. 6Expert Review Flow
  7. 7Document Ingestion with docling
  8. 8Engineering Leadership

Executive Summary

A framework that generates, validates, scores and evolves benchmarks for AI systems that reason over knowledge graphs and large text corpora. It is part of a company's effort to build general corporate intelligence, AI that can reason over an organisation's knowledge, starting with philosophy, a domain where concepts, propositions and arguments have to be captured precisely.

The problem it addresses: LLM pipelines are non-deterministic, so "it looks right" isn't evidence. Before a knowledge-extraction pipeline reaches production, the team needs to show it is correct. The framework turns that into an engineering process:

  • Generate: build benchmark items with LLMs from knowledge graphs and source documents.
  • Validate: check the items for schema, duplicates, contamination and answerability.
  • Score: grade systems with rubric-based LLM judges and exact metrics.
  • Pilot: gate every benchmark on a small batch first.
  • Label: send items to domain experts in the annotation tool, and promote their verdicts to gold.
  • Trace: keep a full record of how every item was produced.

I'm the lead of this framework, and I also built key parts of the experts' annotation tool: identity and access, document ingestion and the review flow between the two systems. I work as a consultant in a team of three engineers with a product manager and a VP of Engineering. With this approach, the team raised the F1 of a structure-extraction task from 0.32 for the LLM baseline to 0.63. The project is in active development, and its quality metrics keep improving.


Client Profile

The client builds a stack for governed knowledge-graph construction: from raw sources to ontology-conformant knowledge, with provenance and reproducible pipelines. Its long-term goal is general corporate intelligence. The first domain is philosophy, where experts work with concepts, propositions and arguments.

Evaluating AI in such a setting is hard:

  • Non-deterministic pipelines: the same LLM pipeline can give different outputs, and small prompt changes can quietly break quality.
  • No ready benchmarks: for specialised domains and custom ontologies, test sets have to be built, and built correctly.
  • Expert judgement is scarce: domain experts' time is limited, so it has to go where automation can't decide.
  • Trust needs evidence: every number has to be traceable to the data, prompts and models that produced it.

Technical Approach

  1. Benchmark Pipeline – A benchmark is defined by a spec and built through fixed stages:

    • Source: knowledge graphs over SPARQL, document corpora and files.
    • Generate: LLM-generated items with curated seeds and difficulty tiers.
    • Validate: schema, deduplication, contamination, answerability and difficulty checks.
    • Score: rubric-based LLM judges plus exact-match and F1 metrics.
    • Pilot: a mandatory gate of 50–100 instances before the full benchmark is generated.
    • Label: export to the expert annotation tool, import the verdicts and promote them to gold.
    • Trace: a generation trace for every instance.
  2. Reproducible LLM Calls – I built the configuration layering, a versioned prompt store and recording of every LLM call with offline replay. Prompts and responses are stored by content hash, so any run can be reproduced and compared without calling the model again.

  3. Prompt Regression Harness – Pinned gold slices, A/B comparison of prompts or models, and a statistical sign test decide whether a change really improved results, so prompt changes don't silently degrade quality.

  4. Plugin Architecture – Domains plug in as packages, with auto-discovery, extension points for validators and emitters, and a scaffold for new domains, so new domains are added without changing the core.

  5. Ingestion and Cross-Source Alignment – Configurable ingestion adapters and declarative alignment across sources, so the same entity in different sources is recognised as one.

  6. Expert Review Flow – Experts give their verdicts in an ontology-driven annotation tool. A typed contract carries review jobs to the tool and results back, with a capability registry, export pre-flight checks and a conformance kit that keeps both sides compatible. Verified sign-in and people administration in the tool come from the company's central identity service, which I also built.

  7. Document Ingestion with docling – I moved the annotation tool's PDF extraction to docling, and benchmarked it against the previous extractors on real and purpose-built hard cases:

    • Quality: scanned pages inside digital PDFs are no longer blank, text comes in whole paragraphs, words hyphenated across lines are rejoined (164 → 0 in a 16-page paper), tables read as rows, and the reader and the text panel show identical text.
    • Speed and memory: on scans it is about 2× faster than the previous OCR (12× with models loaded) and uses about 3× less memory. On digital PDFs it is slower, which was accepted for the quality gain.
    • Safe rollout: every document is pinned to the extractor that produced its text, so existing documents are untouched, and switching new uploads back is a kill switch.
    • Reliability: three parallel jobs needed up to 9.5 GB, enough to risk out-of-memory kills, so jobs run one at a time through a queue. Timeouts, automatic relaunch after a crash or restart, and a give-up limit keep documents from getting stuck. All of it was verified live, including recovery from a killed job, with UI tests in Playwright.
  8. Engineering Leadership – As lead, I review pull requests and write decision records. One example: I found that a candidate metric rewarded models for inventing spans, and asked for it to be fixed before it could flatter results. Another: publishing to experts must fail closed.


Business Outcome

The team can now show, with evidence, whether a non-deterministic AI pipeline is correct before it goes to production. Every benchmark item has a trace, every prompt change is tested against gold data, and experts' time goes only where automated checks can't decide, in an annotation tool that now reads scanned and complex documents correctly. Using this process, the team raised a structure-extraction F1 from 0.32 for the LLM baseline to 0.63.

The framework is in active development. Self-improving evaluation loops and production gates come next, and the quality metrics are expected to keep rising.

Technologies

LLMsLLM-as-a-JudgeKnowledge GraphsSPARQLEvaluationPythonFastAPIStreamlitPostgreSQLPlugin Architecture

Planning something similar?

Tell me about it on a short call. New projects can start within 2 weeks