TL;DR
Adapting Large Language Models (LLMs) to new tasks via context optimization avoids expensive weight updates but has traditionally been limited to the model's internal knowledge. This paper introduces active information seeking (web browsing and Wikipedia search) to context optimization, revealing that naive integration degrades performance due to "context pollution." To solve this, the authors propose a beam-search-guided training procedure that successfully filters out noisy updates, delivering substantial performance gains across translation, healthcare, and complex reasoning tasks.
What Problem Does This Paper Address?
When LLMs need to adapt to niche domains or newly produced information after deployment, fine-tuning is often prohibitively expensive and risks catastrophic forgetting. An alternative paradigm is context training, where an LLM-based optimizer iteratively refines the input prompt or a pluggable memory bank based on task feedback without altering model parameters.
However, existing context optimization frameworks are "closed systems"—they can only rearrange or extrapolate from the model's frozen internal knowledge. If an LLM lacks the prerequisite knowledge to fix an error, it gets trapped in a loop, amplifying hallucinations or suffering from "context collapse."
Simply giving the optimizer access to the web seems like an obvious fix, but the authors identify two critical failure modes in standard linear pipelines:
- Context Pollution: Uncontrolled web content introduces low-quality or misleading information. Without a backtracking mechanism, the optimizer struggles to recover from these toxic updates.
- Local Optima: Greedy optimization strategies quickly commit to suboptimal paths, failing to explore better alternative context strategies.
Methods
The authors reformulate context training by introducing two primary modifications to the standard pipeline:
- Structured Database Context: Instead of using a monolithic text prompt, the context is treated as an external structured database of discrete resource items (with IDs, summaries, and text embeddings). The optimizer manipulates this database surgically via tool calls (add, update, remove).
- Information-Seeking Tools: The optimizer is equipped with a
WikipediaSearchTooland aBrowserUseToolto actively fetch external web pages, transitioning it from a pure reasoning engine to an active searcher.
To overcome context pollution and local optima, they replace linear sequential training with Beam-Search-Guided Context Training:
- Expansion Phase: For each candidate context in a small population ($K$), the optimizer generates $M$ diverse child contexts in parallel over multiple update steps.
- Selection Phase: All generated candidates, along with the previous best context (an "Elitism" or "Do Nothing" option), are evaluated on a held-out validation set. Only the top $K$ performing contexts are retained for the next step, effectively pruning trajectories contaminated by noisy web data.
Datasets
The framework was evaluated across a diverse set of demanding benchmarks using a strictly constrained low-resource data setting (typically 128 training and 64 validation samples):
- FLORES+: Low-resource machine translation from English into five languages unsupported by standard commercial tools (Buginese, Magahi, Kikuyu, Chokwe, and Southwestern Dinka).
- HealthBench: Multi-turn clinical interactions evaluated against comprehensive, physician-written rubrics.
- LiveCodeBench (LCB): Complex reasoning and competitive coding problems.
- Humanity’s Last Exam (HLE): A multidisciplinary, advanced reasoning benchmark spanning subjects like Physics, Math, and Chemistry.
Key Insights and Ideas
- Naive Tool Use is Harmful: Directly adding search tools to a standard sequential pipeline (
Seq-IS) consistently degraded performance compared to tool-free baselines. Pruning and backtracking are strictly necessary when dealing with noisy external data. - Self-Correction Avoids Local Optima: Beam search allows the model to tentatively explore a strategy (like massive dictionary expansion) and discard it if validation feedback shows a different strategy (like combining linguistic rules with parallel examples) works better.
- Remarkable Data Efficiency: The beam search method acts as a signal amplifier. On the English-to-Southwestern Dinka task, it achieved near-optimal performance with as few as 32 training samples.
- Model-Agnostic Generalization: Contexts optimized using a smaller model (Gemini-2.5-Flash) transferred seamlessly to a stronger, newer model (Gemini-3-Flash) without further tuning, often yielding even larger performance gains on the superior model.
Key Results
- Low-Resource Translation: On FLORES+,
BeamSearch-ISachieved an average ChrF++ score of 34.51, substantially outperforming the sequential baseline (31.13) and even beating the much larger, unoptimized Gemini-2.5-Pro baseline (30.37). - Clinical Scenarios: On HealthBench,
BeamSearch-ISraised the score from a baseline of 0.3793 to 0.5026, matching the performance of Gemini-2.5-Pro (0.5030) and outperforming it specifically on emergency referrals. - Complex Reasoning: On LiveCodeBench Hard, it improved pass@1 to 33.9% (vs. 30.0% baseline). On HLE, it achieved the highest average accuracy (8.63%) compared to all internal-reasoning baselines.
Limitations and Future Work
The authors note two primary limitations:
- Dependency on Executor Capabilities: While the optimizer successfully retrieves high-quality resources, a weaker executor agent might still fail to utilize the complex context effectively during problem-solving.
- Context Sparsity: Utility mapping revealed that most retrieved resources are highly instance-specific. If a test set is incredibly diverse and distinct from the training set, the optimized context struggles to generalize.
Future work will focus on enhancing the base model's context utilization, expanding exploration capabilities to mitigate biased retrievals, and developing hybrid offline/online settings.
Summary updated