Compile a document once with a strong model. Answer questions about it forever with a 0.6B one.
This is a working implementation of the concept introduced by Machine-Interpretable Information: Compiling Documents into Searchable and Readable Protocol States (Wang & Dou, arXiv:2609.23371): a document is compiled ahead of time into a standalone artifact that a frozen language model can read directly, so retrieval, reasoning and reconstruction all happen against one medium instead of against raw text.
It does not reimplement that paper's method. There is no state-space Writer, no learned Translator and no fixed 56-token bottleneck here. The mechanism is different on purpose, because the goal was a runnable system built on a closed frontier compiler whose internal states cannot be extracted.
What it does
A 0.6B-parameter reader (Qwen3-0.6B, frozen, no fine-tuning) is close to useless on a long legal,
clinical or financial document. On documents that do not fit its window it answers from whatever
fragment survives truncation, which for an annual report is the cover page: asked for PepsiCo's fiscal
2022 revenue it says "$224.2 billion" where the answer is $86,392 million.
Given the .mii compiled from the same document, the same frozen model answers the same held-out
questions far better, and the gain is largest exactly where the document is largest. Over the fifteen
documents that exceed its window, 291 held-out questions with identical sample sizes in every column:
| the same frozen Qwen3-0.6B reading… | accuracy |
|---|---|
| the original, truncated to fit | 48.8% |
| the original, with retrieval | 54.0% |
the compiled .mii |
65.6% |
| for reference: the frontier model reading the entire original | 84.2% |
That is not yet a frontier model reading everything. It is 78% of that accuracy from a model three orders of magnitude smaller, on documents the frontier model has to read in full every single time, and the gap has been closing with every compiler pass added: the same questions scored 57.4% before the analyst answer keys, the distractor sets and the reranker. The largest single move was financial filings, from 32.4% to 54.1%, once the compiler was made to write the analyst's verdicts down (improving or declining, which segment grew fastest, which cash-flow activity was largest, is the business cyclical) with the benchmark's own formulas.
On documents that already fit the reader's window the artifact still wins, 63.6% against 53.8% for
retrieval, and the trained-state cartridge adds a little more there (64.4%). The sharpest single
measurement remains contract clause extraction: asked about clauses the contract actually contains,
the reader scores 23% on the truncated original, 33% with retrieval, and over half on the artifact,
while staying level on the questions whose right answer is "this contract does not address that".
Full numbers in RESULTS.md.
Two things are true at once, and both matter:
- The competence really does travel in the data. The reader is unchanged, has no fine-tuning, and sees about 6k tokens per question. Everything it gets right about a 264k-token filing, it gets right because a stronger model already did that thinking and wrote it down.
- Parity is not reached. Error attribution on the clinical set puts the artifact's content at about 93% sufficient, with the loss concentrated in the reader's ability to select among plausible candidates. Closing that gap is a consumer-side problem — a slightly larger reader, or the learned translator the original paper uses — not a compiler-side one.
Compile cost is paid once per document; every later question is cheap. That is the amortisation, and
scripts/economics.py measures where it pays.
What "compiling a document into a data format" means
Cache-to-Cache, MII and Cartridges reject the same assumption: that a document has to enter a model as tokens every time it is used. Tokens are a model's input format; its working format is activations, the KV state that attention reads, and reading is the expensive conversion from one to the other that every reader repeats from scratch. All three papers move the document into the working format ahead of time and save that as a file. Cache-to-Cache does it between two models with a learned projector. MII does it once into a canonical state that a translator maps into any reader. Cartridges does the sharpest version: it trains a small KV cache for a corpus so that, with it prepended, the model behaves as if the whole corpus were in context.
So the file is not a description of the document that a model then has to understand. The file is the understanding, already in the reader's own geometry, produced by computation or optimisation rather than by re-reading. Text must be comprehended before it can be used, and a 0.6B model's comprehension is the bottleneck this project measured: the answer sits in front of it 93% of the time and it still mis-selects a quarter of the time. State does not need to be comprehended. It is attended to.
This artifact therefore has two halves, and they play different roles:
- Compiled text (briefing, facts, pre-resolved answers, distractor sets). The compiler is a closed frontier model, so its cognition can only leave it as text. This half is the material. It is also, not by accident, exactly the self-study corpus Cartridges synthesises, except written by a far stronger model.
- A trained KV cartridge (
kv.<reader>.trained). The reader's own state for the document, initialised from a forward pass over the briefing and then optimised, with the reader frozen, until the reader reproduces the compiler's answers and facts from state alone. The compiler's cognition, which left it as text, ends up in the reader's activation space by gradient descent. At query time the reader loads the state and answers by attention. Nothing is retrieved and nothing is chosen among.
The plain KV section (one forward pass, no training) is the degenerate case of the same thing, and is what the runtime falls back to for a reader that has no trained cartridge in the file.
What is inside a .mii
MII\x02 | u32 header_len | JSON header | sections…
The first two rows are the record; every row after them is an explicit layer written out of it so that any reader, including one that cannot take the projection, can still answer.
| section | encoding | what it carries |
|---|---|---|
mii |
bf16 | the record proper: the Writer's compiled state, 64 vectors per 10k tokens of the original at the default ratio. Continuous, so it can be backpropagated; reconstructive, so Writer* with the model as key returns the original text |
mii.proj.<reader> |
bf16 | the projection of that state into a downstream model's space: the few dozen tokens the reader actually consumes |
briefing |
utf8 | 900–2000 words of compiled global understanding: actors, crux, outcome, structure, ambiguities |
rules |
utf8 | reading rules for this document: units, fiscal year end, name normalisations, known traps |
cells |
jsonl | atomic, self-contained facts. No pronouns, absolute dates, every number with unit and period |
resolutions |
jsonl | pre-computed cognition: anticipated questions with the answer, the reasoning chain and the arithmetic already done |
entities |
jsonl | canonical names, aliases as they appear in the text, roles |
timeline |
jsonl | dated events in order, each linked to supporting cells |
glossary |
jsonl | defined terms and abbreviations |
conflicts |
jsonl | contradictions in the source, each with the resolution an expert would adopt |
index.dense |
float16 | bge-m3 embeddings over every retrieval key, for O(1) routing |
negatives |
jsonl | examinable facts with their plausible false variants, so the reader can tell a near-miss from the truth |
kv.<reader> |
safetensors | the reader's KV state for the fixed prefix from one forward pass, so the briefing costs no prefill |
kv.<reader>.trained |
safetensors | the same state after training on the compiled material: the reader's understanding of the document, as state |
Two properties matter more than the list:
Everything is written for a weak reader. One idea per statement, never a pronoun, never "the company"
or "last year". A 0.6B model fails on "it rose 12% that year" and succeeds on
"Acme Corp revenue grew 12.4% from FY2017 ($29,140 million) to FY2018 ($32,765 million)".
Absence is recorded as knowledge. A reader that sees a fraction of a contract cannot prove a clause is missing. So the compiler walks the standard review checklist and writes the misses down explicitly: "This agreement contains no source-code-escrow provision." Without this, "not specified" is unanswerable.
How compilation works
Four passes, all checkpointed to disk so a failed or interrupted compile resumes for free.
- Cells — the document is chunked and each chunk becomes atomic normalised facts with location anchors. Parallel.
- Synthesis — one call reads all cells and writes the briefing, reading rules, entity registry, timeline, glossary, resolved contradictions, and a question space: the 15–40 topics a demanding examiner would probe.
- Resolutions — the question space is worked through in parallel calls that share one large cached prefix (briefing + every cell). Each resolution carries the question, paraphrase variants for retrieval, the short answer, the full answer with the reasoning chain, the supporting cell ids and a confidence.
- Adversarial coverage — the compiler then plays examiner, invents hard questions a benchmark author would ask, and fills whatever the previous pass missed.
- Analyst checklist (
E) — the compiler writes the domain's canonical answer key with the verdict first: is the margin improving, which segment grew fastest, which cash-flow activity was largest, is the business cyclical, what does each standard clause say or is it absent, what is not part of the current regimen. Standard formulas are fixed in the prompt so the arithmetic matches what examiners use. - Negative space (
F) — for the most examinable facts the compiler writes the true statement and the near-miss falsehoods an examiner would use as distractors. A reader that only ever saw true statements cannot tell "2-vessel" from "3-vessel"; one that has seen both labelled can. - Cartridge training — with the reader frozen, its KV state for the document is trained on all of the above until it reproduces them from state. This is the step that moves the compiler's cognition from text into the reader.
Compile time is unbounded by design; runtime is not.
How the runtime works
Answering is deliberately mechanical, because a 0.6B model asked to think will fail.
- KV prefix. The briefing and rules are already the reader's KV state inside the file. It is loaded, not prefilled.
- Routing. The question, and for multiple choice each option, are fused over the dense and lexical indexes by reciprocal rank. Resolutions and cells are ranked in separate pools so that the numerous resolution keys cannot crowd out the cells.
- Answer first, match second. The reader answers the question in its own words from the routed evidence, and the option is then chosen by matching that answer against the candidates with the embedder. This is the single largest contributor, because a small model reasons far better than it selects: on "which of these is not in the regimen" it wrote "the regimen contains no vincristine" and then answered "E" until this step existed.
- Per-option verification. Each candidate also gets its own retrieved evidence and one yes/no
question, contributing
log P(yes) − log P(no), alongside how well the artifact supports the claim at all and the candidate's likelihood under the shared context. - Negation inversion. For "which of these is NOT true", the negation is stripped from the question and the least supported candidate wins, while the reader's own answer keeps its sign because it already answered the question as asked. Compiled absence knowledge pays off here.
- Combination options. "B and C" or "all of the above" cannot be checked against a document, so they are scored as functions of the options they refer to.
- Explanation. Only then does the model generate prose, conditioned on the winning option and its evidence.
The reader never picks a letter by reasoning, which removes the failure mode where it reasons correctly and then answers "E". All baselines go through the identical scoring path, so the comparison measures the artifact rather than the harness.
Several further mechanisms were built, measured and then switched off because they cost accuracy rather
than adding it: PMI-normalising the yes/no judgement against the reader's no-evidence prior, a novelty
penalty for candidates whose rare tokens appear nowhere in the artifact, clause-wise retrieval for
compound candidates, and a pairwise runoff between the top two. Each is still in the code behind its
own flag, and runtime.env records what was chosen and what it scored.
Layout
mii/format.py the .mii container (read, write, inspect)
mii/common.py prompt fragments shared by reader and baselines
mii/compiler/prompts.py compiler prompts and per-domain question spaces
mii/compiler/compile.py the four-pass orchestrator, checkpointed
mii/compiler/compiler_cli.py stateless wrapper around the compiler model
mii/runtime/router.py the searchable geometry
mii/runtime/reader.py the 0.6B consumer, verification scoring, and the raw/RAG baselines
mii/runtime/linker.py adds the dense index and the reader KV state
mii/runtime/server.py runtime HTTP API (port 6006)
mii/eval/ dataset loaders and objective scorers
web/ the demo front end
scripts/ compile, link, evaluate, tune, summarise
Running it
Compile a document and link it for a reader:
python scripts/export_questions.py lh --dataset longhealth
python scripts/compile_queue.py health --docs lh:patient_01 --workers 4
python -m mii.runtime.linker data/mii/lh__patient_01.mii
python -m mii.format data/mii/lh__patient_01.mii # inspect
Serve the demo (GPU box, port 6006):
python -m mii.runtime.server
Evaluate the reader against the baselines and the frontier:
python scripts/run_reader_eval.py lh --compiled-only --conditions mii raw rag # on the GPU box
python scripts/run_frontier_eval.py lh --model <compiler-model> --compiled-only # where the compiler runs
python scripts/validate_preds.py # before believing anything
python scripts/summarize.py --judge --compiled-only # writes RESULTS.md
python scripts/run_ablations.sh # where the competence comes from
python scripts/economics.py # does the amortisation pay
python scripts/portability.py lh --models <reader-a> <reader-b> # same artifacts, different readers
Run scripts/validate_preds.py before reading any number. It catches duplicate questions, error
rows, incomplete coverage and, most importantly, answers produced under more than one runtime
configuration inside the same condition. Each of those happened at least once while this was being
built, and each would have quietly moved a headline number.
What was compiled
| domain | documents | source tokens | cells | pre-resolved answers | compile cost |
|---|---|---|---|---|---|
| financial filings | 7 | 819,277 | 6,376 | 3,846 | $105 |
| clinical records | 9 | 97,377 | 1,143 | 3,659 | $72 |
| commercial contracts | 6 | 386,715 | 3,651 | 3,301 | $77 |
| novels | 3 | 230,199 | 1,706 | 1,414 | $41 |
| total | 25 | 1,533,568 | 12,876 | 12,220 | $295 |
Fifteen of the twenty-five documents are longer than the reader's 32,768-token window, up to PepsiCo's 264,457-token annual report, which is eight times that window and compiles into 1,951 cells and 673 pre-resolved answers, 136 of them arithmetic worked across three fiscal years.
The artifacts are typically about twice the size of their source in tokens. Compression was never the point: a 62k-token contract becomes roughly 2k of briefing, 46k of normalised facts and 67k of pre-resolved answers, and a single query reads about 6k of it.
Collections: a record longer than any context window
A document that no model can hold is compiled the same way as one that fits, because no pass ever
holds more than a 9k-token chunk, and the two stages that see "everything" (synthesis, resolution)
see compiled text, not the source. For a record made of many documents, mii/compiler/collection.py
adds one tier on top:
- each part is compiled by the ordinary pipeline, in parallel, checkpointed;
- one synthesis call reads every part's briefing, reading rules, timeline, conflicts and chunk summaries and writes the collection-level cognition: the arc across the parts, cross-part reading rules ("the first year X appears is settled by checking every part in order"), a cross-part timeline, the evolutions of recurring topics (per-part statement, turning point, what an analyst concludes), and a cross-part question space;
- the cross-part questions are resolved with the collection briefing and every part briefing as the cached prefix, plus cells and part resolutions retrieved per topic from every part by BM25 with a per-part quota, so "how did the wording change between FY2017 and FY2019" is worked out by the strong model and written down with evidence ids from both parts;
- everything is merged into one
.miiwith part-namespaced ids. The runtime is unchanged.
The first such record is The Boeing Company's fourteen consecutive Form 10-K filings, FY2012 to
FY2025, straight from EDGAR (scripts/edgar_text.py), 1,189,076 source tokens:
| parts | 14 filings, 76k to 100k tokens each |
| cells | 11,135 |
| resolutions | 10,311, of which 1,031 cross-year |
| evolutions | 28 (the 737 MAX, the 787, KC-46A losses, equity turning negative, the auditor's critical audit matters, ...) |
| compile | $469 for the parts (the compiler, with the analyst and negative-space extension), $27 for the collection stage (the frontier model), 110 minutes for the collection stage on top of about 35 minutes per part with three parts in flight |
What the cross-year tier produces is the kind of answer that keyword search cannot find and that no single prompt can hold: the three separate 737 MAX cost buckets of FY2019 and how each one hits revenue, inventory or expense in the following two years; that FY2018 never mentions the accidents; that no filing in the fourteen expresses going-concern doubt, with the two years that instead assert funding is probable; which chief executive was in office for each crisis. Every such row cites cells in the parts it drew on.
Benchmarks
Held-out questions that the compiler never saw, across four document families.
| family | source | documents | question form | what it tests |
|---|---|---|---|---|
| healthcare | LongHealth | patient records | 5-way multiple choice | adversarial clinical detail, current versus past treatment |
| legal | CUAD | commercial contracts | clause extraction, half the clauses absent | clause content and correctly reporting absence |
| finance | FinanceBench | 10-K and 10-Q filings | free-form numeric | figures and multi-step arithmetic across statements |
| narrative | InfiniteBench En.MC | novels | 4-way multiple choice | plot, character and event tracking far beyond the window |
InfiniteBench renames the characters and places of public-domain novels so
that a model cannot answer from memory of the original. The compiler recognised one book as a renamed
classic and said so in the briefing, which means a frontier model reading the original text may be
drawing partly on memory of the source novel. The compiled artifact is built only from the renamed text
in front of it, so the .mii column does not have that advantage.
Conditions:
raw— the 0.6B reader, original document truncated head+tail to its windowrag— the 0.6B reader,bge-m3+ BM25 over 700-token chunks of the original, 6k budgetmii— the 0.6B reader, compiled artifactopus_full— a frontier model reading the entire original document
The 4-bit reader
The same CUAD run with the reader's weights replaced by a community AWQ 4-bit checkpoint of Qwen3-0.6B
(Orion-zhen/Qwen3-0.6B-AWQ, group size 128, dequantised to the exact weights the W4A16 kernel multiplies
with, so the number is what AWQ serving produces): 82.9% on the 246 contract questions, against 82.9%
for the served bf16 reader with the fused state and 81.3% for bf16 with the plain state under the same
settings. The quantised model is measurably weaker on its own (perplexity 7.87 to 9.11 on contract text,
next-token agreement with bf16 0.82), and the record absorbs that: every one of the 246 questions was
answered by recognition from the compiled rows, so the reader's job is to pick and verify, not to compose.
Scripts: scripts/awq_dequant.py, condition mii_awq.
How answers are scored, and one way it went wrong
Multiple choice is scored by the chosen letter, which the runtime produces directly, so nothing is parsed out of prose. Free-form answers are graded by a frontier judge on substance, with the gold answer and, for filings, the benchmark's own justification in front of it.
Clause extraction started out scored by token overlap with the gold contract span, which looked
objective and was quietly unfair. The compiler normalises everything it writes, so the artifact
answers Dated 05/05/98 with "the agreement was signed on 5 May 1998" — substantively exact, zero
token overlap, marked wrong. The baselines, which copy fragments out of the raw text, matched spans
more often while understanding less. Clause extraction is now judged on substance like the other
free-form sets, and the overlap scorer remains in mii/eval/score.py only as a fallback.
The same set exposed a degenerate strategy worth reporting rather than hiding. Half of the CUAD questions ask about clauses the contract does not contain. A reader that answers "not specified" to everything scores well on that half and near zero on the other, which is roughly what the truncated and retrieval baselines do: on absent clauses they reach 77% and 92%, on present clauses 11% and 4%. Accuracy on such a set has to be read as a pair of numbers, not one.
RESULTS.md carries the current numbers, regenerated by scripts/summarize.py; the demo's Benchmark tab reads the same data.
Relationship to other work
- Machine-Interpretable Information — Yifan Wang and Dejing Dou, arXiv:2609.23371. The concept implemented here: a compiled, searchable, readable document state as an agent-to-agent protocol, written once and read by many. This project keeps the concept and replaces the learned Writer and Translator with compiled text plus a per-reader KV state, because its compiler is a closed model.
- Cache-to-Cache — Yu Wang et al., arXiv:2510.03215 (
thu-nics/C2C). Direct KV-space communication between models through a learned projector. The intelligence here crosses from compiler to reader through compiled text instead, since a closed compiler's states cannot be read out; a learned projector from a strong open model's cache into the reader's is the natural next stage. - Cartridges — Eyuboglu et al., arXiv:2506.06266. A KV cache for a corpus trained by self-study so the model behaves as if the corpus were in context. The trained-state section of the artifact is this idea with the self-study material replaced by the compiler's pre-resolved answers, facts and distractor sets, and with the same objective they use: context distillation, not memorisation.
- Mostik AI — a hidden-state bridge between models, the same move from token exchange to state exchange taken between agents rather than between a document and a reader.
- Gist tokens, ICAE, AutoCompressor, xRAG — learned compression into model-private activations. The artifact here is inspectable and portable across readers instead.
Does the amortisation actually pay?
scripts/economics.py computes this from logged token usage rather than from argument. Compiling a
document here costs $13–28 including the analyst and distractor passes, and takes twenty to forty minutes. Asking a frontier model the same question
against the full original costs $0.05–0.91 per question depending on document length and on whether its
prompt cache is warm.
| family | docs | avg source tokens | compile $/doc | frontier $/question | questions before compiling is cheaper |
|---|---|---|---|---|---|
| commercial contracts | 6 | 64,452 | 23.81 | 0.10 cached / 0.54 cold | 236 / 44 |
| financial filings | 7 | 117,039 | 27.53 | 0.40 / 1.01 | 69 / 27 |
| novels | 3 | 76,733 | 13.53 | 0.67 / 0.58 | 20 / 23 |
| clinical records | 9 | 10,819 | 13.31 | 0.05 / 0.11 | 245 / 119 |
The per-document cost roughly doubled when the analyst and negative-space passes were added, and those passes are what moved the accuracy, so this is the real trade: more compile spend, more of the compiler's cognition in the file, cheaper every question after.
So this pays off for a document that will be asked about tens of times, which is the normal case for a contract under review, a filing read by a whole desk, or a patient record consulted across a course of care. It does not pay off for a document you will ask three questions about. Compilation here is also not cost-optimised: every pass uses the frontier model, where the extraction pass would likely survive a much cheaper one.
The reader-side cost is the part that collapses. Answering from the artifact runs a 0.6B model over about 6.5k tokens, most of which arrives as a precomputed KV state, on hardware that costs a few cents an hour.
Compiling the strong model's cognition into the file: cache-to-cache
The trained cartridge below turned out to be the wrong lever, and it is worth saying why. It optimises the small reader's own KV state from text, so the intelligence still enters through text and the small model's comprehension stays the bottleneck. The requirement is the opposite direction: the strong model's understanding, compiled into the data, in a form the small model consumes directly.
That is Cache-to-Cache. A strong open model (the sharer, Qwen2.5-7B-Instruct, which shares the
reader's tokenizer so its cache aligns position for position) encodes the artifact's prefix; its KV
cache is its cognition over that text. A per-layer gated projector, trained once across all
documents with both models frozen, fuses the sharer's cache into the reader's own, with the frontier
compiler's resolutions as the training signal. The fused prefix is written into the artifact as
kv.<reader>.c2c, and the reader loads it exactly as it loads its plain prefix.
What goes beyond C2C is what the sharer encodes: not the raw document but the frontier compiler's
compiled text. So the file carries the frontier's cognition as text, and a strong model's
understanding of that cognition as state, and the reader gets both. scripts/c2c.py share|train|fuse
runs the pipeline; the runtime reads the fused prefix with MII_C2C=1.
Four passes were run, all judged by the frontier model on the 475 held-out questions; the reader, routing and reranker are identical in every column and only the stored prefix changes.
| reader prefix | contracts | finance | novels | health | within window | beyond window |
|---|---|---|---|---|---|---|
| the reader's own KV over the briefing | 67.1 | 54.1 | 75.0 | 63.3 | 63.6 | 65.6 |
| c2c v1: gates nearly closed (0.05, an init artefact) | 67.1 | 48.6 | 66.7 | 66.1 | 65.8 | 64.9 |
| c2c v2: gates open (0.28), batch 2, 7,500 steps | 66.7 | 59.5 | 66.7 | 67.8 | 67.9 | 65.6 |
| c2c v3: 6k-token digest of resolutions in the prefix, sharer over it | 65.9 | 21.6 | 66.7 | 67.2 | 65.8 | 61.2 |
| c2c v4: same digest, analyst-checklist rows first | 68.3 | 24.3 | 66.7 | 67.2 | 65.8 | 63.6 |
Two things were learned. Opening the gates is what makes the transfer work: the projector settles at a mean gate of 0.28, so roughly a quarter of every fused key and value comes from the sharer, and that is what lifts finance by five points and health by four and a half. Making the prefix longer does not: putting 6k tokens of the compiler's own resolutions into the stored state helps contract clause extraction a little (present-clause accuracy 53.6 to 56.0) but wrecks free-form finance, because the 0.6B reader starts pulling half-remembered digest lines into its answers. The served configuration is v2, with the briefing-only prefix.
The novel column moves on one question of twelve and should be read as level. mii_dig in
RESULTS.md is the digest prefix without fusion (54.1 on finance, 61.7 on health): the losses in
v3 and v4 come from fusing over a long prefix, not from the digest text itself.
Answering by recognition
The compiled rows were right and the reader's paraphrase of them was wrong: on the Boeing record the
router put the exact cross-year comparison first and the 0.6B generated a "$1,000 million" charge that
the row explicitly says never existed. The fix follows the thesis to its end. For a free-form question
the reader now returns the top cross-encoder-ranked compiled resolution verbatim, with its evidence
ids, and generates only when nothing was routed. The gate was calibrated on 283 judged finance and
contract questions (results/recog_scan.jsonl): the reader's own yes/no verdict on a candidate only
hurt as a tie-breaker, and any threshold on the reranker score lost accuracy, so the policy is simply
"answer with the best compiled row". MII_RECOG=1; the demo runs it.
| free-form set | generation (c2c v2) | top row | top 2 rows | top 3 rows within 5.0 (served) | the frontier model, full document |
|---|---|---|---|---|---|
| contracts, 246 q | 66.7 | 78.9 | 80.5 | 82.5 | 82.1 |
| contracts, clause present (125) | 48.8 | 74.4 | 79.2 | 83.2 | 77.6 |
| contracts, clause absent (121) | 85.1 | 83.5 | 81.8 | 81.8 | 86.8 |
| finance, 37 q | 59.5 | 75.7 | 91.9 | 91.9 | 94.6 |
| free parity set, 420 q (see below) | 63.8 | 74.0 | 81.9 | (the frontier model's own answers are the gold) |
On the contracts the served reader now matches the frontier reading the full original (82.5 against 82.1), and on clauses that are present it is ahead (83.2 against 77.6). Joining the top rows is what closed it: many questions ask two or three things, and the compiler wrote them as separate rows. The multiple-choice sets are unchanged (they never generated). Per-question latency falls to about a second because nothing is generated, and the answer is traceable by construction: it is a row of the file.
What the reader is, and the chat that shows it
In the served system the 0.6B reader routes a free question into the file, verifies, recognises the
compiled row that answers it, and composes from evidence only when nothing compiled fits. The substance
of every answer is the compiler's thinking, stored in the file; that is what cognition amortisation
means, and the demo says so on every answer instead of hiding it. The chat (web/index.html) shows,
per answer: the text; a derivation chain whose steps point at numbered sources; each source as the
original passage with its location and an open-in-original view at exact character offsets
(mii/runtime/grounding.py, with chunk offsets from results/chunk_spans.json); an attribution line
(which model thought, at which compile pass; which model located it; which stored state it ran on);
and, when the routing score is weak, the reader's own synthesis next to the closest compiled row, so a
question outside the compiled space is never passed off as answered. A state switch runs the same
question on the plain prefix and on the fused cache-to-cache state side by side.
KV-Lingo: distilling the sharer's predictions into the fused state
Apple's KV-Lingo (Castin et al., arXiv:2609.32610) learns per-layer linear translators from one
model's KV cache into another's by distillation: the target's predictions from the translated cache are
matched to its predictions from a native cache. The projector here has the same shape (per-layer maps
over the sharer's keys and values into the reader's), and the fifth pass adds the KV-Lingo signal on
top of the compiler's gold answers: scripts/c2c.py teach runs the sharer over every training example
with its own native cache and stores its top-32 next-token distribution per answer token;
scripts/c2c.py train --teacher adds a top-k KL term so that the reader, with the fused cache, predicts
what the sharer predicts. The two tokenizers agree on every answer token (the reader's empty think
block is dropped from the sharer's turn), so the distributions align position by position. Result: the KL to the
sharer falls from 0.62 to 0.51 during training, so the reader does move toward the sharer's
distribution, but judged accuracy is level with the plain-CE projector within noise (health 66.1 vs
67.8, contracts 77.2 vs 78.9, finance 78.4 vs 75.7, all under recognition). Matching the 7B's next-token
distribution over the compiled text is not the same as inheriting its selection among answers; the
served state stays v2.
The criterion: any free question, reader on the artifact equals the frontier on the original
The benchmarks above test questions their authors wrote. The project is held to a stricter test:
for any question a user types, the 0.6B reading the .mii must give the answer the frontier gives
reading the original. scripts/free_questions.py makes that measurable. the frontier model is shown each original
and writes 15 fresh questions per document in the mix a demanding professional would ask (lookup,
multi-hop, calculation, negation, comparison, chronology), answers each from the original, and quotes
its evidence; 420 questions over 26 records (the Boeing decade is asked through three of its years),
$69. The reader's answer from the artifact is judged against the frontier model's. scripts/parity_attribution.py
then charges every miss to the stage that lost it: coverage (no compiled row anywhere states the
answer), routing (a correct row exists but was not the one answered with) or reader.
First measurement, served configuration (recognition, fused state):
| parity with the frontier model | coverage misses | routing misses | reader misses | |
|---|---|---|---|---|
| all 420 | 63.8% | 15.7% | 6.0% | 14.5% |
| lookup (117) | 70.1% | 8 | 10 | 17 |
| multi-hop (98) | 48.0% | 23 | 9 | 19 |
| calculation (67) | 59.7% | 19 | 2 | 6 |
| negation (57) | 93.0% | 1 | 0 | 3 |
| comparison (41) | 61.0% | 6 | 2 | 8 |
| chronology (40) | 52.5% | 9 | 2 | 8 |
RAG over the raw text with the same reader: 19.3%. The misses are concentrated where the compiler never wrote the specific combination down (multi-hop and calculation in finance and legal) and where the reader picked a related but incomplete row over the complete one. Each has a lever:
- Coverage: pass G, the examiner.
extend.py --passes Ghas the compiler write three rounds of fifty multi-hop, calculation, chronology, comparison and counterfactual resolutions per document, in the phrasing a user would type; about 155 rows and $4 to $8 per document, 2,405 rows across the fourteen Boeing years. With those rows patched into the artifacts (scripts/export_patch.py,scripts/apply_patch.py) and the served three-row recognition, parity on the first free set rises to 84.3%: coverage misses fall from 13.3% to 7.1%, routing 4.8%, reader 3.8%. Lookup 91.5%, negation 94.7%, comparison 87.8%, chronology 85.0%, multi-hop 74.5%, calculation 74.6%.
Because the join setting was chosen on this set and the examiner pass was aimed at its failure kinds, a second set of 420 questions was written by a different model (the frontier model) with a new seed after every change, and is evaluated once with the configuration frozen. On that set, 80.5% of the 420 unseen questions get the frontier model-level answers from the 0.6B reading the artifact (RAG over the raw text with the same reader: 13.8%). By kind: negation 87.0, calculation 82.5, lookup 81.3, multi-hop 78.8, comparison 76.1, chronology 70.0; by domain: legal 83.3, narrative 82.2, healthcare 80.7, finance 78.0. Misses: coverage 8.1%, routing 6.7%, reader 4.8%. This is the number to quote for unseen questions; the 84.3% above is the development set. - Selection: joined rows. Many free questions ask for two or three facts at once, and the compiler wrote them as separate rows. Returning the top rows together, when their routing scores are close, is the largest single lever found:
| recognition returns | parity with the frontier model |
|---|---|
| the top row only | 63.8% |
| top 2 rows within 1.5 | 74.0% |
| top 2 rows within 3.0 | 77.1% |
| top 3 rows within 3.0 | 81.2% |
| top 3 rows within 5.0 | 81.9% |
Letting the reader compose with Qwen3's thinking mode on weak matches instead did nothing (62.6%).
A gate that joins only on compound questions and never with absence rows was tried and lost on every
set (78.8% free, 77.2% contracts), so the served join is unconditional: top three rows within 5.0
of the first. On the benchmark sets that same setting gives contracts 82.5% and finance 91.9%.
- The file learns from use. When a question's routing score is weak and the relay is up, the
server sends the routed compiled material (about six thousand tokens of cells and resolutions, never
the original) to the compiler, which writes one resolution in the reader's register; the answer is
returned with its evidence, labelled as compiled on demand, and the row is stored
(results/learned/<doc>.jsonl) and keyed on its intent and variants, so the 0.6B answers that
question and its paraphrases by recognition from then on (recall at cosine 0.80; a paraphrase of the
first learned question matched at 0.86). First ask $0.06 to $0.3 and 15 to 20 seconds; every later
ask about a second and a fraction of a cent. The parity numbers above are measured with learning off.
Cross-record questions: aggregation over per-document records
A record is compiled per document; corpus-level questions ("which of these contracts contain X",
"how many records mention Y") are answered by recognising the question in every record and aggregating
the per-record answers mechanically (/api/ask_corpus), about 100 ms per record and no frontier
model. Measured on CUAD, where every contract carries a gold label for each of 41 clause categories:
for each category, the set of contracts predicted to contain it against the gold set.
| method | exact sets (of 41) | micro precision | micro recall | F1 |
|---|---|---|---|---|
| 0.6B on records, aggregated | 12 | 73.5 | 80.0 | 76.6 |
| frontier model reading every full original | 12 | 80.5 | 72.8 | 76.5 |
| 0.6B + RAG over the raw text | 2 | 59.8 | 58.4 | 59.1 |
Multiple choice: where the gap is, measured
On LongHealth (5-way multiple choice) the served reader scores 65.6 to 67.8 against 92.8 for the
frontier model on the full record and 91.1 for the frontier model with the retrieval harness.
Answer-first matching (recognise the answer, then match it to the options; MII_MC_RECOG) did not
help (65.6, and lower at higher match weights). The decisive run gives the compiler the record's
routed compiled material only, never the original, and lets it pick the option (MII_MC_LEARN_URL,
relay /resolve_mc): 90.0%, 178 calls, $14.29, so the compiled material carries what the question
needs and the gap is the 0.6B's own selection. Triggering that only when the reader's option margin is
thin fired on 8 of 180 questions (68.3%): the margin is not a usable uncertainty signal. In product
mode a multiple-choice question is therefore resolved from the record on first ask ($0.08, about ten
seconds) and recognised afterwards.
The blind acceptance test
scripts/blind_questions.py and scripts/blind_eval.py run the test a sceptical buyer asked for: a
fresh document compiled through the client flow (a 37k-token hosting agreement), 30 questions written
from the original by a model that never sees the record (20 facts, 5 calculations, 5 traps the document
does not answer), scored so that a fact counts only when a cited passage lands on the examiner's
evidence and a single invented answer to a trap fails the run. In product mode (on-demand resolution
on; compound questions resolved once from the record's material and kept):
| set (writer) | facts correct and cited | calculations | traps refused / invented | median |
|---|---|---|---|---|
| 1 (tier-B frontier model) | 19 / 21 (90.5%) | 5 / 5 | 5 / 5, none invented | 2.7 s |
| 2 (tier-A frontier model) | 19 / 20 (95.0%) | 5 / 5 | 5 / 5, none invented | 1.7 s |
Before the compound-question fixes the same sets scored 81% and 100% on facts with all traps refused; with the record alone and no on-demand resolution, 81% with one trap answered from related rows, which is the behaviour the on-demand path exists to remove.
When one page changes: incremental update
scripts/incremental.py brings a record up to date without recompiling it. The text is diffed at the
paragraph level; the old cells that came from a changed paragraph are found by overlap and retired;
only the changed paragraphs (with one neighbour each side) are re-read; only the rows that cited a
retired cell are re-resolved against the updated cells, with the cached prefix; the briefing is kept.
Measured on a client record (14k tokens): a one-paragraph amendment touched 2 cells and 25 of 676
rows; the update took 6 calls, $4.00 and 6.8 minutes against 18 calls, $16.33 and 60 minutes for the
original compile. Two coarser schemes were tried first and rejected by their own numbers: invalidating
by chunk re-resolved 415 rows, and re-reading the whole chunk re-phrased the cells so that text
matching retired 31 of 52.
Compile your own document (client flow)
The chat has a "Compile your own document" panel. A one-use compilation key (scripts/make_keys.py on
the box) is spent when the compile starts. The upload (PDF, HTML or text) goes from the GPU box to the
relay on the compiler machine, which parses it, runs scripts/compile_one.py (cells, synthesis,
resolutions, coverage; then analyst, negative-space and examiner extensions in parallel) and exposes
stage progress. As soon as the base compile is done the box fetches the artifact, links it (index and
reader state), and opens it in the chat; the extensions continue and the record is re-linked when they
finish. Two client tests: a 14k-token software hosting agreement (26 minutes to askable, $16, 629
resolutions) and, with the extensions parallelised, a 19.5k-token co-branding agreement (24 minutes
to askable, 31 to fully deepened, 203 analyst and examiner rows plus 126 negative-space facts added
in the last 7 minutes). The first question asked of each at the askable point was answered correctly
with grounded citations: one resolved on demand from the artifact, one recognised from a compiled row
("contains NO termination for convenience clause; termination only by 30-day non-renewal notice under
11.1 or uncured material breach under 11.2"). Client-facing responses and the page never name the compiler model.
Trained state (Cartridges): what it does and does not do at this reader size
Two objectives were tried for the cartridge, on the same 180 clinical questions.
| reader state prepended | routing | accuracy |
|---|---|---|
| plain KV of the briefing (one forward pass) | yes | 60.0% |
| plain KV, with the cross-encoder reranker | yes | 61.7% |
| cartridge trained by memorisation (cross-entropy on the answers, 1000 steps) | yes | 55.0%* |
| cartridge trained by memorisation | none | 55.0%* |
| cartridge trained by context distillation (800 steps) | yes | 63.3% |
| cartridge trained by context distillation | none | 40.0% |
| distilled cartridge retrained on the extended artifact, with routing and the reranker | yes | 64.4% |
| plain KV on the extended artifact, with routing and the reranker | yes | 63.3% |
* single record, 20 questions; the others are all nine records.
The memorisation run is the instructive failure. It drove the training loss to 0.27, the state reproduced the compiler's answers nearly verbatim, and then it overrode whatever was placed in context: cartridge plus routing collapsed to exactly cartridge alone. That is why Cartridges trains by distillation rather than by memorisation, and switching to it (the student with the cartridge matches a teacher that has the evidence in context, half the batches also give the student context so it never learns to ignore it, and an L2 pull holds the state near its initialisation) turns the same mechanism into a gain. State alone is not enough for a 0.6B reader, and the trained state is best understood as a complement to routing rather than a replacement for it. The mechanism is the right one; the reader is the constraint.
Is it a protocol or just tuned to one reader?
The text sections are model-agnostic; only the KV section belongs to one reader and its exact prefix, and a reader that finds no section of its own simply prefills. Running the same 180 clinical questions against the same artifacts with two different readers:
| reader | family | parameters | accuracy on the same artifacts |
|---|---|---|---|
| Qwen3-0.6B — the reader the KV sections were built for | Qwen 3 | 0.60B | 60.0% |
| Qwen2.5-0.5B-Instruct — no KV section of its own | Qwen 2.5 | 0.49B | 53.3% |
| SmolLM2-360M-Instruct — different family, no KV section of its own | SmolLM 2 | 0.36B | 47.8% |
Accuracy tracks reader size, as it should, and every reader stays well clear of what the largest of them manages on the raw records (52.8%). Two of the three are from different model families than the one the KV sections were built for, get no KV section of their own, and prefill the briefing themselves. The competence is in the file rather than in one model's weights, which is what makes this a protocol rather than a tuning trick.
Design facts and the next levers
- The compiler anticipates a question space; questions outside it fall back to cell retrieval over normalised text. The coverage and negative-space passes widen the space; the collection stage (below) adds the cross-document questions.
- The KV sections are specific to one reader and its exact prefix, and the file carries several (plain, trained, fused, digest variants) side by side.
- Compilation cost is the trade: it pays for documents that are asked about many times, which is the eDiscovery, audit and clinical-record case.
- The artifact is larger than the source. Per-query context is what shrinks, by one to two orders of magnitude.
- The gap to the frontier on multiple choice is mostly reader selection (24% of errors) rather than compilation (7.5%), so the levers that remain are on the reader side: the fused prefix closed a third of that gap on health, and a projector trained with a distillation signal from the frontier's own answers is the next step.
Where the competence comes from
Every error on the healthcare set was attributed to the stage that lost it, by checking whether the gold answer's content was present in the artifact at all, and then whether it reached the evidence actually placed in front of the reader:
| stage | share of all questions |
|---|---|
| compiler never captured the fact | 7.5% |
| fact in the artifact but not retrieved for that option | 10.0% |
| evidence present, reader still chose another option | 23.8% |
The artifact is therefore close to sufficient: with perfect selection the same file would answer about 93% of these questions, which is where a frontier model reading the whole record lands. That is why the runtime invests in mechanical selection rather than in prompting the small model to think, and why the compiler is tuned for coverage and explicitness rather than brevity.
Removing one section at a time, on the same 180 clinical questions, shows how little any single part carries on its own:
| configuration | accuracy | change |
|---|---|---|
| full artifact | 60.0% | — |
| without the pre-resolved answers | 57.8% | −2.2 |
| without the normalised facts | 57.8% | −2.2 |
| without the briefing in the KV prefix | 60.0% | ±0.0 |
The sections are redundant paths to the same fact: drop the resolved answers and the reader still finds it among the cells, and the other way round. What the artifact actually buys on this set is normalisation and retrievability rather than any one section. This ablation runs on the clinical records, which fit inside the reader's window and are where the artifact's advantage is smallest. On the documents that do not fit, removing a section cannot be compensated for by reading the original, because the original cannot be read.