# Reranking for better retrieval

Rerankers are a crucial component of retrieval systems that use LLMs. They help\
improve the quality of the retrieved documents by reordering them based on\
additional features or scores. In this section, we'll explore how to add a\
reranker to your RAG inference pipeline in ZenML.

In previous sections, we set up the overall workflow, from data ingestion and\
preprocessing to embeddings generation and retrieval. We then set up some basic\
evaluation metrics to assess the performance of our retrieval system. A reranker\
is a way to squeeze a bit of extra performance out of the system by reordering\
the retrieved documents based on additional features or scores.

![](/files/NX81D9P6icmO6EqTBIBB)

As you can see, reranking is an optional addition we make to what we've already\
set up. It's not strictly necessary, but it can help improve the relevance and\
quality of the retrieved documents, which in turn can lead to better responses\
from the LLM. Let's dive in!

<figure><img src="https://static.scarf.sh/a.png?x-pxid=f0b4f458-0a54-4fcd-aa95-d5ee424815bc" alt="ZenML Scarf"><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.zenml.io/user-guides/llmops-guide/reranking.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
