Course contentsShow
← Machine Learning and Deep Learning
Lesson 1904 of 3,53840. Advanced Prompting TechniquesFree lesson

ReAct for Question Answering

Applying ReAct to information-seeking tasks using search, lookup, and reasoning actions.

ReAct for Question Answering

What you'll learn: How to apply the ReAct framework to answer complex questions by interleaving search, lookup, and reasoning steps.

The Core Idea

When answering questions that require external knowledge, models need to find information, extract relevant details, and synthesize answers. ReAct (Reasoning + Acting) structures this process as a conversation between thinking and doing: the model reasons about what it needs to know, searches for information, examines results, and iterates until it can confidently answer.

Think of it like a detective solving a case: they don't just guess—they form hypotheses (reasoning), investigate leads (search), examine evidence closely (lookup), revise their thinking based on findings, and repeat until the mystery is solved.

Information-Seeking Actions

In question answering, ReAct typically uses three core actions:

  • Search[entity]: Retrieves a document or paragraph about an entity
  • Lookup[term]: Finds the next occurrence of a term in the current document
  • Finish[answer]: Returns the final answer

The trajectory alternates: Thought → Action → Observation → Thought → ...

For example, if asked "What year was the director of Titanic born?", the model might:

  1. Thought: I need to find who directed Titanic
  2. Action: Search[Titanic director]
  3. Observation: James Cameron directed Titanic...
  4. Thought: Now I need James Cameron's birth year
  5. Action: Search[James Cameron]
  6. Observation: James Cameron (born August 16, 1954)...
  7. Thought: The answer is 1954
  8. Action: Finish[1954]

This interleaving prevents blind guessing and creates an interpretable reasoning trace.

Key Takeaway: ReAct for question answering decomposes information-seeking into explicit search, lookup, and reasoning steps, enabling models to reliably answer questions requiring external knowledge through systematic investigation rather than speculation.