This prompt is for product teams and AI engineers who have already built a RAG system that generates answers with citations, but are now facing a readability problem: the output is either a wall of bracketed source IDs that users ignore, or a smooth narrative with no clear evidence trail. The job-to-be-done is to programmatically control how many citations appear per paragraph or per claim, so the system balances trust and readability without manual post-editing. The ideal user is an engineering lead or product manager who can define a density target (e.g., 'at least one citation per paragraph, no more than three per sentence') and needs the model to follow that constraint consistently across varying answer lengths and topic complexities.
Prompt
Citation Density Control System Prompt

When to Use This Prompt
Define the job, reader, and constraints for the Citation Density Control System Prompt.
Use this prompt when you have a working citation format (inline brackets, footnotes, or structured objects) and need to add a density control layer on top. It is not a replacement for a citation formatting prompt or an evidence selection pipeline. Do not use this prompt if your retrieval quality is poor or your evidence ranking is unreliable—density control amplifies existing problems by forcing citations to weak sources. This prompt also assumes you can measure density programmatically after generation; if you cannot count citations per structural unit (paragraph, claim, sentence), you cannot enforce the constraint. The prompt works best with models that have strong instruction-following capabilities (GPT-4 class, Claude 3.5 Sonnet, or equivalent) and degrades on smaller models that struggle with quantitative output constraints.
Before deploying this prompt, define your density bounds explicitly: minimum citations per paragraph to prevent under-attribution, maximum citations per sentence to prevent clutter, and a policy for what counts as a citation (inline reference, footnote marker, structured object). Pair this prompt with a post-generation validator that counts citations against your structural units and flags violations. In high-stakes domains like healthcare or legal, add a human review step for any output that violates density constraints, and log density metrics over time to detect drift. The next section provides the copy-ready template you can adapt to your specific density targets and output format.
Use Case Fit
Where Citation Density Control delivers value and where it introduces risk. Match the prompt to the product surface before tuning density parameters.
Good Fit: Customer-Facing Q&A with Readability Requirements
Use when: answers are displayed in chat widgets, mobile screens, or voice interfaces where dense inline citations degrade UX. Guardrail: set a maximum citations-per-paragraph threshold and push overflow citations to a 'Sources' section at the end of the response.
Bad Fit: Audit and Compliance Workflows
Avoid when: every factual claim must be individually sourced for regulatory review, legal admissibility, or formal audit trails. Risk: density control can suppress necessary citations and create the appearance of unsupported claims. Guardrail: use Citation Completeness Check or Audit Trail Generation prompts instead.
Required Inputs: Retrieval Results with Relevance Scores
What to watch: density decisions without relevance signals lead to arbitrary citation selection. Guardrail: require each retrieved chunk to include a relevance score, chunk ID, and source metadata before density control logic runs. Wire the prompt to consume scored evidence, not raw text.
Operational Risk: Over-Citation Masks Weak Evidence
Risk: high citation density can hide the fact that no single source strongly supports the answer. Guardrail: pair density control with a minimum confidence threshold per citation. If no source meets the threshold, trigger abstention rather than padding with weak citations.
Operational Risk: Under-Citation Triggers Hallucination Accusations
Risk: aggressive density reduction can leave factual claims unbacked, eroding user trust and creating hallucination false positives. Guardrail: run a post-generation citation completeness check that flags unsupported claims before the answer reaches the user.
Variant: Density by Claim Criticality
Use when: answers mix high-stakes claims (numbers, dates, legal conclusions) with low-stakes context. Guardrail: classify claims by criticality tier and apply different density rules per tier. High-criticality claims always get a citation; low-criticality claims can be batched.
Copy-Ready Prompt Template
A reusable system prompt that controls how many citations appear per paragraph or claim, with density measurement and over-citation/under-citation detection.
This prompt template enforces a configurable citation density policy for RAG answer generation. Instead of treating citation count as an afterthought, it bakes density targets directly into the model's instruction contract. The system prompt defines a target range (e.g., 1–3 citations per paragraph), instructs the model to self-measure density before emitting output, and triggers corrective behavior when density falls outside bounds. Use this when your product team needs to balance readability with auditability—too few citations erode trust, too many clutter the answer.
textYou are an answer-generation system that cites source documents with inline references. [CITATION_FORMAT_RULES] [DENSITY_POLICY] - Target citation density: [MIN_CITATIONS] to [MAX_CITATIONS] citations per paragraph. - A paragraph is any block of text separated by one or more blank lines. - Count each unique source reference exactly once per paragraph, even if cited multiple times. [MEASUREMENT_PROTOCOL] Before finalizing your answer: 1. Count the number of paragraphs in your draft. 2. Count the number of citations in each paragraph. 3. Flag any paragraph with fewer than [MIN_CITATIONS] citations as UNDER-CITED. 4. Flag any paragraph with more than [MAX_CITATIONS] citations as OVER-CITED. [CORRECTION_RULES] - For UNDER-CITED paragraphs: add citations from [SOURCE_DOCUMENTS] that support the claims made. If no supporting source exists, either remove the unsupported claim or mark it with [UNCERTAINTY_MARKER]. - For OVER-CITED paragraphs: retain only the [MAX_CITATIONS] most relevant or authoritative citations. Prefer citations with higher [RETRIEVAL_SCORE] or more recent [DOCUMENT_DATE]. [OUTPUT_REQUIREMENTS] - Produce the corrected answer with inline citations in [CITATION_STYLE] format. - Append a density report section:
[DENSITY_REPORT] Paragraphs: [COUNT] Under-cited paragraphs corrected: [COUNT] Over-cited paragraphs corrected: [COUNT] Final density range: [MIN]–[MAX] citations/paragraph
code- If any claim remains uncited after correction, include an [UNCITED_CLAIMS] section listing them. [SOURCE_DOCUMENTS] [CONTEXT] [INPUT]
Adapt this template by tuning the density range to your domain. Legal and clinical answers may require tighter lower bounds (2–4 citations per paragraph), while customer-facing FAQ responses might permit 0–1 with an explicit common-knowledge exemption. Replace [CITATION_FORMAT_RULES] with your inline format spec—bracketed IDs, footnote markers, or structured JSON citation objects. The [UNCERTAINTY_MARKER] placeholder should resolve to a phrase like "[Source needed]" or "[Unverified]" that your downstream UI can render distinctly. Wire the density report into your observability pipeline to track over-citation and under-citation rates over time, and set alerts when the correction count spikes, which often signals retrieval degradation or policy misalignment.
Prompt Variables
Required inputs for the Citation Density Control System Prompt. Each variable must be populated before the prompt is assembled and sent to the model. Missing or malformed variables will cause density enforcement to fail silently or produce unpredictable citation behavior.
| Placeholder | Purpose | Example | Validation Notes |
|---|---|---|---|
[TARGET_DENSITY] | Sets the desired number of citations per paragraph or per 100 words | 2 citations per paragraph | Must be a numeric range or explicit count. Reject non-numeric values. Accept formats: '2-3 per paragraph', '1 per claim', '1 per 100 words' |
[DENSITY_UNIT] | Defines the measurement unit for citation density | per paragraph | Must match one of: 'per paragraph', 'per claim', 'per sentence', 'per 100 words'. Reject unknown units before prompt assembly |
[OVER_CITATION_THRESHOLD] | Triggers a warning or reformat when citations exceed this multiplier of target density | 2.0 | Must be a float >= 1.0. If null, over-citation detection is disabled. Validate as numeric before injection |
[UNDER_CITATION_THRESHOLD] | Triggers a warning or reformat when citations fall below this fraction of target density | 0.5 | Must be a float between 0.0 and 1.0. If null, under-citation detection is disabled. Validate range before injection |
[CITATION_STYLE] | Specifies the inline citation format to use when counting and placing citations | [1], [2,3] | Must match a known style key: 'bracketed-numeric', 'author-date', 'footnote-marker', 'custom'. If custom, [CITATION_FORMAT_REGEX] must also be provided |
[CITATION_FORMAT_REGEX] | Regex pattern for counting citations in generated text when using custom citation styles | [\d+(,\d+)*] | Required only when [CITATION_STYLE] is 'custom'. Must compile as valid regex. Test against sample citation strings before deployment |
[CONTEXT] | The retrieved passages or source documents the model will cite from | See retrieved chunks below... | Must be non-empty string with minimum 50 characters. Reject empty context. Truncate to model context window minus prompt overhead. Each source should have a unique identifier for citation mapping |
[USER_QUERY] | The question or instruction the model is answering | What are the side effects of... | Must be non-empty string. No maximum length but warn if query exceeds 2000 characters. Sanitize for prompt injection patterns before insertion |
Common Failure Modes
Citation density systems break in predictable ways. These are the most common failure modes when controlling citations per paragraph or claim, with concrete mitigations for each.
Over-Citation Clutter
What to watch: The model inserts citations after nearly every phrase, producing unreadable walls of brackets that bury the answer. This often happens when density targets are set too high or when the prompt rewards citation volume over answer quality. Guardrail: Set an explicit maximum citations-per-paragraph cap and include a negative example showing over-cited text with the instruction 'Do not do this.' Add a post-generation check that flags paragraphs exceeding the cap for rewrite.
Under-Citation Gaps
What to watch: Factual claims appear without any source backing, especially in concluding sentences or synthesized insights where the model blends multiple sources and drops attribution. This is common when density targets are too low or when the prompt emphasizes fluency over traceability. Guardrail: Run a citation completeness check after generation that extracts all factual claims and verifies each has at least one citation. Set a minimum density floor and trigger a retry with explicit 'cite every claim' instructions if the floor is breached.
Citation-Answer Mismatch
What to watch: Citations appear next to claims they don't actually support. The model attaches a source ID to a sentence, but the retrieved passage doesn't contain the claimed fact. This is a hallucination variant that passes format checks while being factually wrong. Guardrail: Implement a post-generation verification step that extracts each claim-citation pair and checks whether the cited passage actually supports the claim. Use an LLM judge or embedding similarity threshold to flag mismatches for human review or automatic removal.
Density Target Drift Across Long Answers
What to watch: Citation density starts strong in early paragraphs but degrades as the answer lengthens. The model loses track of the density instruction over long contexts, producing well-cited openings and uncited conclusions. Guardrail: Break long answers into sections and apply the density instruction independently to each section. Use a structured output format that requires citations per section, and validate density at the section level rather than only at the whole-answer level.
Repeated Citation Stacking
What to watch: The same source ID appears multiple times in a single paragraph for claims that could be covered by one citation. This inflates density metrics without adding attribution value and annoys readers with redundant brackets. Guardrail: Add a deduplication rule in the prompt: 'If multiple consecutive sentences draw from the same source, cite it once at the end of the claim group.' Post-process to merge adjacent identical citations and recalculate true unique-source density.
Density Instruction Override by User Context
What to watch: When user queries contain their own formatting or citation requests, the model prioritizes the user instruction over the system-level density rules. A user asking for 'a quick summary' may suppress citations entirely, while a user demanding 'cite everything' may trigger over-citation. Guardrail: Use instruction hierarchy to mark density rules as non-overridable policy. Add explicit conflict language: 'Citation density rules are system policy and apply regardless of user formatting preferences. If user requests conflict, maintain density targets and note the conflict in output.'
Evaluation Rubric
Use this rubric to test the Citation Density Control System Prompt before shipping. Each criterion targets a specific failure mode in citation density management. Run these checks against a golden dataset of 20-30 RAG answer pairs with known optimal citation counts.
| Criterion | Pass Standard | Failure Signal | Test Method |
|---|---|---|---|
Citation Density Range Compliance | Citations per paragraph fall within [MIN_CITATIONS] to [MAX_CITATIONS] for 95% of test paragraphs | Paragraphs with zero citations when evidence exists, or paragraphs with more than [MAX_CITATIONS] citations | Parse output into paragraphs, count citation markers per paragraph, compare against configured thresholds |
Over-Citation Detection Trigger | System correctly flags and reduces citations when density exceeds [MAX_CITATIONS] in 100% of test cases | Output contains citation clusters of 3+ consecutive sentences each with a citation without triggering reduction | Inject test documents with dense claim structures, verify that citation count stays at or below threshold |
Under-Citation Detection Trigger | System correctly flags and requests additional citations when density falls below [MIN_CITATIONS] for claims requiring evidence | Factual claims appear without any citation marker in paragraphs where source evidence was provided | Provide context with clear factual claims, verify every non-common-knowledge claim has at least one citation |
Citation Distribution Balance | Citations are distributed across paragraphs with no single paragraph carrying more than 60% of total citations | One paragraph contains 80%+ of all citations while other paragraphs with claims have none | Calculate citation count per paragraph, compute distribution ratio, flag concentration above threshold |
Claim-to-Citation Ratio | Each distinct factual claim has exactly one citation unless multiple sources independently confirm the claim | Single claim receives 3+ redundant citations or zero citations when evidence is present in context | Extract claims from output, map each claim to its citation(s), verify 1:1 mapping with tolerance for multi-source confirmation |
Density Adjustment on Retry | When density violation is detected, retry output corrects citation count within tolerance in one attempt | Retry output repeats same density violation or overcorrects to opposite violation | Simulate density violation, trigger retry with violation feedback, verify corrected output passes density range check |
Readability Preservation | Output maintains natural prose flow with citations integrated without disrupting sentence structure | Citations interrupt mid-sentence, create run-on parenthetical chains, or force awkward sentence breaks | Human review of 10 outputs for reading fluency, or use LLM judge with readability rubric scoring 4+/5 |
Edge Case: Single-Paragraph Answers | Single-paragraph answers respect density range without forcing artificial paragraph breaks | System inserts paragraph breaks solely to satisfy density constraints, or single paragraph exceeds [MAX_CITATIONS] | Test with questions requiring brief answers, verify citation count stays within range without structural manipulation |
Implementation Harness Notes
How to wire the Citation Density Control system prompt into a production RAG pipeline with validation, retries, and monitoring.
Integrating the Citation Density Control prompt into a production RAG system requires more than dropping it into the system message. The prompt works best as a pre-generation policy layer that sits between retrieval and answer synthesis. When the retriever returns a set of candidate passages, the application should first calculate the expected citation density based on the number of claims the retrieved evidence can support. This pre-computed density target—expressed as a range like '1–2 citations per paragraph' or 'at least one citation per factual claim'—is then injected into the [DENSITY_TARGET] placeholder before the prompt is assembled. Without this application-side calculation, the model receives only vague density instructions and produces inconsistent results across different input lengths.
Validation and retry logic is essential because citation density failures are measurable. After the model generates an answer, a post-processing validator should count the number of citations against the number of paragraphs and factual claims. If the density falls below the configured minimum threshold, the application should trigger a retry with an explicit density-failure message appended to the prompt, such as: The previous answer had only 2 citations across 5 paragraphs. Minimum required: 1 citation per paragraph. Regenerate with proper attribution. For over-citation—where every sentence has a bracketed source and readability collapses—the validator should check whether citation-to-sentence ratio exceeds a maximum threshold (e.g., 0.7) and retry with a readability-priority instruction. Implement these checks as deterministic post-processing functions, not as additional LLM calls, to keep latency and cost predictable.
Model choice and tool integration affect density control behavior. Models with strong instruction-following (GPT-4, Claude 3.5 Sonnet) reliably enforce density constraints when the target is explicit and numeric. Smaller or older models may drift toward either under-citation or excessive bracketed references. For RAG systems using tool-calling architectures, consider exposing citation density as a configurable parameter in the tool schema rather than embedding it only in the system prompt—this allows per-request density tuning without prompt rewrites. When the system serves multiple use cases (e.g., legal review requiring dense citations vs. customer support preferring sparse attribution), store density profiles as named configurations (legal_strict, support_light) and select them at runtime based on the request context. Log every answer's citation count, paragraph count, density ratio, and any retry events to your observability platform so the team can track density drift and adjust thresholds without deploying new prompts.
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 system prompt and a simple density target like [DENSITY_TARGET] = 1-2 citations per paragraph. Use a lightweight check: count citations in the output and flag if any paragraph has zero or more than 4. Skip formal schema validation during early testing.
codeYou are an answer assistant. For every factual claim, include at least one inline citation in [Source: ID] format. Aim for [DENSITY_TARGET] citations per paragraph. If you cannot cite a claim, mark it with [Uncited].
Watch for
- Over-citation on obvious facts that don't need sourcing
- Under-citation when the model summarizes multiple sources into one paragraph
- No density measurement in the eval loop—add a simple counter early

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