Manuscript Offprint

arXiv:2610.08452

Agentic AutoRAG: RAG Pipeline Optimization through Reasoning-Driven Agents

Lasse B. Strand, Robert Jakob, Kevin O'Sullivan, Markus Kreft

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

Abstract

Retrieval-augmented generation (RAG) is a widely used approach for grounding large language models (LLMs) in external knowledge. However, configuring a pipeline is an expensive hyperparameter optimization problem over many interacting choices, from chunking and embedding model to reranking and generation. Existing optimizers, from greedy search to Bayesian optimization, reduce each trial to an aggregate score and search without modeling why a configuration performed as it did, even though the retrieved chunks already provide evidence about whether each failure occurred during retrieval or after it. We introduce Agentic AutoRAG, an LLM-agent optimizer for multi-objective RAG hyperparameter optimization with retrieval-versus-generation failure attribution. It proposes configurations scored on a frozen exam from the corpus: after each trial a Diagnoser attributes each failed question to retrieval or generation, and a Proposer, grounded in a knowledge base of model rankings and pricing, selects the next configuration, weighing accuracy against cost to trace a Pareto frontier. On three multi-hop QA benchmarks it reaches higher LLM-judge accuracy than every baseline we compare, and within its first 10 trials it matches or beats the statistical baselines' full 30-trial judge accuracy. In its cost-aware mode on a real-world healthcare corpus it reaches a median exam accuracy of 77%, above the strongest baseline's 71.5%, at about 58% of that baseline's cost per query, and it matches that 71.5% at about 22% of the cost. 1^{1}

1 Introduction

Retrieval-augmented generation (RAG) has become a standard way to ground large language models (LLMs) in knowledge beyond their training data (Lewis et al., 2020; Gao et al., 2023). Configuring a RAG pipeline means choosing across many interacting dimensions: chunking, embedding model, index type, retrieval depth, reranker, query expansion, passage compression, and generator. These choices are coupled and should not be tuned in isolation (Wang et al., 2024). The best retrieval depth, for instance, depends on chunk size: small chunks each hold less text, so they need a deeper retrieval to surface the same evidence that a few large chunks already contain. The best configuration also shifts from corpus to corpus: a pipeline tuned for one can underperform on another, so the search must be repeated for each new one (Kartal et al., 2025; Orbach et al., 2026). Scoring a configuration means running the whole pipeline over a test set, so the search must be sample-efficient.

Recent work applies general-purpose search algorithms to this problem: AutoRAG's greedy node-wise selection (Kim et al., 2024), multi-armed bandits (Fu et al., 2024), Bayesian optimization (Conway et al., 2025; Barker et al., 2025), and genetic search (Kartal et al., 2025). All of these optimizers reduce each trial to an aggregate score and search the space without modeling why a configuration performed as it did. When a configuration scores low, they cannot tell whether retrieval and reranking failed to surface the relevant passages, or the generator answered incorrectly despite having the right context. However, any RAG pipeline already records which chunks it retrieved. By checking whether the passages that contain the answer (the gold spans) appear among them, we can attribute each failure to retrieval or generation. We are not aware of prior RAG optimizers that use this per-question failure evidence to drive their configuration proposals.

We introduce Agentic AutoRAG, a reasoning-driven optimizer for RAG pipelines. Like recent LLM-agent optimizers for general hyperparameter

∗^{*}Corresponding author: lstrand.research@gmail.com

Accepted at the Second Workshop for REsearch on Agent Language Models (REALM) at EMNLP 2026 and at the Machine Learning for Systems Workshop at NeurIPS 2026.

1^{1}Code: https://github.com/Agentic-Systems-Lab/Agentic-AutoRAG tuning (Liu et al., 2025; Trirat et al., 2025), it uses a language model to propose configurations, but specializes this approach to RAG and cost-aware search. It contributes three ideas:

  1. A diagnose-then-propose loop. After each trial, a Diagnoser reads the per-question failure evidence, attributes each failure to retrieval or generation, and compresses it into a short diagnosis. A Proposer then reads that diagnosis and selects the next configuration.

  2. A knowledge-base-grounded, cost-aware agent. The Proposer prices and ranks candidate configurations against public model leaderboards and per-token pricing before spending a trial on them, so it navigates the accuracy-cost trade-off without first learning which models are strong or cheap from trial outcomes.

  3. A corpus-derived exam. Adapting established corpus-grounded exam generation (Guinet et al., 2024; Shashidhar et al., 2025), we draft open-ended, multi-hop questions with verbatim gold-answer spans, filter them through a sufficiency oracle, and keep only questions that separate configurations spanning the search space. The exam is frozen once and reused as the optimization target across every trial.

We compare the optimizer against random search and a multi-objective Bayesian optimizer (MO-TPE). On three multi-hop QA benchmarks it reaches higher LLM-judge accuracy than every baseline we compare, and it is sample-efficient: within its first 10 trials it already matches or beats the statistical baselines' full 30-trial judge accuracy. In its cost-aware mode on a healthcare corpus it reaches a median exam accuracy of 77%, above the strongest baseline's 71.5%, at about 58% of that baseline's cost per query, and it matches that 71.5% at about 22% of the cost.

References (34)