Learning with Local Search MCMC Layers

Germain Vivier-Ardisson, Mathieu Blondel, Axel Parmentier · DOI

Abstract

This paper introduces a principled framework for integrating NP-hard combinatorial optimization problems into neural networks as differentiable layers. By reframing local search heuristics—such as simulated annealing—as Markov Chain Monte Carlo (MCMC) samplers, the authors enable the use of inexact, time-limited solvers while maintaining theoretical convergence guarantees. This approach bridges the gap between operations research heuristics and deep learning, providing a robust method for end-to-end learning in structured discrete domains.

Introduction: The Challenge of Combinatorial Layers

In differentiable programming, a significant goal is to embed complex decision-making steps, such as routing or scheduling, directly into neural architectures. Such "combinatorial layers" would ideally map continuous features to structured discrete solutions. However, most interesting combinatorial problems are NP-hard, making exact solutions during every forward pass computationally infeasible.

Existing methods for smoothing these layers often rely on two assumptions that rarely hold in practice:

  1. Gradient Continuity: Combinatorial layers are typically piecewise constant, leading to vanishing gradients that break standard backpropagation.
  2. Solver Exactness: Many theoretical frameworks assume an exact solver is available. When replaced by fast, inexact heuristics, the learning guarantees often vanish.

Methodology: Local Search as MCMC

The core contribution of this work is the realization that local search heuristics, which iteratively improve solutions by exploring "neighborhoods," can be formally treated as MCMC proposal distributions. By defining a combinatorial layer as the expected value of a solution under a Gibbs distribution, the authors transform problem-specific moves into a valid MCMC sampler.

The DVRPTW pipeline: a model predicts "prizes" (theta), and the MCMC layer finds routes (y).

Algorithm and Gradient Estimation

The framework utilizes the Metropolis-Hastings (MH) algorithm to sample from the desired distribution. By maintaining a constant "temperature," local search iterations become a Markov chain that converges to the stationary Gibbs distribution. To train these layers, the authors employ a Fenchel-Young loss. The gradient of this loss is elegantly simple: the difference between the average solution found by the MCMC sampler and the ground-truth solution.

A key advantage of this formulation is its theoretical rigor. Unlike previous methods, this framework provides convergence guarantees even when the MCMC chain has not fully mixed, making it suitable for short-run, inexact searches common in real-time applications.

Experimental Evaluation

The approach was evaluated on two primary tasks: the Dynamic Vehicle Routing Problem with Time Windows (DVRPTW), based on the EURO Meets NeurIPS 2022 challenge, and a synthetic binary vector prediction task used to validate gradient estimators against exact baselines.

Key Results

The MCMC-based layer was compared against state-of-the-art perturbation-based baselines. The results highlight the efficiency of the proposed method in low-time regimes.

Comparison of training methods under different time limits (ms). Lower values indicate better performance.

As shown in the table above, the proposed method significantly outperforms the baseline when the solver is constrained to very short time limits (e.g., 1ms to 100ms). At a 1ms limit, the proposed method achieved a relative cost of 7.8% compared to the baseline's 65.2%. This efficiency allows for training on larger problem instances that were previously computationally prohibitive.

Conclusion and Future Work

By repurposing decades of research in local search heuristics as MCMC proposal distributions, this work provides a robust path for integrating combinatorial optimization into deep learning. While the current framework handles neighborhood-based heuristics effectively, future work aims to incorporate Large Neighborhood Search (LNS), which uses exact sub-solvers for portions of the solution. Additionally, optimizing the forward pass to reduce the bottleneck of iterative search remains an active area of research.

Summary updated

BibTeX
@inproceedings{vivierardisson2025learning,
  author = {Germain Vivier-Ardisson and Mathieu Blondel and Axel Parmentier},
  title = {{Learning with Local Search MCMC Layers}},
  booktitle = {DiffCoALG @ NeurIPS},
  year = {2025},
  url = {https://openreview.net/forum?id=SksmqlJk00},
}
Figure