Test-Time Anchoring for Discrete Diffusion Posterior Sampling

Litu Rout, Andreas Lugmayr, Yasamin Jafarian, Srivatsan Varadharajan, Constantine Caramanis, Sanjay Shakkottai, Ira Kemelmacher-Shlizerman

Introduction

Discrete diffusion models are emerging as a powerful, unified framework for both text and image generation. However, they have historically struggled with "posterior sampling"—the process of guiding a pre-trained model to solve specific inverse problems, such as image restoration or constrained text generation, without retraining. To address this, researchers have introduced Anchored Posterior Sampling (APS). APS leverages a differentiable surrogate for discrete tokens and an adaptive decoding strategy to achieve state-of-the-art results with significantly faster inference than continuous diffusion counterparts.

The Challenge of Discrete Posterior Sampling

Diffusion models are generally categorized into continuous frameworks (adding Gaussian noise to pixels or latents) and discrete frameworks (masking or replacing categorical tokens). While continuous models have dominated image generation, discrete models offer a more natural fit for text and provide finer control over localized image features.

The primary challenge arises during posterior sampling. In continuous diffusion, gradients can easily "nudge" the denoising process toward a solution that matches observations. In discrete space, however, categorical tokens are non-differentiable. Previous attempts to bypass this issue—such as split Gibbs samplers, derivative-free methods, or continuous relaxations—have proven to be too slow, too weak, or overly restricted to specific architectures.

Methodology: Anchored Posterior Sampling (APS)

APS overcomes the non-differentiability of discrete tokens through two primary innovations:

1. Quantized Expectation

Instead of sampling a single discrete token during the optimization step, APS computes an "expected embedding"—a weighted average of codebook entries. This expected embedding is passed through the decoder. By utilizing a Straight-Through Estimator (STE), gradients can flow back from the task-specific loss (e.g., image reconstruction) to update the model's internal probability distribution. This effectively "tilts" the model's predictions toward the desired outcome without requiring any model retraining.

2. Anchored Remasking

Standard discrete models often unmask tokens randomly or based on raw confidence, which can cause the model to hallucinate background details before the main subject is established. APS introduces an adaptive decoding strategy that identifies "anchor" tokens—the most informative parts of the sequence that are consistent with the measurements. By unmasking these anchors early, APS drastically reduces the entropy (uncertainty) for the remaining tokens, yielding highly coherent generations.

Experimental Setup and Key Results

The researchers evaluated APS across diverse domains, including high-resolution faces (FFHQ) and natural images (ImageNet) up to 1024x1024 resolution, as well as complex language prompts using a 7B-parameter diffusion language model.

  • State-of-the-Art Image Restoration: APS outperformed existing discrete samplers (like G2D2 and SGDD) across all image benchmarks. For instance, on FFHQ super-resolution, it improved the perceptual similarity metric (LPIPS) by 13.65% and reconstruction quality (PSNR) by 2.11%.
  • Efficiency and Scalability: Because discrete diffusion requires far fewer steps to generate high-quality samples, APS is roughly 6x faster than continuous latent diffusion models (like PSLD) while achieving comparable or superior results. Furthermore, the "Large" variant (APS-L) successfully scaled to 1024x1024 resolution, a computationally prohibitive feat for many continuous posterior samplers.
  • Language Enhancements: When applied to a diffusion language model, APS achieved a 21.99% relative improvement in question-answering quality, producing more structurally coherent and semantically rich text.

Limitations and Future Directions

Despite these advances, APS faces a few limitations. Its output quality is inherently bound by the underlying visual tokenizer (e.g., MagVIT-v2); any improvements in discrete tokenization will directly boost APS performance. Additionally, while discrete models are rapidly improving, the absolute best continuous foundation models currently maintain an edge in raw generative quality for certain scenarios. Finally, because APS optimizes a surrogate objective, it is not asymptotically exact, which may introduce slight biases compared to slower Markov Chain Monte Carlo (MCMC) methods.

Ultimately, APS represents a significant step toward unified, multimodal "everything-to-everything" models, proving that discrete diffusion can be efficiently and effectively guided for complex inverse problems.

Summary updated

BibTeX
@inproceedings{rout2026test,
  author = {Litu Rout and Andreas Lugmayr and Yasamin Jafarian and Srivatsan Varadharajan and Constantine Caramanis and Sanjay Shakkottai and Ira Kemelmacher-Shlizerman},
  title = {{Test-Time Anchoring for Discrete Diffusion Posterior Sampling}},
  booktitle = {International Conference on Machine Learning},
  year = {2026},
  url = {https://openreview.net/forum?id=rdWE5ol3ps},
}
Figure