LLM recompute cost shifts the store-vs-recompute balance

Type: types/note.md ยท Tags: computational-model, context-engineering

Ordinary software usually avoids storing values it can derive cheaply. Recomputing from a single source of truth avoids a standing consistency liability: a stored copy can go stale, diverge from its source, or force each source change to maintain two surfaces. Persisting the value therefore needs enough workload pressure to repay that liability.

For a value consumed by a model, however, model-side derivation can be unusually expensive. It may require loading files, searching, selecting tools, or reasoning unreliably. These operations consume bounded context, add latency, and can fail. A checked value that the model can read directly may therefore be worth materializing, even when ordinary code could derive it cheaply.

Expensive model-side derivation does not by itself justify persistence. Code may instead derive the narrow answer on demand and return only that answer to the model. The relevant comparison has three paths: model-side derivation, external on-demand derivation, and persisted checked materialization. For a stated validity window, compare their total expected costs, including creation, expected reads, source changes, validation and invalidation, retrieval, context use, and failure recovery. Opposed recompute factors do not decide documentation segmentation supplies the general cache ledger. The LLM-specific change is that model-side derivation can make the recomputation term much larger.

Checked materialization needs a deterministic checking path

The economic case explains why a copy may earn its cost. It does not make the copy safe: checking retained results trades cost against reliance risk. Mechanical checking needs a judgment-free rule, a locatable copy and source, source availability at check time, and a sufficiently trustworthy checker. A system can choose enforcement before every consumption and fallback on failure, but this is a strict policy, not a consequence of checkability. Checking once and reusing across reads preserves more of the saving while accepting risk between checks.

Checkability does not require a fully symbolic payload. For example, a deterministic generator can reproduce a natural-language paragraph byte for byte inside a delimited region bound to its source. The payload remains natural language, while its envelope and validation path are symbolic. The retained artifact therefore has mixed representational form. Fully symbolic content is one implementation, not a consequence of checkability alone.

The economic and safety constraints remain distinct. Materialization pulls repeated derivation out of the model's bounded call. Validation compares the cache with the source at check time; an explicit reuse and refresh policy keeps the cache subordinate without implying continuous freshness.

An instance, a broader pattern, and a non-instance

  • Instance โ€” a mark on a tag README. A scoped file sweep can recover the answer that complete materializes for an agent to read: whether the head reaches every member in one hop. A validator re-derives the answer and rejects a false mark; the tag-readme type spec defines the contract.
  • Broader pattern โ€” frontloading spares execution context. Frontloading precomputes or generates parts of a call whose inputs are already known, so the call reads an answer instead of doing the work. The inserted material need not be a copy of a derived value, while this note concerns the narrower store-versus-recompute choice.
  • Non-instance โ€” a content-hash anchor. A content-hash anchor records an unrecoverable past state so code can detect later divergence. Its value lies in preserving that historical record, not in caching the answer to a recoverable current query for a model reader.

A bounded repository-wiki comparison

Archcheck's agent-wiki experiment reports both a losing and a winning lookup path. Across four questions, code search used 27.3k marginal tokens, a 28-page wiki with source verification used 27.6k, and the same wiki without required verification used 29.8k. A replacement cross-file map used 13.8k tokens and four tool calls, against code search's ten. Marginal tokens subtract a reported 24.3k-token baseline. All arms answered all four questions correctly, but each cell used only one Sonnet agent, and the map was shaped during the experiment that evaluated it.

The comparison illustrates why materialization must be evaluated as a consumption path. Removing source verification alone did not make the 28-page wiki cheaper than code search. The replacement combined cross-file aggregation, direct entry from the agent instructions, and permission to rely on the map at query time, with a separate freshness loop. The reported savings belong to that bundle; they do not isolate one cause. Query-token savings also do not establish that construction and maintenance costs are repaid, or that future answers remain equally reliable. The experiment therefore supplies a bounded economic case, not evidence that the map meets this note's deterministic-checking requirement or outperforms external on-demand derivation.

Decision boundaries

The materialized answer must replace work, not merely precede it. A model may read an answer and then inspect the source or rerun the derivation because the answer is insufficient or untrusted for the task. In that case, materialization adds cost instead of removing it. An insufficient summary precedes the source rather than replacing it develops this substitution condition.

Selective layers also have an addressability floor. For a known question that maps to one discriminating unit on each path, the smaller addressed unit sets the matched selective-read floor. This condition governs that one retrieval component, not materialization in general. Fan-out, discovery, sufficiency, semantic reconstruction, maintenance, and reuse can still decide the broader path in either direction.

The consumer boundary matters. When code consumes the derived value, the ordinary software presumption applies. If code derives one boolean on demand and returns it to the model, that is external on-demand derivation rather than model-side recomputation. Its latency and orchestration costs still belong in the comparison.

Open Questions

  • What is the smallest general mechanism for a machine-locatable, source-bound materialized region inside natural-language instruction text, so a validator can re-derive it before trusted consumption?
  • Which values justify reuse when re-derivation is expensive or judgment-dependent, and what review intervals keep the accepted reliance risk within the task's requirements? The qualitative trade-off alone does not calibrate those choices.