Skip to content

GCF vs TOON

TOON (Token-Oriented Object Notation) is a tabular encoding format for JSON. GCF was designed to solve the same problem (LLM token efficiency) but takes it further with graph-native features, session statefulness, and delta encoding.

This page compares the two formats honestly, using TOON's own benchmark data and their own tokenizer.

Feature comparison

FeatureGCFTOON
Tabular encoding (arrays of objects)YesYes
Positional fields (no field names per row)YesYes
Pipe-separated rowsYesComma-separated
Nested object encoding## key sections + key=valueIndented key: value
Semi-uniform data (optional fields)Native (inline nested when present)Falls back to less efficient encoding
Local IDs for cross-referencingYes (@0, @1)No
Edge/relationship encodingYes (@0<@1 calls, ~4 tokens/edge)No (must repeat full identifiers, ~100 tokens/edge)
Session deduplicationYes (92.7% savings by 5th call)No
Delta encodingYes (81.2% savings on re-queries)No
Distance groupingYes (## targets, ## related)No
Graph-native (nodes + edges)Yes (graph profile)No
Generic data (any JSON)Yes (tabular profile)Yes
Streaming encodeNo (planned)Yes
Key folding (dotted paths)NoYes
LLM comprehension at 500 symbols100%100%
LLM generation (output tokens)75% fewer than JSON40% fewer than JSON
Human-readableDense, agent-optimizedYAML-like, human-friendly
Zero dependenciesYesYes
Language supportGo, TypeScript, PythonTypeScript, Go
MCP proxy (zero-code adoption)YesYes ("Tooner")

Where GCF wins

1. Token efficiency on every data shape

Tested on TOON's own benchmark with their datasets and their tokenizer (gpt-tokenizer, o200k_base):

DatasetGCFTOONWinner
Semi-uniform event logs (2000 records)107,269154,032GCF 44% smaller
E-commerce orders (500, nested items)61,59373,246GCF 19% smaller
Employee records (2000 rows, flat)49,05549,966GCF 2% smaller
Analytics time-series (365 days, flat)8,3989,127GCF 8% smaller
GitHub repos (100 rows, flat)8,5768,744GCF 2% smaller
Deeply nested config (small)698618TOON 11% smaller
Mixed-structure total170,449227,896GCF 34% smaller
Flat-only total66,02967,837GCF 3% smaller

GCF wins on 5 of 6 datasets. TOON's only advantage: deeply nested configuration (a 75-token difference on a 618-token payload).

GCF's largest advantage is on semi-uniform data (44% smaller) because TOON's tabular format requires all rows to have identical fields. When data is semi-uniform (e.g., event logs where some records have nested error objects), TOON falls back to its less efficient nested encoding for the entire array. GCF handles this natively: primitive fields encode positionally, nested fields attach inline only when present.

Reproducible: blackwell-systems/toon@gcf-comparison

2. Edge encoding (the structural advantage)

TOON has no concept of references between records. Every relationship must spell out the full identifier of both endpoints:

TOON edges (repeated identifiers):

edges[3]{source,target,type}:
  github.com/org/repo/pkg.NewServer,github.com/org/repo/pkg.AuthMiddleware,calls
  github.com/org/repo/pkg.AuthMiddleware,github.com/org/repo/pkg.ValidateToken,calls
  github.com/org/repo/pkg.ValidateToken,github.com/org/repo/internal.TokenCache,references

GCF edges (local IDs):

## edges
@0<@3 calls
@1<@0 calls
@6<@1 references

Same information. GCF: ~4 tokens per edge. TOON: ~30-100 tokens per edge depending on identifier length. This advantage grows with longer qualified names (common in Java/Go packages) and higher edge density (call graphs, dependency graphs).

This is a structural limitation of TOON. It cannot be fixed without adding a local-ID system, which would make it a different format.

3. Session deduplication (TOON can't do this)

In multi-turn LLM interactions, the same data appears across multiple tool responses. GCF tracks what's been sent and replaces known records with bare references:

Call 1: full declarations

GCF tool=context_for_task symbols=15 session=true
## targets
@0 fn pkg.AuthMiddleware 0.78 lsp_resolved
@1 fn pkg.ValidateToken 0.72 lsp_resolved
...

Call 5: 92% bare references

GCF tool=context_for_task symbols=22 session=true
## targets
@0  # previously transmitted
@1  # previously transmitted
@2  # previously transmitted
@18 fn pkg.NewEndpoint 0.88 lsp_resolved
...
CallNew recordsBare refsSavings vs JSON
1100%0%84% (base GCF)
235%65%89%
320%80%91%
58%92%92.7%

TOON retransmits every record every time. It has no session concept. By the 5th tool call in a conversation, GCF is using 92.7% fewer tokens than JSON while TOON is still at ~69%.

This isn't a feature that can be bolted on. Session dedup requires the format to support bare references (@N # previously transmitted), which requires local IDs (@N), which TOON doesn't have.

4. Delta encoding (TOON can't do this)

When the LLM re-queries and the data changed slightly, GCF sends only the diff:

GCF tool=context_for_task delta=true base_root=aaa new_root=bbb savings=81%
## removed
fn pkg.OldHandler
## added
@0 fn pkg.NewHandler 0.85 rwr
## edges_removed
pkg.Router -> pkg.OldHandler calls
## edges_added
pkg.Router -> pkg.NewHandler calls

81.2% savings on re-queries in production. TOON must retransmit the entire payload even if one record changed.

5. Distance grouping (semantic structure)

GCF encodes how far each record is from the query center:

## targets       ← direct matches (distance 0)
@0 fn pkg.Auth 0.92 lsp
## related       ← one hop away (distance 1)
@3 fn pkg.Server 0.65 lsp
## extended      ← broader context (distance 2)
@6 type pkg.Cache 0.41 structural

The LLM immediately knows what's most relevant without scanning the entire payload. TOON encodes all records in a flat list with no semantic grouping.

LLM output generation: GCF is 52% smaller

Both formats can be produced by LLMs given a short primer. Tested with the same model (Claude), same data (5 to 100 symbols), validated through real decoders:

SymbolsEdgesGCF outputTOON outputGCF vs TOON
53379 B782 B52% smaller
106643 B1,377 B53% smaller
20121,217 B2,629 B54% smaller
50252,845 B5,898 B52% smaller
100505,619 B11,650 B52% smaller

Both achieved 5/5 validity with a format example. Both achieved 3/5 without one (tied cold-start). GCF is not just cheaper to read; it's cheaper to write.

TOON's LLM integration guide positions TOON as bidirectional (LLMs read and write it). But their guide doesn't publish a generation eval. We tested both formats head-to-head, and GCF produces valid output in half the tokens.

TOON's benchmarks don't test at scale

TOON's retrieval accuracy benchmark uses datasets of 100 rows or fewer and reports a 1.4 percentage point accuracy improvement over JSON (76.4% vs 75.0%). At this scale, all formats perform similarly because JSON's structural noise hasn't yet overwhelmed the model's attention.

GCF's comprehension eval tests at 500 symbols with 200 edges. At this scale:

FormatAccuracyTokens
GCF100%11,090
TOON100%16,378
JSON66.7%53,341

JSON doesn't just use more tokens; it actively miscounts records (guessed 320 instead of 500). The difference between formats is invisible at 100 rows and undeniable at 500. TOON's benchmarks stay in the comfort zone.

Where TOON wins

TOON is 75 tokens smaller on one benchmark dataset: deeply nested configuration with single-key wrapper chains. That's an 11% advantage on a 618-token payload. TOON's key folding (data.metadata.items dotted paths) is marginally more compact for this specific shape.

This is the only dataset where TOON beats GCF. On every other data shape (flat tabular, semi-uniform, nested with arrays, graph data), GCF wins by 2% to 44%.

The bottom line

GCF does everything TOON does, plus:

  • Local IDs and edge encoding (TOON can't do this)
  • Session deduplication (TOON can't do this)
  • Delta encoding (TOON can't do this)
  • Distance grouping (TOON can't do this)

On TOON's own benchmark with their own tokenizer, GCF uses fewer tokens on 5 of 6 datasets. The one exception is a 75-token difference on a 618-token payload.

The gap widens over time. On the first tool call, GCF saves 34% vs TOON. By the fifth call in a session, GCF saves 92.7% vs JSON while TOON is stuck at 69%. No format change can close that gap without adding session state, which requires local IDs, which requires a fundamental redesign of TOON.

Try both formats in the playground with your own data.