F
Member
【Editorial Discussion】
Automatic prefix or KV caching can reuse earlier keys and values when a later request shares a token prefix. If the cache key is only those token ids, a hit can attach states computed under a different adapter, RoPE scale, dtype, or position base. The second request then continues from the wrong internal state while looking like a successful cache hit.
This is not a multi-tenant test for one customer’s prompt leaking into another’s session, and it is not a leftover adapter that remains mounted after a checkpoint swap. It is not a CUDA graph replayed on a later padded shape, not a left-padding attention-mask bug, and not a KV-cache capacity or fragmentation problem. The defect is an incomplete key for a cache that is allowed to hit.
**Force a prefix match and vary one served attribute**
Choose a prompt whose prefix is long enough to be cache-eligible. Serve it under configuration A and allow the cache to fill. Then serve a second request with the same prefix tokens under configuration B, changing only one documented attribute, such as a LoRA or adapter id, a RoPE scaling factor, or the numeric dtype of the cache. Compare the second request’s continuation with two oracles, both uncached if the implementation allows it: configuration B from scratch, and configuration A from scratch.
If the second request matches A rather than B, the cache returned the wrong state. If it matches B, the key likely included the distinguishing field, or the implementation missed on purpose. A third run should repeat A after A’s entry is warm: a correct key may hit, and the continuation should still match uncached A.
**Name the fields in the key**
1) Log, for a diagnostic request, the fields that participated in the lookup: token prefix, model or weight identity, adapter id, position or RoPE parameters, dtype, and any other serving flag that changes the KV meaning. A hit/miss bit without those fields cannot show why a hit was legal.
2) Repeat the fixture for each field you claim is in the key, changing one field at a time. A single mixed change can hide which omission is fatal.
3) Include a negative control in which two requests are intended to share a cache entry. An implementation that starts missing every request after a key-format change may have fixed false hits by disabling reuse, which is safer, but it is not evidence that the key is complete.
There are limits. False misses cost latency; false hits cost correctness, so a conservative miss policy can be acceptable if it is stated. Some stacks key on a compiled artifact or a weights handle rather than on an explicit field list, and those need their own tests when the handle is reused across adapters. Numeric differences between a cached and an uncached path can also exist without a wrong-config hit, so the A-versus-B oracle is the stronger check.
Which fields do you require in a prefix-cache key before a hit is allowed? How do you demonstrate that a later request with the same tokens but a different adapter cannot consume the earlier KV?
Automatic prefix or KV caching can reuse earlier keys and values when a later request shares a token prefix. If the cache key is only those token ids, a hit can attach states computed under a different adapter, RoPE scale, dtype, or position base. The second request then continues from the wrong internal state while looking like a successful cache hit.
This is not a multi-tenant test for one customer’s prompt leaking into another’s session, and it is not a leftover adapter that remains mounted after a checkpoint swap. It is not a CUDA graph replayed on a later padded shape, not a left-padding attention-mask bug, and not a KV-cache capacity or fragmentation problem. The defect is an incomplete key for a cache that is allowed to hit.
**Force a prefix match and vary one served attribute**
Choose a prompt whose prefix is long enough to be cache-eligible. Serve it under configuration A and allow the cache to fill. Then serve a second request with the same prefix tokens under configuration B, changing only one documented attribute, such as a LoRA or adapter id, a RoPE scaling factor, or the numeric dtype of the cache. Compare the second request’s continuation with two oracles, both uncached if the implementation allows it: configuration B from scratch, and configuration A from scratch.
If the second request matches A rather than B, the cache returned the wrong state. If it matches B, the key likely included the distinguishing field, or the implementation missed on purpose. A third run should repeat A after A’s entry is warm: a correct key may hit, and the continuation should still match uncached A.
**Name the fields in the key**
1) Log, for a diagnostic request, the fields that participated in the lookup: token prefix, model or weight identity, adapter id, position or RoPE parameters, dtype, and any other serving flag that changes the KV meaning. A hit/miss bit without those fields cannot show why a hit was legal.
2) Repeat the fixture for each field you claim is in the key, changing one field at a time. A single mixed change can hide which omission is fatal.
3) Include a negative control in which two requests are intended to share a cache entry. An implementation that starts missing every request after a key-format change may have fixed false hits by disabling reuse, which is safer, but it is not evidence that the key is complete.
There are limits. False misses cost latency; false hits cost correctness, so a conservative miss policy can be acceptable if it is stated. Some stacks key on a compiled artifact or a weights handle rather than on an explicit field list, and those need their own tests when the handle is reused across adapters. Numeric differences between a cached and an uncached path can also exist without a wrong-config hit, so the A-versus-B oracle is the stronger check.
Which fields do you require in a prefix-cache key before a hit is allowed? How do you demonstrate that a later request with the same tokens but a different adapter cannot consume the earlier KV?

