A comprehensive benchmark suite comparing ISONGraph against all major graph serialization formats for LLM comprehension and token efficiency.
This benchmark evaluates how well Large Language Models (LLMs) can understand and answer questions about graph data when presented in different serialization formats. The key insight: format matters significantly for both token efficiency and LLM accuracy.
| Metric | ISONGraph | Best Alternative | Improvement |
|---|---|---|---|
| Token Efficiency | 1,698 tokens | ISON (1,976) | 14% fewer |
| Accuracy | 90.0% | Cypher (89.0%) | +1% |
| Efficiency Score | 53.00 Acc/1K | ISON (44.53) | 19% better |
| Format | Description | Token Efficiency | LLM Optimized |
|---|---|---|---|
| ISONGraph | Token-efficient property graph format | Highest | Yes |
| ISON | Base ISON tabular format | Very High | Yes |
| JSON Compact | Minified JSON | Medium | No |
| TOON | Token-Optimized Object Notation | Medium | Yes |
| Cypher | Neo4j's query language format | Medium | No |
| GML | Graph Modelling Language | Low | No |
| RDF/Turtle | W3C linked data standard | Low | No |
| JSON | Standard JSON with indentation | Low | No |
| JSON-LD | JSON for Linked Data | Very Low | No |
| GraphML | XML-based graph format | Lowest | No |
pip install tiktoken requests toon
pip install -e ../ison-py
pip install -e ../ison-graph# Token counting only (fast, no API calls)
python benchmark_kg_100.py --skip-llm
# Quick test with core formats
python benchmark_kg_100.py --skip-llm --quick
# Full benchmark with all 10 formats
python benchmark_kg_100.py --full --formats all
# Test specific formats
python benchmark_kg_100.py --full --formats ISONGraph JSON Cypher TOON| Option | Description |
|---|---|
--skip-llm |
Skip LLM API calls, only count tokens |
--full |
Run complete benchmark with LLM accuracy testing |
--quick |
Test only core formats (ISONGraph, ISON, JSON Compact, JSON) |
--formats |
Specify which formats to test |
| Dataset | Questions | Description |
|---|---|---|
| Social Network | 15 | Users, follows relationships, cycles |
| Knowledge Graph | 15 | Companies, people, products |
| Organization Chart | 15 | Hierarchical reporting structure (DAG) |
| Flight Routes | 15 | Cities, flights, distances |
| Movie Database | 15 | Movies, actors, directors, genres |
| E-Commerce | 15 | Customers, orders, products |
| Academic Citations | 10 | Papers, authors, citations |
| Category | Count | Description |
|---|---|---|
| Single-hop | 33 | Direct neighbor queries |
| Multi-hop | 21 | Friends of friends, reachability |
| Analysis | 23 | Connectivity, cycles, degrees |
| Aggregation | 13 | Counts, sums, averages |
| Path Finding | 9 | Shortest path, path existence |
| Pattern | 1 | Complex relationship patterns |
See BENCHMARK.md for detailed results and analysis.
| Rank | Format | Tokens | Savings | Accuracy | Acc/1K |
|---|---|---|---|---|---|
| 1 | ISONGraph | 1,698 | 68.6% | 90.0% | 53.00 |
| 2 | ISON | 1,976 | 63.4% | 88.0% | 44.53 |
| 3 | JSON Compact | 2,893 | 46.5% | 88.0% | 30.42 |
| 4 | TOON | 2,934 | 45.7% | 85.0% | 28.97 |
| 5 | Cypher | 3,522 | 34.9% | 89.0% | 25.27 |
| 6 | GML | 4,202 | 22.3% | 86.0% | 20.47 |
| 7 | JSON | 5,406 | 0.0% | 87.0% | 16.09 |
| 8 | RDF/Turtle | 4,166 | 22.9% | 58.0% | 13.92 |
| 9 | JSON-LD | 8,191 | -51.5% | 86.0% | 10.50 |
| 10 | GraphML | 9,093 | -68.2% | 87.0% | 9.57 |
The benchmark uses the DeepSeek API by default. Set the DEEPSEEK_API_KEY environment variable before running:
export DEEPSEEK_API_KEY="your-api-key" # Windows PowerShell: $env:DEEPSEEK_API_KEY = "your-api-key"Uses tiktoken with the o200k_base encoding (GPT-4o/GPT-5 tokenizer) for accurate token counting.
After running, the benchmark generates:
benchmark_kg100_YYYYMMDD_HHMMSS.log- Timestamped detailed logbenchmark_kg100_latest.log- Latest run log (overwritten each run)
Lower token count = less context window usage = more room for conversation/results.
ISONGraph uses 68.6% fewer tokens than JSON - meaning you can fit 3x more graph data in the same context window.
Percentage of questions answered correctly by the LLM given the graph data.
ISONGraph achieves 90% accuracy - the highest among all formats tested.
Accuracy per 1000 tokens - combines both metrics into a single efficiency measure.
ISONGraph: 53.00 Acc/1K - nearly 2x better than the next best alternative.
- Tabular Format: Column headers appear once, not repeated per row
- Reference Syntax: Uses
:type:idinstead of verbose JSON object nesting - No Redundant Keys: Eliminates
"nodes":,"edges":,"properties":wrappers - Whitespace Delimited: Spaces instead of
{,},:,,characters - Human Readable: LLMs can parse and understand the structure easily
JSON (596 tokens):
{
"nodes": [
{"id": 1, "type": "person", "name": "Alice", "age": 28},
{"id": 2, "type": "person", "name": "Bob", "age": 34}
],
"edges": [
{"source": 1, "target": 2, "relation": "follows", "since": 2020}
]
}ISONGraph (177 tokens):
edges.FOLLOWS
since source target
2020 :person:1 :person:2
nodes.person
id age name
1 28 Alice
2 34 Bob
Token Savings: 70.3%
This benchmark is part of the ISONGraph benchmark suite:
| Benchmark | Focus | Questions | Formats | Best Acc/1K |
|---|---|---|---|---|
| Knowledge Graph (this) | Format comparison | 100 | 10 | 53.00 |
| Data Traversal | Graph operations | 50 | 5 | 143.97 |
| Aspect | Knowledge Graph | Data Traversal |
|---|---|---|
| Purpose | Compare all graph formats | Test traversal capabilities |
| Formats | 10 (comprehensive) | 5 (core) |
| Questions | 100 | 50 |
| ISONGraph Accuracy | 90.0% | 92.0% |
| Key Insight | ISONGraph beats all competitors | ISONGraph excels at multi-hop |
MIT License - See LICENSE file for details.
Mahesh Vaikri
