LocalAI ships with more than chat models: among its backends are embeddings and a reranker. A reranker scores a list of documents against a query, so a retrieval step that returns ten candidates can keep the three that actually answer the question.
Load the reranker and score the candidates
Install a reranker model in LocalAI — the project’s README lists reranking among its features, alongside embeddings, agents and Projects. Then send the query and the candidate documents to the reranking endpoint the server exposes for that model, and read the scores back in order. Keep the top few for the chat model, and drop the rest.
local-ai models install <reranker-model>
# send the query + candidate documents to the rerank endpoint
# keep the top-scored documents for the chat model
A reranker is not a chat model, and loading a chat model will not give you scores. Pick a model built for reranking, and test the score order on a query you can judge by hand before trusting it in a pipeline.
Try it: four checks
| Check | What you should see | If you do not see it |
|---|---|---|
| Reranker installed | A reranking model is installed | Not a chat model |
| Endpoint answers | The rerank call returns scores | Check the model is loaded |
| Order sane | The relevant document scores highest | Test with a query you can judge |
| Top few kept | The pipeline keeps the top results | Cut the list after reranking |
Expected result. We checked the LocalAI README, which lists a reranker among LocalAI’s features. We did not call a rerank endpoint on this machine.
Limits
This guide covers the reranker concept only. The exact endpoint and model names depend on your LocalAI version. We did not test any call ourselves.
