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

Spherical Flows for Sampling Categorical Data

Jannis Chemseddine, Gregor Kornhardt, Gabriele Steidl

TL;DR

This paper introduces a novel continuous flow-based generative model for discrete sequences by embedding tokens on a hypersphere $\mathbb{S}^{d-1}$ rather than in Euclidean space. By leveraging the von Mises-Fisher (vMF) distribution and its radial symmetry, the authors derive tractable conditional scores and velocities, enabling powerful predictor-corrector sampling. The resulting model significantly outperforms Euclidean baselines on text generation, Sudoku, and mathematical reasoning tasks.

What Problem Does This Paper Address?

While autoregressive large language models (LLMs) dominate text generation, they generate sequences token-by-token, which can be computationally inefficient. Non-autoregressive diffusion or flow-matching models offer an alternative by generating entire sequences simultaneously. However, adapting these continuous methods to discrete data (like text) is challenging.

Prior continuous embedding approaches typically map tokens into Euclidean space ($\mathbb{R}^d$) or onto a probability simplex. Euclidean spaces introduce an arbitrary distinction between a vector's direction (which determines token identity) and its magnitude (which often correlates with model confidence), leading to optimization mismatches. Simplex-based methods can be difficult to scale to large vocabularies.

This paper addresses these issues by constraining the continuous embedding space to the unit sphere $\mathbb{S}^{d-1}$, where direction is the only geometric property that matters.

Methods

The authors propose a continuous noise process directly on the sphere using the von Mises-Fisher (vMF) distribution, the spherical analogue of a isotropic Gaussian distribution.

The core technical challenge in flow matching is finding the conditional velocity field that drives the noise process. While the Riemannian score (gradient of the log-density) is easy to compute for a vMF distribution, the velocity field is generally intractable. The authors solve this by exploiting the radial symmetry of the vMF density. They prove that the high-dimensional continuity equation on $\mathbb{S}^{d-1}$ can be reduced to a simple, one-dimensional scalar ordinary differential equation (ODE) based purely on cosine similarity.

Illustration of von Mises–Fisher density on $\mathbb{S}^2$ for increasing concentration $\kappa$.

Key algorithmic highlights include:

  1. Single Learned Object: A neural network backbone is trained using a standard cross-entropy loss to predict the posterior token probabilities.
  2. Flexible Sampling: This single learned posterior provides closed-form access to both the marginal velocity (for deterministic ODE sampling) and the Riemannian score (for stochastic Predictor-Corrector sampling).
  3. Predictor-Corrector (PC) Sampling: Alternates between deterministic flow ODE steps (moving along the path) and Langevin diffusion corrector steps (snapping the noisy states closer to the true data manifold).

Datasets

The method was evaluated across three distinct domains using four datasets:

  • Sudoku-Extreme: A dataset of over 3 million challenging puzzles used to evaluate conditional generation and constraint satisfaction.
  • LM1B (One Billion Word Benchmark): Standard language modeling dataset used to evaluate unconditional text generation quality (perplexity vs. entropy).
  • OpenWebText: A large web-crawled corpus used to test scalability to GPT-2 scale models.
  • TinyGSM: A synthetic dataset of 11.8 million grade-school math problems paired with Python solutions, testing the model's capacity for mathematical reasoning.

Key Insights and Ideas

  • Dimension-Aware Scaling: Under standard geodesic interpolation (slerp), the expected cosine similarity between a noisy sample and its target remains bounded away from zero regardless of the dimension $d$. In contrast, the vMF path requires the concentration parameter $\kappa_t$ to scale proportionally with $d$ to maintain the same signal level. This means the vMF path's informative range scales correctly with the embedding dimension.
  • The Power of the Corrector: Deterministic ODE sampling alone does not show massive gains for the vMF path. The true "aha moment" occurs when switching on the Predictor-Corrector (PC) sampler. The corrector steps leverage the spherical geometry to aggressively clean up noise, allowing the vMF path to smoothly trade off perplexity and sample diversity (entropy).
Figure 1: LM1B gen. PPL against entropy at NFE = 128, sweeping ε; every curve is predictor-corrector. References that report an entropy are placed at it, AR is drawn as a horizontal line. Data entropy Hdata as a vertical dashed line. Configuration in Appendix D.1.3.

Key Results

  • Sudoku: The vMF path with PC sampling achieved 74.5% validity, significantly outperforming the Euclidean Variance Preserving (VP) baseline (69.1%) and discrete masked diffusion models (56.7%).
  • Mathematical Reasoning (TinyGSM): Combined with self-conditioning, vMF reached 43.5% accuracy on the GSM8K test set, vastly outperforming the Euclidean VP baseline (28.5%) and discrete models (18.0%).
TinyGSM accuracy against sampling budget (NFE).
  • Language Modeling: On OpenWebText and LM1B, vMF + PC sampling traced a vastly superior perplexity-entropy frontier compared to Euclidean alternatives, achieving lower generation perplexity at equivalent text diversity floors.

Limitations and Future Work

The primary limitation of the vMF path is its reliance on numerical methods to precompute the conditional velocity and radial cumulative distribution function (CDF). At very high concentrations ($\kappa$) and high embedding dimensions ($d$), the radial density can suffer from numerical underflow. Although the authors successfully mitigate this using a log-shifted density evaluation and a flux-based ODE formulation, it remains a point requiring careful implementation.

For future work, the authors suggest exploring other radially symmetric distributions on the sphere (such as power spherical or spherical Cauchy paths) which might offer fully closed-form velocities or different scaling properties.

Summary updated

BibTeX
@inproceedings{chemseddine2026spherical,
  author = {Jannis Chemseddine and Gregor Kornhardt and Gabriele Steidl},
  title = {{Spherical Flows for Sampling Categorical Data}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=uVMZotQcJ7},
}
Figure