Problem
A chat assistant built on a large language model (LLM) answers factual questions fluently whether or not the answer is true, and the user cannot tell the two cases apart. The model cannot show how sure it is, and it answers wrongly once a fast-changing fact (a new phone model, a changed job) passes its knowledge cutoff. SberDevices faced this in GigaChat, a free assistant in Telegram, VK and on the web.
Example from the article: a lawyer treated a ChatGPT answer as reliable and filed a lawsuit on it, and the information turned out to be false.
Solution in brief
Put a search system in front of the LLM and generate the answer from the retrieved chunks. A classifier sends only factual queries through this pipeline. Fine-tuned embeddings and a cross-encoder reranker pick three chunks out of a top-100, and the model cites chunk indexes in its answer so the user can check the source.
Questions this case answers
- How to make a language model answer factual questions from retrieved passages with verifiable citations instead of from memory
- How to train a retriever and a reranker for retrieval-augmented answers in a non-English language and handle follow-up questions
- How to reduce factual errors in LLM answers of a chat product using retrieval augmented generation
- How to train a retriever and a reranker for RAG on top of XLM-RoBERTa Large
Tools and methods
- RAG (retrieval augmented generation) — the LLM answers from found documents, not from memory alone
- OpenSearch plus embeddings — first-stage retrieval of the top-100 chunks
- XLM-RoBERTa Large embedder — fine-tuned with hard negatives
- XLM-RoBERTa Large cross-encoder — reranks 100 chunks down to 3, trained with BCE loss
- Query classifier — decides which queries go through RAG
- GigaFunctions — retrieval as a function the model calls itself, for follow-up and multihop questions
Google or a one-time email code. No password.
