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

$Z^2$-Sampling: Zero-Cost Zigzag Trajectories for Semantic Alignment in Diffusion Models

Haosen Li, Wenshuo Chen, Shaofeng Liang, Lei Wang, Kaishen Yuan, Yutao YuearXiv 2026

TL;DR

$Z^2$-Sampling delivers the high-quality semantic alignment benefits of complex "zigzag" sampling paths in diffusion models but at zero additional computational cost. By algebraically collapsing multi-step trajectories into a single step and using a dynamically cached temporal surrogate, it eliminates off-manifold spatial drift and restores the standard 2-NFE (Neural Function Evaluation) baseline speed.

What Problem Does This Paper Address?

Classifier-Free Guidance (CFG) is the backbone of text-to-image diffusion models, steering generations to match text prompts. However, standard CFG is "myopic": it operates strictly on instantaneous gradients, ignoring the highly non-linear curvature of the underlying data manifold. This often causes text-to-image models to struggle with dense, complex, or compositional prompts.

To fix this, recent advanced strategies like Zigzag Diffusion Sampling (Z-Sampling) introduce a lookahead-and-return mechanism—oscillating the latent trajectory forward and backward to probe local curvature. While this significantly improves semantic alignment, it comes with two severe penalties:

  1. Computational Overhead: It triples the inference cost (requiring 6 NFEs per step instead of the standard 2).
  2. Spatial Approximation Error: Evaluating the network at intermediate, uncorrected states pushes the latents off the true data manifold, leading to numerical drift, structural artifacts, and ugly color oversaturation.
Visualizing the structural paradigm shift from standard and explicit zigzag sampling to $Z^2$-Sampling.

Methods

The authors introduce $Z^2$-Sampling (Zero-cost Zigzag Sampling) to capture the benefits of curvature exploration without the physical overhead. Their approach relies on two core innovations:

  1. Trajectory Collapse via Exact Noise Reuse: The authors mathematically prove that the explicit forward-backward zigzag sequence is topologically reducible. Instead of evaluating the network at an out-of-distribution intermediate state, they recycle the unconditional noise evaluated at the exact on-manifold anchor. Through the intrinsic algebraic dualities of deterministic ODE solvers, the intermediate physical steps analytically cancel out, collapsing the two-step oscillation into a single deterministic translation and eliminating spatial error ($\tau(t) = 0$).
  2. Temporal Semantic Surrogate: To eliminate the remaining computational redundancy, they introduce a dynamically cached proxy ($\Delta \epsilon$). Leveraging the temporal coherence of continuous diffusion trajectories, they substitute exact spatial noise differences with cached noise differences from the previous timestep ($t+1$). This completely restores the standard baseline of one CFG evaluation (2 NFEs) per step.
Methodological comparison showing how $Z^2$-Sampling algebraically collapses the intermediate traversal and reuses a cached Temporal Semantic Surrogate.

Using Backward Error Analysis (BEA), the authors formally demonstrate that this discrete algebraic collapse implicitly synthesizes a modified Effective Vector Field. This field naturally incorporates a directional derivative curvature penalty that acts as a zero-cost geometric regularization, keeping the trajectory securely on the data manifold.

Datasets

The authors evaluated their method across several highly challenging, standardized benchmarks:

  • Text-to-Image: Pick-a-Pic (complex prompts and human preference labels), DrawBench (dense compositions and unusual spatial relations), and GenEval (fine-grained compositional and counting tasks).
  • Text-to-Video: ChronoMagic-Bench-150 (evaluating prompt fidelity and physical/temporal consistency).

Evaluations were performed across diverse architectures including U-Nets (SD-2.1, SDXL, ModelScope-1.7B) and Diffusion Transformers (Hunyuan-DiT, CogVideoX-2B).

Key Insights and Ideas

  • Topological Reducibility: The physical forward-backward steps of zigzag sampling are mathematically redundant. Reusing the on-manifold noise allows the intermediate state to be factored out entirely as a dummy variable.
  • Curvature Penalty as a Centripetal Force: The algebraic collapse naturally yields a curvature penalty ($-\h\gamma_1\nabla_{\Delta v}v$). This acts like a Riemannian centripetal force, preventing the latent state from escaping the manifold even under ultra-high guidance scales.
  • Temporal vs. Spatial Queries: Noise differences change slowly and predictably across timesteps. Exploiting this temporal coherence via caching allows the model to bypass expensive real-time spatial queries while preserving the local truncation error bound at $\mathcal{O}(h^2)$.

Key Results

  • Shattering the Pareto Frontier: $Z^2$-Sampling completely eliminates the performance-efficiency trade-off. For SDXL, it cuts inference time from 17.8 seconds (explicit Z-Sampling) back down to the standard baseline of 5.8 seconds (~3× speedup) while matching or exceeding generation quality.
Performance-Efficiency Pareto frontier showing winning rates and text-image alignment vs. inference time.
  • Superior Compositional Accuracy: On GenEval, $Z^2$-Sampling achieved a superior overall accuracy of 57.35%, noticeably outperforming explicit Z-Sampling in complex relational tasks like "Two Objects" (75.10% vs 74.75%) and "Counting" (46.80% vs 46.25%).
  • Visual Fidelity: Qualitatively, $Z^2$-Sampling successfully suppresses the color oversaturation and structural artifacts typical of explicit Z-Sampling, yielding photorealistic, text-aligned images and temporally smooth videos.
Qualitative comparison of text-to-image generation across different sampling methods.
  • Zero Memory Overhead: The VRAM overhead required to cache the surrogate tensor is an incredibly negligible $\sim$0.31 MB, making it highly practical for consumer hardware.

Limitations and Future Work

The primary limitation of $Z^2$-Sampling is its empirical dependency on a warmup phase. The continuous diffusion manifold is highly chaotic in its initial denoising steps, meaning the temporal surrogate requires a brief warmup period ($W=5$ steps for images, $W=10$ steps for videos) to stabilize.

Currently, these warmup windows are heuristically determined. The authors note that developing an adaptive mechanism to dynamically transition from standard CFG to $Z^2$-Sampling based on real-time trajectory curvature or signal-to-noise ratios remains an open and promising avenue for future research.

Empirical evaluation of cosine similarity across denoising steps, illustrating the necessity of the warmup phase.

Summary updated

BibTeX
@misc{li2026z,
  author = {Haosen Li and Wenshuo Chen and Shaofeng Liang and Lei Wang and Kaishen Yuan and Yutao Yue},
  title = {{$Z^2$-Sampling: Zero-Cost Zigzag Trajectories for Semantic Alignment in Diffusion Models}},
  year = {2026},
  eprint = {2604.23536},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2604.23536},
}
Figure