Manuscript Offprint

arXiv:2608.30647

What It Costs to Compose, Rebuild, and Correct Precomputed Memory

Asa Shepard

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

Language models can answer from precomputed memory, a model's saved reading of a body of material, reused across requests instead of read again at each. This paper maps where that practice preserves correctness and the conditions under which it fails. Across experiments on Llama-3.1-8B-Instruct using both saved key-value caches and trained compressions of them, precomputed memory degrades when assembled from separately prepared parts, stays current only through rebuilds costing a large fraction of full preparation in our measurements, and ignores corrections served beside it conditional on phrasing. If precomputed memories can be served alongside one another, be cost-efficiently rebuilt, and be superseded by new information arriving in real-time, they can serve as a way to avoid re-feeding context to a model over repeated queries. The implication of our results for a deployed system that deals with a variety of queries is that precomputed memories are best rebuilt on the cadence at which new information changes what the memory was originally computed from. Both warm-rebuilding trained compressions of key-value caches and serving specifically-phrased updates beside a memory, as pasted text or injected cache state, show particular promise for keeping precomputed memories current, the latter as an interim measure between rebuilds, and we measure the cost and name the remaining questions associated with each.

Recombine separately built parts?

Figure

trained apart

served together

Rebuild cheaper than from scratch?

Figure

warm start + new source + replay r

Corrections without rebuilding?

Figure

pile of updates, k = 1 to 512

Figure

memories composed

generation

pile size k

Figure 1: The three questions. Left, build time: separately trained memories are concatenated at serving time, and accuracy falls with the number of memories composed. Removing the duplicated start-of-text columns recovers about half the fall (Section 4). Middle, build time: one evolving memory is rebuilt warm as sources accumulate, and replay of the earlier sources' training data is what separates chains that track a fresh retrain from chains that decay to the never-updated floor (Section 5). Right, query time: an already-built memory is served together with a pile of updates. On two-hop items, use of the correction falls as revisions accumulate, and no delivery policy comes within 64 points of the full-context reference (Section 6).

1 Introduction

We test two different forms that a model's saved state can take, in the setting where a stream of diverse queries arrives against a common corpus, such as a legal case, a medical profile, or company records. The default way to serve such queries is in-context learning (ICL; Brown et al., 2020). The material is placed in the model's context window and the model conditions on it, paying a prefill, the model's single forward pass over the input, which computes and stores each token's key and value vectors before any output is generated. A cache is that key-value state exactly as one prefill pass produces it, ICL's internal representation of the material saved for reuse. It's cheap to make (one forward pass), contains one stored entry per token, and thus it's as large in storage as the text it came from. A cartridge is a smaller cache trained to imitate the full one (Eyuboglu et al., 2025). It's expensive to make, but it's compressed, with the training cost meant to be amortized over every future query against the same material. We call either a precomputed memory, and we test both to help us determine whether a limit belongs to one substrate or to precomputed memory as a whole, as well as to test the more versatile form of cartridges, which are reported to deploy with a smaller footprint over larger amounts of context without sacrificing accuracy.

The key and value vectors stored for any given token that has passed through a model are computed with attention over everything else present in the same pass. For example, token 1001 requires information from tokens 1–1000, so if any of those first 1000 tokens are changed, then token 1001 will be stored differently in the model's key-value cache. A cartridge inherits the same property, and uses synthetic conversations about the corpus of data it is “memorizing” to train itself, a method called self-study.

New information can enter a memory at two points (Figure 1). It can be present at build time, in the prefill or training data while the memory is made, or it can arrive at query time, served next to the finished memory as prompt text or as state written into the cache. For example, a memory about Bob's finances is built in January, and in March, Bob buys a new house. The build-time option is to rebuild the precomputed memory from scratch but now including the new fact that Bob bought a house, and the query-time option is to hold the original January memory static and supply the new March information alongside it. With precomputed memories, the model only has to attend over the memory's X static tokens about Bob's financial history at every pass. Training a cartridge is more expensive up front, but it compresses that further, so the model only has to attend over X/c tokens, for a compression ratio c, with each new request. However, this is only a clear benefit in a world where the memory's information is never updated or superseded, since a corpus that never changes and is queried enough amortizes the cost of any build, however expensive, without risking a staleness-caused decline in accuracy.

Whether the idea scales past that depends on three questions. Can separately prepared parts be recombined, enabling preparation to only be done once per block of information? Can rebuilds cost less than building from scratch, making updates to existing memories more cost-effective? And can corrections be served without rebuilding at all, letting a memory stay static between rebuilds? A prior question, whether preparation can be made partial, has its answer predicted by prior work on modular context (Ratner et al., 2023; Yang et al., 2024; 2025b) and confirmed at measured magnitudes in Appendix B: A cache delivers 95% of its benefit on questions that connect facts only once 82–92% of its text was visible during preparation, a constant fraction across a 16× range of length (fitted slope −0.045, 95% CI −0.130 to +0.046, replicated on fresh items), so throughout the paper, full joint preparation is treated as necessary per-unit. The three questions each have their own section. The answers are the paper’s contributions, and Figure 2 previews them per substrate.

  1. A composition penalty for cartridges and a method for partial recovery. Composing separately-trained memories costs accuracy. We attribute about half of the loss we observe with composing separately-trained cartridges to duplicated start-of-text markers, a mechanical artifact of concatenation, and show that the remainder survives partially co-visible training (Section 4). The result sits between the composability reported by Eyuboglu et al. (2025) and the collapse reported by Hardalov et al. (2026).

  2. Warm-start retraining, with replay as the controlling factor of both quality and cost. Rebuilding a cartridge memory warm as sources accumulate stays within a workable distance (within ten points, the smallest gap the corpus we use can detect) of fresh retraining through the deepest

Cache (prefilled)Cartridge (trained)
NoNo
Separately prepared parts recombine?isolated pieces lose 48.5-79.5 points; co-preparation is the repair (App. B)net -10.6 points at 4 memories, -12.5 at 8 after BOS repair (not distinguishable at 2); co-visible training did not protect
Rebuilds cheaper than from scratch?N.A.a rebuild is the same one prefill as the build, and there is no training to warm-start; splicing stored pieces instead is ruled out (App. B)Partialhalf replay holds quality at ~ half a fresh retrain's cost; no replay is 15× cheaper and buys nothing; below half replay: unmeasured
Corrections served without rebuilding?Partiala lone correction rescues ~1/3; under a tenth by 512 updates; naming the question → >0.9Partialthe same naming lever binds, +45.0 to +64.5 points, matching a quality-matched cache; other update forms and piles were swept on caches only

Figure 2: The three questions of the introduction, answered per substrate on this model. Sections 4 through 6 carry the measurements. The premise that preparation cannot be made partial, which is why full joint preparation is treated as given throughout, is measured in Appendix B.

chain our corpus supports, but only with replay of the older material, mixing the earlier sources' training data back into each rebuild (Section 5). The no-replay chain is 15× cheaper per rebuild and buys nothing, with thirteen successive updates worth nothing measurable over never updating at all. The full-replay chain preserves quality at slightly more than a fresh retrain's cost, and the half-replay chain matches full replay within the detectable margin at about half the cost of a fresh retrain.

  1. The query-time collapse, decomposed. At query time, when a lone realistic correction to a precomputed memory (a prefilled cache, or the stale text re-read) is served beside the memory, the correction is used (repeated correctly when the model is asked a question about it) on about a third of a set of two-hop questions (questions that require reasoning over two independent facts at once), whether pasted as text or injected into the cache. Use falls as further revisions accumulate to under a tenth at 512 (Section 6). No policy for delivering updates on top of a static memory that we measured is workable on our configuration, with every cell at least 20 points short of the full-context reference and the two-hop cells at least 64 short. The accumulation cost is the update's content rather than the size of the update in tokens, because token-matched padding that revises nothing costs far less in accuracy than real revisions do, a contrast that replicates on fresh items. And swept over all ten pile sizes, we only observe the cost with two-hop questions, while single-hop questions gain 16.7 points from updates kept in context before plateauing near 32.

  2. Naming the question is what makes an update bind. An update that names its question is used on over nine-tenths of items, a labeled value that names nothing is used on a tenth, and whether the delivery mechanism is pasted text or cache injection changes the outcome by less than a point (Section 6). The same binding occurs with trained cartridges. The effect replicates on fresh items, and a wrong-naming control locates its mechanism not as recognition, but as compliance, since a false value that names the question is adopted nearly as readily as the true one.

References (61)