Log inStart free
LESSON 16.10 · 6 STAGES · 3 CONTROLS · 3 CHECKSPRO · PREVIEW

Action masking and invalid actions

See a mask stop invalid actions, and what each fallback does when one slips through.


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

Go Pro · $8.25/mo
EXPLAINER · 16.10 · WAREHOUSE BAY4 OF 7 ACTIONS VALID
01
Stage 1 of 6 · Action mask
The preconditions give the action mask: 1 marks a valid action, 0 an invalid one. 4 of 7 actions are valid.
Explain it simply

The robot stands on shelf B. Each row is one action, and a failed precondition shows in red. The mask holds one bit per action, a yes or a no. Right hits the cart, down leaves the floor, and pack needs the station.

The robot is on shelf B, cell 19. The mask is 1, 0, 0, 1, 1, 0, 1. Invalid: right, the cart; down, off the floor; pack, not at station.

statelogits and resourcesprobabilities and packed shareinvalid actions and gradientmask 0, cart, latent stock, tried move, the other π
012345P6A78910C111213141516171819B20cart212223Rabccaclock5 of 30battery19 of 24carriedastock B1, latentactioncheckmupok1rightthe cart0downoff the floor0leftok1pickok1packnot at station0waitok1mask m = (1, 0, 0, 1, 1, 0, 1)4 of 7 actions validthe agent sees: cell, carried, battery, packed, clockwarehouse flooractions in this statethe mask and the agent012345P6A78910C111213141516171819B20cart212223Rabccaclock5 of 30battery19 of 24carriedastock B1, latentactioncheckmupok1rightthe cart0downoff the floor0leftok1pickok1packnot at station0waitok1mask m = (1, 0, 0, 1, 1, 0, 1)4 of 7 actions validthe agent sees: cell, carried, battery, packed, clockwarehouse flooractions in this statethe mask and the agent
Toy: the 16.C2 warehouse, robot on shelf B; a fixed, untrained policy
STAGE 1 / 6
MATH · STAGE 1HOVER A SYMBOL OR A SHAPE
ma={1every precondition of a holds0otherwise\sy{m}{ink}{m_a} = \begin{cases} 1 & \text{every precondition of } a \text{ holds} \\ 0 & \text{otherwise} \end{cases}
m=(1,0,0,1,1,0,1)m = (1, 0, 0, 1, 1, 0, 1)

An action gets mask 1 only when all its preconditions hold.

Common mix-ups

MYTHMasking the sampler is enough; the loss can skip it.

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

Predict, then reveal
3 CHECKS · PRO
Q01Under terminate, do more or fewer episodes pack the order than under no-op?

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

PRO LESSON · YOU WATCHED STAGE 1 OF 6
Unlock the full explainer
  • 5 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.