Skip to content

Image-language and multimodal models · Image-language and multimodal models · MM019 · Model

DALL·E: original autoregressive text-to-image model

Models text and discrete image tokens in one autoregressive stream. The original DALL·E is a historically important bridge from language-style sequence modeling to text-conditioned image generation, distinct from later…

Runs as a notebook Complete calculation CodeSplash's run and the reference's record

In CodeSplash

No method yet, but the reference's example runs here as a notebook.

Do it in CodeSplash Open the reference's example as a Python or R notebook.

Availability
Runs as a notebook
Code example
Complete calculation
Who ran it
CodeSplash's run and the reference's record
CodeSplash's run
The reference's example ran in Python and R here, and they agree.
The reference's record
Python: Ran in the reference's review. The report doesn't record which version of the code ran. R: Reviewed but not run: R wasn't available to the reference's authors.

Purpose

Models text and discrete image tokens in one autoregressive stream. The original DALL·E is a historically important bridge from language-style sequence modeling to text-conditioned image generation, distinct from later diffusion-based DALL·E systems.

Question / objective

Can autoregressive prediction of compressed image tokens conditioned on text generate images for novel descriptions? The learning target replaces a null/alternative hypothesis formulation; benchmark evaluation is a separate statistical task.

Method type and supervision

Model/system family. Image-language or broader multimodal learning using the paired, generated or task-specific supervision described below. This is not a classical significance test.

Architecture / computational structure

A discrete image autoencoder converts images to code tokens; a transformer models concatenated text and image tokens with causal attention. Image-token samples are decoded into pixels; optional sample-ranking procedures are separate from the core generative likelihood.

Assumptions

The tokenizer bounds image detail, and autoregressive likelihood does not guarantee compositional correctness. Prompt-distribution overlap, sample selection and re-ranking can inflate qualitative impressions. The original paper does not imply access to current proprietary products or their internals.

Formula / computational definition

p(z∣c)=∏ipθ(zi∣c,z<i)p(z\mid c)=\prod_i p_\theta(z_i\mid c,z_{<i}), where zz are discrete image codes and cc text. The tokenizer has its own compression objective; transformer training uses token cross-entropy under its sequence layout. This captures the central mechanism; consult the primary source for all masks, stages, normalizations and loss terms.

Parameters and notation

Learned/estimated quantities: Tokenizer/codebook/decoder and transformer parameters are learned in separate stages. Vocabulary, image compression, token order and sampling temperature are design choices. Hyperparameters and design choices: Codebook size, spatial compression, sequence length, text context, sampling temperature and number of candidate samples affect quality and cost.

Fitting, fine-tuning, and adaptation

A custom reproduction can freeze the tokenizer while adapting the token transformer on domain pairs. Changing the codebook changes token meanings and requires retokenization. Exact original full-model fine-tuning availability is not assumed. Save the exact trainable-module selection, data split, loss, optimizer and processor configuration; distinguish parameter adaptation from inference-time prompt tuning.

How to use and calibrate

Choose a specific model/processor and task protocol, validate preprocessing on known examples, tune only on a held-out development set and freeze the final evaluation. Evaluate prompt adherence, composition, diversity and tokenizer reconstruction separately; report any candidate selection or re-ranking.

Example application

Generate a small image from a text description by sampling its discrete visual-code sequence.

Interpretation / pitfalls

Watch out

Reported capability is conditional on available visual evidence, data coverage and the chosen task. Evaluate prompt adherence, composition, diversity and tokenizer reconstruction separately; report any candidate selection or re-ranking. A successful numeric component example is not evidence that a complete system achieves a published benchmark score.

Python and R code examples

Component: Compute image-token likelihood after a text prefix. Dependencies: shared NumPy/base-R setup above. Python: executed successfully. R: unexecuted. Complete model training/inference: not run.

Full implementation routes: Python: implement a documented discrete-image tokenizer plus autoregressive transformer as a research reproduction; do not claim the complete original system is provided by this toy code. R: compute token objectives natively and bridge neural compression/generation.

Python and R

The reference's own programs, shown as written. A component demo shows one central piece of the method; it doesn't train a full model.

Python

Complete calculation — Compute image-token likelihood after a text prefix.

Shared setup for this chapter
import numpy as np
def softmax(x):
    z = np.asarray(x, dtype=float)
    e = np.exp(z-z.max())
    return e/e.sum()
prefix=["a","red","cube"]
image_tokens=np.array([1,0,2])
prob=np.array([[.1,.8,.1],[.7,.2,.1],[.2,.2,.6]])
image_nll=-np.log(prob[np.arange(3),image_tokens]).sum()
print("text prefix",prefix,"image-token NLL",image_nll)
R

Complete calculation — Compute image-token likelihood after a text prefix.

prefix <- c("a","red","cube"); image_tokens <- c(2L,1L,3L)
prob <- rbind(c(.1,.8,.1),c(.7,.2,.1),c(.2,.2,.6))
image_nll <- -sum(log(prob[cbind(1:3,image_tokens)]))
print(prefix); print(image_nll)

Sources

From the CodeSplash reference, entry MM019.