> 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/readme.md).

# World Models from Scratch

*Building Modern World Models from First Principles*

[**Read the book on GitBook**](https://world-models-from-scratch.gitbook.io/)

[**View the source on GitHub**](https://github.com/nahidalam/world_model_from_scratch)

This book is a hands-on guide for builders who want to understand, train, evaluate, customize, and deploy world models.

## Chapters

* [Chapter 1: Understanding World Models](/wmfs/chapters/chapter_01.md)
* [Chapter 2: Running a Pretrained World Model](/wmfs/chapters/chapter_02.md)
* Chapter 3: Evaluating World Models (coming soon)
* Chapter 4: Building a World Model from Scratch (coming soon)
* Chapter 5: Architectures of Modern World Models (coming soon)
* Chapter 6: Pretraining World Models (coming soon)
* Chapter 7: Adapting and Fine-Tuning World Models (coming soon)
* Chapter 8: Improving World-Model Training (coming soon)
* Chapter 9: Improving World Models at Inference Time (coming soon)
* Chapter 10: Efficient World Models and Distillation (coming soon)

## Code

Reusable code is in `src/world_models/`, tests in `tests/`, self-contained explorable demos in `interactive/`. Install dependencies with:

```bash
pip install -r requirements.txt
pip install -e .
```

Different chapters might have additional GPU or system requirements, described in the corresponding chapters.


---

# 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/readme.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.
