RECAST: Learning to Compute the Right Context through Adaptive Evidence Routing

Yilun Hao, Krishna Sayana, Isabella Ye, James S Ren, Sukhdeep Sodhi, Craig Boutilier, Chuchu FanarXiv 2026

TL;DR

RECAST (Routing Evidence through Computation, Access, and Synthesized Tools) is a novel framework that moves beyond simple information retrieval to active evidence construction. By training a lightweight "RouterLM" to iteratively select retrieval primitives or synthesize custom Python code, the system can derive complex answers—like calculating financial margins across multiple documents—that are not explicitly stated in any single source.

What Problem Does This Paper Address?

Conventional Retrieval-Augmented Generation (RAG) operates on a "find and read" philosophy: it assumes the necessary evidence exists as a discrete chunk somewhere in a database. However, many complex tasks require derived evidence. If you ask a model to identify which three-month period had the largest increase in operating margin, the answer isn't "in" the source; it must be computed by filtering, aggregating, and performing arithmetic across multiple data points.

While "agentic" RAG variants exist, they remain largely retrieval-centric, focusing on better query reformulation rather than data transformation. RECAST addresses this gap by treating computation as a first-class citizen alongside retrieval.

Methods

The RECAST architecture (illustrated in Figure 1) functions as a sequential decision process involving three specialized LLMs:

Figure 1
  1. RouterLM (The Decision Maker): A lightweight, trained model (Qwen3.5-9B) that observes the task and a "source profile." In each round, it chooses to either call a primitive, request a code synthesis, or accept the current context.
  2. CompilerLM (The Coder): A frozen model that translates the RouterLM’s high-level synthesis requests into executable Python code.
  3. AnswerLM (The Solver): A frozen model that receives the final, refined evidence and produces the natural language answer.

The system's action space (see Figure 2) includes:

  • Primitives: Lexical (BM25), Semantic (vector search), and Relational (SQL) operations.
  • Synthesis: Custom Python programs for logic that primitives can't handle (e.g., sliding window calculations).
Figure 2

Training: The authors used a two-stage approach. First, Supervised Fine-Tuning (SFT) established valid multi-round behavior. Second, Group Relative Policy Optimization (GRPO)—a reinforcement learning technique—refined the policy by rewarding trajectories that led to correct answers while maintaining structural validity.

Datasets

The authors evaluated RECAST across a diverse set of nine benchmarks representing heterogeneous data formats (CSV, JSON, HTML, text):

  • In-Domain: DataBench, FinQA, HiTab, HotpotQA, LaMP, and MultiHiertt.
  • Held-Out (Zero-Shot): 2WikiMultiHopQA, TAT-QA, and WikiTableQuestions.

These datasets cover everything from multi-hop Wikipedia reasoning to complex numerical analysis of hierarchical financial tables.

Key Insights and Ideas

  • Computation is Complementary: Ablation studies revealed that neither retrieval primitives nor code synthesis are sufficient on their own. Primitives are efficient for "finding," while synthesis is essential for "deriving."
  • Small Models Can Out-Route Giants: A specifically trained 9B parameter RouterLM outperformed a much larger, training-free Gemini 3.5 Flash router by 5.0%. This suggests that routing logic is a specialized skill that benefits significantly from targeted RL.
  • Zero-Shot Generalization: The most striking finding was that a RouterLM trained on one set of tasks generalized exceptionally well to entirely different data structures (e.g., moving from financial reports to Wikipedia tables), improving over the strongest baseline by 15.0% on held-out benchmarks.
  • Efficiency through Delegation: By using a small model for the iterative "thinking" steps and only invoking larger models for code compilation and final answering, RECAST achieves high success rates with 27.9% fewer total tokens than the strongest agentic baseline.

Key Results

As shown in Table 1, RECAST sets a new state-of-the-art for context construction:

  • Mean Success Rate: 75.6%, outperforming the strongest large-model baseline (Interact-RAG) by 15.9%.
  • Consistency: Unlike baselines that excel at either text (HotpotQA) or tables (DataBench), RECAST maintained high performance across all heterogeneous source types.
  • Robustness: The performance gains held steady even when evaluated by different "judge" models (GPT-4.1 and DeepSeek-V4), proving the results aren't an artifact of a specific evaluator.
Table 1

Limitations and Future Work

The authors acknowledge that constructing the training data for RECAST is computationally expensive, as it requires generating and executing thousands of trajectories. Additionally, the iterative nature of the framework increases inference latency compared to single-pass RAG.

Future research directions include developing cost-aware routing policies that explicitly trade off between the "cost" of an operation (tokens/time) and the expected "gain" in evidence quality, as well as more efficient ways to bootstrap expert trajectories for training.

Summary updated

Abstract

Large language models are increasingly applied to tasks grounded in long, heterogeneous information sources. Conventional Retrieval-Augmented Generation (RAG) relies on fixed similarity-based retrieval, while agentic variants adapt queries and tool use but remain largely retrieval-centric. However, in many tasks, the evidence required for a solution is not explicitly present in any single source item. Instead, it must be derived through filtering, aggregation, or computation across multiple source items. In this work, we introduce RECAST (Routing Evidence through Computation, Access, and Synthesized Tools), a learned framework that formulates evidence construction as a sequential decision process over heterogeneous retrieval and computation operations, allowing evidence to be actively derived rather than merely retrieved. A lightweight RouterLM iteratively selects and formulates primitive operations or specifies customized operations for a frozen CompilerLM to translate into executable code. Once it judges the evidence sufficient, RouterLM passes the accepted evidence to a frozen AnswerLM to produce the final solution. We train RouterLM with supervised fine-tuning (SFT) followed by group relative policy optimization (GRPO). Across six heterogeneous benchmark families, RECAST achieves a mean success rate of 75.6%, outperforming the strongest large-model baseline by 15.9%. Moreover, training enables the Qwen3.5-9B RouterLM to outperform a training-free Gemini 3.5 Flash RouterLM by 5.0%. On three held-out benchmarks, RECAST improves over the strongest baseline by 15.0% on average, demonstrating strong zero-shot generalization across tasks and heterogeneous source representations.
BibTeX
@misc{hao2026recast,
  author = {Yilun Hao and Krishna Sayana and Isabella Ye and James S Ren and Sukhdeep Sodhi and Craig Boutilier and Chuchu Fan},
  title = {{RECAST: Learning to Compute the Right Context through Adaptive Evidence Routing}},
  year = {2026},
  eprint = {2610.10507},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2610.10507},
}
Figure