A deterministic world has a terminal goal G and two states A and B, each with one action, "right". Right from B gives reward and ends at G. Right from A gives reward and moves to B. Start with everywhere, , . The agent experiences and then , each with one Q-learning update, and stores them in a model. Then Dyna-Q does two planning updates, replaying first and second. What are and after each stage, and what did planning achieve?
Reinforcement learning, Model-based RL
Level L2 Elementary. Length Medium. Nature Mat Mathematical.
What's being asked
Whether you understand that Dyna-Q reuses stored experience as simulated experience, so value information travels further per real step.
Key idea
Dyna-Q performs the real Q-learning update and then extra updates of the same form on transitions sampled from a learned model. Each planning update costs no real interaction.
Steps
- Real step 1 on , with terminal value : . Store the transition in the model.
- Real step 2 on : . Store it too.
- Planning update 1, replaying : .
- Planning update 2, replaying : the target is , so .
- Summarise: without planning the values are and . After planning they are and . The true values are and .
- State the point: the same two real transitions produced much more learning, and the order of replay matters. Replaying B first lets the improved flow back to A.
Common mistakes
- Thinking planning updates need new interaction with the environment. They only use the stored model.
- Forgetting that a deterministic model can be wrong if the environment changes. Dyna-Q+ adds an exploration bonus for this reason.
- Using the old in the planning update for A, rather than the freshly updated one.
How long your answer should be
6 steps of arithmetic; about 4 minutes.
Last checked on 4 December 2026.
Read this
Previous in Reinforcement learning: After total pulls, a three-armed bandit with rewards in has pull counts and sample means . Which arm does UCB1 pull next, using the index ? What would a greedy agent do?
Next in Reinforcement learning: One episode with visits states A, B, A, C in that order and then ends. The rewards received after leaving each state are respectively. What are the returns from each time step and the first-visit and every-visit Monte Carlo estimates of , and from this single episode?