Nonlocal optimization of binary neural networks

Amir Khoshaman, Giuseppe Castiglione, Christopher SrinivasaarXiv 2022 · DOI

Introduction

Binary Neural Networks (BNNs), characterized by weights and activations restricted to $\{-1, 1\}$, offer significant advantages for edge computing due to their minimal memory and compute requirements. However, their discrete nature makes training exceptionally difficult. Traditional gradient-based methods, such as the Straight-Through Estimator (STE), rely on local approximations that often fail in highly constrained or under-parameterized regimes, where the loss landscape is riddled with sharp, sub-optimal local minima.

This paper introduces a "nonlocal" optimization framework based on message-passing algorithms from statistical mechanics—specifically Belief Propagation (BP) and Survey Propagation (SP). By reframing BNN training as a constraint satisfaction problem (CSP), the authors enable the exploration of the solution space beyond local gradients.

Stochastic Nonlocal Message Passing (SNMP)

The primary challenge in applying message passing to neural networks is the high degree of connectivity; a single neuron (factor) is connected to many weights (variables), making exact message calculation computationally intractable. The authors propose Stochastic Nonlocal Message Passing (SNMP) to overcome this:

  1. Stochastic Belief Propagation (SBP): Uses Monte Carlo sampling to estimate messages, replacing exponential sums with expectations over weight distributions.
  2. Stochastic Survey Propagation ($S^4P$): An extension of SP that tracks multiple solution clusters simultaneously, also utilizing stochastic sampling for high-degree factors.
  3. Max-Sat Relaxation: To handle non-separable data, the authors introduce an inverse temperature parameter ($\beta$), transforming the hard CSP into a probabilistic energy minimization problem.

Validation and Consistency

A critical step in the proposed method is ensuring that the stochastic approximations (SBP and $S^4P$) remain faithful to the exact, deterministic versions of BP and SP. The authors validated this on small-scale problems where exact computation is still feasible.

Consistency between exact message passing (BP, $S^3P$) and the proposed stochastic approximations (SBP, $S^4P$). Bubble sizes indicate the number of samples ($L$) used for estimation.

As shown in the figure above, the stochastic versions demonstrate high correlation with exact results, with accuracy improving as the number of samples ($L$) increases. This confirms that sampling is a viable bridge for applying these physics-inspired algorithms to dense neural architectures.

Exploring the Solution Space

The advantage of message passing, particularly $S^4P$, is most evident in the under-parameterized regime. While local methods like Gradient Descent (GD) often fail when the number of constraints is high relative to the number of variables, SNMP can "see" the broader structure of the solution space.

Evolution of weight marginals during $S^4P$ optimization ($L_{SP}=500$). The heatmap shows how the algorithm explores and eventually 'freezes' into a valid weight configuration, achieving 100% accuracy.

Visualizing the evolution of weight marginals reveals how $S^4P$ maintains a "mixed" state, exploring various potential solution clusters before converging. This contrasts with BP, which often locks onto a single candidate too early, potentially missing the global optimum.

Key Results and Future Directions

The authors evaluated SNMP on synthetic datasets (Glass, Stained Glass) and real-world benchmarks like MNIST. Key findings include:

  • Superiority in Tight Regimes: SNMP significantly outperforms local gradient methods in highly constrained settings.
  • Competitive Performance: On MNIST, SNMP achieves results comparable to SGD across various architectures, including MLPs and small ConvNets.

Despite these successes, challenges remain regarding scalability to deep architectures like ResNets due to memory overhead. Future work will focus on optimizing message storage and exploring the persistence of nonlocal benefits in over-parameterized models.

Summary updated

BibTeX
@misc{khoshaman2022nonlocal,
  author = {Amir Khoshaman and Giuseppe Castiglione and Christopher Srinivasa},
  title = {{Nonlocal optimization of binary neural networks}},
  year = {2022},
  eprint = {2204.01935},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2204.01935},
}
Figure