Hands-On Examples for the Axial-Parity Gauge Paper
Three interactive demos — the gauge theorem you can’t break, the negative-result scoreboard, and why hard \(\mathbb{F}_2\) kills the gradient
Companion to the tutorial and to the paper “Gauge Structure and Architectural Inductive Bias for Axial Parity Codes: A Theorem and a Negative Result” (B. Guarraci, Galatheus).
The tutorial explains why the codec is a discrete fracton gauge theory and why hard-coding that algebra fails; this page lets you see it. Every widget runs entirely offline with hand-written canvas + JavaScript — no libraries. Widget 1’s parity checks, the gauge transformation \(T=\partial_x\partial_y\partial_z\), and the live rank \(3n^2-3n+1\) are exactly the construction in verify_fracton_theorem.py (its ranks \(\{37,91,169\}\) at \(n\in\{4,6,8\}\) are machine-checked there and reproduced live below). Widgets 2–3 take their numbers verbatim from Tables 1–2 of main.tex and the run log in experiments.tsv. Nothing is invented.
The one idea to hold onto
The set of voxel grids passing every parity check — the codespace — is exactly the image of a discrete third derivative \(\partial_x\partial_y\partial_z\) over \(\mathbb{F}_2\). That makes the codec a discrete \(\mathbb{Z}_2\) fracton gauge theory: a codeword is the “field strength” of a hidden potential \(\phi\), and you can XOR in any \(\partial_x\partial_y\partial_z\phi\) without moving a single parity bit (Widget 1). And yet hard-wiring that exact algebra into a neural decoder makes it worse: it plateaus at IoU 0.283 against an unconstrained baseline’s 0.481 (Widget 2). Widget 3 shows the mechanism — the hard \(\mathbb{F}_2\) gate starves the gradient.
1. The gauge theorem you can’t break
Why the syndrome never moves (the theorem in one line)
Each parity check is the \(\mathbb{F}_2\) inner product of the field with the indicator of an axis line, plane, or the whole lattice. A gauge codeword \(T\phi=\partial_x\partial_y\partial_z\phi\) has the property that every such sum telescopes to \(0\bmod 2\) under the periodic boundary — each \(\phi_v\) enters an even number of times. So \(\mathrm{image}(T)\subseteq\ker H\), and a dimension count (\(\dim\,\mathrm{image}\,T = n^3-(3n^2-3n+1) = \dim\ker H\)) forces equality: \(\mathcal{C}(n)=\mathrm{image}(\partial_x\partial_y\partial_z)\). The verifier confirms it exactly at \(n\in\{4,6,8\}\): \(\mathrm{rank}(H)=\{37,91,169\}\).
The bug the theorem caught
Closed-form rank is also a correctness check. The previously deployed parity matrix reported rank 2016 at \(n=32\) instead of the correct 2977 (\(=3\cdot1024-96+1\)). Run through the same verifier its construction gives ranks \(\{28,66,120\}\) at \(n\in\{4,6,8\}\) — strictly smaller than \(\{37,91,169\}\), i.e. a genuinely different, lower-rank code from a duplicate-axis indexing error. The theorem paid rent.
2. The negative-result scoreboard
The gap is the result — not any single cell
At matched 5.0M params and 20 epochs the only thing that changes between x-prior (0.481) and phi-prior (0.283) is the fixed output operator \(\partial_x\partial_y\partial_z\). Across 14 configurations — capacity (5M = 12M), training length (20 = 30 epochs), positive-class weighting (sweet spot pos_weight = 19), and data scale (2K = 8K) — the phi-prior never clears \(\approx0.29\). And x-prior capacity saturates too: 12M gives 0.489, 17.9M gives 0.474. Capacity is not the bottleneck; the hard constraint is.
For completeness: what actually wins (Table 2)
A gauge-free multi-scale autoencoder (encoder \(\to 8^3\) latent \(\to\) SharpNet upsample) beats everything at 0.572 ± 0.004 over seeds \(\{42,43,44\}\). A soft U(1) transporter helps modestly (0.509), but a controlled ablation removing its gauge machinery improves it to 0.518 — the gauge structure is not load-bearing. The lesson: a known mathematical structure tells you what is reachable, not the right inductive bias.
3. Why hard \(\mathbb{F}_2\) collapses learning
A non-local credit-assignment problem (the paper’s own explanation)
The toy here uses two inputs; the real operator XORs 8 corner \(\phi\)’s per voxel. To flip one residual bit the network must simultaneously modulate all 8 — and most residual targets are 0, so BCE provides little drive. The gradient through the bilinear product is bounded by 1 but attenuated at every factor, and the STE forward/bilinear backward split (run exp05) left the loss flat at 0.36 because \(\sigma'(-5)\approx0.007\) crushed the passed-through gradient. Correct constraint, hostile landscape.
Companion to the tutorial and main.tex. Widget 1’s lattice, parity checks, gauge operator \(T=\partial_x\partial_y\partial_z\), and the closed-form rank \(3n^2-3n+1\) follow verify_fracton_theorem.py exactly; its machine-checked ranks \(\{37,91,169\}\) (correct) and \(\{28,66,120\}\) (the caught bug) at \(n\in\{4,6,8\}\), and the \(n=32\) value \(2977\), are reproduced verbatim. Widget 2’s scoreboard is Tables 1–2 of main.tex (x-prior 0.481/0.489/0.474; phi-prior 0.283/0.276/0.291/0.292 and the degenerate 0.002/0.021/0.001/0.001; autoencoder \(0.572\pm0.004\); transporter 0.509/0.518) cross-checked against the per-run log in fracton_xcube/src/gauge_paper/experiments.tsv. Widget 3 is a schematic of the bilinear soft-XOR vs. STE gate described in §6 of main.tex; the −5 bias init and the flat-loss STE failure are from experiments.tsv (exp02, exp05). No results were invented.