RAG Reranking คืออะไร?
Reranking คือขั้นตอนหในระบบ RAG (Retrieval-Augmented Generation) ที่ทำหน้าที่ จัดอันดับข้อมูลที่ค้นพบใหม่อีกครั้ง เพื่อเลือกข้อมูลที่เกี่ยวข้องกับคำถามของผู้ใช้มากที่สุด ก่อนส่งต่อให้ LLM สร้างคำตอบ
ดังนั้น Reranker ไม่ได้สร้างคำตอบ แต่ทำหน้าที่ คัดเลือก Context ที่มีคุณภาพก่อนส่งให้ LLM
เครื่องมือที่ใช้ทำ Reranking
ตัวอย่างเครื่องมือและโมเดลที่นิยม ได้แก่
- Cohere Rerank
- BGE Reranker
- Jina Reranker
- Cross-Encoder
- Hugging Face Reranker Models
Cohere Rerank
installation
pip install -U cohere
Usage
import cohere
co = cohere.ClientV2()
response = co.chat(
model="command-r-plus-08-2024",
messages=[{"role": "user", "content": "hello world!"}],
)
print(response)
ความคิดเห็น
แสดงความคิดเห็น