Learning preferences

Make learning more comfortable. Changes apply immediately.

Enlarges page content, including diagrams and their labels. You can also use your browser’s zoom.

Choose the colours that are easiest for you to distinguish. Applies to lesson diagrams and lab plots. Labels, shapes, hatching and line patterns also distinguish meanings. Source photographs and raw image brightness stay unchanged; mask-only views are available for image overlays.

ExampleComparisonSample link

Saved in this browser on this device. Preferences are separate from progress backups.

Lesson 6 of 14 in this unit

Build AI Systems · SOURCE LESSON 16

Learn from verified self-play.

Generate game experience, check it against exact rules, and use verified outcomes to change future decisions.

By the end: Distinguish inference from persistent learning, explain why self-generated experience needs trustworthy feedback, and evaluate a frozen policy against another opponent.

Start with the exampleJump to the experimentRead the explanation
Prerequisites and path options

Why learn this? Evaluate learning from an opponent without mistaking repeated wins in practice for general skill.

01 · TRY

Start with something concrete.

Put seven stones on a table. Two players alternate taking one or two; whoever takes the last wins. Could a learner discover useful choices by playing both sides, without someone labeling every move?

Try the interactive model
02 · PREDICT
Before you experiment

The learner says its own answer is correct, then trains on that answer. What is missing?

The learner says its own answer is correct, then trains on that answer. What is missing?
03 · EXPERIMENT

Change one thing. Watch what follows.

Loading this browser experiment…

04 · UNDERSTAND
READ & CONNECT

Understand what changed.

Back to the experiment

A shorter explanation, with the original worked examples available below. Both explain the same experiment and its limits.

Same learning goal in both modes: Distinguish inference from persistent learning, explain why self-generated experience needs trustworthy feedback, and evaluate a frozen policy against another opponent.

The idea in everyday terms

Self-play creates experience by having a policy play a game against another policy or a copy of itself. The game rules can provide feedback without someone labeling the best move at every turn. Here the stone-game verifier checks the moves and which player took the last stone.

What to watch in the experiment

Generate games, verify them, then update the table from valid outcomes. Freeze the policy before comparing it with separate opponents. That separation helps distinguish learning from simply continuing to practice during a test.

What this does not establish

A legal winning game proves that particular outcome, not a universally strong strategy. Repeated play against familiar opponents and public cases is limited evidence of wider skill.

Open the full worked examples, calculations and limitations

This is the same reference used in Technical mode. Expand it whenever you need the exact numbers, assumptions or further explanation.

Experience can be generated; correctness still needs evidence

Self-play uses an agent or copies of its policy to generate experience by playing a game. The rules can provide exact feedback even when nobody labels the best action at every position. The familiar pieces form a loop: generate experience → verify an outcome → update learned values → evaluate the new policy.

In our stone game, a separate verifier checks alternating players, legal takes, consistent remaining piles, and an empty final pile. The winner is the player who took the last stone. A policy cannot make a losing game count as a win by claiming it won.

The Q table stays fixed while one training game is generated. After verification, the learner moves each played action’s estimate toward +1 if that player won and −1 if that player lost:

Qnew=Qold+0.3 (outcome−Qold)Q_{\mathrm{new}}=Q_{\mathrm{old}}+0.3\,(\text{outcome}-Q_{\mathrm{old}})

This is a simple Monte Carlo update: it uses the completed episode’s outcome rather than a next-state value estimate. Both players’ actions supply examples. The opponent changes as the shared table changes, so the learning problem is not stationary. The estimates are not guaranteed calibrated probabilities, and more games need not improve every measurement.

Search now versus learn for later

An agent can spend extra computation during inference: search candidate moves, revise an answer, or use examples in its current context. These can improve the current result without changing its learned parameters. The lab’s practice game only reads a frozen Q table; it does not train on your moves.

Persistent learning retains a change that affects future tasks. Here the retained change is to table entries. In a neural system it could be a weight update. A lasting memory update is another kind of retained change, but it is not automatically a neural weight update. Always identify what actually changed and test whether it helped.

Systems such as AlphaZero combine self-play with search and neural policy/value learning. This small game implements none of that architecture’s neural training or tree search. It isolates the experience-and-feedback loop so you can inspect every update.

Test beyond the training partner

A policy can exploit a weak opponent without learning a robust strategy. We therefore freeze the table and compare an untrained baseline and the learned policy against a random opponent and a separately programmed optimal opponent.

Why are only six of the twelve optimal-opponent matchups winnable? A player facing a multiple of three cannot force a win against perfect play. From other piles, taking one or two can leave a multiple of three; then answer the opponent’s take with the amount that makes their two turns remove three. Across starting piles 4–9 and both seats, six assignments give the model a forced win and six a forced loss. A 50% total win rate can therefore be perfect on this balanced test.

The states are familiar. This evaluation tests different opponents and fixed rollouts, not generalization to larger piles, different game rules, or unseen puzzles. Repeated tuning against the same test also weakens its independence. A stronger research experiment would reserve new tasks and report failures as well as successes.

Why not simply trust generated answers?

If a model invents a fact and then treats that same statement as a correct label, training can reinforce the error. Agreement with itself is not an independent truth signal. Games work well when outcomes have exact rules; factual questions often require evidence outside the generator.

For a puzzle system, one useful loop is to generate candidate solutions, check every move and the final goal with an exact simulator, and retain verified solutions as training examples. Verification establishes that those particular solutions are valid. It does not establish diversity, optimality, or success on unfamiliar puzzles. Keep reserved puzzles outside the generated curriculum and compare solve rate, cost, and failure types after each update.

05 · APPLY
Check your understanding

An agent searches through five answers, chooses one, and discards its temporary search notes. Its learned parameters do not change. Which description fits?

An agent searches through five answers, chooses one, and discards its temporary search notes. Its learned parameters do not change. Which description fits?
06 · CONTINUE

Take this idea with you.

Self-play can create useful training experience when outcomes are verifiable. Keep generation, verification, persistent updates, and independent evaluation separate; none guarantees continuous improvement.

My Learning
Explore related topics and the topic map

How this topic connects

Explore this topic on the interactive map

Use these connections to review a foundation or choose where to go next. You can open any topic without completing the others.

What it builds on

You are hereLearn from verified self-play

Generate game experience, check it against exact rules, and use verified outcomes to change future decisions.

What it enables