MCP
arXivarXiv
Preprint
Published: August 4, 2026
cs.DB

RAG-Stack: Co-Optimizing RAG Serving Performance and Quality

Abstract
Retrieval-augmented generation (RAG), which augments large language model (LLM) generation with information retrieved from databases, has become a widely used approach for knowledge-intensive applications. Modern RAG systems, however, expose many configuration choices, such as retrieval indexes, model selections, and how models invoke retrieval. Each configuration yields a different trade-off between answer quality and serving performance, making it challenging to choose the optimal setting for a specific application deployment. We present RAG-Stack, a framework for efficiently discovering quality-performance Pareto frontiers across diverse RAG applications and serving systems. RAG-Stack consists of RAG-PE, an iterative design-space exploration algorithm that selects the next RAG configuration to evaluate; RAG-IR, a workload abstraction for diverse RAG algorithms; and RAG-CM, a performance model that predicts the optimal deployment and serving performance on the given hardware. Together, these components allow RAG-Stack to search the joint algorithm-system configuration space without deploying every candidate and to transfer an existing Pareto frontier to a new serving system. Given the same number of optimization iterations across diverse datasets, the Pareto frontiers found by RAG-Stack cover 52.5% to 153.2% more of the normalized quality-performance space than those found by state-of-the-art configuration-search methods evaluated over the same RAG design space.
0
AI overview
Reviews
Citation graph
References · 74
Structured
This preview uses generator v1; v2 is available

Overview

To address the difficulty of efficiently optimizing the quality-performance trade-offs arising from the many configuration choices in RAG deployment, this paper proposes the RAG-Stack framework, which can find the quality-performance Pareto frontier of RAG systems across the full algorithm and system design space without deploying all candidate configurations.

The Quality-Performance Co-Optimization Problem in RAG Service Deployment

Retrieval-augmented generation (RAG), which supplements the generation process of large language models by retrieving information from a database, has become the mainstream implementation approach for knowledge-intensive applications. However, modern RAG systems involve a large number of configuration choices spanning multiple dimensions, including retrieval indexes, model selection, and how models invoke retrieval. Different configurations form entirely different trade-offs between answer quality and service performance, which poses a significant challenge to selecting the optimal configuration for a specific application deployment scenario.

Manually achieving joint quality and performance optimization in RAG scenarios is clearly difficult, and extensive measured results show that the trade-off relationships often defy developer intuition: an agentic ReAct pipeline can achieve faster response times than a sequential pipeline at only a small quality cost, and query expansion sacrifices throughput for quality gains—but such quality gains hold only under some configurations, and even switching to a larger generation model does not always improve answer quality.

Existing Approaches and Design Gaps in RAG Configuration Optimization

In fact, all parameters related to answer quality Q change the logical computation path of the RAG service, and therefore necessarily affect service performance P, satisfying the containment relation IQ⊆IPI_Q \subseteq I_P; there are no purely quality-related parameters that are entirely independent of performance effects.

In the traditional full-deployment measurement approach, the full configuration space XfullX_{full} that must be traversed is the Cartesian product of the algorithm configuration space XalgoX_{algo} and the system configuration space XcmX_{cm} that only affects performance, where XalgoX_{algo} contains all parameters that affect both Q and P, and XcmX_{cm} contains all parameters that affect only P.

The Overall RAG-Stack Framework and Its Core Positioning

The proposed RAG-Stack is an efficient co-optimization framework for RAG service deployment. Without deploying every candidate configuration one by one to measure actual performance, it covers the complete algorithm and system design space and solves for the quality-performance Pareto frontier of the RAG system. The framework directly addresses the core limitation of existing approaches, which cannot jointly optimize answer quality and service performance over the full design space.

Fig. 1: Overview of RAG-Stack's overall architecture and its two operating modes.

Design and Working Mechanisms of RAG-Stack's Three Core Components

RAG-PE builds on traditional multi-objective Bayesian optimization (MOBO) by extending it with stage-aware diagnostics, heterogeneous candidate generation, and global arbitration, making the configuration exploration process more targeted while retaining end-to-end Pareto optimization. The necessity of this design stems from the inseparability of stage effects in RAG pipelines: the benefit of adjusting a single stage depends heavily on the configuration choices of other stages, so a greedy stage-by-stage optimization strategy will miss configurations that perform well only as a complete pipeline, while traditional composite-function Bayesian optimization assumes the final objective is a known function of intermediate outputs and cannot adapt to the characteristics of RAG scenarios.

RAG-IR serves as an intermediate representation layer, bridging the quality assessment module and the RAG-CM cost model. Its design has two core properties: first, system independence—it fully decouples the logical workload from the specific deployment plan, allowing RAG-CM to search deployment options independently and recompute the cost of the same workload on new hardware without actually running the workload; second, RAG-workflow independence—a unified encoding paradigm supports both sequential and agentic RAG pipelines, so RAG-PE can freely explore different workflow structures while RAG-CM does not need to write dedicated modeling logic for each workflow.

RAG-CM predicts configuration performance through a four-layer structure, obtaining performance metrics over the full configuration space without actual deployment: the first layer, the algorithm layer, generates hardware-independent operator work profiles for each RAG stage; the second layer, the performance layer, maps each operator work profile to actual runtime on the corresponding host; the third layer, the communication layer, computes the cost of data transfers between operators; and the fourth layer, the assembly layer, traverses the system design space and combines the outputs of the first three layers to obtain throughput and latency metrics for each algorithm-system configuration.

Experimental Validation and Results Analysis of RAG-Stack

In the end-to-end co-optimization task, RAG-Stack was compared against GP+LogNEHVI, the strongest baseline on both datasets. On the RAGEval dataset, its average hypervolume is 0.514 versus 0.364 for the baseline; on the MS MARCO dataset, its average hypervolume is 0.635 versus 0.259 for the baseline, corresponding to per-seed relative improvements averaging 52.5% and 153.2% respectively. Across all six seed-dataset pairs, RAG-Stack's per-seed hypervolume exceeds that of the strongest baseline. Readers can refer to the figure below to observe the distributions of log-scale QPS versus answer relevance quality on the two datasets.

Fig. 2: End-to-end quality-performance Pareto frontiers at log-scale performance, showing the optimization results of different methods on two datasets.

For a performance model that guides the search of the system space, preserving the relative ranking priority between configurations is more valuable than minimizing absolute prediction error. On two different systems, the calibrated RAG-CM achieves Spearman correlation coefficients of 0.968 to 0.978 for latency and QPS, with overall mean absolute percentage errors kept between 11.2% and 15.3%. Even for the random-access-intensive IVF-PQ-FS and HNSW index structures, where the mean absolute percentage error rises to 20.1%, the Spearman correlation coefficient remains no lower than 0.977, indicating that the remaining prediction errors essentially do not disturb the relative ranking of configurations and can provide reliable ranking signals to support RAG-PE's optimization process.

In the cross-system transfer scenario, with the same evaluation budget of 20, the uncalibrated transfer approach improves normalized hypervolume by 108.4% over optimization from scratch, and the calibrated transfer approach improves normalized hypervolume by 182.2% over optimization from scratch.

Applicability Boundaries and Core Conclusions of RAG-Stack

Currently, RAG-Stack's support for agentic RAG uses a trace-driven mode: RAG-IR must fully execute the pipeline and observe the runtime control flow before RAG-CM can complete the performance prediction for the corresponding configuration.

This mechanism brings clear capability boundaries: on one hand, RAG-PE cannot densely sample the performance objective before the quality assessment stage, and cannot leverage multi-task Gaussian processes to use a large number of performance-only observations to improve sampling efficiency; on the other hand, the framework cannot filter out configurations that violate the service level agreement before they enter the candidate screening pool.

The research team has already implemented a static RAG-IR and RAG-CM path that requires no execution traces for sequential RAG scenarios where the control flow can be directly determined by the configuration, while extending this pre-execution-free performance prediction capability to agentic RAG scenarios remains explicitly stated future work in the paper.

Rating
No ratings yet
Rate
Community rating
—
/ 5
No ratings yet
Rating
—
Soundness
—
Presentation
—
Contribution
—
Confidence
—
Discussion
Top
Newest
Questions
Replication
Author
No comments yet — be the first