Learning Recoverable Neural Networks against Weight Corruption via Simple Zero-Sum Projection

Sanggeon Yun, Ryozo Masukawa, SungHeon Jeong, Hyunwoo Oh, Nathaniel D. Bastian, Mohsen ImaniNeurIPS 2026

TL;DR

Deep neural networks are notoriously fragile at the hardware level: flipping just a handful of bits in memory—whether via cosmic rays or deliberate physical attacks—can turn a state-of-the-art model into a random number generator. Instead of bolting on external error-correcting codes, this paper teaches networks to heal themselves by training their weights to form tiny, mathematical "Sudoku puzzles" where every row and column sums to zero. If a bit flips, the broken sum instantly gives it away, allowing the model to restore its own weights on the fly with zero storage overhead.

What Problem Does This Paper Address?

When we deploy AI to the edge—think satellites, autonomous drones, or low-power sensors—we leave the cozy, error-free illusion of cloud servers behind. In the wild, hardware experiences bit flips: stored 0s spontaneously become 1s (and vice versa) due to voltage drops, heat, or radiation. Worse, adversaries can intentionally trigger targeted bit flips using physical attacks like RowHammer (rapidly accessing memory rows to leak charge into adjacent ones) to destroy accuracy or plant stealthy backdoors.

Without duplicating the entire model in memory, existing defenses generally fall into two camps, both with major blind spots:

  • Fault-tolerance trains models to be less sensitive to weight changes, which delays the inevitable—performance still collapses as random errors accumulate over time.
  • Fault-recovery embeds classical Error-Correcting Codes (ECC) directly into quantized weights. However, ECC creates concentrated failure points (flipping just two bits in the same codeword can break standard single-error correction) and typically only works for low-precision, quantized CNNs—leaving standard 32-bit floating-point (FLOAT32) models and Vision Transformers out in the cold.

Methods

Inspired by homeostatic plasticity—the biological brain’s knack for regulating its own neural activity back to a stable baseline after localized damage—the authors embed recoverability directly into the geometry of the weights.

  1. Block-wise Zero-Sum Projection: During training, each layer's weight tensor is flattened and sliced into $K \times K$ square blocks (default $K=8$). Before the forward pass, a symmetric, differentiable projection ($\Pi_{\text{balanced}}$) subtracts the row and column means so that every row and column in every block sums strictly to zero. Gradients flow right through this projection during backpropagation, allowing the network to learn naturally within this constrained space.
Figure 2: Training with zero-sum projection. Trainable weights A(ℓ) are partitioned into blocks, projected, and reassembled into W (ℓ) = Φ(A(ℓ)), with gradients propa- gated through Φ.
  1. Fixed-Scale Quantization: For INT8 deployment, standard quantization uses mutable per-layer scaling factors—giving attackers a juicy target where flipping one scale bit warps an entire layer. Instead, the authors use a single, fixed significance-level hyperparameter scale across layers, eliminating that attack surface.
  2. Sudoku-Style Detection & Recovery: At deployment, checking for corruption is simple matrix math: sum the rows and columns. If any sum exceeds a tiny numerical threshold (or hits NaN/Inf), a fault is flagged at the intersecting coordinates. If a row or column isolates a single suspect entry, its exact pre-flip value is restored immediately; if multiple errors overlap, a "soft correction" distributes the residual error evenly across the suspects.
  3. Recovery-Aware Adaptive Attacks: Unlike standard white-box attacks that optimize bit flips on static weights, the authors introduce a new adaptive threat model where the attacker simulates the defense's recovery step first, greedily picking bit flips based on the damage that survives after recovery.

Datasets

The authors evaluate their framework across five standard visual benchmarks spanning different scales and domains: CIFAR-10, CIFAR-100, GTSRB (German Traffic Sign Recognition), SVHN (Street View House Numbers), and ImageNet-1K. No new datasets are introduced, though additional task-agnostic evaluations (with LSTMs and U-Nets) are noted in the appendices.

Key Insights and Ideas

  • Weights want to be zero-sum anyway: Looking at naturally trained ResNets, VGGs, and Vision Transformers, weights are already symmetric and tightly centered around zero—even locally. Enforcing a strict zero-sum constraint barely disturbs clean accuracy because it reinforces a structure DNNs naturally gravitate toward, rather than overwriting weight bits with unnatural ECC parity payloads.
Figure 1: Global and local weight distributions on ImageNet1K for naturally trained models and our method with block size K = 8. (a) Across architectures, naturally trained weights are already approximately symmetric and centered near zero; our method preserves this structure while enforcing a more strictly zero-centered distribution. (b) Each local mean is computed over M consecutive flattened weights. Even naturally trained models exhibit near-zero local means across scales, while our method makes this local zero-centering substantially tighter.
  • Symmetry matters during optimization: An intuitive way to make a $q \times q$ block sum to zero is to let $(q-1) \times (q-1)$ weights be free and force the last row and column to balance them out ("Ours-U"). Surprisingly, this privileges certain coordinates and creates an optimization asymmetry that hurts low-precision robustness. Treating all coordinates equally via balanced projection ("Ours-B") is consistently superior.
  • ECC is brittle against smart attackers: Because ECC packs rigid parity rules into small codewords, a recovery-aware attacker can easily overwhelm a block with two targeted flips. Distributing the zero-sum constraint across 2D blocks avoids these concentrated Achilles' heels.

Key Results

  • Immunity to cumulative FLOAT32 drift: In FLOAT32, flipping an exponent bit causes massive numerical explosions. Under 10 steps of cumulative random bit flips (BER of $10^{-6}\%$) on ImageNet-1K, ViT-B/16 collapses to near-zero accuracy (0.0015 undefended, 0.0020 with ECOC). With Ours-B, ViT-B/16 holds steady at 0.7266 from step 1 through step 10 (and 0.7043 on ResNet-34 vs. 0.0256 undefended).
ViT-B/16 cumulative random bit-flip robustness in FLOAT32
  • Broad precision and adversarial dominance: Under INT8 cumulative random faults (BER of $10^{-2}\%$), Ours-B achieves the best robustness across nearly all CNN/dataset pairs (e.g., 0.5098 after 10 steps on ImageNet-1K ResNet-34, vs. 0.4103 for ECC and 0.1245 for bit-flip-aware training WCAT). It similarly dominates across 1 destructive and 6 stealthy Trojan bit-flip attacks at budgets of 10 and 20 flips.
  • Surviving adaptive attacks: Under recovery-aware adaptive attacks on CIFAR-10 (ResNet-18, INT8), an undefended model drops to 0.107 accuracy after just 5 flips, and ECC is readily neutralized. Ours-B retains 0.847 accuracy even after 100 threshold-evading flips.

Limitations and Future Work

  • Naive weight grouping: Blocks are currently formed simply by flattening weight tensors and slicing them sequentially, along with a manual choice of block size $K$. Smarter, structure-aware grouping and principled $K$-selection across fault rates remain open.
  • Coordinated "ghost" attacks: Mathematically, if an attacker simultaneously flips four bits in a rectangle within a single block such that the errors cancel out along both rows and columns (e.g., $+\delta, -\delta$ on one row and $-\delta, +\delta$ on another), the zero-sum check is completely blind to it. While inducing simultaneous, spatially coordinated multi-bit hardware faults is physically very difficult in practice, defending against jointly optimized residual-canceling patterns is an open theoretical challenge.

Summary updated

Abstract

Deep neural networks are highly vulnerable to bit corruption in stored weights, whether from naturally occurring memory faults or deliberate fault-injection attacks. Existing defenses remain fundamentally limited: fault-tolerance methods degrade under cumulative corruption and remain vulnerable to strong white-box attacks, while ECC-based recovery methods are often tied to specific precisions or architectures and expose concentrated vulnerable surfaces. We propose a simple training-based recovery framework that endows model weights with recoverable structure through block-wise zero-sum constraints enforced by differentiable projection. The resulting method incurs no additional weight-storage overhead and generalizes naturally across architectures and numerical precisions. We further develop adaptive adversarial bit-flip attacks tailored to recovery-based defenses, covering both our method and prior ECC-based approaches. Across diverse architectures, precisions, datasets, threat models, and tasks, our method consistently delivers strong robustness and recoverability while preserving clean performance.
BibTeX
@inproceedings{yun2026learning,
  author = {Sanggeon Yun and Ryozo Masukawa and SungHeon Jeong and Hyunwoo Oh and Nathaniel D. Bastian and Mohsen Imani},
  title = {{Learning Recoverable Neural Networks against Weight Corruption via Simple Zero-Sum Projection}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=3RaBUzol9c},
}
Figure