DEV Community

Mahesh VAIKRI
Mahesh VAIKRI

Posted on

Your Knowledge Graph Is Wasting 70% of Its Tokens

Everyone building GraphRAG tunes the same three dials: the retriever, the chunk size, the re-ranker. Then the retrieved subgraph gets serialized into the prompt with json.dumps() — and nobody measures what that step costs.

I did. It costs more than everything else you tuned.

The benchmark

I compared 10 graph serialization formats — JSON, GraphML, RDF variants, edge lists, and others — on three axes:

  • Token count for the same property graph
  • Traversal QA accuracy (can the model correctly walk the graph?)
  • Multi-hop reasoning accuracy (can it chain 2-3 relationships?)

Same graph. Same model. Same questions. Only the serialization changed.

The findings

1. Verbose formats waste ~70% of tokens on syntax. Braces, quotes, repeated keys — none of it carries signal. If you're on an 8K or 16K context window, your effective graph budget is roughly a third of what it should be.

2. The format alone swings multi-hop accuracy from ~40% to ~80%. This was the result that surprised me. We obsess over model choice while a free variable — how you lay out the graph — doubles or halves the outcome.

3. Tabular and relational layouts consistently beat nested markup. The likely reason: LLMs have seen tables and relational patterns billions of times in training. Deeply nested structures force the model to track brackets instead of relationships.

What I built with the findings

Those results became ISONGraph — a property-graph representation designed for LLM comprehension, part of the ISON ecosystem of token-efficient formats for AI workflows.

  • ~70% fewer tokens than verbose graph formats
  • 92% traversal accuracy, 90% knowledge-graph QA (best of the 10 formats tested)
  • 80% multi-hop accuracy vs 40-70% for alternatives
  • Node/edge CRUD, multi-hop traversal, path finding, Cypher-like pattern queries, schema validation, and optional embedding-based semantic search
  • MIT licensed, implementations in Python, JavaScript/TypeScript, Rust, Go, C++, and C#
pip install isongraph
Enter fullscreen mode Exit fullscreen mode

Benchmark methodology and full results: github.com/isongraph/isongraph
Docs: graph.ison.dev · Ecosystem: ison.dev

Poke holes in it

A benchmark is only as good as its adversaries. If you have graphs or question sets where a different format wins — nested JSON, RDF, anything — I genuinely want to test against them. Open an issue or drop a comment.

I'm Mahesh — AI Architect at Dell, founder of AroorA AI Labs, building open infrastructure for trustworthy agentic AI: RudraDB, MAPLE, ISON, SnapLLM. One principle behind all of it: AI systems should be verifiable, not just impressive.

Top comments (0)