cd /news/large-language-models/deterministic-serialization-for-mult… · home topics large-language-models article
[ARTICLE · art-64844] src=dev.to ↗ pub= topic=large-language-models verified=true sentiment=↑ positive

Deterministic serialization for multi-agent LLM sessions - 3.45x fewer tokens than JSON, up to 9.9x for non-English content

A developer built a serialization protocol called SCP that reduces token usage in multi-agent LLM sessions by up to 3.45x compared to JSON, and up to 9.9x for non-English content. The protocol replaces natural language or JSON messages with short positional ASCII identifiers resolved against an external dictionary, eliminating hallucination risk on decode. Benchmarks show significant savings, especially for non-English languages, though caching discounts from providers like Anthropic and OpenAI may affect real-world cost benefits.

read2 min views1 publishedJul 18, 2026

Multi-agent LLM systems -” several models exchanging messages within

one session -” pay for context, not intelligence. Every round trip in

natural language or verbose JSON burns tokens re-stating structured

context that a fixed, external schema could carry in a fraction of

the size.

I got tired of watching this happen in my own pipelines, so I built a

small serialization protocol to fix it. Sharing it here in case it's

useful to others hitting the same wall.

Move inter-agent messages from natural language / JSON to short,

positional ASCII identifiers (P1:A2:X0:V4

), resolved against an

external, versioned dictionary.json

. A deterministic Python layer

handles encode/decode -” no model involved in reconstructing meaning,

so there's no hallucination risk on the decode side.

def encode(payload: dict, schema: dict) -> str:
    parts = []
    for field_name, field_id in schema["fields"].items():
        if field_name not in payload:
            continue
        value = str(payload[field_name])
        value_id = schema["values"][field_name][value]
        parts.append(f"{field_id}{value_id}")
    return ":".join(parts)

Unknown fields or values raise an explicit error instead of guessing -”

the whole point of an external schema is that the model never has to

improvise meaning on decode.

Conceptually this is closer to Protocol Buffers than to prompt

engineering: a fixed contract, not a clever prompt.

Measured on cl100k_base

(industry-standard reference tokenizer):

Format Tokens
Natural language (RU) 49
Standard JSON 38
SCP ASCII ID-stack 11

3.45x fewer tokens than JSON. Full reproducible benchmark script

is in the repo -” run it yourself against your own tokenizer before

trusting these numbers for a cost projection.

Tokenizer vocabularies are trained predominantly on English text, so

non-Latin scripts pay a real, measurable tax. Same sentence, same

meaning, measured multiplier vs. the SCP ID-stack:

Language Multiplier vs. SCP
English 1.89x
Russian 5.11x
Arabic 5.56x
Japanese 4.22x
Hindi 9.89x

Because the ID-stack costs the same regardless of source language (9

tokens either way -” it's just ASCII after encoding), SCP's savings

scale disproportionately for non-English multi-agent deployments.

That's not a marketing angle, it's just what the tokenizer does.

cl100k_base

as a common reference point. If you're deploying against a different model family, re-run the benchmark script against that tokenizer before relying on these numbers.Anthropic and OpenAI both offer ~90% discounts on cached input tokens.

Three conditions determine whether SCP's savings actually materialize

in a caching setup:

python mvp/encoder_decoder.py encode '{"system": "Quantumoan", "version": "4", "action": "paradigm_shift", "target": "cognitive_profiles_alignment"}'

python mvp/encoder_decoder.py decode "P1:V4:A2:X0"

Repo (AGPLv3): https://github.com/andrey-architect/scp-protocol

Would genuinely like to know where this breaks -” issues and PRs welcome.

── more in #large-language-models 4 stories · sorted by recency
── more on @anthropic 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
Live at https://your-agent.zahid.host
Get free account → Pricing
from €0/mo · no card required
LIVE [news/deterministic-serial…] indexed:0 read:2min 2026-07-18 ·