RajatDandekar/build-a-world-model-from-scratch

Build a World Model from Scratch — the Vizuara AI lecture series: slides, from-scratch code, and Colab notebooks

20

stars

10

commits

Python

primary language

Aug 31, 2026

updated

colab-notebook
deep-learning
from-scratch
lectures
pytorch
reinforcement-learning
world-models

README

Build a World Model from Scratch — pixels → encoder → code → memory → prediction → imagined frame

Build a World Model from Scratch

A lecture series by Vizuara AI — slides, runnable code, and Colab notebooks.
Everything is built from first principles, every number on every slide is real output from the code in this repo.

YouTube Open in Colab Dependencies No GPU required


What is this?

A world model is a neural network that learns how a world works — well enough to predict what happens next, and eventually well enough that an agent can plan, imagine, and train inside the model instead of the real world. World models sit behind some of the most exciting results in modern AI: Dreamer agents that learn in imagination, video models that simulate reality, robots that rehearse before they act.

This series builds that entire idea up from scratch — small worlds, small networks, complete code, honest engineering. No magic, no hand-waving, no "trust us, it works." When something broke while we built it (and plenty did), the failure and the fix are part of the lecture.

The lectures

Each lecture folder holds its slides, its runnable code, and a README with the full write-up.

#LectureMaterialsWhat you'll learn
0Series IntroductionslidesWhy world models, the Renderer/Simulator/Planner map of the field, and where this series goes
1What Is a World Model, Really?slides · codeThe agent–environment loop, why state ≠ observation, 80 years of the idea, and the taxonomy
2The World Modeler's ToolkitslidesThe four tools every world model stands on: latent spaces, reward over time, value, actor-critic
3Your First World Modelwrite-up · slides · notebookBuild a complete world model on MiniPong: encoder + memory + prediction, then run it as the game
4Dreams That Last — the RSSMwrite-up · slides · notebookBuild an RSSM on real SO-101 robot data: track a belief, carry a memory and a doubt, dream 60 steps with the camera off
5A Vector, or a Vocabulary? — IRISwrite-up · slides · play with itDiscrete latents and transformers: give a world model a vocabulary instead of a vector, then open the transformer and trace one word through every layer
6aThe World Model in Your Headwrite-up · slidesLeCun's blueprint, made runnable: what an energy landscape is, and the measured contours that show why predicting in representation space wins
6Stop Painting Pixels — I-JEPAwrite-up · slides · codeBuild I-JEPA's ideas from scratch, watch representation collapse happen on purpose, and replicate the ImageNet study — including at 1% of labels

More on the way — next, world models that predict the future without rendering it (V-JEPA, DINO-WM).


Latest result — Lecture 6

Five encoders, identical training data, one exam: score how "surprised" each model is by candidate answers to what is behind the mask? — the true content, or content from a different image. Drawn as a map (light = calm, dark = surprised):

Measured energy contours of five encoders

The collapsed models are stripes — blind to the very axis that matters (they rank the true answer above an impostor at a coin-flip 0.500). I-JEPA digs the deepest well, centred on the truth: 0.9998. And its space is organized by meaning — a goose's nearest neighbours are herons, while a pixel-trained model offers a gas mask and a cauliflower.

Nearest neighbours: meaning vs texture

Contributors

RajatDandekar

10 commits

RajatDandekar/build-a-world-model-from-scratch

Build a World Model from Scratch — the Vizuara AI lecture series: slides, from-scratch code, and Colab notebooks

20

stars

10

commits

Python

primary language

Aug 31, 2026

updated

colab-notebook
deep-learning
from-scratch
lectures
pytorch
reinforcement-learning
world-models

README

Build a World Model from Scratch — pixels → encoder → code → memory → prediction → imagined frame

Build a World Model from Scratch

A lecture series by Vizuara AI — slides, runnable code, and Colab notebooks.
Everything is built from first principles, every number on every slide is real output from the code in this repo.

YouTube Open in Colab Dependencies No GPU required


What is this?

A world model is a neural network that learns how a world works — well enough to predict what happens next, and eventually well enough that an agent can plan, imagine, and train inside the model instead of the real world. World models sit behind some of the most exciting results in modern AI: Dreamer agents that learn in imagination, video models that simulate reality, robots that rehearse before they act.

This series builds that entire idea up from scratch — small worlds, small networks, complete code, honest engineering. No magic, no hand-waving, no "trust us, it works." When something broke while we built it (and plenty did), the failure and the fix are part of the lecture.

The lectures

Each lecture folder holds its slides, its runnable code, and a README with the full write-up.

#LectureMaterialsWhat you'll learn
0Series IntroductionslidesWhy world models, the Renderer/Simulator/Planner map of the field, and where this series goes
1What Is a World Model, Really?slides · codeThe agent–environment loop, why state ≠ observation, 80 years of the idea, and the taxonomy
2The World Modeler's ToolkitslidesThe four tools every world model stands on: latent spaces, reward over time, value, actor-critic
3Your First World Modelwrite-up · slides · notebookBuild a complete world model on MiniPong: encoder + memory + prediction, then run it as the game
4Dreams That Last — the RSSMwrite-up · slides · notebookBuild an RSSM on real SO-101 robot data: track a belief, carry a memory and a doubt, dream 60 steps with the camera off
5A Vector, or a Vocabulary? — IRISwrite-up · slides · play with itDiscrete latents and transformers: give a world model a vocabulary instead of a vector, then open the transformer and trace one word through every layer
6aThe World Model in Your Headwrite-up · slidesLeCun's blueprint, made runnable: what an energy landscape is, and the measured contours that show why predicting in representation space wins
6Stop Painting Pixels — I-JEPAwrite-up · slides · codeBuild I-JEPA's ideas from scratch, watch representation collapse happen on purpose, and replicate the ImageNet study — including at 1% of labels

More on the way — next, world models that predict the future without rendering it (V-JEPA, DINO-WM).


Latest result — Lecture 6

Five encoders, identical training data, one exam: score how "surprised" each model is by candidate answers to what is behind the mask? — the true content, or content from a different image. Drawn as a map (light = calm, dark = surprised):

Measured energy contours of five encoders

The collapsed models are stripes — blind to the very axis that matters (they rank the true answer above an impostor at a coin-flip 0.500). I-JEPA digs the deepest well, centred on the truth: 0.9998. And its space is organized by meaning — a goose's nearest neighbours are herons, while a pixel-trained model offers a gas mask and a cauliflower.

Nearest neighbours: meaning vs texture

Contributors

RajatDandekar

10 commits

Languages

Python

81.7%

Jupyter Notebook

16.2%

HTML

1.9%