The DQN Workshop

A Deep Q-Network learns by grading its own guesses. After every move it asks one question: how far off was my guess, compared with what actually happened plus my guess about what happens next? Then it nudges its weights to shrink that gap. The four stations below let you poke at that loop until it clicks. On the first three you train small networks yourself; on the fourth, a much bigger one that learned offline plays the real arcade rules.

qthe guess rreward you got + γfuture discount · vvalue of where you land
Everything right of the arrow is the target. The distance between the guess and the target is the gap. Learning is nothing more than shrinking that gap, millions of times. Colors stay the same on every station: live network, frozen copy.

The Bench

Set up one moment of the game, pick a move, and watch a single update happen with real numbers from a real network. Change anything (the board, the move, a knob) and the whole worked solution recomputes.

Brain

Try a situation

Tapping a square will
Pick a move
What happened (S′)

Change the rewards

Game points. They are multiplied by 0.01 before training, so a pellet (+10) becomes +0.10. These only affect the Bench.

  1. The guess

    The live network looks at board S and scores all four moves. Only the move you picked gets graded.

    q(S, ) =

  2. Peek at the future

    Live network picks the best next move
    Frozen copy says what it is worth

    v =

  3. The target

    What q should have been, in hindsight: the reward you actually got, plus the discounted value of where you ended up.

  4. The gap

    Guess against target. This single number is what the whole network gets adjusted to shrink.

    gap =   loss =

  5. Nudge the weights

    Backpropagation works out, for every one of the network’s weights, which direction would move q toward the target. Each nudge moves every weight a tiny step that way.

    Press a nudge button to watch the guess move toward the target.