Manuscript Offprint

arXiv:2610.10507

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 Fan

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Yilun Hao †1^{\dagger 1}, Krishna Sayana ∗2^{*2}, Isabella Ye ∗2^{*2}, James S Ren 2^{2}, Sukhdeep Sodhi 2^{2}, Craig Boutilier 2^{2} and Chuchu Fan 1^{1}

1^{1}MIT, 2^{2}Google Research

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.

1. Introduction

Large language models (LLMs) are increasingly applied to diverse tasks, such as question answering, data analysis, and personalized assistance, many of which require reasoning over long contexts drawn from heterogeneous external sources such as document collections, databases, tables, semi-structured records, and user histories (Jiang et al., 2023a; Li et al., 2023; Nakano et al., 2021; Packer et al., 2023; Zhang et al., 2023; Zhong et al., 2024). Although modern LLMs can process increasingly long inputs, supplying the complete source incurs substantial computational and token costs while still offering no guarantee that the model will identify and correctly use the information required for a particular task (Jiang et al., 2024; Liu et al., 2024). Retrieval-augmented generation (RAG) offers a practical solution by retrieving a small amount of relevant content and conditioning generation on the retrieved evidence (Guu et al., 2020; Izacard and Grave, 2021; Lewis et al., 2020). Conventional RAG typically performs a single retrieval step before generation, whereas iterative and agentic variants allow LLMs to reformulate queries, invoke retrieval operations over multiple rounds, and assess whether additional evidence is needed (Hui et al., 2026; Trivedi et al., 2023).

These retrieval-based formulations generally assume that useful evidence can be located directly within the source. However, LLM applications increasingly rely on heterogeneous sources, from which the required evidence may need to be derived rather than simply retrieved. For example, suppose

∗^{*}Equal contributions.

†^{\dagger}Work done during internship at Google.

© 2026 Google. All rights reserved the source provides monthly revenue and operating income, while the task asks which three-month period had the largest increase in operating margin. Answering the question requires computing the margins and comparing their changes across periods. More broadly, the required operations vary across tasks, from lexical or semantic retrieval to relational filtering and aggregation, and some tasks require customized computation that must be synthesized for the task at hand.

Context construction must therefore determine not only where relevant information appears, but also how it should be transformed into useful evidence. Although iterative and agentic methods make retrieval more adaptive, they primarily change how the system searches for source content and offer limited support for constructing such derived evidence. We therefore consider a broader context-construction problem in which retrieval and computation serve as complementary evidence operations, adaptively selected and combined for each task instance.

Figure

Figure 1 | Overview of RECAST. At each round, RouterLM uses the task, compact source profile, and evidence and feedback from earlier rounds to either select and formulate a primitive or synthesized operation or pass the evidence to AnswerLM when it considers the evidence sufficient.

In this work, we introduce RECAST (Routing Evidence through Computation, Access, and Synthesized Tools), illustrated in Figure 1. RECAST formulates evidence construction as a learned sequential decision process over heterogeneous retrieval and computation operations. At each round, a lightweight RouterLM determines what evidence is needed and formulates a task-specific operation for obtaining it. It may invoke a parameterized lexical, semantic, or relational primitive, or request synthesis of a customized operation that a frozen CompilerLM translates into executable code. The resulting evidence and execution outcome inform subsequent decisions, allowing RouterLM to refine the constructed evidence over multiple rounds. Once the evidence is sufficient, RouterLM accepts it and passes it as context to a frozen AnswerLM for final solution generation. We train the RouterLM using supervised fine-tuning (SFT) followed by group relative policy optimization (GRPO).

We evaluate RECAST on DataBench, FinQA, HiTab, HotpotQA, LaMP, and MultiHiertt (Chen et al., 2021; Cheng et al., 2022a; Grijalba et al., 2024; Salemi et al., 2024; Yang et al., 2018; Zhao et al., 2022). These six benchmarks span heterogeneous source representations, including dataframes, financial reports, hierarchical tables, Wikipedia passage collections, and user profiles. Across them, RECAST achieves an average success rate of 75.6%, outperforming the strongest large-model baseline at 59.7%. The trained Qwen3.5-9B RouterLM outperforms a large training-free Gemini 3.5 Flash router, which achieves 70.6%. On three held-out benchmarks, 2WikiMultiHopQA, TAT-QA, and WikiTableQuestions (Ho et al., 2020; Pasupat and Liang, 2015; Zhu et al., 2021), RECAST obtains 79.3%, compared with 64.3% for the strongest baseline, demonstrating strong zero-shot generalization across tasks and heterogeneous source representations.

In summary, our key contributions are:

• We broaden evidence construction beyond retrieval by treating retrieval and computation as complementary means of obtaining task-relevant evidence from heterogeneous sources.

• We propose RECAST, a multi-round framework in which a lightweight RouterLM formulates primitive or synthesized evidence operations, assesses their outcomes, and determines when evidence is sufficient. We further improve its evidence-construction policy through SFT and GRPO.

• We evaluate RECAST across 6 in-domain and 3 held-out benchmark families. RECAST achieves 75.6% in-domain and 79.3% on held-out benchmarks, outperforming the strongest baselines by 15.9% and 15.0%, respectively. It also surpasses a large training-free RouterLM and transfers effectively across alternative CompilerLMs.

References (42)