Rotations on Latent Hyperspheres: A Geometry-Aware Guiding Framework for Diffusion Models

Luca Sacchetto, Klaus DiepoldNeurIPS 2026

TL;DR

Diffusion models are brilliant artists, yet notoriously sloppy physicists—they routinely generate outputs that look plausible on the surface while violating fundamental real-world constraints. By realizing that high-dimensional Gaussian noise actually lives on the thin shell of a giant hypersphere rather than in flat space, the authors train a lightweight reinforcement learning agent to gently rotate initial noise vectors into "sweet spots" before generation even begins. The result is fast, single-pass inference that dramatically improves physical and structural accuracy without touching a single weight of the underlying diffusion model.

What Problem Does This Paper Address?

Whether simulating fluid dynamics, designing proteins, or synthesizing images, purely data-driven diffusion models often hallucinate outputs that break strict domain rules (like conservation of mass or exact geometric counts).

Rather than enduring the massive expense of retraining or fine-tuning a giant model, researchers often turn to Latent Space Optimization (LSO)—tweaking the initial random noise fed into a frozen model to steer the final output. However, current LSO methods suffer from two major headaches:

  1. Inference bottlenecks: Most methods optimize each sample from scratch by backpropagating gradients through the entire denoising chain multiple times, making generation painfully slow.
  2. Geometric blindness: Standard optimizers step through latent space as if it were flat, Euclidean territory. Yet, in high dimensions ($n$), a curious quirk of probability—the Gaussian Annulus Theorem—dictates that random Gaussian vectors almost exclusively cluster on a thin spherical shell of radius $\sqrt{n}$. Naive Euclidean steps push vectors off this shell, degrading output quality unless clunky mathematical penalties or projections are used to force them back.

Methods

The authors introduce Rotational Latent Space Optimization (RLSO), combining high-dimensional geometry with reinforcement learning (RL):

  • Geometry-Aware $c$-fold Rotations (Novel): Instead of adding perturbation vectors that alter a latent vector's length, RLSO moves strictly along the hyperspherical shell using rotation matrices. Because parameterizing a full $n$-dimensional rotation is computationally prohibitive, the authors introduce a modular "$c$-fold rotation"—simultaneously rotating $c$ latent channels within mutually orthogonal 2D planes using Gram-Schmidt orthogonalization.
  • Continuous vs. Discrete Action Spaces (Novel): The RL agent chooses rotation directions and angles either continuously or from a discrete menu. Cleverly, the discrete directions are built from Hadamard matrices, whose columns are mutually orthogonal and maximally distant from coordinate axes—guaranteeing each rotation meaningfully alters the whole image rather than just a tiny local patch.
  • Amortized RL Policy (Standard PPO, New Formulation): Using Proximal Policy Optimization (PPO), a lightweight policy network learns a multi-step trajectory of rotations guided by black-box, non-differentiable reward functions. While training requires decoding samples to score them, inference is amortized: the trained policy rapidly rotates the starting noise a few times, requiring only a single denoising pass of the diffusion model to produce the final output.

Datasets

No brand-new datasets are introduced, though existing benchmarks are adapted to test three distinct domains:

  • Darcy Flow PDEs: 10,000 steady-state 2D fluid-flow solutions ($64 \times 64$ grids of permeability and pressure fields) from Bastek et al., evaluated by how well they obey physical mass conservation.
  • Voronoi SCM: A modified, $64 \times 64$ grayscale version of Deshpande et al.’s synthetic Stochastic Context Models dataset (10,000 images restricted to 16 regions), scored on strict geometric rules like edge straightness and region count.
  • Text-to-Image Prompts: Evaluated on Stable Diffusion 1.5 using fixed prompts (primarily "A photo of an astronaut riding a horse on mars") alongside a small random prompt set, scored via human-preference model ImageReward.

Key Insights and Ideas

  • Don't fight the hypersphere—skate on it: Standard unconstrained RL baselines completely flatline during training because Euclidean nudges wander off the Gaussian manifold. Rotating vectors preserves their norm automatically, keeping every exploratory step valid.
  • Less freedom means faster learning: Restricting the RL agent to a discrete set of Hadamard-derived directions outperforms continuous 360-degree freedom—converging faster, reaching higher rewards, and allowing RLSO to scale effortlessly to Stable Diffusion's massive 16,384-dimensional latent space.
  • Gradient-free flexibility: Because PPO doesn't need gradients from the reward function, you can plug in virtually any messy, non-differentiable physics solver or rule-checker to guide your generator.
Figure 1: Darcy Flow: RL training over 5 seeds (left) and residual error comparison evaluated on 10000 samples for one seed (right).

Key Results

Across all domains, RLSO substantially boosts adherence to target metrics in a single inference denoising pass:

  • Darcy Flow: Discrete RLSO slashes mean PDE residual error from 0.49 to 0.36 (~27% relative reduction), rivaling specialized physics-informed architectures. Matching this via naive brute-force ("best-of-$N$") sampling would require generating 300 samples per output.
  • Voronoi Geometry: Reduces structural violation errors by ~11% (continuous) and ~24% (discrete, from 2.04 down to 1.55), with peak runs hitting ~41% improvement (equivalent to a best-of-80 brute-force search).
  • Stable Diffusion 1.5: Boosts mean ImageReward from 1.28 to 1.63 (up to +1.26 gain in further tests) while improving independent CLIP alignment scores, confirming genuine visual improvement rather than "reward hacking."

Limitations and Future Work

RLSO is a navigator, not a creator: it can only uncover the best latent vectors already within the frozen model's learned distribution, meaning it cannot conjure features the base model never learned. Furthermore, a separate RL policy currently must be trained per downstream task (or specific prompt setup, as broad prompt generalization yielded a modest +0.01 gain), making it worthwhile mainly when you plan to generate enough samples to pay off the upfront training cost. Future work could swap PPO for more sample-efficient RL algorithms to speed up policy training.

Summary updated

Abstract

Diffusion models have emerged as a powerful tool across diverse domains. However, their purely data-driven nature can produce samples that violate domain-governing constraints. We introduce a plug-and-play reinforcement learning framework that optimizes initial noise samples in the latent space of frozen, pre-trained diffusion models. Leveraging the near-spherical geometry of high-dimensional Gaussian distributions, we introduce a novel rotation-matrix-based scheme for efficient latent space exploration. This steers the model toward more feature-preserving outputs, guided by task-specific rewards. We evaluate our method on three diffusion models: one trained on solutions of the Darcy Flow PDE, one on a synthetic dataset with complex structural features, and a text-conditioned one. Across all three settings, our framework yields significant improvements in sample quality, achieving a ~27% relative reduction in PDE residual, up to a ~41% relative improvement on the synthetic dataset's feature-alignment metric, and substantial gains in ImageReward, compared to the vanilla diffusion models. Finally, we show that rotation-matrix-based exploration significantly outperforms unconstrained exploration, validating our geometry-aware approach and establishing a more effective method for latent space control.
BibTeX
@inproceedings{sacchetto2026rotations,
  author = {Luca Sacchetto and Klaus Diepold},
  title = {{Rotations on Latent Hyperspheres: A Geometry-Aware Guiding Framework for Diffusion Models}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=mY8ppH3y0N},
}
Figure