Cosmos and Omnimodal World Foundation Models › Multimodal Generative Dynamics

Michael BrenndoerferJuly 23, 202614 min read
World Models HandbookAll chapters
Part 9 of 12Foundation and World-Action Models
Chapter 53Cosmos and Omnimodal World Foundation Models › Multimodal Generative Dynamics
Reading section 3 of 8 · Multimodal Generative Dynamics · 14 minSection 3 of 8 · 14 min

Book contents

Section 3 of 8 · 14 min read

Cosmos and Omnimodal World Foundation Models › Multimodal Generative DynamicsOne section · Sections in this chapter3 / 8 ↓
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

With latents in hand, we can state a conditional prediction task. A video generator can be used as a world model when its generated futures are fit for the intended dynamics and decision question; architecture or visual quality alone does not establish that suitability.

The conditional video model as a dynamics model

Write the conditioning context as cc (text, a first frame, a layout, a control signal) and the observed history as x≤tx_{\le t}. A video world model represents

pθ ⁣(xt+1:t+K∣x≤t,c),p_\theta\!\left(x_{t+1:t+K} \mid x_{\le t}, c\right),

the distribution over the next KK observation frames. Compare this with the latent state-space form we have used throughout the book, pθ(zt+1∣zt,at) pθ(ot∣zt)p_\theta(z_{t+1} \mid z_t, a_t)\, p_\theta(o_t \mid z_t). Two differences stand out and both have consequences.

First, this factorization has no separately defined Markov state ztz_t. A video transformer still has internal latent tokens and activations, but they need not be a compact, inspectable belief state. It conditions on observation history within a finite context, so object permanence across occlusion must be learned and evaluated rather than assumed. A generated car that fails to reappear after an occlusion is a temporal-consistency error; diagnosing its cause takes more than observing pixels alone. The temporal-state discussion in Part III provides a useful comparison.

Second, an explicit action variable is not required for observational prediction. Without one, a model trained on behavior data estimates futures under the behavior mixture represented in that dataset. Such samples may aid some data-generation or perception tasks after validation, but they do not by themselves isolate a proposed braking intervention from correlated observations. Adding recorded actions makes counterfactual control studies possible only with adequate coverage, causal assumptions, and measured action adherence; conditioning alone is not a causal guarantee. We return to action interfaces in the next chapter.

Diffusion and flow matching in latent space

Diffusion and flow matching are two related ways to train continuous-latent generators; neither is simply a universally cleaner reformulation of the other. The flow construction below clarifies the number of network evaluations per solver rollout; realized latency also depends on token count, implementation, and hardware. Prediction and inpainting can share weights when the model is trained and conditioned for those tasks; they do not follow automatically from the ODE.

Let y1y_1 be a data sample (a latent video, all tokens at once) drawn from pdata(⋅∣c)p_{\text{data}}(\cdot\mid c) for context cc, and let y0∼N(0,I)y_0 \sim \mathcal{N}(0, I) be independent noise of the same shape. Define a straight-line interpolant indexed by t∈[0,1]t \in [0,1]. This teaching convention runs from noise at t=0t=0 to data at t=1t=1; the Predict2.5 report writes the opposite time orientation, which is equivalent after reversing tt and the velocity sign:

yt=(1−t) y0+t y1.y_t = (1-t)\, y_0 + t\, y_1 .

Along any particular path, the velocity is constant and equal to y1−y0y_1 - y_0. The conditional velocity field is therefore trivial. The marginal velocity field is the conditional expectation

ut(y,c)=E ⁣[ y1−y0  |  yt=y, c ],u_t(y,c) = \mathbb{E}\!\left[\, y_1 - y_0 \;\middle|\; y_t = y,\ c \,\right],

and regressing a network vθ(y,t,c)v_\theta(y, t, c) onto y1−y0y_1 - y_0 with a plain squared error,

L(θ)=Ey0,y1,t ⁣[∥vθ(yt,t,c)−(y1−y0)∥2],\mathcal{L}(\theta) = \mathbb{E}_{y_0, y_1, t}\!\left[\left\| v_\theta(y_t, t, c) - (y_1 - y_0) \right\|^2\right],

has ut(y,c)u_t(y,c) as its population squared-loss minimizer under the stated sampling construction. The network sees individual (noise, data, context) examples rather than the conditional expectation directly. Once trained, samples are produced by numerically integrating the transport equation

dydt=vθ(y,t,c),y(0)∼N(0,I),\frac{dy}{dt} = v_\theta(y, t, c), \qquad y(0) \sim \mathcal{N}(0, I),

from t=0t = 0 to t=1t = 1 with an Euler or higher-order solver. With the ideal field and exact integration, this flow transports noise to the conditional data distribution. A trained, finite-step solver approximates it. “Probability-flow ODE” has a more specific meaning in score-based diffusion; this is a flow-matching transport ODE. Fewer steps reduce network evaluations, but latency and quality do not scale by a universal factor.

Why this matters for world models specifically, beyond sample quality:

  • Generation can be parallel across frames within one solver step. A KK-frame clip may take the same number of network evaluations as a one-frame sample, but each evaluation processes more tokens and can cost much more compute and memory. This favors some offline batch workloads; it does not guarantee a latency win.
  • Prediction and inpainting can share a masked generator when its architecture and training support that conditioning. Replacing known coordinates during sampling needs a noise-level-consistent procedure; repeatedly inserting clean values is not a universal sampler. Depth, segmentation, and first-frame controls may require separate encoders, branches, or post-training, and adherence remains measured rather than guaranteed.
  • For a fixed-shape clip sampler, you choose KK when laying out that sample's token grid. One common longer-horizon design chains generated chunks conditioned on earlier output; it needs seam and consistency tests. Other architectures can use different extension strategies, so chunk seams are a design-specific risk, not a universal location for failure.

The autoregressive alternative

The discrete-token path has a different mix of tradeoffs, especially sequential token decoding and the opportunity to cache prior context.

pθ(x1:K∣c)=∏k=1Kpθ(xk∣x<k,c).p_\theta(x_{1:K} \mid c) = \prod_{k=1}^{K} p_\theta(x_k \mid x_{<k}, c).

Here xkx_k denotes a discrete token index, not a whole frame; for Cosmos1 it can be an FSQ index. Each token is sampled from a categorical distribution conditioned on available earlier tokens and context. Generation is incremental and may reuse a KV cache, but context length, cache memory, runtime, and error accumulation bound practical horizons. Action tokens can be interleaved only when the model was designed and trained to use them. Part IX develops the foundation-model setting.

The costs are operational. Sampling token indices is sequential in this factorization, so longer sequences normally require more decoding work, although batching, caching, and serving affect wall-clock latency. Exposure bias can arise when generated histories differ from training prefixes, allowing errors to compound. A generator may synthesize plausible high-frequency detail after quantization, but it cannot infer the exact lost detail from the code alone. These are distinct failure mechanisms; quantization does not itself cause autoregressive drift.

As a first approximation, clip-oriented flow/diffusion sampling trades several full-clip network evaluations against autoregressive token-by-token latency and caching. Both families can be adapted to longer sequences or interactive workloads, with different engineering costs. The original Cosmos platform released continuous- and discrete-token video families; later releases should be described by their own interfaces rather than assumed to share that exact division.

Sampling is drawing a future, and the mean is not one

The next worked example isolates a failure of point prediction under a multimodal future.

Suppose you train a deterministic regressor to predict a future position by minimizing squared error. The Bayes-optimal solution is the conditional mean. With a multimodal conditional distribution, that mean can lie in a low-density region between likely outcomes. A point prediction then hides the risk of each mode, even though the mean itself need not have zero probability.

Multimodal futures can arise in interaction: a pedestrian may cross or stop, a vehicle may brake or continue, and a cyclist may swerve or hold a line. Their prevalence is task-dependent. For risk-sensitive decisions, a model needs a way to represent consequential alternatives; a conditional mean alone can conceal them. That does not imply a generative model is automatically calibrated or more accurate.

We use one scalar, one conditioning variable, and a two-component mixture. It illustrates a decision risk without claiming to reproduce the full behavior of a deployed system.

Worked example: the pedestrian whose mean is a ghost

Consider a single decision-relevant scalar: the pedestrian's lateral position one second in the future, measured in metres relative to the ego vehicle's path. The context is c∈[0,1]c \in [0,1], how much the ego yields (0 means the ego does not yield at all, 1 means it yields fully). The true generative process has two outcomes:

  • the pedestrian crosses: y=+2.0y = +2.0 m,
  • the pedestrian stops: y=−1.0y = -1.0 m,

with the crossing probability increasing smoothly in cc, and Gaussian noise of standard deviation 0.25 m on either branch. The bimodality is the whole point: both outcomes are physically plausible, and which one occurs is uncertain given the context. Reducing the process to a single number is exactly the simplification that makes it tempting and wrong.

Let's write that process down and measure how bad the conditional mean is.

In[16]:
Code
import torch
import torch.nn as nn

MODE_STOP, MODE_GO = -1.0, 2.0  # lateral position 1 s ahead, in metres
MODE_SIGMA = 0.25


def mixture_weight(yield_amount, sharpness=3.0):
    """Probability that the pedestrian completes the crossing."""
    return 1.0 / (1.0 + np.exp(-sharpness * (yield_amount - 0.5)))


def sample_futures(yield_amount, n, rng):
    """Draw futures from the true bimodal process."""
    complete = rng.random(n) < mixture_weight(yield_amount)
    centre = np.where(complete, MODE_GO, MODE_STOP)
    return centre + rng.normal(0, MODE_SIGMA, n)

At an ambiguity of c=0.5c = 0.5, the two outcomes are equally likely, and the conditional mean sits exactly between them. For a continuous outcome, any exact point has zero probability; the meaningful quantity here is the probability density near the midpoint compared with the two modes. That comparison makes the failure concrete.

Out[17]:
Console
conditioning c = 0.5  ->  P(pedestrian crosses) = 0.50
conditional mean outcome   = +0.50 m
density at the mean outcome: 2.43e-08
density at a real outcome  : 7.98e-01
ratio                      : 3.3e+07x

The conditional mean lands in a region roughly seven orders of magnitude less
dense than either modal centre. The midpoint is possible but very unlikely.

Now we train a generative model of the same conditional distribution using flow matching, so the model learns the shape of the uncertainty rather than a single summary. The training signal is the same data a regressor would have used; only the target changes, from the outcome to the direction that carries noise into outcomes.

In[18]:
Code
class VelocityNet(nn.Module):
    """v(y_t, t, c): a learned flow-matching velocity field for one scalar future."""

    def __init__(self, hidden=64):
        super().__init__()
        self.fc1 = nn.Linear(3, hidden)
        self.fc2 = nn.Linear(hidden, hidden)
        self.fc3 = nn.Linear(hidden, 1)
        self.act = nn.SiLU()

    def forward(self, x):
        return self.fc3(self.act(self.fc2(self.act(self.fc1(x)))))


def make_batch(n, rng):
    """Sample the flow-matching regression problem: regress (y1 - y0) at the interpolant."""
    c = rng.uniform(0.0, 1.0, size=n)
    y1 = sample_futures(c, n, rng)
    y0 = rng.normal(0.0, 1.0, size=n)
    t = rng.uniform(0.0, 1.0, size=n)
    y_t = (1 - t) * y0 + t * y1
    return c, t, y_t, y1 - y0

The training loop is short because the flow-matching objective is short. With probability 0.1 we replace the conditioning value with a null token. That training choice makes classifier-free guidance possible later, at the cost of allocating some examples to the unconditional task. The model must learn that task before we can combine conditional and unconditional velocity estimates at inference.

In[19]:
Code
torch.manual_seed(0)
rng_train = np.random.default_rng(5)
NULL_COND = -1.0

model = VelocityNet()
optimizer = torch.optim.Adam(model.parameters(), lr=2e-3)

for step in range(3000):
    c, t, y_t, target = make_batch(256, rng_train)
    c_eff = c.copy()
    drop = rng_train.random(c.shape[0]) < 0.1
    c_eff[drop] = NULL_COND
    features = torch.tensor(
        np.stack([y_t, t, c_eff], axis=1), dtype=torch.float32
    )
    labels = torch.tensor(target, dtype=torch.float32)[:, None]
    loss = ((model(features) - labels) ** 2).mean()
    optimizer.zero_grad()
    loss.backward()
    optimizer.step()

Sampling means integrating the learned velocity field from noise to data. We include the guidance argument now so the same function serves the next section.

In[20]:
Code
def sample_model(net, c, n, steps=100, guidance=1.0, seed=0):
    """Integrate the learned flow-matching velocity from noise to futures."""
    generator = torch.Generator().manual_seed(seed)
    y = torch.randn(n, 1, generator=generator)
    cond = torch.full((n, 1), float(c))
    null = torch.full((n, 1), NULL_COND)
    dt = 1.0 / steps
    with torch.no_grad():
        for k in range(steps):
            t = torch.full((n, 1), k * dt)
            v_cond = net(torch.cat([y, t, cond], dim=1))
            if abs(guidance - 1.0) < 1e-9:
                v = v_cond
            else:
                v_null = net(torch.cat([y, t, null], dim=1))
                v = v_null + guidance * (v_cond - v_null)
            y = y + dt * v
    return y.numpy().ravel()

We draw two thousand futures at several conditioning values and compare sampled event frequencies with the analytic process. A decision use needs this kind of calibration check for its own event definition and evaluation range; a visually convincing sample is not enough. For the toy monitor below, we call y>1.9y>1.9 m the conflict-line event. That one-dimensional boundary is chosen to probe the upper crossing mode; it does not represent a vehicle footprint, pedestrian size, or physical collision geometry.

In[21]:
Code
sample_counts = {}
for c_value in (0.1, 0.5, 0.9):
    sample_counts[c_value] = sample_model(
        model, c_value, 2000, steps=100, seed=int(c_value * 100)
    )

risk_threshold = 1.9
density_grid = np.linspace(-2.5, 3.8, 400)
density_mid = mixture_pdf(density_grid, 0.5)
hist_mid, hist_edges = np.histogram(
    sample_counts[0.5], bins=density_grid, density=True
)
hist_centers = 0.5 * (hist_edges[:-1] + hist_edges[1:])
Out[22]:
Console
c=0.1   model P(crosses)=0.28   analytic=0.23   P(lateral > 1.9 m)=0.19   mean=-0.18 m
c=0.5   model P(crosses)=0.48   analytic=0.50   P(lateral > 1.9 m)=0.29   mean=+0.42 m
c=0.9   model P(crosses)=0.75   analytic=0.77   P(lateral > 1.9 m)=0.43   mean=+1.20 m

Compare each sampled crossing-branch frequency with the analytic mixture
weight; disagreement is model or sampling error. The distribution can remain
bimodal even when those frequencies are not calibrated.

The histogram shows two learned outcome modes and a low-density region near the conditional mean. Its mode weights need not match the analytic mixture merely because both peaks appear.

Out[23]:
Visualization
Bimodal histogram of sampled pedestrian positions with an analytic curve and a marker at the conditional mean.
Density of two thousand futures sampled from the learned flow model at an ambiguous conditioning value, compared with the analytic bimodal density. The sampled distribution captures both the crossing and stopping outcomes, while the deterministic conditional mean falls in the low-density gap between them. This illustrates why a single summary statistic cannot represent a genuinely uncertain future.

The decision consequence depends on the planner's defined conflict region and risk threshold. In this toy, a point-estimate rule could proceed at the +0.5+0.5 m mean. At c=0.5c=0.5, the analytic process assigns a 50% crossing probability, so a distribution-aware toy rule could brake; the fitted model's estimate must be calibrated before use. Those opposite choices illustrate what is lost by replacing a mixture with its mean. They are not a safety result: the learned sample frequencies differ from the analytic mixture, and a real planner needs validated event definitions, calibration, and operating thresholds.

Separating Prediction Quality from Decision Usefulness

A world model can have low average prediction error yet hide alternatives a controller must distinguish. Conversely, a model with worse average error might support a decision better if it preserves the relevant alternatives and their calibrated frequencies. Open-loop prediction and closed-loop decision usefulness need separate tests; the planned Part XI material develops that evaluation question.