Token savings by format (not by smarter prose)
Your goal: fewer tokens using better representations — same idea as your maths research:
images / tables / covers pack what matters denser than English essays.
No retrain. Prompting + external store + tool I/O format only.
1. Core law (from your research, translated to formats)
| Research finding | Format translation |
|---|---|
| Don’t recover all scores — approximate output \(A(q)\) | Don’t store full chat — store what the next step needs |
| Low \(r_\Sigma\) → few anchors cover the manifold | Few prototype lines / codes cover long history |
| \(A_0\) = winner value only (often nearly enough) | Keep one best fact per topic, not the debate |
| Hybrid: exact recent + compressed past | Last \(N\) turns exact-ish; older → dense IR |
| Content-id / fetch body on demand | Paste ids/titles, expand only when needed |
| Paid novelty (only grow on real splits) | Only add memory when state actually changed |
**English prose is the dense-model’s slow path.**
Tokenizers charge you for grammar glue (“the”, “we decided to”, “because”).
Better formats remove glue and keep anchors.
2. Efficiency ladder (worst → best for agent memory)
Rough density for the same facts (illustrative; measure with your tokenizer):
| Rank | Format | Relative tokens | When to use |
|---|---|---|---|
| 0 | Narrative chat history | 100% (baseline) | Almost never for multi-turn agents |
| 1 | Bullet English summary | ~40–60% | Human handoff only |
| 2 | Min JSON / YAML short keys | ~25–40% | APIs, tools, structured answers |
| 3 | Tables / TSV / CSV | ~15–30% | Multi-entity, tool dumps, logs |
| 4 | STATE-IR + LEGEND codes | ~10–25% | Default agent memory |
| 5 | Δ patches only | ~5–15% after turn 1 | Ongoing sessions |
| 6 | IDs + one-line titles (body external) | ~2–10% | Codebases, docs, big tool results |
| 7 | Image / screenshot / diagram (vision) | win or lose | UI, plots, layout, PDFs — not pure abstract facts |
About “images more efficient than text”
Sometimes yes, sometimes no.
| Case | Prefer image | Prefer text/IR |
|---|---|---|
| UI bug, dashboard, architecture diagram | Screenshot + 1-line ask | Describing every pixel in English |
| Chart with many points | Plot image | Listing 200 numbers as prose |
| Exact code / legal wording / IDs | — | Text/IR always (images OCR-waste + error) |
| Abstract decisions, constraints | — | STATE-IR (cheapest + checkable) |
| Photo of whiteboard | Image + extract IR | Long transcription in-prompt every turn |
Rule: image = dense spatial packet; IR = dense symbolic packet.
Your maths is about symbolic covers (anchors). Images are the multimodal cousin for spatial covers.
3. The format pack to use (drop-in)
A) Default: STATE-IR (symbolic, like \(r^*\) anchors)
# PREFIX once (prompt-cache):
IR v1 | keys: G F D O N X R Δ | codes in LEGEND | no narrative memory
LEGEND: T1=AuthService T2=StripeWebhook T3=users_table
# BODY each turn (only this + user):
G: ship billing v1
F: [T1→T2 signed, T3=postgres+tx]
D: [idempotency=key-hdr]
O: [PCI review]
N: [CHK X, CALL verify_sig, COMMIT]
X: [no_raw_pan]
R: [{id:c91,t:pci.md}]
Δ: [F+ rate=100rpm]
Why tokens drop: no essays, short keys, codes reuse long names, bodies live behind R.
B) Tool I/O: never prose dumps
Bad (token bomb):
The query returned 40 rows. The first row has id 1 and name Alice and email...
Good (table IR):
id|name|email|st
1|Alice|a@x|ok
2|Bob|b@x|fail
... max 30 rows; use SQL LIMIT
Or even denser:
rows:30 cols:id,name,st sample:[[1,Alice,ok],[2,Bob,fail]] ...
C) History: Δ not replay
After turn 1, don’t resend full STATE — send:
BASE@rev3
Δ: O-[PCI done] N:[write mig] F+[mig=up]
Same idea as edit script / path compression and your hybrid exact-recent + compressed past.
D) Retrieval: \(A_0\) style (winner only)
When RAG/tools return many chunks:
# not: paste 5 chunks
# yes:
WIN: {id:c91, claim:"PCI needs tokenization", conf:0.8}
ALT: [{id:c77, claim:"..."}] # only if conf close
One winner claim ≈ \(A_0\); extras only if competitive (paid novelty).
E) Multimodal: image when spatial
USER: [image: dashboard.png]
Q: which panel is red? answer as IR: {panel, status, fix?}
Then store the answer as IR, not the image every turn.
4. Concrete “format codec” inspired by your maths
Name: CoverFormat (user-space cousin of output-manifold covering)
| Math object | CoverFormat rule |
|---|---|
| Anchors \(r^*\) | Max K fact lines in F (e.g. K=12); merge/reencode when over |
| \(r_\Sigma\) gate | If task “repetitive / local” → aggressive codes; if “novel hard” → more exact text allowed in N only |
| \(A_0\) | One WIN per question |
| Hybrid window | Last 2 user/assistant turns raw-ish; older only IR |
| Paid novelty | Append to F/D only if new line isn’t paraphrase of existing |
| Content-id | Docs/code as R:[{id}] never full file |
Pseudo-orchestrator (weekend):
on each turn:
1. encode user msg → IR fields (or keep short raw if simple Q)
2. build prompt = PREFIX + SUMMARY_IR + last2 + user
3. model must answer in IR (or final user prose once)
4. merge Δ into SUMMARY_IR
5. if len(SUMMARY_IR) > budget: reencode (keep G,X, last D, collapse F)
6. tools must return tables ≤ M rows
5. Expected savings (honest)
| Workload | Realistic tokens_in cut vs full chat prose |
|---|---|
| Multi-turn coding agent (8+ turns) | 40–70% with IR+Δ+no file paste |
| Tool/SQL heavy | 50–80% with table caps |
| RAG with chunk paste | 30–60% with WIN/A0 extract then drop chunks |
| Pure one-shot chat | 0–20% (format tax can hurt if you over-schema) |
| Vision for UI vs describing UI | Often big win; vision for pure logic often lose |
Falsify like always: 20 tasks, kill if not ≥20–25% tokens_in down or quality drops >10%.
6. What not to do
- Invent a “magical binary language” the model doesn’t know — models already know JSON, tables, code, short labels.
- Put giant base64 images every turn (usually worse than IR).
- Compress by deleting constraints in
X(fidelity death). - Use soft prompts / finetune (out of scope).
- Assume image tokens are always cheaper (count your provider’s vision token formula).
7. One-page cheat sheet
ALWAYS
- Short-key STATE (G F D O N X)
- LEGEND for repeated names
- Tools → tables
- Docs → id + title; fetch body on demand
- History → Δ after baseline
SOMETIMES
- Screenshot for UI/layout
- Plot image for dense numeric trends
- Winner-only RAG claim (A0)
NEVER
- Full chat novel as memory
- Paste whole DB / log / repo
- Re-send unchanged LEGEND/schema every time without prompt cache
8. Link to your piles of work
| Source | Use for formats |
|---|---|
| Maths 17 / filter (low \(r_\Sigma\), hybrid, A0) | Anchors, winner-only, hybrid window |
dense_ir_primitives.md / PB12 | STATE-IR alphabet |
| Tesla codec ops | intern, patch, fetch_on_miss, gate, decay_uncited |
| Chirotope “paid novelty” | Only grow F when something splits decisions |
Bottom line:
Token savings you want = stop using text essays as the working medium.
Use tables + short-key IR + codes + deltas + ids, and images only for spatial stuff.
That is the same spirit as “approximate the output manifold, not the full transcript” — without training any weights.