DISCS: A Benchmark for Discrete Sampling

Katayoon Goshvadi, Haoran Sun, Xingchao Liu, Azade Nova, Ruqi Zhang, Will Sussman Grathwohl, Dale Schuurmans, Hanjun DaiSODS @ ICML 2023

Abstract

Sampling in discrete space, with critical applications in simulation and optimization, has recently aroused considerable attention from the significant advances in gradient-based approaches that exploits modern accelerators like GPUs. However, two key challenges seriously hinder the further research of discrete sampling. First, since there is no consensus for the experimental setting, the empirical results in different research papers are often not comparable. Secondly, implementing samplers and target distributions often require nontrivial amount of effort in terms of calibration, parallelism, and evaluation. To tackle these challenges, we propose DISCS (DISCrete Sampling), a tailored package and benchmark that supports unified and efficient implementation and evaluations for discrete sampling from three types of tasks, namely the sampling for classical graphical models, combinatorial optimization, and energy based generative models. Throughout the comprehensive evaluations in DISCS, we also learned new insights in terms of the scalability, the design principle of proposal distributions, and lessons for the adaptive sampling design. DISCS implements representative discrete samplers in existing research works as baselines, and offers a simple interface that researchers can conveniently design new discrete samplers and compare with baselines in a calibrated setup directly.

Introduction

Sampling from discrete spaces—where variables take on specific categories or binary values—is a fundamental challenge across scientific domains, from simulating spin glasses in physics to solving complex logistics problems and generating text in natural language processing. Unlike continuous spaces, where smooth gradients can guide optimization, discrete spaces are inherently discontinuous. While traditional methods like Gibbs sampling have been the standard for decades, they often struggle with slow convergence in high-dimensional settings.

Recently, a new family of "locally balanced" samplers has emerged as a promising alternative, utilizing gradient-like information to inform transitions. However, the lack of a standardized benchmarking framework has led to inconsistent experimental settings and incomparable results across the literature. DISCS addresses this by providing a unified, JAX-based library for the rigorous evaluation of discrete samplers.

The DISCS Framework

DISCS automates the complexities of parallelization and hyperparameter calibration on modern hardware (GPUs/TPUs). The core of the benchmark focuses on Locally Balanced Samplers, which use a "ratio-informed" approach to evaluate transitions between states. Key implemented baselines include:

  • Gibbs with Gradients (GWG): Approximates optimal discrete flips using gradient information.
  • Path Auxiliary Sampler (PAS): Utilizes auxiliary paths to enable jumps to larger neighborhoods.
  • Discrete Langevin Monte Carlo (DLMC): Adapts continuous Langevin dynamics for discrete state spaces.

Key Insights: Temperature and Scalability

The Role of Temperature and Weight Functions

A critical finding in the DISCS benchmark is the interaction between the sampler's weight function $g(t)$ and the landscape's "temperature." The choice of weight function significantly impacts the Effective Sample Size (ESS).

The relationship between weight functions and inverse temperature shows that different functions excel at different temperature regimes.

As shown in Figure 5, the standard weight function $g(t) = \sqrt{t}$ performs well in high-temperature (smooth) landscapes. However, in "sharp" landscapes (low temperature), such as those found in overparameterized neural networks, the function $g(t) = t/(t+1)$ proves superior.

Scalability in High Dimensions

Traditional samplers like Random Walk Metropolis (RWM) and Gibbs sampling experience a sharp decline in efficiency as the dimensionality of the problem increases. Locally balanced samplers maintain significantly higher efficiency, making them essential for large-scale applications.

Efficiency (ESS per clock second) of various samplers on the Ising model as grid dimensions increase.

Figure 3 illustrates this scalability on the Ising model. While the performance of traditional methods drops precipitously as the grid size grows from 25x25 to 250x250, locally balanced methods like DLMC and PAS maintain much higher ESS per clock second, demonstrating their viability for large-scale problems.

Benchmarking Results

DISCS evaluates samplers across three primary domains:

  1. Classical Graphical Models: In physics-inspired models like Ising and Potts, DLMC consistently provides the highest ESS per second.
  2. Combinatorial Optimization: For tasks like MaxCut and Maximum Independent Set (MIS), PAS emerges as the dominant method, finding high-quality solutions faster than traditional heuristics on large-scale graphs.
  3. Energy-Based Generative Models (EBMs): In text-filling tasks using BERT, locally balanced samplers with the $t/(t+1)$ weight function produce significantly more diverse and higher-quality outputs compared to standard random walks.

Conclusion

DISCS brings much-needed standardization to the field of discrete sampling. By providing a "living" benchmark and a high-performance implementation library, it enables researchers to focus on algorithmic innovation. The findings highlight that locally balanced samplers are the clear successors to traditional methods for high-dimensional discrete problems. Future work will expand DISCS to include zero-order methods and hybrid continuous-discrete models.

Summary updated

BibTeX
@inproceedings{goshvadi2023discs,
  author = {Katayoon Goshvadi and Haoran Sun and Xingchao Liu and Azade Nova and Ruqi Zhang and Will Sussman Grathwohl and Dale Schuurmans and Hanjun Dai},
  title = {{DISCS: A Benchmark for Discrete Sampling}},
  booktitle = {SODS @ ICML},
  year = {2023},
  url = {https://openreview.net/forum?id=9LoW5l6r4z},
}
Figure