> ## Documentation Index
> Fetch the complete documentation index at: https://www.getmaxim.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Evaluate Retrieval Quality

> Retrieval quality directly impacts the quality of output from your AI application. While testing prompts, Maxim allows you to connect your RAG pipeline via a simple API endpoint and evaluates the retrieved context for every run. Context specific evaluators for precision, recall and relevance make it easy to see where retrieval quality is low.

## Evaluate retrieval at scale

While the playground experience allows you to experiment and debug when retrieval is not working well, it is important to do this at scale across multiple inputs and with a set of defined metrics. Follow the steps given below to run a test and evaluate context retrieval.

<Steps>
  <Step title="Initiate prompt testing">
    Click on test for a prompt that has an attached context (as explained in the previous section).

    <img src="https://mintcdn.com/maximai/YdQNCf1tftKyYOR4/images/docs/evaluate/how-to/evaluate-prompts/rag-quality/test-prompt-with-context.png?fit=max&auto=format&n=YdQNCf1tftKyYOR4&q=85&s=55ba274d13394d1d10e5843d2b2c0ed1" alt="Test button" width="2314" height="1572" data-path="images/docs/evaluate/how-to/evaluate-prompts/rag-quality/test-prompt-with-context.png" />
  </Step>

  <Step title="Select your test dataset">
    Select your dataset which has the required inputs.

    <img src="https://mintcdn.com/maximai/YdQNCf1tftKyYOR4/images/docs/evaluate/how-to/evaluate-prompts/rag-quality/select-dataset-context.png?fit=max&auto=format&n=YdQNCf1tftKyYOR4&q=85&s=ea128cbe463bc1bc81717c0613a7441f" alt="Dataset selection" width="1188" height="1396" data-path="images/docs/evaluate/how-to/evaluate-prompts/rag-quality/select-dataset-context.png" />
  </Step>

  <Step title="Choose context evaluation source">
    For the `context to evaluate`, select the dynamic Context Source

    <img src="https://mintcdn.com/maximai/YdQNCf1tftKyYOR4/images/docs/evaluate/how-to/evaluate-prompts/rag-quality/select-context-evaluate.png?fit=max&auto=format&n=YdQNCf1tftKyYOR4&q=85&s=ed943aba60f91fb8690c7ec3ce24bf13" alt="Dataset selection" width="1188" height="336" data-path="images/docs/evaluate/how-to/evaluate-prompts/rag-quality/select-context-evaluate.png" />
  </Step>

  <Step title="Add retrieval quality evaluators">
    Select context specific evaluators - e.g. Context recall, context precision or context relevance and trigger the test

    <img src="https://mintcdn.com/maximai/YdQNCf1tftKyYOR4/images/docs/evaluate/how-to/evaluate-prompts/rag-quality/context-evaluation.png?fit=max&auto=format&n=YdQNCf1tftKyYOR4&q=85&s=3312b7ecc0bdf88251bf672e09b1a202" alt="Context evaluators" width="1138" height="406" data-path="images/docs/evaluate/how-to/evaluate-prompts/rag-quality/context-evaluation.png" />
  </Step>

  <Step title="Review retrieved context results">
    Once the run is complete, the retrieved context column will be filled for all inputs.

    <img src="https://mintcdn.com/maximai/YdQNCf1tftKyYOR4/images/docs/evaluate/how-to/evaluate-prompts/rag-quality/run-retrieved-context-column.png?fit=max&auto=format&n=YdQNCf1tftKyYOR4&q=85&s=95eb747117769306e6043410753a7654" alt="Variable linking" width="1398" height="882" data-path="images/docs/evaluate/how-to/evaluate-prompts/rag-quality/run-retrieved-context-column.png" />
  </Step>

  <Step title="Examine detailed chunk information">
    View complete details of retrieved chunks by clicking on any entry.

    <img src="https://mintcdn.com/maximai/YdQNCf1tftKyYOR4/images/docs/evaluate/how-to/evaluate-prompts/rag-quality/retrieved-chunks-details.png?fit=max&auto=format&n=YdQNCf1tftKyYOR4&q=85&s=1ea526174dd5752c26e1d119a58133e7" alt="Retrieval details" width="1510" height="1648" data-path="images/docs/evaluate/how-to/evaluate-prompts/rag-quality/retrieved-chunks-details.png" />
  </Step>

  <Step title="Analyze evaluator feedback">
    Evaluator scores and reasoning for every entry can be checked under the `evaluation` tab. Use this to debug retrieval issues.

    <img src="https://mintcdn.com/maximai/YdQNCf1tftKyYOR4/images/docs/evaluate/how-to/evaluate-prompts/rag-quality/context-evaluation-reasoning.png?fit=max&auto=format&n=YdQNCf1tftKyYOR4&q=85&s=ec8c94b8da926eb0e27dc2e2b718a7a6" alt="Evaluator reasoning" width="1512" height="1164" data-path="images/docs/evaluate/how-to/evaluate-prompts/rag-quality/context-evaluation-reasoning.png" />
  </Step>
</Steps>

By running experiments iteratively as you are making changes to your AI application, you can check for any regressions in the retrieval pipeline and continue to test for new test cases.
