This process is a two-stage generation-and-filtering pipeline. First, the input text is BPE-encoded into a token sequence and fed into the trained second-stage Transformer prior model. The model autoregressively generates a sequence of 1,024 image tokens through stochastic sampling, controlled by a temperature parameter (typically set to 1). This process can be repeated to obtain multiple candidate sequences. Each candidate token sequence is then fed into the frozen first-stage dVAE decoder to reconstruct a 256×256 candidate pixel image. Due to the stochastic nature of autoregressive sampling, a critical contrastive reranking step is introduced to ensure output quality: a pretrained contrastive model (such as CLIP) computes a matching score between each candidate image and the original text, and the highest-scoring image is selected as the final output. This combines the creativity of the generative model (producing diverse candidates) with the precision of the discriminative model (accurately evaluating image-text relevance), effectively improving the reliability and quality of zero-shot text-to-image generation.