Sells the model that drives other people’s arms.
The opening · Why this matters
Three companies, three ways to teach a robot
Three ways to teach a robot. Tonight, you teach one yourself.
Tonight’s game · Agent Arcade
Three lanes. Dodge. Collect.
- Three actions: LEFT · STAY · RIGHT
- 300 steps · 3 lives. Survive a frame: +0.02.
Who survives an unseen level — you, your bot, or neither?
▶ Play the game now — no install
Game rules · 90-second briefing
Every step earns +0.02. Events add a bonus or a penalty.
every decision step
- ✎Play the demonstration rows — do not hand-edit them, add a row, or remove one.
- ≠Do not test on the level you trained on.
- ❚❚STAY is a real action — doing nothing is not missing data.
Open the black box · picture → numbers → decision
One frame becomes four measurements, one action, and one outcome.
| Sensor | What it measures | Value means |
|---|---|---|
| obs_dx | Obstacle left / right | − left · 0 same lane · + right |
| obs_distance | Distance to nearest hazard | 0 near · 1 far / none |
| coin_dx | Coin left / right | − left · 0 same lane · + right |
| coin_distance | Distance to nearest coin | 0 near · 1 far / none |
dx means “delta x”: horizontal offset relative to you — not screen pixels. All four values are normalized.
One row is one decision. Not one whole game.
The data · What the bot learns from
What a demonstration row is
- State: 4 sensor numbers — obstacle left / right, hazard distance, coin left / right, coin distance. All normalized, relative to you — not screen pixels.
- Action: LEFT · STAY · RIGHT — the move you made in that state.
- Outcome: survive a frame +0.02 · coin +10 · hazard −12.
One row is not a policy. The table is the policy.
Imitation, method 1
Copy the nearest demos — k-NN
Action labels
① Find neighbors
Smallest two-feature distances; the real game repeats this in four dimensions.
What is happening?
② Weighted vote
Neighbors: LEFT 2 · STAY 3 · RIGHT 4
Closer points contribute more.
Teaching projection: two features make distance visible. The production policy uses all four sensors, k = 9, inverse-distance votes, and class balancing.
Training is remembering. Prediction is comparing.
Imitation, method 3
Four numbers are enough
4,675 parameters
State 1 of 3 — hazard close on the left, coin far on the right. The network stays.
- A small network that sees only 4 numbers — the same 4 sensors.
- Game score: 236.6.
- Trained in about 6 seconds.
The right 4 numbers beat a picture. Choose the inputs, not just the model.
Imitation, method 3 · Inside the network
Watch the numbers flow
Simplified view — the real network has 64 + 64 hidden nodes; the numbers shown are the real values for these connections (rounded to 2 decimals).
▶ Open the live demo — train it yourself
Small CNN · in 3D
Watch the shading change
3D view — 3 of 16 (then 32) feature maps shown, the ones with the strongest response. Heights and shades are the real values from the trained network (conv1 max 2.90, conv2 max 7.36), scaled per stage so you can see the pattern. The input grid is the real 48×24 frame: gold = coin, pink = hazard, cyan = ship. Drag to rotate · scroll to zoom.
The other way · Live demo
Reinforcement learning: no teacher
- No teacher. No demonstrations. Reward only.
- Q-learning: the bot plays 500 games — tries, fails, and remembers what worked.
- Coin +10 · Hazard −12 · about 1 minute.
Press Next step to play the first move. The bot starts by guessing.
After 500 games of this, the bot has learned which moves raise the reward — final score 249.0.
The write-up
Write a claim the numbers can carry
- Four parts: Scope + Result + Limit + Next test.
A score means something only when you can say what it was scored against.
After class
Try it yourself
Exit ticket
The bot played. You did the research.
One thing you taught the bot.
One thing you tested.
One thing you still doubt.
Next time the robot messes up, what do you check first?
Your photo appears on the presenter. Nothing is uploaded.
Live composite preview: an illustrated stage with your photo, made in your browser. Not an AI-generated image. Your photo stays in your browser — it is never sent anywhere.
Thank you — questions welcome.
Slides: cnpcshangbo.github.io/slides/python-ai-research/