Skip to main content

Benchmarking

This guide covers best practices for running comprehensive benchmarks to compare RAG architectures and identify optimal configurations.

Benchmarking Goals

A comprehensive benchmark should answer:

Quality

Which RAG architecture produces the highest quality answers?

Performance

Which architecture is fastest and most cost-effective?

Robustness

Which architecture handles diverse questions best?

Scalability

Which architecture scales best to production?

Benchmark Types

1. Single RAG Benchmark

Evaluate one RAG architecture in depth.
Use when:
  • Testing a new RAG implementation
  • Debugging a specific architecture
  • Quick quality check
Output: ragas_evaluation_[rag_type]_[timestamp].json

2. Multi-Model Benchmark

Compare how different LLMs perform with the same RAG architecture.
Use when:
  • Selecting the best LLM for your use case
  • Understanding model-specific strengths
  • Cost-benefit analysis across models
Output: ragas_multimodel_[rag_type]_[timestamp].json

3. Comprehensive Benchmark

Test all RAG architectures with all available models.
Use when:
  • Conducting research
  • Selecting production configuration
  • Publishing results
Output: ragas_comprehensive_all_rags_all_models_[timestamp].json

Running a Comprehensive Benchmark

1

Prepare Environment

Ensure stable conditions for fair comparison:
2

Run Comprehensive Evaluation

Start the full benchmark:
This runs in the background and logs all output.
3

Monitor Progress

Watch the log file:
You’ll see progress through RAG types:
4

Wait for Completion

Typical duration:
  • 6 RAG types × 4 models × 10 questions = 240 evaluations
  • ~5-10 seconds per question
  • Total: 2-4 hours
Do not interrupt the benchmark. Results are only saved at the end.

Understanding Benchmark Results

The comprehensive benchmark produces a detailed JSON file:

Summary Section

Compare all RAG architectures:

Best Performers

Identify winners for each metric:

Comparing RAG Architectures

Quality Comparison

Rank by overall average score:
Key insights:
  • Hybrid-RRF offers the best overall quality
  • Rewriter excels at recall (finding all relevant info)
  • Simple is fast but lacks answer relevancy

Performance Comparison

Rank by speed and cost:
Key insights:
  • Simple is 2.6× faster than Rewriter
  • Simple costs 4.2× less than Rewriter
  • Advanced RAGs trade cost/speed for quality

Trade-off Analysis

Best Overall Quality

Hybrid-RRF
  • Average score: 0.891
  • Excels in all metrics
  • Cost: $0.048 per 10 questions
Use for: Production systems where quality matters most

Best Balance

Hybrid RAG
  • Average score: 0.858 (only 3.7% lower)
  • 15% faster than Hybrid-RRF
  • 19% cheaper than Hybrid-RRF
Use for: Most production use cases

Best Performance

Simple Semantic
  • Fastest: 8.2s average
  • Cheapest: $0.021 total
  • Score: 0.623 (acceptable)
Use for: High-volume, cost-sensitive applications

Best Recall

Rewriter RAG
  • Context recall: 0.894
  • Answer relevancy: 0.887
  • Most thorough retrieval
Use for: Critical applications requiring completeness

Cross-Model Analysis

For multi-model benchmarks, analyze how models perform across RAGs:

Model Performance Matrix

Insights:
  • GPT-5.2 offers best quality but at higher cost
  • GPT-5 provides best value (quality/cost ratio)
  • Medical-specialized models (medgemma) need more tuning

Best Practices

Fair Comparison

All RAGs should be evaluated on the exact same questions:
Don’t change embeddings between RAG evaluations:
Keep k (number of chunks) consistent:
  • Run evaluations on the same hardware
  • Use the same API tier (avoid rate limits)
  • Don’t run in parallel (can affect timing)

Result Storage Organization

Organize results for easy comparison:

Documentation

Document your benchmark methodology:

Analyzing Results Programmatically

Load and Compare

Visualize Results

Publishing Results

For research or internal documentation:

LaTeX Table

Next Steps

RAGAS Metrics

Understand what each metric measures

Interpreting Results

Detailed guide to analyzing evaluation results