TL;DR
The popular ReAct (Reason + Act) prompting framework frequently derails when agents forget the original user query in long contexts or get trapped in repetitive action loops. Focused ReAct solves this with two simple heuristics: constantly reiterating the primary question at each reasoning step and triggering an early stop when duplicate actions occur. Across small-to-medium open models, this boosts question-answering accuracy by 18% to 530% while reducing execution time by up to 34%.
What Problem Does This Paper Address?
The ReAct framework synergizes reasoning (generating internal thoughts) and acting (querying external tools or APIs) to solve complex, multi-hop tasks. However, in practice, ReAct agents routinely suffer from two critical failure modes:
- Context Dilution (Losing Focus): As the trajectory of thoughts, tool calls, and tool observations expands, the initial question is pushed further back in the context window. The agent often shifts attention to intermediate tangents, drifting away from answering the actual user prompt.
- Infinite Action Loops: When an agent fails to retrieve what it expects, it frequently repeats the exact same tool call (e.g., searching for the identical keyword multiple times) without making progress, wasting tokens and runtime before failing.
The authors propose a focused variation of ReAct to mitigate both issues without requiring fine-tuning or heavy computational overhead.
Methods
Focused ReAct introduces two non-invasive modifications to the standard ReAct loop:
- Reiteration: At the beginning of each reasoning step (
Thought:), the system automatically re-inserts the original user question into the prompt context. This continuously reinforces the primary objective, preventing the target from fading as the observation history grows. - Early Stop on Action Loops: The execution environment programmatically monitors tool calls. If the agent emits an action identical to an earlier one, the system assumes that either sufficient data has already been collected or tool retries will be unproductive. It immediately halts tool execution and forces the model to generate a final answer based on the accumulated context (
Finish [answer]).
Datasets
- HotpotQA: The authors evaluate their approach on a subset of 150 randomly selected question-answering tasks from the multi-hop HotpotQA benchmark.
- No new benchmarks were introduced; experiments were run across three open-weight language models: Gemma 2 2B, Phi-3.5-mini 3.8B, and Llama 3.1 8B.
Key Insights and Ideas
- Recency bias in prompt context is real: Transformer attention often suffers from "lost in the middle" phenomena. Simply repeating the goal prompt alongside incoming observations acts as an attention anchor, keeping the LLM oriented toward the terminal objective.
- Repetition usually means saturation, not exploration: When an LLM repeats a tool invocation, it almost never recovers autonomously within the same session. Treating duplicate actions as an explicit signal to synthesize an answer—rather than letting the agent spin its wheels—salvages many answers that would otherwise time out or fail.
- Smaller models benefit disproportionately: While all tested model sizes saw double-digit percentage gains in accuracy, smaller models (e.g., Gemma 2 2B) saw massive improvements in both accuracy (+530% relative) and speed (-34%). Smaller LLMs have weaker self-correction and attention control, making rule-based scaffolding especially effective.
Key Results
Experiments were conducted on a single 24GB NVIDIA L4 GPU, measuring accuracy (percentage of correctly answered questions) and wall-clock task completion time:
- Task Accuracy:
- Gemma 2 2B: jumped from 2.0% (baseline ReAct) to 12.6% (Focused ReAct) — a +10.6% absolute (+530% relative) gain.
- Phi-3.5-mini 3.8B: improved from 22.0% to 26.0% (+4.0% absolute / +18% relative).
- Llama 3.1 8B: rose from 14.0% to 23.3% (+9.3% absolute / +66% relative).
- Execution Latency:
- Gemma 2 2B runtime dropped from $11.68 \pm 2.66\text{s}$ down to $7.68 \pm 2.41\text{s}$ (a 34% reduction).
- Larger models saw modest latency reductions (3% for Phi-3.5-mini and 4% for Llama 3.1 8B), as larger models naturally enter fewer degenerate loops.
Limitations and Future Work
- Limited Evaluation Scope: The benchmark evaluation is small (150 questions drawn exclusively from HotpotQA) and focuses only on basic text-based search/QA tasks.
- Heuristic Early Stopping: Assuming that any duplicate tool call implies "sufficient information is available" is a coarse heuristic. In scenarios where queries need parameter adjustments or pagination, naive exact-match duplicate detection could trigger premature termination.
- Future Directions: The authors plan to test Focused ReAct on more diverse autonomous agent scenarios, evaluate robustness across varied toolsets, and integrate execution-acceleration techniques like speculative sampling.
Summary updated