NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Navigating the Boolean Hypercube: Sharpness-Aware Minimization Directly in Discrete Loss Landscapes

Ba-Hien TranNeurIPS 2026

TL;DR

Training ultra-efficient 1-bit neural networks usually means settling for brittle models that stumble on out-of-distribution data, because standard "flatness-seeking" optimizers fail to translate from continuous space to discrete $\{-1, +1\}$ grids. This paper introduces Hamming-SAM, the first optimizer designed to hunt for flat, generalizable minima natively on the Boolean hypercube—delivering binary models that are significantly more accurate and robust without relying on continuous-weight workarounds.

What Problem Does This Paper Address?

To run AI on energy-constrained edge devices, Binarized Neural Networks (BNNs) strip weights down to just $-1$ and $+1$. Like standard networks, BNNs generalize much better when they settle into "flat" minima—regions of the loss landscape where small nudges don't cause the error to spike.

In continuous deep learning, Sharpness-Aware Minimization (SAM) finds flat valleys by probing a small Euclidean sphere around the current weights for the worst-case loss, then stepping away from it. Previously, applying SAM to binary networks meant keeping hidden, continuous "latent" weights in the background, perturbing those, and projecting them back to $\{-1, +1\}$ via a sign function.

The author formalizes two geometric pathologies showing why this surrogate approach breaks down:

  1. The Vanishing Perturbation Effect: As training progresses, latent weights grow confident and drift far from zero. A small continuous nudge never crosses the zero threshold, meaning the binary signs don't flip and the sharpness signal completely vanishes. Continuous SAM perturbations fail to cross the sign threshold when latent weights grow large, causing the sharpness signal to vanish.

  2. Metric Distortion: Euclidean distance doesn't map to bit-flip (Hamming) distance. Two latent vectors infinitesimally close near the origin can flip every bit in the network, while two vectors miles apart in the same quadrant produce the exact same binary network. Euclidean proximity in continuous space is neither necessary nor sufficient for proximity in discrete Hamming space.

Figure 1: The vanishing perturbation effect (Proposition 3.1). Continuous SAM perturbs ˜wi = 2.5 within a ball of radius ρ = 0.7. Since the ball never crosses the sign threshold, the sharpness signal vanishes.
Figure 2: Euclidean–Hamming metric distortion (Proposition 3.2, n=2). Left: Two latent-weight vectors ˜u, ˜v that are ε-close in R2 but straddle the sign boundary, producing dH = 2. Right: Two vectors far apart but in the same quadrant, so dH = 0. Euclidean proximity is neither necessary nor sufficient for Hamming proximity.

Methods

Hamming-SAM ditches continuous Euclidean spheres for a $k$-bit Hamming ball—the set of all binary weight configurations reachable within $k$ bit-flips—and operates directly on $\{-1, +1\}^n$.

Instead of continuous gradients, it relies on Boolean Variation ($\text{BV}_i$), the finite difference in loss if you flip bit $i$. Using existing discrete backpropagation backends (like BOLD or Straight-Through Estimators), all $n$ bit-flip signals are estimated in a single backward pass. Each optimization step runs a two-phase greedy dance at the cost of two backward passes:

  • Phase 1 (Greedy Ascent): Estimate $\text{BV}_i$ at the current weights $w^t$. Find the top $k$ bits whose flips hurt the loss the most, and flip them to construct a worst-case "adversarial" neighbor $\hat{w}$.
  • Phase 2 (Sharpness-Aware Descent): Estimate $\text{BV}_i$ at that adversarial point $\hat{w}$. Identify the non-ascent bit (or accumulated set of bits) that reduces loss the most from there, and apply that flip back to your original weights $w^t$.
Figure 3: Hamming-SAM walkthrough on {−1, +1}3 with k=1. Node values show loss ˆL (green = low, red = high). (a) Current weight wt=(+1, +1, +1) (loss 0.30); blue edges show B1(wt) and Boolean Variations. (b) Phase 1 selects bit 2 (BV=0.25, the only increase) as the adversarial point ˆw=(+1, −1, +1). (c) Phase 2 evaluates BV at ˆw and flips bit 1 (BV1( ˆw)=−0.20), yielding wt+1=(−1, +1, +1) with loss 0.22. Base-point descent would instead flip bit 3, reaching a point whose one-bit worst case is 0.62 rather than 0.35.

Datasets

The author evaluates standard clean generalization and out-of-distribution corruption robustness across:

  • CIFAR-10 & CIFAR-100 (and their 19-corruption benchmarks, CIFAR-10-C & CIFAR-100-C) using ResNet-18, VGG-16, and Vision Transformers (ViT).
  • ImageNet and ImageNet-C for large-scale validation using ResNet-50.

No new datasets are introduced.

Key Insights and Ideas

  • No Scaling Ambiguities: In continuous networks, "flatness" is notoriously tricky because you can rescale weights layer-by-layer to make a sharp minimum look artificially flat without changing the network's output. On the $\{-1, +1\}^n$ hypercube, smooth rescaling symmetries don't exist—making Hamming-ball sharpness an unambiguous geometric measure.
  • The Discrete Interaction Hessian Rules Everything: Flipping two bits together can cause a loss jump much larger (or smaller) than the sum of flipping each alone. This pairwise synergy is captured by the discrete interaction Hessian ($H_{ij}$). The paper proves that this single quantity governs both how close the fast greedy ascent gets to the true worst-case configuration and whether the descent step is guaranteed to converge.
  • Self-Reinforcing Convergence: Empirically, Hamming-SAM naturally steers networks into regions where pairwise bit interactions ($|H_{ij}|$) collapse toward zero—flattening the interaction spectrum and making the optimizer's own greedy approximations even more accurate as training goes on.

Key Results

  • Robustness Gains Outpace Clean Gains: Across CIFAR-10/100 on ResNet-18, VGG-16, and ViT, Hamming-SAM beats all binary baselines, with corruption accuracy improvements averaging 3× larger than clean accuracy gains. On VGG-16 (CIFAR-10, $k=500$), clean accuracy rises from 91.65% (BOLD) to 92.15%, while mean corruption accuracy jumps from 70.56% to 72.39%.
  • Scales Where Latent-SAM Fails: On ImageNet (ResNet-50), latent-space STE-SAM actually degrades performance compared to standard STE (68.53% vs. 68.97% test accuracy), confirming that continuous-proxy pathologies worsen at scale. Hamming-SAM boosts top-1 accuracy from 69.03% to 69.72% and jumps OOD AUROC on ImageNet-C by +2.65 points (78.22% to 80.87%).
  • Taming Spiky Landscapes: At convergence on VGG-16, the standard deviation of sampled interaction Hessian entries drops by ~40× compared to standard Boolean training, and the "spikiness" ratio (largest interaction vs. fifth-largest) plummets from 53.5 down to 2.08–4.85 for $k \in [100, 500]$.

Limitations and Future Work

  • One-Shot vs. Sequential Ascent: Re-evaluating bit interactions after every single flip during Phase 1 would require $k$ backward passes per step. For tractability, Hamming-SAM selects all $k$ bits in one shot—trading a bounded interaction error for massive compute savings, and requiring $k$ to stay moderate (e.g., $k \in [100, 500]$; pushing to $k=10,000$ degrades accuracy and increases seed variance).
  • Oracle Approximations: While the core theory assumes exact discrete derivatives, practical training relies on single-pass backward approximations (like BOLD or STE) and multi-bit accumulators.
  • Future Directions: Because Hamming-SAM optimizes via discrete flips rather than smooth gradients, it opens the door to directly regularizing networks with non-differentiable measures—such as algorithmic Kolmogorov complexity approximations (Block Decomposition Method)—and applying discrete curvature tools across broader combinatorial optimization problems.

Summary updated

BibTeX
@inproceedings{tran2026navigating,
  author = {Ba-Hien TRAN},
  title = {{Navigating the Boolean Hypercube: Sharpness-Aware Minimization Directly in Discrete Loss Landscapes}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=evBaB8ZWOV},
}
Figure