How to build AI systems that cite their sources -- the data engineering infrastructure for traceable, auditable LLM outputs.
A citation is not just a user-experience feature -- it is a data lineage record. When a model makes a claim with an attached citation, you can verify the claim against the source, trace the source back to the ingestion pipeline, and identify which data product was responsible if the source was wrong. This makes attributed answering a prerequisite for any AI system that needs to be auditable.
Building citation infrastructure requires designing your retrieval pipeline to preserve source identity throughout the generation process. Every retrieved chunk must carry its provenance: document ID, section, and ideally character offset. This metadata must survive chunking, embedding, retrieval, and context assembly without being stripped. If you are retrofitting citations onto an existing RAG pipeline, you will spend most of your effort on provenance tracking, not on the citation model itself.
Precision vs. recall is the central citation trade-off. A system with high recall includes a source for every claim but may attach irrelevant citations. A system with high precision cites accurately but may leave some claims uncited. The right balance depends on your use case: legal and medical applications need high precision even at the cost of recall; consumer-facing summaries can tolerate more liberal attribution. Measure both with the ALCE framework metrics before deploying.
The failure mode to watch for is citation hallucination: the model cites a real source, but the cited passage does not actually support the claim. This is more dangerous than an uncited claim because users treat a citation as verification they often do not bother to check. Your faithfulness eval must verify that cited passages genuinely support the claims they annotate, not just that citations exist.
Claude's native citation feature maps output spans to specific source passages. The fastest path to attributed answering if you are already on the Anthropic API -- no external postprocessing needed.
The benchmarks and methodology for measuring citation quality: citation recall, citation precision, and fluency. Use this to design your citation eval harness before shipping.
Self-RAG trains a model to generate inline retrieval and self-critique tokens during generation. Shows how attribution can be built into the generation loop rather than bolted on as a postprocessing step.
The Assistants API file search returns inline citations with file and quote references. A practical reference implementation for attribution in a managed retrieval system.
New resources and perspective on building AI-ready data systems, a few times a month. No spam.