Structure citations by making them a formatting contract that references your retrieved chunk identifiers, not a free-form behavior you hope the model follows. In RAG, “citations” should mean: the model explicitly indicates which retrieved chunk(s) support each claim, and your application can verify those references. The simplest reliable citation format is a numbered source list ([S1], [S2]) plus inline markers (... [S1]). The more robust format is chunk-ID citations ([doc_42#7]) that map directly to your vector database records.
A practical approach looks like this:
In retrieval, assign each chunk a short citation key:
S1..Skand store{S1: chunk_id, url, title}.Insert context like:
[S1] Title: ...
URL: ...
Text: ...
- Require output:
### Answerwith inline[S1]markers### Sourceslisting each used key once, with URL
Then validate: parse the output, extract cited keys, and ensure every cited key exists in the retrieved set; reject answers that cite non-existent keys or omit Sources entirely. This validation step is what makes citations reliable. Without it, even strong models occasionally invent references.
With Milvus or Zilliz Cloud, citations are easy to implement because each chunk already has a primary key. You can also include section headings and versions in citations so users understand why a source is relevant (“v2.5 docs, section ‘Index params’”). This citation structure improves trust and click-through: users can jump directly to the right doc section. For a website like Milvus.io, citations are also a UX feature: they turn answers into navigable entry points back into your documentation.