Constrain source quotations in prompts and verify each excerpt
A prompt that asks for citations does not guarantee that a model reproduces source text exactly. Separate direct quotation from paraphrase, specify citable material and policy-defined limits, and verify the quote and its source ID against the original. A citation helps readers find evidence; it does not prove quotation accuracy or factual support by itself.
A prompt that asks for citations does not guarantee that a model reproduces source text exactly. Separate direct quotation from paraphrase, specify citable material and policy-defined limits, and verify the quote and its source ID against the original. A citation helps readers find evidence; it does not prove quotation accuracy or factual support by itself.
Define what can be quoted
Pass source material in identifiable units: a whole document, a paragraph or retrieved chunk, or a line range. Give each unit a stable ID, and preserve enough title, section, date, or surrounding text for a person to inspect it. Units that are too large make support hard to locate; units that are too small can omit conditions.
Tell the model: direct quotes must be exact contiguous text from supplied sources; do not edit or join separated passages; label quotation and paraphrase separately; use only supplied source IDs; set a maximum quote length and count according to the project’s rights and editorial policy; if evidence is missing or cannot be checked, do not invent a quote and state the limitation. A maximum is a ceiling, not a target. If explanation matters more than exact wording, ask for a paraphrase with a source reference instead.
Separate quotations from explanations
Suppose a support document says, “Unopened items may be returned within 30 days of delivery.” In a hypothetical task asking for evidence of the return deadline, ask for the exact passage in a quote field and a separate explanation of why it answers the question. Do not let the model freely rewrite a quote as if it were verbatim.
Sources are provided in <source id="S1"> tags.
Answer the question. If a direct quote is needed, copy one contiguous passage from S1 exactly.
Do not edit a quote or combine nonadjacent text. Keep quotes separate from paraphrases.
Use only supplied source IDs. If evidence is absent, omit the quote and state what is missing.
Stay within the project’s allowed quote length and count.
Return: answer, evidence_type, quote (empty for paraphrase), source_id, limitation.This is a prompt example, not an API feature or validation result. Model output alone cannot ensure that a quote is exact.
Validate the quote and its support
In application code, check that the source ID exists in the current retrieval results, that quoted text appears in the allowed source text, and that length and count limits are met. Then review whether the passage in context actually supports the associated claim. Exact-string matching catches altered quotations, but OCR errors, line breaks, or Unicode differences can cause mismatches; normalization rules should be used only for comparison, and ambiguous cases should be reviewed. A quote may match exactly and still omit a condition that changes its meaning. Paraphrases need a separate meaning-and-support check.
OpenAI’s citation guidance recommends choosing suitable citable units, stable IDs, clear source representation, explicit citation instructions, and validation before display. Microsoft’s RAG guidance recommends labeling retrieved chunks and citing the source for claims. These markers aid traceability; they do not establish that every generated sentence is supported.
Test edge cases
Include cases with available evidence, no evidence, partial answers, conflicting sources, and questions that do not need a quote. Measure quote-to-source match, source-ID validity, claim support, adherence to limits, and fallback behavior separately. When a case fails, distinguish unclear instructions, missing retrieval text, incorrect IDs, and absent application checks; fix the cause and rerun the same cases.
In short, define source boundaries, exact-versus-paraphrased fields, IDs, project-specific limits, and missing-evidence behavior, then validate both the text match and the meaning in context. A prompt can request the format but cannot replace validation.
References
[OpenAI API: Citation Formatting](https://developers.openai.com/api/docs/guides/citation-formatting) — Citable units, stable source IDs, prompt instructions, and validation before rendering.
[Microsoft Learn: RAG prompt engineering](https://learn.microsoft.com/en-us/azure/architecture/ai-ml/guide/rag/rag-prompt-engineering) — Source IDs and metadata for retrieved chunks, claim citations, and insufficient or conflicting evidence.