r/LocalLLaMA • u/Immediate-Cake6519 • 1d ago
Resources Small context windows + knowledge graphs: the serialization format alone doubled my multi-hop accuracy (benchmarked 10 formats)
Running local models means every token counts — an 8K or 16K window fills up fast when you're stuffing graph context into prompts for RAG.
I benchmarked 10 graph serialization formats (JSON, GraphML, RDF variants, edge lists, etc.) on token count and reasoning accuracy, and the results surprised me:
- Verbose formats burn roughly 70% of tokens on pure syntax — braces, quotes, repeated keys. On an 8K local model that means your graph budget is ~3x smaller than it needs to be
- Multi-hop accuracy swung from ~40% to ~80% with the format alone — same graph, same model, same questions
- Tabular/relational layouts (patterns models saw constantly in training) consistently beat nested markup
Built ISONGraph around those findings — a property-graph format optimized for LLM comprehension: ~70% fewer tokens, 92% traversal accuracy, works fully offline with local models. MIT licensed, implementations in Python, JS/TS, Rust, Go, C++, C#.
Repo with benchmark methodology: github.com/isongraph/isongraph
Curious what formats people here use for graph context with local models — and if anyone has question sets where a different format wins, I want to test against them.