1. Home
  2. Explore
  3. Computer Science
  4. Reasoning and Search with Deep Nets

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

Reasoning and Search with Deep Nets

Speaker 1Speaker 2

Reasoning and Search with Deep Nets

16:42
0:00-16:42
  1. Anna

    Today we’re looking at reasoning and search with deep nets: what can we build on top of powerful language models and other foundation models? The key idea is that a system doesn’t have to produce just one answer in one pass. It can explore possibilities, compare them, and try to identify a better answer.

  2. Michael

    And “search” here can mean a classical algorithm, like exploring branches in a search tree, or something more agent-like that uses a model to work through a problem in multiple steps. The topic connects to recent headline-making models, including DeepSeek R1 and OpenAI’s o1 and o3. We’ll explain the ideas behind the approach while keeping clear that the exact details of every model aren’t necessarily public.

  3. Anna

    A useful way to see why this matters is to compare language models around 2020 with more recent systems. Early models such as GPT-3 were trained largely to predict what text would come next in a huge collection of online writing. So a chatbot could produce something that sounded like a plausible internet response, but that didn’t guarantee it was correct, fair, or unbiased.

  4. Michael

    The newer goal is to get a good answer, where “good” might mean accurate, correct, unbiased, or fair. That doesn’t mean today’s systems are perfect. It means researchers have added techniques that can help them do more than imitate the most likely continuation of internet text.

  5. Anna

    The lecture frames this as a distinction between learning and reasoning. Learning means estimating the distribution of the data: given examples of how people write, build a model of the many kinds of text people might produce. Reasoning, in this framework, means using a model or distribution to seek a decision or prediction—ideally, not just a random plausible answer, but the best answer for the task.

  6. Michael

    The terminology can get confusing, because fields use the same words differently. A statistician might call fitting a model to data “statistical inference,” while a machine-learning researcher might call that learning. Words like inference, prediction, thinking, and cognition can also be used for what this lecture calls reasoning. The important thing is to follow the idea, not assume everyone uses the labels identically.

  7. Anna

    Think of the system as a pipeline. First comes pre-training: fit a base model to a large corpus, often by predicting the next token from the preceding tokens. Then there can be adaptation or post-training, such as fine-tuning the model for a particular kind of task. At deployment, a user provides a prompt or context, and the system produces an answer.

  8. Michael

    In a simple deployment setup, the model makes one prediction at a time: predict the next token, choose or sample it, and repeat. That was a common way to use these systems. A newer option is to query the model multiple times, examine several possible answers, and select or combine them. There’s a blurry boundary between training, adaptation, prompting, and search, but they’re useful stages to distinguish.

  9. Anna

    There’s also an important connection to reinforcement learning. In the broad picture we’ll use today, search can find a promising answer or behavior, and learning can then update the model so it is more likely to produce that behavior again. So search and learning can feed into one another.

  10. Michael

    That connects to Rich Sutton’s essay, “The Bitter Lesson.” Its central point is that AI progress has often come from relatively simple methods that scale with more data and computation, rather than from increasingly elaborate human-designed rules. Deep learning is one example: train on more data with more compute and performance can improve. Sutton also pointed to search as another approach that can scale.

  11. Anna

    That gives us two broad scaling ideas. The learning scaling idea is to use more training-time compute and data to improve the model. The search scaling idea is to spend more compute at test time—more inference or “thinking”—to improve the answer. Recent systems have made that second idea much more prominent.

  12. Michael

    Search itself is an older AI idea. IBM’s Deep Blue, for example, explored possible chess moves and the replies an opponent might make. It built a game tree, looked ahead through possible paths, and chose an initial move based on what those paths suggested. The account here emphasizes that Deep Blue’s achievement came from search, not from a deep neural network.

  13. Anna

    AlphaGo combined the two approaches. It used a search tree to explore possible moves, but neural networks helped evaluate positions at the ends of the explored paths. So the search considered possible futures, while the learned model helped judge whether a position looked promising.

  14. Michael

    Here’s a compact mathematical way to describe the general idea. Suppose x is an input, such as a question, and y is a possible answer. Learning fits a model of the probability of different x-and-y combinations. Reasoning or search then takes the observed x and looks for a y that scores well—perhaps the y with the highest probability, or the highest value under some other scoring function.

  15. Anna

    The word “search” means that maximization step: look for an answer that makes the score as high as possible. The score doesn’t have to be a probability. It could be any function that takes a candidate answer and gives it a number representing how good it is for some purpose.

  16. Michael

    Let’s apply that to autoregressive language models. They build a response one token at a time, estimating the next token from the tokens already produced. Those local next-token probabilities fit together into a probability for a whole sequence. But choosing the most likely next token at every step does not necessarily produce the single most likely complete answer.

  17. Anna

    Right. Imagine choosing the locally strongest word at each point in a sentence. That may lead down a path whose overall sequence is less probable than another path that began with a less likely word. So greedy, step-by-step decoding is a simple way to generate text, but it isn’t guaranteed to find the most probable complete response.

  18. Michael

    One straightforward alternative is called best-of-n sampling. Ask the model to generate n candidate answers, score each complete answer under the model, and choose the best-scoring one. If the question is “What is coffee?” the candidates might describe it as a stimulant that enhances cognitive function, a stimulant that improves thinking, or a chemical that makes you feel more awake. If their scores differ, best-of-n picks the highest-scoring candidate.

  19. Anna

    It’s a simple search procedure, but it spends more compute because the model has to generate several possibilities. And it only chooses well relative to the score it uses. If the score is the model’s own probability, it finds a high-probability answer—not automatically the most factual, fun, or scientifically accurate one.

  20. Michael

    A more structured approach is tree search, including a method called beam search. Rather than generating a set of complete answers independently, the search expands promising partial sequences. At each step, it considers likely next tokens, keeps several paths alive, and continues expanding them. After looking ahead, it can compare the probabilities of the resulting paths.

  21. Anna

    That resembles the game-tree approach in chess: explore branches, but concentrate on promising branches rather than every possibility. In a language example, the model might start an answer, explore several likely continuations, and eventually choose the path with the best overall probability.

  22. Michael

    Then came a surprising possibility: perhaps we don’t always need to program a classical search procedure ourselves. If training data contains examples of people reasoning or searching, the model may have learned patterns associated with those behaviors. We can prompt it to reason in a particular way and see whether it can imitate that process.

  23. Anna

    That’s the intuition behind chain of thought. For example, instead of asking only “What is four times five plus ten?” you can ask the model to think step by step. It may lay out intermediate steps rather than jumping straight to a final answer. The lecture also describes prompting a model to use a named method, such as beam search, and having it write out a procedure resembling that method.

  24. Michael

    There’s a catch: the model can only draw on patterns it learned from its data, and results can vary. Its prompted reasoning may not be the same as a rigorously implemented classical algorithm. It may sometimes be more flexible or find a useful approach, but classical algorithms can have guarantees that we don’t get just by asking a model to imitate them.

  25. Anna

    So emergent or prompted search comes with a trade-off. It may be powerful, but it can also be less robust and harder to characterize. Researchers use interpretability methods to investigate what models are doing, but understanding whether a model’s reasoning is reliable remains an open scientific question.

  26. Michael

    Another big idea is that search can optimize more than the model’s probability. Give the search procedure a score for a candidate answer, and it can look for candidates that maximize that score. For instance, you might want a description of caffeine that is fun rather than simply the most probable description.

  27. Anna

    A scoring model could rate how fun a sentence sounds, how closely it matches a category such as “cat” rather than “dog,” or how scientifically accurate it appears. Search can then generate candidates and select those with the highest score. The choice of score determines what “best” means.

  28. Michael

    Some of the clearest examples are programming and mathematics, where we can use verifiers. A verifier checks whether a proposed solution meets formal criteria. For code, a compiler can detect syntax errors, and other checks can test whether the logic is right. In mathematics, a proof checker can verify a proof even though finding the proof may be much harder.

  29. Anna

    Take a request to write Python code for the Fibonacci sequence. The model could generate multiple programs. A verifier could reject code that fails to compile, or check whether each number follows the rule that it equals the sum of the previous two. Then the system can select a candidate that passes the checks.

  30. Michael

    This strategy is useful when verification is easier than generation. In computer science, the lecture connects that idea to NP problems: a solution may be difficult to find, while checking a proposed solution can be efficient. The traveling-salesperson problem is an example: finding a good route can be hard, but checking a specified route is much easier.

  31. Anna

    The practical lesson is to let a verifier guide generation when one is available. Generate candidates, check them, and keep the ones that pass. That works particularly well for formal tasks such as code and proofs, where correctness can be checked more directly than qualities like fun or general scientific accuracy.

  32. Michael

    These search ideas aren’t limited to language models. The lecture points out that they can also be applied to other generative models, including diffusion models. A diffusion model gradually turns noise into an image by denoising it. Instead of following just one sequence of denoising choices, you can search among possible paths through that process for a promising output.

  33. Anna

    So the underlying pattern carries across different kinds of generation. With language, search can explore sequences of tokens. With diffusion, it can explore paths through denoising steps. The details differ, but in both cases the aim is to use a generative model and search to find a better result.

  34. Michael

    Search can also be continuous rather than a discrete tree of choices. If a generative model maps continuous latent variables to an image, and a second model gives that image a continuous score, we can adjust the latent variables to improve the score using gradient descent.

  35. Anna

    One example from the lecture uses a model of human memorability. Researchers first ran experiments to see which images people remembered and which they forgot. They then used a generative model to change an image so that a memorability model would assign it a higher or lower score.

  36. Michael

    In their example, adjusting the image toward higher predicted memorability made a dog appear closer and cuter; moving in the other direction made it blurrier and harder to recognize. The researchers also tested people’s memory and found that people remembered the higher-memorability version better. The same general method can target other scores, such as aesthetics or emotional valence.

  37. Anna

    That illustrates a broader point: once you have a generative model and a scoring model, you can search the generator’s inputs to create outputs that score highly for a chosen quality. A related approach is reinforcement learning from human feedback, where a model is optimized toward outputs that people prefer.

  38. Michael

    You can even try to steer generation with ordinary language. Ask for a beautiful waterfall painting, then a very beautiful one, then an even more beautiful one. The lecture describes playful experiments where repeating “very” seemed to push the output toward a stronger version of the requested quality, and the “make it more” meme works by repeatedly exaggerating features of an image.

  39. Anna

    That kind of prompting isn’t the same as a formal, reliable optimization algorithm. But it shows how language can sometimes act as a rough way to request a direction of change. The more systematic version is to use a score and search or optimization to improve it.

  40. Michael

    Now we can put reinforcement learning into the picture. One way to think about it is: use search to find a good behavior, then feed that result back into training. Suppose a verifier can tell which generated program is correct. We could keep generating candidates until we find a good one, but that can require many model runs.

  41. Anna

    Reinforcement learning tries to help the model produce good behavior more directly. It explores possible behaviors, rewards the successful ones, and trains the model to make those behaviors more likely. In this simplified account, once we have a successful input-and-output example, the learning step can be ordinary supervised learning: train the model to produce that good output for the given input.

  42. Michael

    That’s why the lecture connects reinforcement learning with synthetic data. Search can generate examples of successful behavior, and those examples can then be used to train the model. The names emphasize different aspects of the process, but the shared idea is to use discovered good solutions to improve learning.

  43. Anna

    And learning can improve search in return. After the model has learned from successful solutions, it can propose more promising candidates. Search can then explore those candidates, find better solutions, and provide more examples for training. It becomes a loop: search, learn, search again.

  44. Michael

    A game gives us an intuitive example. If Mario needs to jump near a tube to win, search can try action sequences and identify ones that lead to high reward. Training then adjusts a policy—the model that chooses actions—so it is more likely to jump in that situation. The improved policy can guide later searches toward promising actions.

  45. Anna

    This is related to beam search in spirit: don’t explore every branch equally. Use what the model has learned to focus on branches it thinks are promising, while continuing to search for better possibilities.

  46. Michael

    That search-and-learning loop is an important idea behind recent reasoning models. The lecture discusses a method called STaR, which popularized one version of the approach. A language model generates an answer along with a chain of thought, or rationale. If the answer is correct, that reasoning example can be used to fine-tune the model so it becomes more likely to produce similar reasoning.

  47. Anna

    If the answer is incorrect, that example is discarded in the version described here. So the model samples different reasoning attempts, keeps the ones that lead to correct answers, and trains on those. With more problems and more rounds of training, the model may produce better chains of thought and solve more problems.

  48. Michael

    The general recipe is: search over candidate chains of thought, identify those that solve the problem, train the model on the successful ones, and repeat. At deployment, you might also add more search on top—or you might use the improved model in a single forward pass. The approaches can be combined in different ways.

  49. Anna

    The lecture uses DeepSeek R1 as a current example and emphasizes that its described training procedure is relatively simple: it uses a reinforcement-learning approach called policy gradients, without some of the additional components that more elaborate approaches might include. The point is not that we know every system works the same way; the speaker says the exact workings of OpenAI’s o1 and o3 aren’t known from this account.

  50. Michael

    The simplicity raises an interesting question. Maybe later systems will add more machinery and improve further. Or maybe, as the Bitter Lesson suggests, a relatively simple method can go surprisingly far when it scales. Either way, the wider lesson is that reasoning systems can combine a learned model, search over possible answers, and training on successful results.

  51. Anna

    So we’ve moved from models that mainly learned to imitate patterns in text toward systems that can spend extra computation exploring, checking, and refining answers. Search can be explicit, like best-of-n sampling or a tree; it can be guided by a verifier or reward; it can use gradient descent in continuous models; or it can emerge through prompted, step-by-step reasoning.

  52. Michael

    And reinforcement learning closes the loop: use search to find good solutions, train the model to produce them more readily, and let the improved model guide future search. That combination—learning plus search—is the central idea behind this new layer of AI systems.

Ask anything

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

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent