Principle:Infiniflow Ragflow Citation Insertion
| Knowledge Sources | |
|---|---|
| Domains | RAG, Conversational_AI, Information_Retrieval |
| Last Updated | 2026-02-12 06:00 GMT |
Overview
A post-processing technique that inserts source attribution markers into LLM-generated answers by matching answer segments to retrieved chunks.
Description
Citation Insertion adds traceability to RAG-generated answers by identifying which retrieved chunks contributed to each part of the response. It uses a combination of keyword similarity (tokenized content) and vector similarity (embeddings) to match answer segments to source chunks, inserting [ID:N] markers that map to the reference array. This enables users to verify answer accuracy by clicking through to source documents.
Usage
Applied automatically during chat response generation when the quote option is enabled in prompt_config.
Theoretical Basis
Citation matching uses a hybrid similarity approach:
- Keyword matching: BM25-style token overlap between answer segments and chunk content
- Vector matching: Cosine similarity between answer segment embeddings and chunk embeddings
- Weighted combination: Uses the same vector_similarity_weight as retrieval for consistency