Lesson 1 of 21 in this unit
Reason with procedures and search.
Compare a local shortcut with a procedure that explores alternatives and checks its result.
By the end: Distinguish memorization, a direct policy, and search; explain why a budget failure is not proof of impossibility.
Prerequisites and path options
Why learn this? Choose when to use exact search and recognize the difference between running out of time and proving there is no solution.
Start with something concrete.
You can remember a familiar route home. When a road is closed, remembering that route may not help. You need a way to consider alternatives, check which roads are legal, and tell when you have actually arrived.
Try the interactive modelA move makes the straight-line distance to the goal smaller. Must it belong to a successful route?
Change one thing. Watch what follows.
Loading this browser experiment…
Understand what changed.
A shorter explanation, with the original worked examples available below. Both explain the same experiment and its limits.
The idea in everyday terms
A shortcut makes a quick choice from the current situation. Search explicitly tries alternatives according to the rules. Keeping track of visited states helps it avoid repeating the same dead ends. A returned route still needs its moves and goal checked.
What to watch in the experiment
Compare the local policy with breadth-first search on the same maze. Watch how many alternatives search examines and what happens when the work budget is small. Search can spend effort on states that do not appear in its final route.
What this does not establish
Running out of budget is not proof that no solution exists. This lab uses programmed rules and search, not a neural network that has learned a general reasoning procedure.
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.
A remembered answer and a reusable procedure
A lookup table can return a multiplication result it has seen before. An algorithm applies a sequence of operations to new inputs. In the source example, 18 boxes × 24 apples − 175 sold becomes 432 − 175 = 257 apples. Multiplication and subtraction supply reusable rules; storing the answer 257 does not by itself supply those rules.
A neural network can learn computations that behave like procedures, but gradient training does not guarantee a robust algorithm. Test changes in input size, names, composition, and required depth. Success on familiar patterns alone does not establish systematic generalization.
Written intermediate steps can let an autoregressive model reuse prior calculations. They can also contain errors. More words are not an independent check of arithmetic. In an exactly defined task, an exact calculator or simulator can provide a stronger check.
A local clue is not a complete plan
A heuristic estimates what looks promising. Our direct rule chooses a legal neighboring square with the smallest Manhattan distance: horizontal distance plus vertical distance to the goal. It considers four local moves, but does not explore their later consequences. Obstacles can make a temporary move away from the goal necessary.
The policy detects a repeated square and stops so that the demonstration cannot loop forever. That memory detects the failure; it does not give the policy a strategy for escaping it. The rule is hand-written, not a trained policy network.
Search keeps alternatives
Breadth-first search keeps a queue of discovered states. It expands a state by checking its four possible actions, records how newly reached states were found, and continues with the earliest queued state. The parent records reconstruct a path when the goal is reached.
With equal move costs and correct deterministic rules, breadth-first search finds a shortest path when given enough work. It may explore many states that are not on the final path. That extra work is the cost of keeping alternatives instead of committing to a local guess.
A queue emptied without reaching the goal rules out a route in this finite graph. A query-budget cutoff does not: unexplored alternatives may remain. In our lab, the budget counts transition queries, not all bookkeeping or wall-clock time. An independent replay then checks every proposed move and the final goal.
Where neural estimates can fit
A policy network can prioritize promising actions, and a value network can estimate future success. Search can use those estimates while an exact simulator handles legal transitions. A verifier checks whether the final proposal satisfies the task. These roles complement one another; an estimate is not an exact rule.
A fixed-depth network performs a fixed sequence of transformations per pass. Additional generated tokens allow additional passes. A recurrent model instead repeatedly updates a hidden state. Both can add sequential computation, but the updates must be useful. We inspect repeated state updates in the refinement lesson.
Sort the jobs in chess
The source exercise asks you to separate pattern recognition, search, exact execution, and verification in move selection. Try assigning each of these jobs before opening the example.
Compare the four roles
A learned policy may recognize a promising attack or a familiar position. Search explores possible move sequences and responses. Exact rules determine whether moves are legal and how the board changes, including special rules. A verifier can check a claimed legal sequence or checkmate against those rules. A position evaluation estimates promise; it does not prove the eventual outcome of an unexplored game.
Search stopped because its query budget ran out. What can you conclude?
Take this idea with you.
Reusable procedures can handle new inputs, but correctness depends on the rules and stopping conditions. Search spends work on alternatives; verification checks the resulting claim.
Explore related topics and the topic map
How this topic connects
Explore this topic on the interactive mapUse 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
- States, actions, and goals
Connect an action to later consequences so you can design rewards that encourage the intended behavior.
- Compute budgets
Compare model and hardware choices against a limited budget without confusing estimates with measured performance.
Compare a local shortcut with a procedure that explores alternatives and checks its result.
What it enables
- Use an informed search
Use a heuristic to reduce search work while checking the assumptions needed for the result you claim.
- Predict what an action will change
Anticipate the consequences of actions and know when a plan needs new observations rather than more imagination.
- Refine an idea over several passes
Recognize when repeated computation improves an answer and when it merely settles on a wrong one.
Show 2 more connections
- Test the parts of a planning system
Decide whether an extra planning component earns its cost by comparing systems under the same budget.
- Test a proposed system improvement
Require evidence before promoting a change and keep a way to reverse harmful regressions.