본 내용은 아래 Medium 글을 정리하였습니다.
https://towardsdatascience.com/10-ways-to-improve-the-performance-of-retrieval-augmented-generation-systems-5fa2cee7cd5c
means
increasing the proportion of queries for which the systemContext information is below. Given the context information and not prior knowledge, answer the query.
You are a ** agent. You are designed to be as helpful as possible while providing only factual information. You should be friendly, but not overly chatty. Context information is below. Given the context information and not prior knowledge, answer the query.
[참고] Tuning a hybrid retrieval and reranking system is an extremely complicated task - it requires training models to combine dozens different ranking signals
(including semantic similarity, keyword match, document freshness, personalization features, and more)
in order to produce a final relevance score.
- Glean (https://www.glean.com/blog/how-to-build-an-ai-assistant-for-the-enterprise)
- Glean’s Personalization - Knowledge Graph
- Node
- Contents – Individual documents, messages, tickets, entities, etc.
- People – Identities and roles, teams, departments, groups, etc.
- Activity – Critical signals and user behavior, sharing and usage patterns
- Edge
- Document linkage – Documents that are linked from other documents, or mentioned by other users are more likely to be relevant (PageRank - the paper that started Google)
- User-User interactions – Documents from authors who are on the same team, who I have interacted with in the past, whom I have an upcoming meeting with, … are more likely to be relevant to me.
- User-Document interactions – Documents that I (or someone from my team) created/edited/shared/commented/… are all more likely to be relevant to me
MultiRetrievalQAChain
retriever_infos = [
{
"name": "state of the union",
"description": "Good for answering questions about the 2023 State of the Union address",
"retriever": sou_retriever
},
{
"name": "pg essay",
"description": "Good for answering questions about Paul Graham's essay on his career",
"retriever": pg_retriever
},
{
"name": "personal",
"description": "Good for answering questions about me",
"retriever": personal_retriever
}
]
chain = MultiRetrievalQAChain.from_retrievers(OpenAI(), retriever_infos, verbose=True)
Cohere
의 reranking 을 참조하면 좋음 (commonly used for this)Reranking model
rerank-english-v2.0
rerank-multilingual-v2.0
results = co.rerank(model="rerank-english-v2.0", query=query, documents=docs, top_n=3)
참고: Cohere Reranking
Contriever
복수 개의 Hypothetical Documents 에 대해 Contriever 로 Embeddings 을 구하여 평균 내어 한 개의 벡터로 표현
This second step ground the generated document to the actual corpus, with the encoder’s dense bottleneck
filtering out
the incorrect details.
text-embedding-ada-002
를 사용