> For the complete documentation index, see [llms.txt](https://world-models-from-scratch.gitbook.io/wmfs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://world-models-from-scratch.gitbook.io/wmfs/chapters/chapter_01/04-components-of-a-world-model.md).

# 1.4 Components of a World Model

A world model must connect information about the present to a prediction about the future. Conceptually, it does this in three operations: encode the present, advance an internal state through time, and decode the result. The middle operation is called **dynamics**.

![](/files/E5a3C10gSc4RzGlx1jAK)

*Figure 1.5: Dynamics is the learned state update between the representation of the present and the prediction of the future. An action, when present, enters this update.*

## Observations and Actions

An observation is information available from the environment at one time step. It can be an image, a sensor vector, a text sequence, or a structured state.

A sequence of observations forms an observation history. One image can show an object's position. A sequence can also show how its position changes.

An action is a command applied to the environment. Examples include a steering command, a robot movement, or a mouse click. Some prediction tasks do not include actions.

## Representation

An encoder converts the observation history into an internal state. This state is also called a representation. It contains information used to predict what happens next. For a moving object, that information may include its position and motion.

## Dynamics

Environment dynamics describes how the environment changes over time. The model approximates this process with a dynamics function placed between the encoder and decoder:

$$
z\_t = \operatorname{encode}(o\_{\leq t}), \qquad
z\_{t+1} \sim \operatorname{dynamics}*\theta(z\_t, a\_t), \qquad
\hat{o}*{t+1} = \operatorname{decode}(z\_{t+1}).
$$

The function uses the current internal state $$z\_t$$ and optional action $$a\_t$$ to predict the next state $$z\_{t+1}$$. A one-step model repeats this update; a sequence model may predict several future states jointly without a separate component named `dynamics`.

## Prediction

The decoder converts the predicted internal state into an output. The output may be the next image, the next sensor reading, or another observation.

## How the Model Generates a Rollout

Return to the self-driving-car example from Section 1.1:

1. The observation history contains recent camera frames and sensor readings.
2. The encoder represents relevant information such as vehicle motion, lane geometry, and nearby traffic in an internal state.
3. A proposed action, such as braking, is supplied to the dynamics update.
4. The dynamics function advances the internal state to represent what may happen after that action.
5. The decoder converts the future state into a predicted camera frame, sensor reading, or other required output.

The first future observation completes one predicted transition. Repeating the state update and prediction produces a sequence of future observations. As defined in Section 1.1, that predicted sequence is a **rollout**. A model may also generate all the observations in the rollout together rather than expose these repetitions one by one.

To make this data flow visible, the pipeline walkthrough introduces a small toy world: a ball moving along a 12-cell line. Select Step to see exactly when the dynamics update is used. Change the action or switch from a single next state to several possible next states.

[Open the world-model pipeline in a new tab](https://nahidalam.github.io/world_model_from_scratch/interactive/chapter_01/pipeline_walkthrough.html).

Chapter 2 applies this pipeline using a pretrained world model. It begins by preparing an observation and generating a rollout.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://world-models-from-scratch.gitbook.io/wmfs/chapters/chapter_01/04-components-of-a-world-model.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
