Exact Solutions and Topological Phase Transitions to Boolean Logic in Minimal RNNs

Damiano AnselmiarXiv 2026

TL;DR

Can a continuous, messy neural network ever learn to execute a discrete rule with literal zero error forever, without floating-point drift? By swapping standard Cross-Entropy for a custom loss function, Damiano Anselmi shows that tiny Recurrent Neural Networks (RNNs) abruptly "snap" from fuzzy statistical approximators into exact, noise-immune finite-state machines. Even better, you can freeze these exact neural circuits and wire them together like Lego bricks to build complex, zero-error processors.

What Problem Does This Paper Address?

Deep learning models are phenomenal pattern matchers, but at heart, they are statistical black boxes living in continuous spaces. Ask a standard RNN to learn a rigid, sequential rule—like binary addition with carry—and it usually gets stuck in an approximate local minimum. It might get 99.9% accuracy on 10-bit numbers, only for microscopic floating-point errors to compound and derail the calculation at bit 1,000.

Historically, theorists proved RNNs could emulate exact state machines, but those proofs relied on unphysical crutches: discontinuous step activations, infinite weights, or infinite-precision irrational numbers. Meanwhile, training standard continuous networks (using smooth tanh activations) with Cross-Entropy loss actively sabotages exact logic. Because Cross-Entropy never hits zero gradient—even when a prediction is 95% confident—it relentlessly pushes weights toward infinity, saturating activations and creating brittle, chaotic decision boundaries. The open challenge is bridging continuous gradient descent and provable, infinite-horizon symbolic execution on standard finite-precision hardware.

Methods

The author studies a minimal RNN with tanh activations tasked with bit-serial binary addition (reading two numbers from least- to most-significant bit, outputting the sum bit while internally remembering the hidden carry). The minimum latent space required is $d=2$ (one dimension for the output decision, one for the carry memory).

Step-by-step trace of bit-serial binary addition for 9 + 5 = 14, processed least-significant-bit first.

The secret sauce is replacing Cross-Entropy with the Repulsive Dead-Zone Loss ($\mathcal{L}_{\text{RDZ}}$), which sculpts the optimization landscape into three regimes based on the target class probability $p_t$:

  • Active Training ($p_t < 0.90$): Standard $-\log(p_t)$ pulls wrong answers toward the right basin.
  • Neutral Dead Zone ($0.90 \le p_t \le 0.98$): Loss and gradients drop to exact zero, letting well-behaved weights coast and settle without perturbation.
  • Repulsive Barrier ($p_t > 0.98$): An inverted penalty $-\log(1 - p_t + \epsilon)$ actively pushes back against overconfidence, preventing weight explosion and tanh saturation.

Finally, to demonstrate modular "verticalization," the author freezes the trained $d=2$ neural adder to act as an immutable Arithmetic Logic Unit (ALU), and trains a separate, tiny $d=2$ RNN controller to route shift-and-add binary multiplication.

Datasets

  • Training: Exhaustive synthetic datasets of binary additions: all 256 pairs of 4-bit numbers, reduced to 64 pairs (3-bit), and ultimately just 16 pairs (2-bit: sums of 0, 1, 2, and 3). Multiplication used the 256 4-bit pairs.
  • Evaluation / Stress Tests: Zero-error generalization was tested on all sums up to 14 bits, random sequences up to $10^3$ bits, and adversarial carry-cascade edge cases up to $10^6$ bits long. The multiplication controller was tested on unbroken sequences of up to $2^{20}$ ($\sim 10^6$) clock cycles without state resets.

Key Insights and Ideas

  • Topological Phase Transitions: Under $\mathcal{L}_{\text{RDZ}}$, the network doesn't slowly grind toward zero error. It plateaus, then undergoes an abrupt global bifurcation—dropping to exact zero loss in a single epoch. The smooth latent space fractures into compact logical islands separated by finite safety gaps, mapping strictly into their own interiors and absorbing float32 truncation noise forever.
  • Open Sets Beat Human Symmetry: When humans hand-craft exact weights (analyzed in $d=3, 4$), we gravitate toward clean symmetries that accidentally sit on fragile, zero-gap boundaries. Gradient descent ignores our aesthetic biases, landing in "messy," asymmetric configurations that form topologically open subsets in parameter space. Because open sets are "fat" and contain dense machine-representable fractions (dyadic rationals), standard float32 gradient descent can hit them reliably without infinite precision.
  • Algorithmic Occam’s Razor: While the adder forged a persistent hysteresis loop to remember the carry bit, the multiplication controller did the exact opposite: under $\mathcal{L}_{\text{RDZ}}$, it spontaneously pruned its own recurrent memory, collapsing into a pure, memoryless hardware switch.

Key Results

  • Instant Crystallization: On the 256-addition dataset ($d=2$), loss collapsed vertically from 0.001075 at Epoch 8716 to 0.000000 at Epoch 8717.
  • Extreme Data Efficiency: Exact zero-error infinite stability was achieved training on as few as 16 examples (collapsing at Epoch 302,834).
  • Infinite-Horizon Proofs: Using graphical and Weierstrass analytical bounds across $d=2, 3, 4$, the author proves strict interior containment of all state transitions. Empirically, 0 errors occurred across $10^6$-bit addition cascades and $2^{20}$-step multiplication runs in standard float32.

Limitations and Future Work

  • Sparse Optimization Hurdles: On the tiny 16-example dataset, standard Adam stagnated in flat parameter regions; escaping required a custom hybrid engine alternating gradient descent with surgical, single-parameter backtracking.
  • From Proof-of-Concept to "Vertical AI": Currently demonstrated on foundational arithmetic, the author proposes the Universal Topological Quantization Conjecture—that any discrete algorithm harbors open sets of exact continuous RNN solutions. Future work aims to scale this into a self-organizing, fractal hierarchy ("verticalization"), where meta-controllers autonomously decompose hard problems and route signals across frozen, topologically protected neural micro-modules instead of relying on monolithic horizontal scaling.

Summary updated

BibTeX
@misc{anselmi2026exact,
  author = {Damiano Anselmi},
  title = {{Exact Solutions and Topological Phase Transitions to Boolean Logic in Minimal RNNs}},
  year = {2026},
  eprint = {2611.38168},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.38168},
}
Figure