LAB / 022
LLM mechanics (5): after editing history, can we recompute only the changed suffix?
27 fixed conditions and 81 raw arrays test longest-prefix cropping, continuation positions, sliding-window fallback and scope isolation.
EXPERIMENT RESULT
01 / QUESTION
27 fixed conditions and 81 raw arrays test longest-prefix cropping, continuation positions, sliding-window fallback and scope isolation.
METHOD
An untrained two-layer NumPy model, 3 seeds × 9 conditions: full recomputation, correct cropping and stale-position negative control.
RESULT
All 27 correct paths have maximum error about 3.89e-16; nine partial-reuse negative controls diverge. 81 arrays are archived.
OBSERVATIONS
Editing token five gives cut=4 and 48 continuation projection rows versus 72 fresh rows; partial sliding-cache hits fall back.
CONCLUSION
Reusing an identical prefix requires consistent K/V, absolute positions, scope and retained cache state.
LIMITATIONS
No trained model, tokenizer, GPU or latency measurement. Counts exclude prefill, hashing, lookup and copying. Scope strings are not authentication.
REPRODUCE
Pinned code and raw records are in the repository; the article provides run, audit and replay commands.
KEEP EXPLORING
Related content
- Mechanisms
LLM mechanics (5): after editing history, can we recompute only the changed suffix?
27 fixed conditions and 81 raw arrays test longest-prefix cropping, continuation positions, sliding-window fallback and scope isolation.
- PROJECT / 002
Java LLM Practice
Reproducible Java conversation, retry and persistence boundaries, alongside attention, cache-cost and quantization-error experiments.
- Mechanisms
LLM mechanics (4): when a prefix changes, is the old KV cache still valid?
Three seeds and six conditions compare unchecked and keyed prefix reuse; numerical equality does not establish permission to share across scopes.
- Mechanisms
LLM mechanics III: why is a four-slot cache not four-token recomputation?
Separate absolute positions, cache slots and retained representations with a two-layer sliding-attention experiment.