# Citations and Evidence

Requiring generated claims to point at the retrieved passages supporting them, making answers checkable.

**Rests on:** Multi-Document Retrieval

**Leads to:** Admissible Evidence Spans, Enterprise Knowledge Assistants

*LLMs and Generative AI · Retrieval-Augmented Generation*


## Why learn this

You're learning this so that when an AI answers a question, you can see *where* that answer came from. This is what turns a chatbot that confidently says something false into a tool you can actually trust in your work. Once you master this, you'll be ready to study RAG deeper — how to retrieve the right passages in the first place, how to measure if retrieval quality is good, and how to prevent hallucination. Without citations, every AI answer is a black box. With them, you can check, question, and verify. This is also a critical requirement in regulated fields like law, medicine, and finance — where an answer that can't point to its source might as well be wrong.


## The intuition

Imagine you're writing a school essay or a report at your job. You make a claim like 'India's GDP grew by 7% last quarter.' Where did you get that number? If you can't point to the government report, the news article, or the spreadsheet where you saw it, your boss or teacher has every right to be suspicious. You might have misremembered, or the source might be wrong, or you might have just made it up to sound knowledgeable. Now imagine you asked an AI assistant the same question. A normal AI model just predicts the next word based on patterns it learned during training — it has no actual memory of 'facts'. So when it says '7%', it's not reading it from any document; it's generating a word that *sounds* plausible. It can be completely wrong, and it won't know. That's called hallucination. Citations fix this problem. Instead of the AI just saying the answer on its own, we give it a stack of real documents (through retrieval), and we *force* it to show its work: 'Here is my answer, and here are the exact sentences from the documents that support it.' This makes the mistake visible. If the citation doesn't match the answer, you immediately see the lie. If there's no citation at all, you know to be suspicious. It turns trust from a leap of faith into a simple check.


## An analogy

Think of a courtroom witness. A good witness doesn't just say 'I saw him commit the crime.' They must show evidence: 'I saw him at 7pm, and this is the CCTV footage at that time.' The court doesn't trust a bare claim. It demands the witness *point* to the specific piece of evidence that backs each statement.

A citation in an AI answer works exactly the same way. The AI is the witness. The retrieved passages are the CCTV footage, the fingerprints, the signed document. When the AI makes a claim, it must raise its hand and say 'This claim is supported by this exact sentence in this document.'

But the analogy breaks down in one important way. In court, the witness is *expected* to remember what they saw and connect it to evidence. The AI model does not remember anything in that sense. It has no memory of 'facts'. It only knows patterns of words. So the citation is not the AI *recalling* where it learned something — it is the system *showing you the document it read* at the same moment it generated the answer. The document is right there in front of it, and the citation is just a pointer saying 'this is the sentence that I am basing my next word on.' This is more like a witness who is allowed to keep the CCTV footage on the table in front of them and point to it: they can see it, you can see it, and everyone can verify the connection.


## Definition

A system that makes the model's answer point directly to the specific retrieved passage that supports each claim, so that the chain from evidence to answer is transparent and checkable.


## How it connects

You have mastered nothing yet, so this is your very first concept. This is a *young* topic — it sits right at the heart of something called retrieval-augmented generation, a technique where a model is given a set of retrieved documents and asked to answer based on what they say. That is your parent concept, listed in your library. From here, you will naturally move on to learning about *chunking* (how documents are split into retrievable pieces of evidence — this determines what a citation can legally point to), *retrieval quality* (measuring whether the right passages were even found), and then *why hallucinations happen*. This concept connects to your notes on *Admissible Evidence Spans* — in regulated setting, citations aren't just about transparency, they're about *permission*: the model may only cite passages that are legally allowed to influence an answer.


## The mathematics

Think about a scoring game. You have a question. You have a set of retrieved passages (each is just a chunk of text). You want to decide: for the answer the model is generating, which passage is the most supportive?

We give each passage a score. The score is computed by measuring how much the model's next word 'agrees' with the passage. The model has a probability for the next word: 'India', 'China', 'Brazil' — each has a probability of coming next given the question and the passage. The score of the passage is simply that probability: if the model is more likely to say the correct answer after reading this passage, then this passage is more supportive. This is pure multiplication: we take the model's probability for the correct next word, and that becomes the evidence score.

The branch of mathematics used here is *probability* — the science of measuring uncertainty. We use numbers between 0 and 1. A 0 means the model thinks the answer is impossible given the evidence; a 1 means the model is certain. We never see a 0 or a 1 exactly, but we see things like 0.7 or 0.95.

The actual operation is just one multiplication per candidate. For each passage, we look up the probability the model gives to the correct next word when that passage is in context. We compare across passages. The one with the highest number wins — that is the evidence we cite.

For each candidate passage P, the evidence score is: score(P) = Probability(correct next word | context including P).

The passage with the highest score is selected as the citation: citation = argmax over P of score(P).

This is how a citation is made: not by matching keywords, but by measuring which passage makes the answer more probable.


## A worked example

```
You are building a simple evidence scorer. Your model has three possible next words, each with a probability. We will compute the score for each candidate passage. The numbers are probabilities — they always sum to 1 for a given passage.

Step 1: Passage A: next word probabilities are [0.7, 0.2, 0.1]   # The model, when given passage A as context, says the answer 'India' has 70% probability, 'China' has 20%, and 'Brazil' has 10%.
Step 2: Passage B: next word probabilities are [0.4, 0.5, 0.1]   # With passage B, the model is less sure of 'India' (40%) and more sure of 'China' (50%).
Step 3: We want the score for the correct answer 'India' → score_passage_A = 0.7   # We simply look at the probability for the correct word. That is our evidence score.
Step 4: score_passage_B = 0.4   # The same operation for passage B.
Step 5: 0.7 is greater than 0.4, so passage A is the better evidence.   # We compare the two scores. The passage that makes the correct answer more likely is the stronger support.

Result: Passage A is the best evidence for the answer 'India'. Its score is 0.7, which is higher than passage B's 0.4.
```


## From scratch, in Python

```python
# Plain Python, no frameworks. This teaches Python basics and the concept.
# We will compute an evidence score for two passages.

# --- Python building blocks you'll see here ---
# A list is an ordered collection that can change: [0.7, 0.2, 0.1]
# A loop (for) repeats code for each item in a list.
# A function is a named block of code that takes inputs and returns a value.

# The probabilities the model gives to each answer for each passage.
# For passage A: probabilities for "India", "China", "Brazil" are:
passage_a_probs = [0.7, 0.2, 0.1]  # a list of numbers

# For passage B:
passage_b_probs = [0.4, 0.5, 0.1]

# The answers in the same order as the lists.
answers = ["India", "China", "Brazil"]

# The correct answer we are checking.
correct_answer = "India"

# A function that finds the probability of the correct answer in a probability list.
def evidence_score(probabilities, answer_list, correct_answer):
    # Loop through each position in the answer list.
    for i in range(len(answer_list)):
        if answer_list[i] == correct_answer:
            return probabilities[i]  # return the matching probability
    return 0.0  # if the answer is not in the list, score is 0

# Compute the scores for both passages.
score_a = evidence_score(passage_a_probs, answers, correct_answer)
score_b = evidence_score(passage_b_probs, answers, correct_answer)

# Print them: shows the scores so we can compare.
print("Score for Passage A:", score_a)
print("Score for Passage B:", score_b)

# Now pick the passage with the higher score.
if score_a > score_b:
    best_citation = "Passage A"
else:
    best_citation = "Passage B"

print("Best citation is:", best_citation)
```


## The same thing, with a framework

In a real system with hundreds of passages, we use a python library like NumPy to handle lists of numbers efficiently. The framework `numpy` lets us work on entire lists at once instead of writing loops. For our example, we can do:

```python
import numpy as np

# A matrix: each row is a passage. Columns: India, China, Brazil.
probs_matrix = np.array([
    [0.7, 0.2, 0.1],  # Passage A
    [0.4, 0.5, 0.1]   # Passage B
])

# The column index for 'India' is 0.
india_column = 0

# Extract the column with all probabilities for India.
prob_india = probs_matrix[:, india_column]  # gives array([0.7, 0.4])

# The best passage is the one with the largest value.
best_passage_index = np.argmax(prob_india)  # returns 0 (for Passage A)

# Under the hood, np.argmax does the same compare-and-pick you wrote in the for loop.
```


## What the code does

We started with a list — an ordered collection of values. We had two lists: one for passage A's probabilities, one for passage B. We also had a list of answers in the same order. We define a function called `evidence_score` that takes three inputs and returns the probability of the correct answer. Inside the function, we use a `for` loop to go through each position in the answer list. The loop looks at index 0 (India), then 1 (China), then 2 (Brazil). When it finds the correct answer, it returns the probability at that same position. Then we just compare two scores with an `if` statement. If A's score is bigger, we say the best citation is Passage A. Otherwise, Passage B. 

The framework version using NumPy does the same thing but without writing the loop ourselves. We put the probabilities into a matrix (a table of numbers). The line `probs_matrix[:, india_column]` grabs the entire column for India. `np.argmax` finds the position with the largest value — just like our `if` statement did. This is exactly what a library like PyTorch does when it computes evidence scores for citations, but at a much larger scale.


## Common misconceptions

**Citations are just footnotes, not part of the meaning** — The answer is the important thing; the citation is just a decoration to make it look professional.

The citation is the evidence that the claim is true. An answer without a citation is an unsupported assertion, and in an AI system it is very likely a hallucination. The citation is the difference between a guess and a sourced fact. In fact: The citation is an integral part of the answer. It tells you exactly where to verify the claim, and its presence or absence is a direct signal of reliability.

**A citation proves the AI is correct** — If the answer has a citation, it must be true.

The citation might be misapplied. The model could point to a passage that doesn't actually support the claim, or the passage itself might be outdated or wrong. Even with a valid citation, the source itself could be flawed. In fact: A citation means 'this claim is supposed to be supported by this passage.' You still need to check that the passage actually says what the answer claims.

**One citation per answer is enough** — As long as there is a single citation anywhere, the whole answer is trustworthy.

A single answer may contain many separate claims. Each distinct fact should have its own citation. If you only cite one source, the other claims are unsupported and may be hallucinations. In fact: Each distinct claim in the answer deserves its own citation, pointing to a specific passage that supports that individual claim.

**A citation can be any document that mentions the topic** — If a document mentions India's GDP, it can be cited for the claim that GDP grew 7%.

A citation must support the *specific statement*. If the document says 'India's GDP was expected to grow 5%,' it does not support a claim of 7% growth. The passage must contain the exact fact, or at least a highly relevant and consistent statement. In fact: A citation must contain the specific information that backs the claim — a number, a date, a name — not just a general mention of the topic.


## In short

Citations and evidence make AI answers checkable. Instead of trusting a model's word, you can see the exact passage it relied on. The core idea: each claim must point to evidence. In practice, this is done by computing a score for each candidate passage — how likely the correct answer is given that passage — and picking the highest score. This one idea is what separates a fact-checked assistant from a hallucinating one, and it is the foundation for trustworthy RAG systems.


## Where this is used

Citations and evidence are the backbone of any trustworthy AI system. In large language models (like ChatGPT or Claude), citation is not yet standard unless you specifically ask for it, but the technology works the same way: the model is shown a query and a set of retrieved documents, and it is trained to produce a response that includes quote-like references to those documents. In many models, the system will literally copy the sentence from the document and put it in a footnote. The mechanism is to include the source document in the prompt and ask the model to format its answer with inline citation markers that map to the provided source list. In practice, developers write something like: for each claim in the answer, find the sentence in the source that has the highest embedding similarity (a measure of meaning), and output a superscript number pointing to that source.

On small language models that run on your phone or laptop, the principle does not change. You still have the same evidence-scoring step. The difference is that the model is smaller, so the probability calculation is simpler and quicker, but the process is exactly the same — a list of passages, a probability for the next word, and a comparison.

In retrieval-augmented generation (RAG) systems, citations are not optional. The whole point of RAG is to ground answers in real documents, and citation is how you prove you did that. A typical RAG pipeline first retrieves passages using vector search, then the model generates an answer with citations to the top passages. If the model cannot find a passage that supports a given statement, it must say so — that is just honesty. In enterprise systems, like a law firm's document assistant, citation is a hard requirement, because an answer without a valid citation could be legal malpractice.

For agentic systems, where the AI plans actions, calls tools, and executes loops, citations become part of the validation step. The agent does not just generate an answer; it verifies its own work by checking that the cited evidence actually contains the claimed fact. This is called self-consistency checking. For example, an agent that summarises financial reports must, for each number in its summary, retrieve the original sentence and check that the numbers match. If they don't, it must retract or rephrase.

In ordinary applied machine learning, such as recommender systems or fraud detection, citation is less common because the task is not text generation. But it appears in areas where you need to explain a decision: an automated loan approval system might say "we recommend approval because the applicant meets the income requirement (source: bank record)." This is a simple citation to a data field, but the principle of pointing to the source of a claim is the same.

When things go wrong without citations, the result is hallucination — the AI says something that sounds real but is completely made up. This can be embarrassing, dangerous, or even illegal. For example, a medical chatbot without citations might confidently suggest a treatment that has no basis, endangering a patient. With citation, you can see the mistake and stop it. If the AI cites a passage that does not contain the fact, that's also a sign of failure — a trained model might 'point' to a source that doesn't match the claim. Developers check this with an extra step: they compare the quote in the answer with the actual passage text, using text matching or semantic similarity, and flag mismatches.


---

Read this on the web: https://basavapurushottam.com/learn-ai/citations-and-evidence
