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

Discrete Neural Flow Samplers with Locally Equivariant Transformer

Zijing Ou, Ruixiang Zhang, Yingzhen Li

TL;DR

Discrete Neural Flow Samplers (DNFS) provide a new, efficient way to sample from unnormalized discrete distributions by learning the "flow" of a continuous-time Markov chain. By combining a novel Locally Equivariant Transformer architecture with variance-reduction techniques, the authors achieve state-of-the-art performance in training energy-based models and solving complex combinatorial optimization problems.

The Challenge of Discrete Sampling

Sampling from discrete distributions—such as the configurations of atoms in a crystal or the nodes in a graph—is a cornerstone of scientific computing. However, we often only know these distributions "up to a constant" (unnormalized). For example, we might know the energy of a specific state, but calculating the total "partition function" (the sum of energies over all possible states) is computationally impossible for large systems.

Traditional methods like Markov Chain Monte Carlo (MCMC) are the gold standard but often suffer from "slow mixing," where the sampler gets stuck in local minima and takes an impractical amount of time to explore the full space. Recent "neural samplers" attempt to learn the distribution directly using deep learning, but they often struggle with the discrete nature of the data or become computationally explosive as the number of dimensions increases.

Introducing Discrete Neural Flow Samplers (DNFS)

The authors introduce Discrete Neural Flow Samplers (DNFS), which treat sampling as a dynamic process. Instead of jumping between states like traditional MCMC, DNFS learns a rate matrix that describes how probability "flows" over time from a simple noise distribution to the complex target distribution.

Key Innovations

  1. The Kolmogorov Objective: The model is trained to satisfy the Kolmogorov forward equation, which mathematically describes how probability distributions evolve in a Markov process.
  2. Stein Control Variates: Because the partition function is unknown, the training objective usually suffers from massive variance. The authors use "Discrete Stein Identities" to create control variates—essentially a mathematical "baseline"—that drastically reduces noise during training, allowing for stable optimization via coordinate descent.
  3. Locally Equivariant Transformer (leTF): This is the architectural "secret sauce." Standard neural networks are slow in this context because they must be evaluated many times to calculate the rates for every possible neighbor of a state.
Architecture of the Locally Equivariant Transformer (leTF)

The leTF uses a "hollow" design (where the $i$-th output doesn't depend on the $i$-th input) and dual causal Transformers (Left-to-Right and Right-to-Left). This allows the model to compute the transition rates for all dimensions in a single forward pass, making it $O(1)$ relative to the neighborhood size.

Key Insights and Synergy

  • One-Way Flows are Sufficient: The paper leverages a proof showing that any probability path can be represented by a "one-way" rate matrix (where if you can go from $x$ to $y$, you cannot immediately go back). This significantly simplifies the neural network's job.
  • The Power of "Hollow" Networks: By enforcing that the network's prediction for a specific bit cannot "see" that bit's current value, they guarantee a property called local equivariance. This ensures the model treats all possible bit-flips consistently.
  • Synergy with MCMC: Because DNFS learns the marginal distributions at every time step, it can be seamlessly combined with traditional MCMC. The neural sampler provides a highly accurate "warm start," and a few MCMC steps at the end refine the solution to near-perfection.

Experimental Results

The researchers evaluated DNFS across three distinct domains: synthetic Energy-Based Models (EBMs), statistical physics (the Ising Model), and combinatorial optimization (Maximum Independent Set and MaxCut).

Performance comparison of leTF against baseline architectures, showing superior RMSE and Effective Sample Size (ESS)
  • Superior EBM Training: DNFS outperformed standard methods like Persistent Contrastive Divergence (PCD) and ALOE+ on synthetic benchmarks, achieving lower Maximum Mean Discrepancy (MMD) and better capturing multi-modal distributions.
  • High-Fidelity Physics Sampling: On the Ising model, DNFS achieved an Effective Sample Size (ESS) near 1.0, meaning almost every sample generated was independent and useful. It significantly outperformed baselines like GFlowNet, which struggled to capture the correct energy modes.
  • Solving Hard Graphs: In the Maximum Independent Set task, DNFS combined with a refinement step (DNFS+DMALA) achieved results nearly identical to the Gurobi solver (the industry-standard commercial oracle), while being much faster for inference.

Limitations and Future Work

While powerful, DNFS has a few hurdles to clear:

  • High-Dimensional Scaling: The loss function involves a summation over all dimensions. While the leTF architecture makes this more efficient, extremely high-dimensional spaces can still lead to "exploding loss" values.
  • Binary vs. Categorical: Most of the current work focuses on binary spaces (0 or 1). Extending this to large categorical spaces (like text tokens) is theoretically possible but computationally more expensive.
  • Approximation Bias: The authors found that using Taylor approximations to speed up certain calculations introduced bias that hurt sample quality, leading them to stick to exact (but slower) parallel computations for complex energy functions.

Future work will likely focus on stabilizing training for even larger scales and exploring "masked diffusion" settings to handle more structured discrete spaces.

Summary updated

BibTeX
@inproceedings{ou2025discrete,
  author = {Zijing Ou and Ruixiang ZHANG and Yingzhen Li},
  title = {{Discrete Neural Flow Samplers with Locally Equivariant Transformer}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2025},
  url = {https://openreview.net/forum?id=Wk65okms3T},
}
Figure