# How do I compare RAG retrieval configurations fairly in an offline experiment?

Exam: AI-300 — Operationalizing Machine Learning and Generative AI Solutions
Knowledge domain: Optimize generative AI systems and model performance
Updated: 2026-11-25T04:35:43.129199+00:00
HTML: https://learningpathx.com/faq/AI-300/ai300-controlled-rag-retrieval-experiment.html

## Also asked as

- How do I isolate a chunking, candidate-depth or hybrid retrieval change in a RAG test?
- What should stay fixed when comparing two RAG retrieval configurations offline?

Run baseline and candidate against the same frozen questions and raw source snapshot, changing one retrieval factor at a time. Keep generation settings and the context-selection rule fixed so the comparison can identify what changed.

Use approved nonproduction resources and non-sensitive or synthetic material. Set indexing/model/evaluator budgets and cleanup ownership; do not direct production clients to candidate indexes.

Label expected evidence by source passage, not generated chunk ID. Chunking changes boundaries and IDs, so retain each chunk's mapping to its original passage range. Freeze query text, eligibility rules, answer criteria and reviewed labels, keeping labels/reference answers out of generation input.

Retain embedding model and query vectorization, text configuration, vector algorithm, access rules, prompt/deployment, evaluator versions and timing method. A chunking candidate needs its own index and recomputed vectors for the new text. A depth candidate changes `k`; a hybrid candidate changes retrieval strategy. Do not combine them and attribute the result to one factor. Keep semantic reranking out of that first comparison or define it as a separate experiment with an adequate candidate pool; the documented vector-plus-semantic pattern uses `k=50`, distinct from prompt context size.

Apply the same context-selection algorithm and token budget to all candidates, even though selected text changes. Record any unavoidable differences. Capture ordered retrieval evidence before generation and retain the exact context actually used. This is a paired offline comparison, not randomized live traffic or demonstrated production impact.

For a practice comparison, start with fixed chunks, vector-only retrieval and `k=5`. Test `k=10` on that index before changing retrieval mode. In a separate chunking test, compare 400-token and 200-token windows with the same 50-token overlap and embedding model, provided the corpus and model support the setup. Test hybrid with the original index and match the number of returned results and context budget where possible. These settings illustrate isolation of changes.

**Microsoft Learn**

* [Generate embeddings for search queries and documents](https://learn.microsoft.com/en-us/azure/search/vector-search-how-to-generate-embeddings)
* [Create a vector query in Foundry IQ (Azure AI Search)](https://learn.microsoft.com/en-us/azure/search/vector-search-how-to-query)
* [Semantic ranking in Foundry IQ (Azure AI Search)](https://learn.microsoft.com/en-us/azure/search/semantic-search-overview)
* [Create a hybrid query in Foundry IQ (Azure AI Search)](https://learn.microsoft.com/en-us/azure/search/hybrid-search-how-to-query)

Source: [AI-300: Lab: Comparing RAG Retrieval Configurations](https://learningpathx.com/news/ai-300-lab-comparing-rag-retrieval-configurations.html)
