Benchmarking R2R

Comparing Performance of Popular RAG Solutions

Owen C., Nolan T., Shreyas P. / 07/15/2024
4 min read

In the rapidly evolving space of Retrieval-Augmented Generation (RAG), developers face a critical decision: which tool will best serve their project's needs? As more options become available, one factor stands paramount—scalability. This article dives deep into a comparative analysis of R2R against four leading alternatives: LlamaIndex, Haystack, Langchain, and RagFlow, with a focus on performance and throughput.

Our goal is to provide developers with concrete data to inform their choice of RAG tool. By rigorously testing each system's ingestion capabilities, we hope to shed light on their potential to handle real-world, data-intensive applications.

Figure 1: Tokens Ingested vs. Time#

The steeper the better, as the rate indicates faster ingestion

We employed a two-pronged approach to stress-test these systems:

  • Bulk Ingestion: We pushed the limits by firehosing approximately ten million tokens of data in batches of 256 files, simulating a high-volume data environment.
  • Individual File Processing: To mimic everyday use cases, we measured the ingestion times for single txt and PDF documents, both individually and in multi-file batches. This provides insight into the user experience when adding files to the system.

The results of our benchmarking reveal significant differences in performance across the tested solutions.

Scalable Ingestion#

Our scalable ingestion test aimed to simulate a high-volume data environment, pushing each solution to its limits. This test provides crucial insights into how these tools might perform in data-intensive, real-world scenarios.

We leveraged the HuggingFace Legacy Datasets' Wikipedia corpus for this benchmark. This dataset offers a diverse range of articles, making it an ideal candidate for testing RAG systems. Each framework was tasked with ingesting articles as per their recommended practices, allowing us to measure their performance under optimal conditions.

Note: While R2R supports asynchronous ingestion out of the box, LlamaIndex requires additional configuration for this feature. To ensure a fair comparison, we included results for both the default and asynchronous configurations of LlamaIndex.

The results, summarized in both Table 1 and Figure 1, reveal significant variations in ingestion rates across the tested frameworks. R2R demonstrated the highest throughput, processing over 160,000 tokens per second, while other frameworks showed varying levels of performance.

Table 1: Ingestion Time over 10008026 Tokens

SolutionTime Elapsed (s)
R2R62.97
LlamaIndex (Async)81.54
LlamaIndex171.93
Haystack276.27
LangChain510.04

Individual File Ingestion#

To complement our bulk ingestion test, we also examined how each solution handles individual file processing. This test simulates typical user interactions, such as uploading single documents or small batches of files.

Our test suite included two text files of similar size but different content, and two PDF files of identical size but varying complexity. We measured three key metrics for each file:

  • Ingestion Time
  • Tokens processed per second (for text files)
  • Megabytes processed per second

Additionally, we tested combined ingestion of identical file types to assess each solution's performance with multi-file uploads.

Table 2: Time taken to Ingest Files

MetricShakespeareChurchillCombined txtUniversity PhysicsIntroductory StatisticsCombined PDF
R2R7.049.079.588.5714.620.7
LlamaIndex67.057.71897.9218.025.3
Haystack18.816.837.88.1717.024.9
Langchain65.264.71349.3124.735.2
RagFlow16303800

Table 3: Megabytes per Second Throughput

MetricShakespeareChurchillCombined txtUniversity PhysicsIntroductory StatisticsCombined PDF
R2R0.7670.6281.1593.1271.8332.593
LlamaIndex0.0810.0990.0563.3841.4902.121
Haystack0.2880.3381.4163.2801.5732.156
Langchain0.0830.0880.0822.8791.0861.523
RagFlow0.0030.001

We encourage developers to conduct their own tests using our publicly available benchmarking code.

Was this helpful?