LlamaGen
LlamaGen generates images by predicting discrete image tokens one at a time with a Llama-style Transformer.
Diffusion and generative · 1,026 operations Checked
Click or tap a spot to read it up close. Scroll or drag inside the diagram to move through it. Zoom with + and − or Ctrl and scroll. Press 0 for the whole graph. Swipe inside the diagram to move through it. Use + and − to zoom.
At a glance
- Parameters
- 110.9M
- Operations
- 1,026
- Framework
- PyTorch
- Recurrent
- No
- Published
- 2024, arXiv
- Cited by
- 12 (as of 24 October 2026)
- Authors
- Peize Sun, Yi Jiang, Shoufa Chen and others
- License
- MIT
- Checked
- Passed: the trace was replayed operation by operation and matched the model's own output for this input.
Files
The file opened in a new tab. Use your browser's Save command there to keep it.
The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.
Details
- Stable ID
- m17961
- Graph hash
- 6123c3b753643a72278b90b0bba2893244d43666fddf85c1902471180daf78e8
- Skeleton hash
- 43223f873bcbaa71419b4ad932940ee2bd078cd04c7a02f63b5dce3eabcef836
- Architecture hash
- d9fe2ad6a369ea4b080ef25d84a64be712f6cce9ba96e06777a700ca9e31f8ab
- Diagram SHA-256
- da6de601136cde29f92e2cfc24af510110d85f6c28fa0991e46e124d7c27eef1
- TorchLens version
- 2.36.0
- Renderer
- graphviz 2.43.0+pyvips 3.2.0+libvips 8.18.7+render-opts@06c1f0d3
- Check
- Forward pass replayed in PyTorch
What it is
LlamaGen is a family of image generation models that apply the next-token prediction approach of large language models to images. The paper frames it as a test of whether a plain autoregressive model such as Llama, with no built-in assumptions about visual signals, can reach the image generation quality of the leading methods when scaled properly.
An image tokenizer with the same encoder-quantizer-decoder architecture as VQGAN first turns an image into discrete tokens. The tokens are arranged into a sequence in raster scan order and used to train a Transformer-based autoregressive model. That model's architecture is largely based on Llama, with RMSNorm pre-normalization, the SwiGLU activation function and rotary positional embeddings. For class-conditional generation, the class embedding is used as the prefilling token embedding, and the image tokens are predicted after it. The authors do not use AdaLN, in order to keep the structure the same as a language model.
The paper reports class-conditional models ranging from 111M to 3.1B parameters, reaching 2.18 FID on the ImageNet 256x256 benchmark. It also reports a 326% to 414% speedup from serving the models with vLLM, an LLM serving framework. The authors note that their released models are still behind the leading diffusion-based visual generation models of the time.
Key idea. The paper shows that a Llama-style autoregressive Transformer without inductive biases on visual signals, scaled up to 3.1B parameters, reaches 2.18 FID on the ImageNet 256x256 benchmark.
- LlamaGen
- autoregressive image generation
- image generation
- next-token prediction
- class-conditional image generation
- text-conditional image generation
- image tokenizer
- Llama for image generation
- LlamaGen-B
AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.
Cite the paper
@misc{sun2024autoregressivemodelbeatsdiffusion,
title={Autoregressive Model Beats Diffusion: Llama for Scalable Image Generation},
author={Peize Sun and Yi Jiang and Shoufa Chen and Shilong Zhang and Bingyue Peng and Ping Luo and Zehuan Yuan},
year={2024},
eprint={2406.06525},
archivePrefix={arXiv},
primaryClass={cs.CV},
url={https://arxiv.org/abs/2406.06525},
}