Machine Learning Overview


Machine Learning Overview

Anna
So last week we talked about machine learning, where you learn a predictor from data. That predictor maps inputs to outputs reflexively, like a neural network doing feedforward inference. But that's not enough for problems that require reasoning—solving a Rubik's cube or planning a route. That's where search comes in.

Hope
Right, search is a form of reasoning for deterministic worlds. But isn't search kind of old-school? I thought we moved past symbolic AI into deep learning?

Anna
That's a fair point. But Rich Sutton's famous essay 'The Bitter Lesson' argues that general methods that scale with computation—like search and learning—are ultimately the most effective. So search isn't obsolete; it's a pillar. And combining learned models with search is powerful, like in test-time compute for language models.

Hope
Okay, so search is still relevant. But how do we formalize a search problem? It sounds like we need a clear definition.

Anna
Exactly. A search problem has a start state, a successor function that tells you what actions you can take, their costs, and the resulting states, and an is_end function to check if you've reached the goal. The objective is to find a sequence of actions that minimizes total cost.

Hope
Like the travel problem in the lecture: you're at block 1 and want to get to block n. You can walk (cost 1, go to i+1) or take a magic tram (cost 2, go to 2i). The successors from state 1 would be both walk and tram, both leading to state 2 but with different costs.

Anna
Right. And is_end just checks if you're at block n. But if you add constraints—like limited tram tickets—the state must include the number of tickets left. You can't just use location alone, because you need to know if you're allowed to take the tram.

Hope
So the state encodes all information needed to evaluate future actions. If you also forbid taking the tram twice in a row, you'd need to add a flag like 'last action was tram' to the state.

Anna
Yes. You could always put the entire history in the state, but that blows up the number of states. You want the minimal representation to keep things tractable.

Hope
Once we have a search problem defined, how do we solve it? Exhaustive search tries every possible sequence of actions. That works for tiny problems but blows up exponentially.

Anna
Right. The key idea is the future cost function: the minimum cost from a given state to the end. You can compute it recursively: for each successor, take the immediate cost plus the future cost of the resulting state, and choose the minimum. That recurrence is the heart of search.

Hope
But exhaustive search explores the same state multiple times if there are multiple paths to it. Like in the travel problem, state 2 can be reached via walk from 1 or tram from 1, but exhaustive search recomputes the future cost for state 2 each time.

Anna
Exactly. That's where dynamic programming comes in. It's just exhaustive search plus caching: before computing the future cost for a state, check if you've already done it. If so, return the cached result. That way you only compute each state once.

Hope
So dynamic programming is huge: it turns exponential time into linear time in the number of states. But it requires storing all states in memory, which can be a problem if there are billions of states.

Anna
Right. When states are too numerous—like when the state contains a set of locations or a sequence of tokens—exact search becomes intractable. Then we need approximate methods.

Hope
Like best of n: you run n random rollouts (using a policy to choose actions) and take the best solution. It's embarrassingly parallel and can work well if the policy is informed.

Anna
The policy could be a language model. In the lecture, they showed a small LM generating math solutions: the policy samples tokens, and you roll out multiple sequences. Then you pick the one with lowest cost (negative log probability plus a bonus from a verifier).

Hope
Another approximate method is beam search. You keep a fixed number (beam width) of partial solutions at each step. You expand all of them, then prune to keep only the best ones. It's like driving with headlights—you only see a narrow beam ahead.

Anna
Beam search is deterministic and uses costs directly, unlike best of n's stochastic rollouts. If beam width is 1, it's greedy. As it goes to infinity, it becomes exhaustive search. In practice, you pick a width that balances quality and memory.

Hope
So we've got exact methods (exhaustive, dynamic programming) and approximate ones (best of n, beam search). The choice depends on the problem size and structure.

Anna
And remember the synergy: search and learning together. You can learn costs from data, like LM probabilities, and then use search to find the best solution. That's the recipe for many modern AI systems, from planning to test-time compute.

Ask anything
We've read this whole study set, so questions about it get the best answers.