# Reranker 模型

## 什麼是 **Reranker**？

**Reranker** 是一種用於**排序任務**的模型或系統，通常在信息檢索、推薦系統或自然語言處理（NLP）中使用。其主要目的是在一組候選結果中重新排序，以便返回最相關或最合適的選項。

## Reranker 的運作方式

通常，當一個搜索引擎或推薦系統返回一系列候選項（例如搜索結果、推薦商品或文章），已經根據某些初步的排序標準進行了排序。這些初步排序可能基於簡單的匹配或基本的相關性指標。然而，這樣的排序並未完全考慮所有的細節或更深層次的語義關係，可能導致不完全符合用戶需求的結果。

例如，假設你在網路上搜尋“最好吃的披薩店”，搜尋引擎會根據一些基本標準給你返回很多結果，比如餐廳的名稱、評分、地址等。這些結果可能已經根據關鍵字或簡單的匹配進行排序了，但它們不一定完全符合你的需求。

這時 Reranker 會進一步幫助你“**優化排序**”，會根據更多的細節來檢查這些結果，可能會考慮你過去的搜尋習慣、其他人對該餐廳的評價，或者餐廳的最新狀況等，從而重新排列結果，最後挑出最相關的餐廳，讓你能夠更快找到最佳選擇。以這個範例而言，Reranker 的運作流程如下：\\

{% stepper %}
{% step %}
**初步排序：使用簡單的排序模型（如基於關鍵字匹配、TF-IDF 或其他特徵）對候選項進行初步排序**

搜尋：「最好吃的披薩店」，搜尋引擎返回了一堆餐廳的列表
{% endstep %}

{% step %}
**候選結果篩選：根據更多特徵（如上下文理解、語義關聯、用戶行為等）來細化排序，重新對候選項進行評分**

再仔細看看這些餐廳，考慮是否有餐廳在你常去的區域，或是否有其他用戶的高評價，或餐廳提供的優惠等等
{% endstep %}

{% step %}
**最終排序：基於其評分結果返回最相關或最合適的結果**

Reranker 會將最符合你需求的餐廳排在最前面，讓你更容易找到最適合的選擇
{% endstep %}
{% endstepper %}

## MaiAgent 提供的 Reranker 模型

### Cohere Rerank v3.5 的特色

**Cohere Rerank v3.5** 是 Cohere 提供的一款 **重新排序（reranking）** 模型，專門用來優化搜尋結果或候選答案的排序，能在候選結果中進行精細排序，根據更深層次的語義理解與上下文來選擇最相關的結果，從而提升最終的品質。


---

# 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.maiagent.ai/tech/quickstart/reranker.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.
