The mirror had a hole. Test 6 found it.

#1
by ElBalor - opened
Owner

Author: Eric Yaka
Body:
I built a persistent KV cache. Five proofs said it was lossless. Isometry, conjugate recovery, cross-distance, relative-offset, persistence all green, all bit-for-bit on this hardware.

Then I attacked it in a way I hadn't thought of. Permute every stored entry across its slots. Values intact. Addresses destroyed.

[before shuffle] recover(10) max err = 5.96e-08 exact
[after shuffle] recover(10) max err = 7.62e-01 garbage

The position was living in the array slot, not in the payload. Five tests passed because none of them moved anything.

Fix: every entry carries its own position tag. The slot is parking. The tag is the address. recover() finds entries by tag and takes the un-rotation angle from the entry itself.

Same attack, after the fix:

[before shuffle] recover(10) max err = 5.96e-08
[after shuffle] recover(10) max err = 5.96e-08 SURVIVED

Six tests green, this machine (RTX, torch 2.8.0+cu126, Windows):

  1. Isometry 0.00e+00
  2. Conjugate recovery 0.00e+00
  3. Cross-distance (4990 writes) 5.96e-08
  4. Relative-offset invariance 1.00e-05
  5. Save/load persistence 5.96e-08
  6. Shuffle-invariance 5.96e-08

Cost of the upgrade: one int64 per entry. The rotation, the isometry, the attention math untouched. Legacy saves without tags still load. Slots become tags automatically.

Run it on CPU, older torch, M-series Mac post your max error. I want to see where the float32 floor moves. Find an attack I missed, open a thread. The mirror is self-describing now. Lossless and order-independent.

Come break it.

This is a really interesting catch. The fact that the original tests passed while the cache was still fundamentally position-dependent is a great reminder that correctness under expected conditions isn't the same as structural correctness. I especially like that the fix preserves the core math while making each entry independently recoverable. The shuffle test is a much stronger proof of robustness than the initial green tests. Solid work.

Sign up or log in to comment