Dyna-Q
Q-learning that also learns a model and replays imagined transitions from it.
The idea
After each real step the agent does a normal Q-learning update, records the transition in a model, and then performs n extra "planning" updates using transitions sampled from that model. Every real experience is therefore reused many times, so learning is much faster per real step.
Watch it run
This is a real computation, not a drawing. Pause, step, change the settings, or try new random data.
- positive value
- negative value
- best action
- agent
Dyna-Q: learn from this real step, remember it in a model, then replay imagined steps.
- episode:
- 1
The agent explores with some randomness while learning which action is best in each cell.
Step by step
- 1Act and observe (s, a, r, s′).
- 2Update Q(s, a) from the real experience.
- 3Store (s, a) → (r, s′) in the model.
- 4Repeat n times: sample a remembered (s, a), simulate it with the model and update Q.
Where it is used
Sample-efficient learning in small environments.
Watch out for
A wrong or outdated model causes wrong updates (Dyna-Q+ adds an exploration bonus for changing worlds).