Log inStart free
LESSON 17.04 · 5 STAGES · 3 CONTROLS · 3 CHECKSPRO · PREVIEW

Dueling networks

Watch a Q-network split into a value and four advantages, then join them again.


Pro lesson. Stage 1 is free to watch. Pro opens all 5 stages, 3 controls and 3 checks, in this lesson and every other.

Go Pro · $8.25/mo
EXPLAINER · 17.04 · DUELING BAYV + A − MEAN · V(S) 0.76
01
Stage 1 of 5 · Two streams
A dueling network splits after the hidden layer. A value stream gives V(s); an advantage stream gives 4 advantages.
Explain it simply

On the right, the cell's row and column feed 16 hidden units, shared by both streams. The top stream gives one number, V, how good the cell is. The lower stream gives 4 advantages, how much better each move is. A join turns them back into 4 Q-values.

The grid is on the left, the network on the right. It has 8 inputs and 16 hidden units. A value stream gives 1 output, an advantage stream gives 4. At S, V is 0.76.

cell input, transitionweights, the subtracted constantpit, negative values, V gapV, advantages, Q-values
GP+1−1S012457891011131415cell 2the game · after 6,000 stepsthe network · two streams · cell Sr0r1r2r3c0c1c2c316 hiddenrow, columnV 0.76value stream↑ 0.00→ 0.00↓ −0.04← −0.03advantage streamjoin− mean↑0.78→0.78↓0.74←0.74Q-valuesGP+1−1S012457891011131415cell 2the game · after 6,000 stepsthe network · two streams · cell Sr0r1r2r3c0c1c2c316 hiddenrow, columnV 0.76value stream↑ 0.00→ 0.00↓ −0.04← −0.03advantage streamjoin− mean↑0.78→0.78↓0.74←0.74Q-values
Toy: the 17.C1 grid game, 16 cells, an 8–16 trunk, 6,000 DQN steps
STAGE 1 / 5
MATH · STAGE 1HOVER A SYMBOL OR A SHAPE
h(s)=relu(W1x(s)+b1),V(s)=wV⊤h(s)+bV\sy{h}{param}{h(s)} = \mathrm{relu}(W_1\sy{x}{data}{x(s)} + b_1),\quad \sy{v}{out}{V(s)} = w_V^{\top}\sy{h}{param}{h(s)} + b_V
V(12)=0.761, A(12,⋅)=(0.003, 0.002, −0.036, −0.034)V(12) = 0.761,\ A(12,\cdot) = (0.003,\ 0.002,\ -0.036,\ -0.034)

One hidden layer feeds a value stream and an advantage stream.

Common mix-ups

MYTHThe value stream always learns the true state value.

The fix, and 1 more mix-up with the diagram to show them, come with Pro.

Predict, then reveal
3 CHECKS · PRO
Q01With the plain head, do the 3 untried moves at S move as far?

Make your guess, then test it in the diagram. All 3 checks come with Pro.

PRO LESSON · YOU WATCHED STAGE 1 OF 5
Unlock the full explainer
  • 4 more stages and 3 live controls
  • 2 mix-up cards and 3 predict-then-reveal checks
  • Watch it as a narrated video, in three voices
  • Every Pro lesson and capstone · 656 in total

$99 a year, or $15 a month. Cancel any time.