Skip to main content

Mirror Dimension — Persistent KV Cache (Six-Proof Build)

The MirrorDimension object from the Mirror Dimension paper (Heylel Yaka, v0.2), upgraded with embedded position tags and a sixth proof: shuffle-invariance.

The discovery (Sept 21, 2026 session)

The original five tests are real and reproduce bit-for-bit (Test 1 identical to the paper on an RTX GPU). But a sixth attack — permuting every stored entry across slots, values intact — exposed that the position lived in the array slot, not the payload:

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

The fix: every entry now carries its own position tag (t, one long per slot). recover() finds entries by tag, and takes the un-rotation angle from the entry itself. The slot is parking, not addressing. Same attack, after the fix:

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

The mirror is now genuinely self-describing: lossless AND order-independent.

Files

File What it is
mirror_dimension.py The tagged MirrorDimension + all six tests (python mirror_dimension.py)
test6_shuffle.py The shuffle attack, standalone — the before/after evidence
mirror_test.pt Persistence-test artifact (written by Test 5)

Reproduce

pip install torch          # CUDA optional; CPU works
python mirror_dimension.py # runs all six tests
python test6_shuffle.py    # runs the shuffle attack standalone

Measured results this machine (RTX GPU, torch 2.8.0+cu126, Windows):

Test Property Result
1 Isometry (norm preservation) diff 0.00e+00
2 Conjugate recovery 0.00e+00 both parts
3 Cross-distance (4990 writes) 5.96e-08 = float32 eps
4 Relative-offset invariance diff 1.00e-05
5 Save/load persistence 5.96e-08
6 Shuffle-invariance (new) 5.96e-08 after full permutation

Legacy saves (no tags) load cleanly — slots become tags automatically.

Cost of the upgrade

One int64 per entry (~4 bytes vs 2×head_dim float32s) plus a tag lookup on read. Zero change to the rotation, the isometry, or the attention math.

Metadata

Release files for mirror-dimension 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mirror-dimension 0.1.0
File Size Uploaded
mirror_dimension-0.1.0.tar.gz 6.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mirror-dimension 0.1.0
File Interpreter ABI Platform
mirror_dimension-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 12.8 kB

Release files / mirror_dimension-0.1.0.tar.gz

Download URL mirror_dimension-0.1.0.tar.gz
Size 6.3 kB
Tags Source
SHA-256 checksum
How to use checksums
89a0b9948eb829012075aad1c5acea0b9a627bada3d90fab9c254c0e5416a57e
BLAKE2b-256 checksum
How to use checksums
cde0cb1543d314b78fc6a42345e7c539a00931c66815db1f66227bcdb526ae80
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.4

Release files / mirror_dimension-0.1.0-py3-none-any.whl

Download URL mirror_dimension-0.1.0-py3-none-any.whl
Size 6.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
96fd0417874145685f49be01e012b3fe635293d686f44803a4c5c90617873dc8
BLAKE2b-256 checksum
How to use checksums
ee76fe5e1b43980d40a647c407ec35f2800ef602bd6696c7316909e5fb666539
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.4

Release history Release notifications | RSS feed

0.2.0

2 release files

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page