Mind the Gap: Removing the Discretization Gap in Differentiable Logic Gate Networks

Shakir Yousefi, Andreas Plesner, Till Aczel, Roger Wattenhofer

TL;DR

Differentiable Logic Gate Networks (DLGNs) offer ultra-efficient inference by replacing heavy arithmetic with hardware-native logic gates, but they suffer from slow training and a severe performance drop when converting from "soft" training to "discrete" inference. This paper introduces Gumbel LGNs, which inject Gumbel noise and use a straight-through estimator to smooth the loss landscape. This simple change speeds up training by 4.5× in wall-clock time, slashes the discretization gap by 98%, and ensures 100% neuron utilization.

What Problem Does This Paper Address?

Deep neural networks are notoriously power-hungry. Logic Gate Networks (LGNs) solve this by expressing machine learning models directly in the native language of digital hardware—Boolean operations like AND, OR, and XOR. Because they bypass floating-point arithmetic entirely, LGNs enable incredibly fast and energy-efficient inference.

However, training discrete networks is notoriously difficult because discrete choices lack gradients. Differentiable LGNs (DLGNs) circumvent this by using a "soft" continuous relaxation during training (essentially a weighted sum of all 16 possible two-input logic gates).

The catch? After training, the network must be discretized for deployment by selecting the single gate with the highest weight. This mismatch creates a massive discretization gap—a significant drop in accuracy between the soft training model and the hard inference model. Furthermore, DLGN training is painfully slow (taking days to weeks) and leaves nearly half of the neurons uncollapsed and unused because the underlying loss landscape is sharp and brittle.

Methods

The authors propose Gumbel Logic Gate Networks (Gumbel LGNs) to align training dynamics with inference-time behavior.

Instead of a standard deterministic softmax over the 16 candidate logic gates, Gumbel LGNs inject stochastic Gumbel noise into the gate selection process during the forward pass. Crucially, they combine this with a Straight-Through (ST) Estimator:

  1. Forward Pass: The network makes a hard, discrete choice by selecting the single logic gate with the highest noise-perturbed logit.
  2. Backward Pass: Gradients are approximated using a continuous, soft Gumbel-Softmax relaxation, allowing backpropagation to function normally.
Figure 2: Overview figure. (a) DLGNs: Leftmost shows the internal structure of a node. We parameterize each node by weighing the 16 possible logic gates (shown below) and summing their output. This results in a hard, brittle, loss landscape, slowing convergence and increasing the discretization gap. (b) Gumbel LGNs: during training, we inject Gumbel noise on the 16 gate weights and select the logic gate with the highest weight. This results in a smoother loss landscape and aligns the training with the network at inference. This results in faster training and reduces the discretization gap. (c) Structure of DLGNs and Gumbel LGNs. Each neuron receives two inputs. The nodes in the final layer are aggregated by summation, thus producing class likelihoods. (d) Results of using Gumbel LGNs instead of DLGNs. We achieve up to 4.5× faster convergence (in wall-clock time), a 98% reduction in discretization gap, and 100% reduction of unused neurons.

Mathematically, the authors prove that adding Gumbel noise acts as an implicit Hessian regularizer. It minimizes the trace of the Hessian matrix, which forces the optimization algorithm toward flatter minima. A flatter loss landscape means the network is far less sensitive to the parameter perturbations caused by final discretization.

Datasets

The primary evaluations were performed on standard image classification benchmarks:

  • CIFAR-10
  • CIFAR-100

To demonstrate broader applicability and verify performance against baseline DLGNs, the authors also evaluated several MNIST-like baselines:

  • MNIST & QMNIST
  • EMNIST (both balanced and letters splits)
  • FashionMNIST
  • KMNIST

Key Insights and Ideas

  • Noise as a Geometry Smoother: Injecting stochastic Gumbel noise isn't just a trick to sample discrete variables; it fundamentally flattens the loss landscape. It acts as a curvature-penalizing regularizer that smooths out a noisy, brittle landscape into a well-behaved optimization bowl.
  • The "Goldilocks Zone" of Temperature: The Gumbel-Softmax temperature parameter ($\tau$) controls the strength of this implicit smoothing. If $\tau$ is too high ($>1$), there is almost no smoothing; if it's too low ($<0.1$), the network converges too slowly. A medium value ($\tau \approx 0.25$) hits the sweet spot for rapid convergence.
  • Solving Neuron Collapse: In standard DLGNs, early layers often fail to commit to a single gate, leaving nearly 50% of the network effectively unused. Gumbel LGNs force neurons to make hard choices during training, driving the entropy of gate distributions to near zero and ensuring every gate contributes to the final prediction.

Key Results

  • 4.5× Faster Wall-Clock Training: Although noise sampling adds a tiny computational overhead (~5% per iteration), Gumbel LGNs converge so much faster in terms of iteration count that they achieve a massive overall wall-clock speedup.
  • 98% Reduction in Discretization Gap: The performance discrepancy between the soft training network and the discrete inference network is virtually eliminated.
Figure 1: CIFAR-10 test accuracy compar- ison. Solid and dashed lines show discrete and soft performance, respectively. Gumbel LGNs (GLGN, red) demonstrate faster con- vergence and minimal discretization gap com- pared to DLGNs (DLGN, blue).
  • 100% Reduction of Unused Gates: Unused neurons dropped from roughly 49.81% in standard DLGNs to exactly 0.00% in Gumbel LGNs.
  • Visually Smoother Loss Surfaces: Using 2D loss landscape projections, the authors qualitatively confirmed that Gumbel LGNs successfully eliminate the chaotic, noisy local minima characteristic of baseline DLGNs.

Limitations and Future Work

  • Dataset Complexity: The empirical evaluation is limited to relatively simple image datasets (CIFAR and MNIST variants). Testing on larger, more complex datasets like ImageNet remains an open challenge.
  • Hyperparameter Sensitivity: The temperature parameter $\tau$ requires manual tuning to balance convergence speed and accuracy. The authors suggest adaptive temperature scheduling as a promising direction for future work.
  • Theoretical Simplifications: While the connection to Hessian trace minimization is proven under certain differentiability assumptions, a comprehensive theoretical treatment of the discretization gap itself is still an open problem.
  • Scaling Dynamics: A comprehensive analysis of width scaling and the interplay between network width and depth was left for future research.

Summary updated

BibTeX
@inproceedings{yousefi2025mind,
  author = {Shakir Yousefi and Andreas Plesner and Till Aczel and Roger Wattenhofer},
  title = {{Mind the Gap: Removing the Discretization Gap in Differentiable Logic Gate Networks}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2025},
  url = {https://openreview.net/forum?id=chYXaetMmz},
}
Figure