This prompt is for product teams who have already built a working RAG pipeline and are now facing a specific production trade-off: their outputs are either so dense with citations that they are unreadable, or so fluent that no one can verify the claims. The job-to-be-done is to produce a single, configurable system instruction that lets the application layer control citation density at runtime, from minimal key-claim attribution to exhaustive per-sentence grounding, without rewriting the core prompt for every use case. The ideal user is an AI engineer or technical product manager who needs to ship a feature where the end-user's tolerance for citation noise varies by surface—think of a 'detail' toggle in a UI that actually changes model behavior.
Prompt
Citation Density Control Prompt

When to Use This Prompt
Define the job, reader, and constraints for the Citation Density Control Prompt.
Use this prompt when you have a single answer-generation flow that must serve multiple audiences or risk postures. For example, a customer-facing summary widget might need only one citation per paragraph, while an internal compliance review screen for the same content requires a citation on every date, figure, and proper noun. Do not use this prompt if your retrieval quality is poor or your source documents are unreliable; controlling citation density will not fix hallucinations, it will only change how they are presented. This prompt assumes that the underlying evidence is relevant and that your retrieval system can supply the passages needed to support dense citation when requested. If you are still debugging retrieval relevance or source authority, start with the Evidence Weighting and Scoring Prompt or the Source Gap Analysis Prompt instead.
Before integrating this prompt, define your density levels as explicit, testable contracts. A common three-tier schema is: 'minimal' (cite only quantitative claims and direct quotes), 'standard' (cite all factual claims that are not common knowledge within the domain), and 'exhaustive' (cite every declarative sentence). You will need to validate that the model actually changes its behavior across these levels, not just the number of brackets it produces. The next section provides the template, and the implementation harness section covers how to build a density validator that counts citation-to-sentence ratios and fails outputs that drift from the requested level.
Use Case Fit
Where the Citation Density Control Prompt works, where it fails, and what you must provide before using it in production.
Good Fit: Configurable Trust Workflows
Use when: Your product needs to serve different audiences from the same RAG pipeline—executive summaries with minimal citations for leadership and exhaustive per-sentence attribution for audit teams. Guardrail: Map each density level to a specific user role or risk tier in your application config before the prompt is assembled.
Bad Fit: Unstructured or Unchunked Source Material
Avoid when: Retrieved context lacks clear passage boundaries, stable identifiers, or consistent paragraph structure. The prompt cannot cite what it cannot reference. Guardrail: Validate that your retrieval pipeline returns chunk IDs, section headers, or stable paragraph indices before enabling high-density citation modes.
Required Input: Density Configuration Contract
Risk: Without an explicit density level, the model defaults to inconsistent citation behavior across requests. Guardrail: Always pass a structured density parameter such as minimal, key-claims, balanced, or exhaustive with clear definitions for each level in the system prompt.
Operational Risk: Citation Drift Under High Density
Risk: At exhaustive density, models may fabricate citations to satisfy the per-sentence attribution requirement when evidence is thin. Guardrail: Pair high-density outputs with a citation completeness audit step that verifies each citation maps to a real retrieved passage before the answer reaches the user.
Operational Risk: Readability Collapse
Risk: Dense inline citations can render answers unreadable, especially in conversational interfaces where users expect fluent prose. Guardrail: For chat surfaces, use minimal or key-claims density and move full citation metadata to a collapsible footer or tooltip layer in the UI.
Bad Fit: Real-Time Streaming Without Post-Processing
Risk: Streaming token-by-token citation generation makes it impossible to validate citation accuracy before the user sees partial output. Guardrail: Buffer the full response, run citation validation, and only release the answer to the user after the audit pass—or disable streaming for high-density modes.
Copy-Ready Prompt Template
A reusable prompt template with square-bracket placeholders for controlling citation density in AI-generated answers.
This prompt template lets you configure how many citations appear in a generated answer, from minimal key-claim attribution to exhaustive per-sentence sourcing. Use it when your application needs to balance readability against traceability, and when different user roles or risk levels demand different citation densities. The template uses square-bracket placeholders that you replace at runtime with your retrieved context, user question, density configuration, and output schema.
textYou are an evidence-grounded assistant. Your task is to answer the user's question using ONLY the provided retrieved context. You must cite your sources inline according to the specified citation density level. ## CITATION DENSITY LEVEL: [DENSITY_LEVEL] - "minimal": Cite only the 1-3 most important factual claims. Do not cite common knowledge, definitions, or transitional statements. - "moderate": Cite key claims, statistics, dates, names, and any claim a reader might reasonably question. Aim for 1 citation per 2-3 sentences on average. - "exhaustive": Cite every factual statement, including definitions, background context, and supporting details. Every sentence that contains a fact from the sources must have a citation. - "per-sentence": Attach at least one citation marker to every sentence, even if multiple sentences draw from the same source passage. ## CITATION FORMAT Use numbered inline markers in square brackets: [1], [2], [3]. Each marker must correspond to a source in the provided context. If multiple sources support a claim, list all relevant markers: [1][3]. ## RETRIEVED CONTEXT [RETRIEVED_CONTEXT] ## USER QUESTION [USER_QUESTION] ## OUTPUT REQUIREMENTS 1. Answer the question using only information from the retrieved context. 2. Apply the citation density specified above. 3. If the context is insufficient to answer, state that clearly and do not fabricate citations. 4. Return your answer in the following JSON format: { "answer": "The full answer text with inline citation markers.", "citations": [ {"marker": 1, "source_id": "doc_1", "passage": "The cited passage text."}, {"marker": 2, "source_id": "doc_2", "passage": "The cited passage text."} ], "density_applied": "[DENSITY_LEVEL]", "citation_count": 3, "insufficient_context": false } ## CONSTRAINTS - Do not cite sources outside the retrieved context. - Do not invent source passages or marker numbers. - If [DENSITY_LEVEL] is "exhaustive" or "per-sentence", every factual sentence must have at least one citation marker. - Preserve the exact passage text in the citations array.
To adapt this template, replace [DENSITY_LEVEL] with one of the four supported values based on your application's risk tolerance and user needs. Populate [RETRIEVED_CONTEXT] with your RAG pipeline output, including source IDs and passage text. Insert the [USER_QUESTION] at runtime. The JSON output schema is designed for programmatic consumption, making it straightforward to validate citation counts against the requested density level before surfacing the answer to users. For high-risk domains, add a human-review step when insufficient_context is true or when the actual citation_count falls below the expected threshold for the requested density.
Prompt Variables
Required and optional inputs for the Citation Density Control Prompt. Each placeholder must be populated before inference to produce reliable, density-calibrated outputs.
| Placeholder | Purpose | Example | Validation Notes |
|---|---|---|---|
[USER_QUERY] | The question or task requiring a cited answer | Explain the impact of interest rate changes on bond prices | Required. Must be non-empty string. Reject if only whitespace or under 10 characters. |
[RETRIEVED_CONTEXT] | Source passages with identifiers to ground the answer | Passage 1 (doc_id: fin101): Bond prices move inversely to yields... | Required. Must contain at least one passage with a unique identifier. Validate that each passage has a doc_id or source key. |
[CITATION_DENSITY] | Controls how many claims receive citations | key_claims_only | balanced | per_sentence | exhaustive | Required. Must match one of the allowed enum values. Reject unknown values and return a clarification request. |
[CITATION_FORMAT] | Defines the output citation style and marker structure | inline_numeric | footnote | parenthetical_author_date | custom | Required. Must match one of the allowed enum values. If custom, [CUSTOM_FORMAT_RULES] must also be provided. |
[CUSTOM_FORMAT_RULES] | Specifies the citation format when [CITATION_FORMAT] is custom | Use superscript numbers in square brackets linking to a references section at the end | Required only if [CITATION_FORMAT] is custom. Must be a non-empty string describing the format. Validate presence when custom is selected. |
[OUTPUT_SCHEMA] | Defines the expected output structure | paragraph_with_citations | bullet_list_with_citations | json_with_citation_array | Required. Must match one of the allowed enum values. If json_with_citation_array, validate that downstream parser expects the specified JSON shape. |
[MAX_ANSWER_LENGTH] | Token or word budget for the generated answer | 500 words | 2000 tokens | Optional. If provided, must be a positive integer with a unit. If omitted, model uses default budget. Validate that value does not exceed model context window minus prompt overhead. |
[ABSTENTION_THRESHOLD] | Minimum source coverage required before the model should abstain | 0.6 (60% of claims must be sourceable) | Optional. If provided, must be a float between 0.0 and 1.0. If omitted, default is 0.0. Validate that threshold is not set to 1.0 unless exhaustive citation is acceptable with zero unsourced statements. |
Implementation Harness Notes
How to wire the Citation Density Control Prompt into an application with validation, retries, and observability.
The Citation Density Control Prompt is designed to be a configurable component in a production RAG pipeline, not a standalone chat instruction. The primary integration point is immediately after retrieval and before the final response is surfaced to the user. Your application should inject the retrieved context chunks, the user's query, and a runtime density configuration into the prompt template. The density configuration should be a controlled parameter—exposed as a user preference, a product feature flag, or an API parameter—with allowed values like minimal, balanced, and exhaustive. Never allow free-text density descriptions from untrusted input, as this can lead to prompt injection or unpredictable behavior.
After the model returns a response, you must validate the citation density before the output reaches the user. Implement a post-processing validator that counts the number of citation markers or reference brackets in the output and compares it against the expected density tier. For minimal density, expect citations only on key quantitative claims or direct quotes; for exhaustive density, expect a citation on nearly every sentence. If the validator detects a mismatch—such as zero citations in an exhaustive request or excessive citations that degrade readability in a minimal request—trigger a retry loop. The retry should resubmit the same prompt with an additional constraint injected into the [CONSTRAINTS] block, such as 'The previous output had insufficient citations. Every factual sentence must include a source reference.' Limit retries to a maximum of two attempts before falling back to a human review queue or surfacing the best-effort output with a warning flag.
Model choice significantly impacts this prompt's reliability. Models with strong instruction-following capabilities, such as Claude 3.5 Sonnet or GPT-4o, handle density instructions more consistently than smaller models. If you are using an open-weight model like Llama 3 or Mixtral, expect to invest more effort in few-shot examples within the [EXAMPLES] block to demonstrate each density tier. Log every invocation with the density configuration, the number of citations produced, the validator result, and the retry count. This telemetry is essential for tuning density thresholds and detecting drift when you change models or update the retrieval pipeline. For high-stakes domains like legal or healthcare, always route exhaustive density outputs to a human reviewer before they reach the end user, regardless of validator results.
Expected Output Contract
Defines the structure, types, and validation rules for the output generated by the Citation Density Control Prompt. Use this contract to parse and validate the model's response before it reaches the user or downstream systems.
| Field or Element | Type or Format | Required | Validation Rule |
|---|---|---|---|
answer_text | String | Must be non-empty. Length must be within the configured [MAX_ANSWER_LENGTH] constraint. Content must be a coherent synthesis of the provided [CONTEXT]. | |
citations | Array of Citation Objects | Array length must be >= [MIN_CITATIONS] and <= [MAX_CITATIONS] as defined by the [DENSITY_LEVEL] configuration. If no citations are possible, the array must be empty and the 'answer_text' must be an abstention message. | |
citations[].source_id | String | Must exactly match a 'source_id' provided in the [CONTEXT] input. A mismatch or fabricated ID is a critical failure. | |
citations[].claim_reference | String | Must be a verbatim substring of the 'answer_text'. If the substring cannot be found, the citation is invalid. For 'exhaustive' density, every sentence must have a corresponding citation. | |
citations[].relevance | String (Enum) | Must be one of: 'directly_supports', 'provides_context', 'mentions'. The value 'directly_supports' is required for key claims at 'minimal' density. | |
density_level_applied | String (Enum) | Must exactly match the [DENSITY_LEVEL] input parameter. Validates that the model followed the correct configuration. | |
abstention_flag | Boolean | Must be 'true' if the [CONTEXT] is insufficient to answer the [USER_QUERY] without fabrication. If 'true', 'answer_text' must be a pre-defined abstention message and 'citations' must be empty. | |
validation_warnings | Array of Strings | If present, each string must describe a specific, non-blocking issue encountered during generation, such as 'Low-confidence source: [source_id]'. Must not contain any PII from the context. |
Common Failure Modes
Citation density control fails in predictable ways. Here are the most common failure modes, why they happen, and how to guard against them before they reach users.
Density Drift Toward Exhaustive Citations
What to watch: The model ignores the requested density level and defaults to citing every sentence, producing unreadable walls of bracketed references. This happens when density instructions are buried late in the prompt or expressed only as a single adjective. Guardrail: Place the density configuration early in the system prompt using a structured enum like [MINIMAL | KEY_CLAIM | STANDARD | EXHAUSTIVE] and reinforce it with a negative example showing the failure pattern.
Under-Citation of Inferred or Implied Claims
What to watch: The model generates reasonable-sounding conclusions that connect multiple sources but fails to cite any of them, treating synthesis as original thought. This is especially dangerous in analysis and recommendation outputs. Guardrail: Add an explicit instruction that any claim not labeled as common knowledge must have at least one source citation, and include a few-shot example showing a synthesized claim with its composite citations.
Citation-Answer Mismatch After Density Changes
What to watch: When density is reconfigured, the model changes both citation frequency and answer content, sometimes dropping key claims that were previously cited. The answer drifts because the model conflates citation density with answer completeness. Guardrail: Separate the answer-generation instruction from the citation-density instruction. Use a two-pass approach or explicit constraint that answer substance must remain identical across density levels, only citation frequency changes.
Placeholder or Fabricated Citations at Low Density
What to watch: At minimal density, the model may cite a source that does not actually support the claim, because it feels pressure to include at least one citation and selects poorly. This produces confident-looking but unverifiable outputs. Guardrail: Require that every citation marker maps to a verifiable passage in the provided context. Add a post-generation validation step that checks each cited source against the claim it supposedly supports, and flag mismatches for human review.
Density Instruction Override by User Prompt
What to watch: A user request like "give me all the details with sources" overrides the configured density setting, causing the model to switch to exhaustive mode without the system detecting the override. This breaks consistency guarantees for downstream consumers. Guardrail: Add a system-level instruction that the density configuration is a hard constraint not subject to user override unless the user explicitly requests a density change using the approved enum values. Log density overrides as an operational event.
Readability Collapse at High Citation Density
What to watch: At exhaustive density, inline citations make sentences unparseable, especially when multiple sources are cited mid-clause. The output becomes technically cited but functionally unusable for readers. Guardrail: For exhaustive density, instruct the model to use footnote-style or end-of-sentence citation grouping rather than inline mid-clause markers. Provide a formatting rule that no sentence may contain more than two inline citation markers before switching to grouped format.
Evaluation Rubric
Use this rubric to test citation density control outputs before shipping. Each criterion targets a specific failure mode in density configuration, readability, or traceability.
| Criterion | Pass Standard | Failure Signal | Test Method |
|---|---|---|---|
Density Level Adherence | Output matches the requested [DENSITY_LEVEL] (e.g., minimal, balanced, exhaustive). | Output uses a different density than requested, such as exhaustive citations when minimal was specified. | Parse citation count per sentence or paragraph. Compare ratio to expected density band defined in [DENSITY_CONFIG]. |
Citation Marker Format Consistency | All citations use the format specified in [CITATION_FORMAT] (e.g., [1], (Author, Year)). | Mixed formats appear, such as some numeric markers and some inline author-date. | Regex validation against the expected citation pattern. Flag any deviation from the format rule. |
Claim-to-Citation Mapping | Every factual claim in the output has a corresponding citation when [DENSITY_LEVEL] is balanced or exhaustive. | A factual statement appears without a citation marker, or a citation is present but no claim is made. | Manual spot-check or LLM-as-judge: extract claims, then verify each has a citation marker within the same sentence or clause. |
Readability Preservation | Output remains fluent and readable at the requested density. No sentence fragmentation from over-citation. | Sentences are broken into fragments by excessive citation insertion, or prose becomes unreadable. | Human review or readability score (e.g., Flesch-Kincaid) compared to a baseline. Flag if score drops below [READABILITY_THRESHOLD]. |
No Fabricated Citations | All citation markers correspond to sources provided in [SOURCE_LIST] or [CONTEXT]. | A citation marker references a source ID that does not exist in the provided context. | Parse all citation markers. Cross-reference each marker ID against the provided source list. Flag any orphans. |
Source Grounding Accuracy | Cited sources actually support the claim they are attached to. | A citation is attached to a claim that the source does not support or directly contradicts. | LLM-as-judge with evidence: for each cited claim, check if the referenced source passage supports it. Flag mismatches. |
Density Boundary Handling | Output respects the upper and lower bounds of the [DENSITY_CONFIG] without over-citing or under-citing. | Output cites every word (over-citing) or cites only the final paragraph (under-citing) when a balanced density is requested. | Count total citations. Assert count is within the range defined in [DENSITY_CONFIG]. Fail if outside bounds. |
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Adapt This Prompt
How to adapt
Start with the base prompt and a single density level. Remove the multi-level configuration block and hardcode one density setting (e.g., key-claim). Use a simple string output instead of the structured JSON schema. Test with 5-10 document-answer pairs manually.
code[CITATION_DENSITY] = "key-claim" [OUTPUT_FORMAT] = plain text with bracketed citations
Watch for
- Density drift: the model may default to its own citation frequency regardless of instruction
- Missing validation: without schema checks, malformed citation markers go undetected
- Over-citation on simple facts: the model may cite every sentence even when told to be sparse

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us