Autoregressive Token World Models › From Latent States to Token Sequences

Michael BrenndoerferJune 27, 20265 min read
World Models HandbookAll chapters
Part 5 of 12World-Model Architectures
Chapter 27Autoregressive Token World Models › From Latent States to Token Sequences
Reading section 2 of 11 · From Latent States to Token Sequences · 5 minSection 2 of 11 · 5 min

Book contents

Section 2 of 11 · 5 min read

Autoregressive Token World Models › From Latent States to Token SequencesOne section · Sections in this chapter2 / 11 ↓
Reading tools Definitions & inline links

Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.

Article links

Make inline references clickable

Before diving into tokenizers, it is worth being explicit about what changes relative to the recurrent state-space models of Part V: World-Model Architectures.

A recurrent world model carries a fixed-width state hth_t. At fixed numerical precision its storage capacity is finite, but the state can still be a sufficient statistic for a task. A strict window-conditioned token model instead recomputes predictions from the most recent WW token IDs and their positions. Those IDs are retained exactly, not the pre-tokenization observations. Rolling multilayer KV caches are a different implementation: retained contextual representations can encode information from tokens whose original entries have since been evicted.

Both designs allocate finite resources to an unbounded past. The recurrent summary may preserve selected information from arbitrarily long ago; the explicit token buffer preserves a bounded record. Neither guarantees successful prediction: representation loss, available context, learned attention, and optimization all matter. Direct availability of a token is not the same as retrieving its useful content.

This difference has consequences worth internalizing early:

  • Memory quality: a strict token buffer preserves its stored symbols exactly. A recurrent state can preserve selected old facts or an adequate filtering statistic without preserving the full record. A relevant event outside a recomputed buffer is unavailable only if no retained evidence represents it. Tasks needing recent fine detail and tasks needing distant events therefore suggest different tests, not an automatic architecture ranking.
  • Per-step compute: at fixed dimensions, a recurrent update has O(1)O(1) work in elapsed history. A cached new-token attention query has O(W)O(W) mixing work; recomputing dense attention over the entire prefix costs O(W2)O(W^2) per generation step. KV caching reuses earlier projections because a causal model's earlier states do not depend on future tokens, provided positions and other state conventions remain consistent. The cache uses O(W)O(W) storage. Dense full-sequence training has quadratic pairwise attention work, distinct from the linear cached-query cost.

The next cell plots illustrative asymptotic growth, with each curve separately normalized to one at the smallest window. It is not a timing benchmark or a claim that the methods have equal costs at that window. It also computes cache storage for one sequence with full-width keys and values, width 1,024, 12 layers, and two-byte entries; other head layouts, batch sizes, or precisions change that accounting.

In[3]:
Code
import numpy as np

window_lengths = np.array([256, 512, 1024, 2048, 4096, 8192, 16384, 32768])

## Relative per-step cost, normalized so the recurrent update at the smallest
## window costs 1. A recurrent state update is O(1) in history length.
recurrent_step = np.ones_like(window_lengths, dtype=float)

## With a KV cache, each new token attends over all W cached tokens: O(W).
cached_step = window_lengths / window_lengths[0]

## Without a cache, every step recomputes attention over the full window: O(W^2).
uncached_step = (window_lengths.astype(float) ** 2) / (window_lengths[0] ** 2)

## KV-cache memory: d_model=1024, 12 layers, K and V tensors, 2 bytes (fp16) each.
D_MODEL, N_LAYERS, BYTES = 1024, 12, 2
kv_mb = window_lengths * D_MODEL * 2 * N_LAYERS * BYTES / 1e6
print(f"KV-cache memory at 32768 tokens: {kv_mb[-1]:.2f} MB per sequence")
Out[3]:
Console
KV-cache memory at 32768 tokens: 1610.61 MB per sequence
Out[4]:
Visualization
Log-log chart: recurrent cost flat, cached transformer linear, uncached quadratic.
Separately normalized asymptotic per-token costs at fixed model dimensions, not measured latency. A full-width, batch-one fp16 KV cache with 12 layers and width 1,024 occupies 1.61 GB at 32,768 tokens; other head layouts and precisions change this.
  • Training signal: next-token prediction provides a loss term at each supervised token position. A 32×3232\times32 image grid has 1,024 such terms per frame. Recurrent image models can also supervise many pixels, rewards, and latent quantities; naming their sum one loss does not reduce its information content. Token supervision is a convenient objective, not a proof of more useful gradients or superior sample efficiency. Auxiliary objectives may still help retain task-relevant information.
  • Discreteness: categorical probabilities define an explicit predictive distribution, but need not be calibrated or separate epistemic from environmental uncertainty. Sampling draws symbols rather than averaging their decoded values. Learned visual quantizers can lose information; tokenization of already discrete variables can be exact. Continuous encoders also have architectural and learned bottlenecks. No downstream predictor can recover an absent distinction from unchanged inputs alone, though other retained evidence may make it inferable.
Token

A token is an element of a finite discrete vocabulary. In the fully unified design, observations, actions, rewards, and commands can all be serialized as tokens. Other token world models use continuous components or separate heads. Vocabulary size depends on the modality and tokenizer rather than one universal range.