> For the complete documentation index, see [llms.txt](https://docs.maiagent.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.maiagent.ai/tech/quickstart/reranker.md).

# Reranker 模型

Reranker 模型如何在檢索後重新排序段落、MaiAgent 怎麼使用 Reranker、雲端啟用中的模型、地端部署的模型與自備服務的網址規則。

## 什麼是 Reranker？ <a href="#what-is-reranker" id="what-is-reranker"></a>

Reranker 是專門做「重新排序」的模型。第一階段的檢索（向量與關鍵字）速度快，但只能粗略比對；Reranker 把問題和每一個候選段落放在一起逐一判斷相關程度，再依分數重新排列，讓真正回答問題的段落排在前面。

{% stepper %}
{% step %}

### 初步檢索 <a href="#first-stage" id="first-stage"></a>

以向量與關鍵字從知識庫快速取回一批候選段落。
{% endstep %}

{% step %}

### 重新評分 <a href="#scoring" id="scoring"></a>

Reranker 逐一比對「問題＋段落」，給每個段落一個相關分數。
{% endstep %}

{% step %}

### 篩選 <a href="#selection" id="selection"></a>

依分數保留前幾名，並濾掉低於相似度門檻的段落，再交給大型語言模型。
{% endstep %}
{% endstepper %}

## MaiAgent 如何使用 Reranker <a href="#how-maiagent-uses-reranker" id="how-maiagent-uses-reranker"></a>

* 每個知識庫各自選定一個 Reranker 模型，並以 <mark style="color:blue;">啟用搜尋結果重排序 (Reranking)</mark> 開關（預設開啟）。
* 開啟時，第一階段會取回 <mark style="color:blue;">檢索片段數量</mark> × 平台設定的放大係數（預設 7 倍）筆候選，Reranker 重新排序後只保留 <mark style="color:blue;">檢索片段數量</mark> 筆。
* <mark style="color:blue;">相似度門檻值（0-1）</mark> 作用在 Reranker 的分數上，所以只有開啟 Reranker 時才有效。
* 關閉時，第一階段直接取回 <mark style="color:blue;">檢索片段數量</mark> 筆，不做重新排序，也不套用相似度門檻。

完整流程見 [RAG 知識庫檢索系統](https://docs.maiagent.ai/tech/quickstart/rag.md#rerank)。

## MaiAgent 雲端啟用中的模型 <a href="#saas-models" id="saas-models"></a>

以下為 2026 年 10 月正式區的啟用清單，建立知識庫時可選的模型以後台顯示為準。

| 模型（後台名稱）              | 供應商                        |
| --------------------- | -------------------------- |
| Cohere Rerank v3.5    | Cohere（`rerank-v3.5`）      |
| Cohere Rerank v4 Pro  | Cohere（`rerank-v4.0-pro`）  |
| Cohere Rerank v4 Fast | Cohere（`rerank-v4.0-fast`） |

## 地端部署 <a href="#on-premise" id="on-premise"></a>

地端與私有雲可以在本機部署 Reranker（部署包的模型目錄提供 `jina-reranker-v2-base-multilingual` 與 `bge-reranker-v2-m3`，需要 GPU），或接上既有的模型服務、雲端供應商。可用的模型與接法見 [地端模型服務接入](https://docs.maiagent.ai/tech/platform-development/onprem-model-services.md#local-model-catalog)；各雲端供應商是否支援 Reranker 見 [雲端模型推論 API 服務](https://docs.maiagent.ai/tech/platform-development/cloud-model-inference-api-service.md)。

{% hint style="warning" %}
**自備 Reranker 服務時，網址不要加 `/v1`**，否則知識庫搜尋會全部失敗。網址規則見 [地端模型服務接入：接既有的 OpenAI 相容模型服務](https://docs.maiagent.ai/tech/platform-development/onprem-model-services.md#external-openai-compatible)。
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.maiagent.ai/tech/quickstart/reranker.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
