Manuscript Offprint

arXiv:2609.05760

RAGMark: A Comprehensive Framework for Benchmarking Retrieval-Augmented Generation Systems

Zlatan Feric, Amir Taherin, Bin Ren, Yanzhi Wang, Jennifer Dy, David Kaeli

Zlatan Feric*, Amir Taherin*, Bin Ren†, Yanzhi Wang*, Jennifer Dy*, David Kaeli*

*Northeastern University, Boston, MA, USA ‡College of William & Mary, VA, USA

{feric.z, taherin.a, yanzhiwang, j.dy, d.kaeli}@northeastern.edu

bren@cs.wm.edu

Abstract—We present RAGMark, a modular benchmarking framework for advanced Retrieval-Augmented Generation (RAG) systems targeting small-scale multi-GPU environments. RAGMark evaluates diverse RAG components, including retrievers, vector databases, prompt-processing methods, and generator models, while collecting detailed per-stage metrics such as latency, GPU utilization, memory consumption, power usage, time to first token (TTFT), throughput, and answer quality. The framework is highly extensible, separating RAG stages, timing, and resource monitoring into modular components, and is designed to efficiently sweep large configuration spaces while minimizing repeated model and database initialization overhead.

Using RAGMark, we characterize five RAG workloads on open-domain QA datasets across varying retrieval depths, model scales, reranking, compression methods, and vector database configurations. We show that while autoregressive generation dominates latency in naive pipelines, context-reduction techniques shift bottlenecks across compute, memory bandwidth, and preprocessing stages. Reranking and compression produce compounding benefits: reranking reduces compression workload itself, while both jointly reduce prefill and KV-cache traversal costs, lowering energy consumption by up to 66%. We further observe strong cross-stage interactions, where small upstream context reductions cascade through downstream latency, memory traffic, and energy consumption. The RAGMark source code is publicly available at: https://github.com/zferic/RAGMark.

Index Terms—Retrieval-Augmented Generation, Benchmarking, GPU profiling, LLM Inference

1. Introduction

Large Language Models (LLMs), such as GPT-4 [1], LLaMA3 [2], and Mistral [3], have achieved impressive results across a diverse set of Natural Language Processing (NLP) tasks, including question answering, summarization, and code generation. Despite these advances, LLMs continue to face fundamental challenges, including hallucinations, outdated world knowledge, and restricted access to domain-specific knowledge. Retrieval-Augmented Generation (RAG) [4] has emerged as a practical solution by extending LLM capabilities through an information-retrieval component that accesses an external knowledge source and augments prompts with relevant passages to improve generation quality. As RAG pipelines grow more sophisticated, understanding their computational demands has become increasingly important, particularly in locally deployed environments where data sensitivity and resource constraints are significant concerns [5], [6].

Even in a simple or naive RAG implementation, consisting of only retrieval and generation, system performance is shaped by a large number of parameters, including input query length, encoding model architecture and size [7], [8], database index configuration [9], [10], database size, retrieval depth, final context length, generator model architecture [11], and output length. Furthermore, the allocation of resources across different RAG components can shift the computational bottleneck. For example, retrieval performed on a CPU versus a GPU can drastically change the latency characteristics. While most large-scale retrieval systems rely on CPU-resident indexes due to memory constraints, moderately sized indexes can be hosted on GPUs, resulting in a significant latency reduction, especially in long context or batch search scenarios. However, transferring indexes to GPU memory introduces additional memory overhead and may leave accelerator resources underutilized after retrieval completes.

The dominant bottleneck in a RAG pipeline is therefore highly configuration dependent. Prior work suggests that LLM inference is often the primary bottleneck in RAG systems [12], while others demonstrate that bottlenecks shift depending on retrieval architecture, database placement, and model scale [13]. For example, a large CPU-resident retrieval index paired with a small generator may become retrieval-bound, whereas a GPU-resident index paired with a large generator model (e.g., Llama 70B [14]) will typically be generation-bound. In addition, many practical RAG workloads involve large textual queries or multi-hop reasoning tasks, increasing computational demand before retrieval and generation even begin.

Modern RAG pipelines have evolved beyond the classical retrieve-then-generate architecture to include additional stages such as query rewriting [15], [16], document reranking [17], [18], and prompt compression [19]–[21]. These additional stages often rely on auxiliary encoder models or autoregressive LLMs, introducing additional inference and preprocessing overhead, while only modestly improving answer quality [22], [23]. This creates a fundamental tension between efficiency and quality, making RAG a uniquely challenging workload to characterize and optimize.

Despite the growing complexity and widespread deployment of RAG systems, there is currently a lack of systematic benchmarking frameworks capable of capturing the full RAG configuration space, profiling individual pipeline stages, and analyzing resulting system-level trade-offs [22], [23]. Existing studies either focus narrowly on LLM inference [12], [24] or treat RAG as a monolithic workload [13], [25], overlooking the rich interactions between embedding, retrieval, compression, reranking, and generation stages.

RAG workloads present several unique challenges for workload characterization:

  • Heterogeneous Components: RAG systems combine multiple distinct subsystems, including embedding models, vector databases, rerankers, compressors, and autoregressive generators, each with different individual configurations and distinct computational and memory characteristics.
  • Complex Performance Interactions: Pipeline stages interact in non-trivial ways. For example, adding a reranking or compression method will reduce context length, but the additional computational overhead simultaneously increases preprocessing overhead latency and resource consumption, while either increasing or decreasing latency.
  • Dynamic Query-Dependent Behavior: Retrieval recall, reranking, compression effectiveness, and generation cost vary significantly across datasets, individual query complexity, and retrieved context length. Therefore, RAG exhibits different system performance across queries, so a RAG benchmark needs to adapt accordingly.
  • Large Configuration Space: Exploring combinations of retriever models, index types, compression methods, retrieval depths, and generator scales creates an extremely large benchmarking space that is expensive to evaluate exhaustively.

To address these challenges, we present RAGMark, a user-friendly benchmarking and analysis framework targeted at studying small-scale multi-GPU environments. Our framework is designed to efficiently explore an extensive set of RAG configurations, while minimizing redundant computations. For example, vector databases and models are loaded once and reused across multiple experimental configurations, allowing large parameter sweeps without repeatedly rebuilding indexes or reloading models. The framework also supports dataset sampling strategies to reduce benchmarking time while preserving representative workload behavior. In addition, the framework produces detailed query-level and temporal trace logs, enabling both aggregate analysis and fine-grained per-stage profiling.

The key contributions of this work include:

Figure

Figure 1. Workflow comparison: standalone LLM vs. RAG. The factually accurate answer is shown in green.

  • We present RAGMark, a modular and extensible benchmarking framework for end-to-end RAG characterization, supporting configurable retrievers [26]–[29], vector stores [9], [10], reranking methods, prompt compression techniques [19]–[21], and generator models [30]–[33].
  • We develop a unified measurement infrastructure for per-query, per-stage characterization of RAG systems, including latency, energy consumption, GPU/CPU utilization, memory usage, and response quality.
  • We enable systematic exploration of the RAG design space through configuration-driven execution, including configurable retrieval and reranking depths, compression rates, model configurations, vector-index configurations, pipeline configurations, and mapping of RAG pipeline stages across CPUs and GPUs.
  • Using RAGMark, we identify and quantify cross-stage interactions across representative RAG pipelines, showing how retrieval depth, reranking, compression, model scale, and index placement shift system bottlenecks, and how upstream context reduction can propagate into downstream reductions in generation latency, memory traffic, and energy consumption.

References (55)