MarkovGen: Structured Prediction for Efficient Text-to-Image Generation

Sadeep Jayasumana, Daniel Glasner, Srikumar Ramalingam, Andreas Veit, Ayan Chakrabarti, Sanjiv Kumar

Abstract

Modern text-to-image (T2I) generation models, while capable of producing high-quality imagery, often suffer from significant computational overhead during the final stages of iterative refinement. We present MarkovGen, a novel approach that replaces the computationally expensive final sampling steps of token-based models with a lightweight, fully-connected Markov Random Field (MRF). By modeling the joint distribution of image tokens and enforcing spatial and label compatibility, MarkovGen achieves a 1.5x speedup over state-of-the-art models like Muse while simultaneously improving image quality and structural consistency.

Introduction

The current landscape of text-to-image generation is dominated by heavy, iterative models such as Stable Diffusion and Muse. These models typically employ billion-parameter Transformers to refine images from noise or masked tokens over many steps. A key observation is that the final stages of this process are primarily dedicated to ensuring local and global consistency—tasks for which massive Transformers may be overkill. For instance, ensuring that the left and right sides of a face are symmetrical or that textures remain consistent across an object does not necessarily require the full expressive power of a global attention mechanism at every step.

Example of structural artifacts in a base model generation, such as the distorted nose and eye region.

MarkovGen addresses this inefficiency by introducing a "lighter hammer" for the final polish: a structured prediction layer based on classical probabilistic graphical models.

Methodology

MarkovGen is built upon the Muse framework, which generates images using discrete VQGAN tokens. Instead of completing the full sequence of Transformer-based sampling steps, the process is truncated early. The resulting "unfinished" token probabilities are then passed to a fully-connected Markov Random Field (MRF).

Structured Prediction with MRFs

The core of MarkovGen is the MRF, which models the joint distribution of all image tokens. Unlike standard independent pixel/token prediction, the MRF explicitly accounts for:

  1. Spatial Compatibility: Learned weights that determine how much a token at one location influences another.
  2. Label Compatibility: Learned weights that model the likelihood of specific token pairs appearing in proximity.

Differentiable Inference

To integrate the MRF into a modern deep learning pipeline, the authors formulated mean-field inference as a differentiable neural network layer. This allows the MRF parameters to be optimized via backpropagation. The training involves a two-stage process: pre-training on masked-token prediction followed by fine-tuning to mimic the high-quality outputs of a full-scale Muse model.

Experimental Results

The model was trained on the large-scale WebLI dataset and evaluated using MS-COCO and Parti Prompts.

Efficiency and Speed

MarkovGen demonstrates a significant efficiency gain, operating 1.5x faster than the base Muse model. The MRF inference itself adds negligible overhead (less than 0.3ms), effectively replacing multiple Transformer steps that each take 10-24ms.

Image Quality and Human Preference

Quantitative evaluation on MS-COCO shows an improvement in Frechet Inception Distance (FID), with MarkovGen reaching 12.28 compared to Muse's 13.13. More importantly, human preference studies indicate a strong bias toward MarkovGen, with raters preferring its outputs 85.6% of the time.

MarkovGen refinement fixes structural inconsistencies, resulting in a more coherent and realistic image.

The model is particularly adept at resolving "broken" structures in complex subjects like faces and architectural textures, where traditional iterative sampling might fail to converge on a globally consistent state.

Conclusion and Future Work

MarkovGen proves that incorporating classical structured prediction techniques can significantly enhance the efficiency and quality of modern generative models. By offloading the final consistency checks to a specialized MRF layer, we achieve faster generation with fewer artifacts. Future research will explore making the MRF "prompt-aware" to improve alignment with complex text descriptions and investigating joint training of the base Transformer and MRF layer from scratch.

Summary updated

BibTeX
@inproceedings{jayasumana2024markovgen,
  author = {Sadeep Jayasumana and Daniel Glasner and Srikumar Ramalingam and Andreas Veit and Ayan Chakrabarti and Sanjiv Kumar},
  title = {{MarkovGen: Structured Prediction for Efficient Text-to-Image Generation}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2024},
  doi = {10.1109/cvpr52733.2024.00890},
}
Figure