Inferensys

Prompt

Abstractive Compression Prompt with Factuality Constraints

A practical prompt playbook for using Abstractive Compression Prompt with Factuality Constraints in production AI workflows.
Wide-angle shot of a modern WeWork open floor plan with creative walls covered in AI system architecture diagrams, product team collaborating in standing desk area with industrial lighting.
PROMPT PLAYBOOK

When to Use This Prompt

Define the job, the user, and the boundaries for abstractive compression with factuality constraints.

This prompt is for AI engineers and operators who need to compress long evidence passages into shorter, fluent summaries when extractive snippets are too verbose or disjointed for the target context window. The core job-to-be-done is reducing token cost and latency without introducing claims that are absent from the source material. The ideal user is someone integrating this into a production RAG pipeline, an agent workflow, or a document processing system where downstream tasks depend on factual accuracy. You should have the original source text, a clear compression target (e.g., token count or reduction ratio), and a defined downstream consumer—whether that's another model, a human reviewer, or a structured data extraction step.

Do not use this prompt when the evidence is short enough to pass through verbatim, when extractive snippets with citations are required for compliance, or when the compression ratio is so aggressive that essential facts will inevitably be dropped. It is also the wrong tool when the downstream task requires exact legal or medical terminology that must not be paraphrased. In regulated domains, always pair this prompt with a factuality verification step and a human review gate before the compressed output is used in decisions. The prompt is designed for abstractive compression, meaning it will rephrase and condense—it will not produce a word-for-word extract. If you need verbatim quotes mapped to claims, use an extractive snippet selection prompt instead.

Before wiring this into production, define your factuality eval criteria: compare the compressed output against the source for additions, omissions, and semantic drift. Common failure modes include hallucinated dates, invented proper nouns, and subtle shifts in causality or certainty. Start with a moderate compression ratio (e.g., 50%) and tighten only after validating that your eval pass rate holds. If the compression introduces unsupported claims, adjust the constraints, add few-shot examples of faithful compression, or reduce the target ratio. The next section provides the copy-ready template with placeholders for your source, constraints, and output schema.

PRACTICAL GUARDRAILS

Use Case Fit

Where abstractive compression with factuality constraints works and where it introduces unacceptable risk.

01

Good Fit: Long-Form Evidence Summarization

Use when: source documents are too long for extractive snippets but the downstream task needs fluent, condensed context. Guardrail: always run a factuality preservation check prompt comparing the compressed output against the original source before feeding it to the answering model.

02

Bad Fit: Regulatory or Legal Filings

Avoid when: every word carries compliance weight and paraphrasing could alter legal meaning. Guardrail: use extractive snippet selection with verbatim quotes and citation markers instead. Abstractive compression should be blocked or require human review with a redline diff against the source.

03

Required Inputs

Must have: the full source text, a defined compression target (token count or ratio), and a downstream task description so the compressor knows what to preserve. Guardrail: missing any of these produces either over-compression that drops critical facts or under-compression that wastes tokens without solving the problem.

04

Operational Risk: Hallucinated Facts

What to watch: the model introduces claims, dates, or entities not present in the source. Guardrail: pair every compression run with a factuality verification step that extracts claims from the compressed output and checks each claim against the original. Flag any unsupported claim for human review before downstream use.

05

Operational Risk: Semantic Drift

What to watch: the compressed output shifts emphasis, tone, or certainty in ways that change how downstream models interpret the evidence. Guardrail: implement a context drift detection check that compares the compressed and original texts for tone shifts, missing nuance, and emphasis changes. Gate high-stakes workflows on drift scores.

06

Variant: Query-Focused Compression

Use when: you have a specific user question and need to compress evidence while preserving only query-relevant details. Guardrail: provide the user query as an additional input and instruct the compressor to drop information irrelevant to that query. Still run factuality checks on what remains.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

A reusable prompt template for producing condensed, abstractive summaries with explicit guardrails that forbid introducing claims absent from the source material.

This template is the core instruction set for an abstractive compression task. It is designed to be copied directly into your prompt management system, IDE, or orchestration code. The prompt forces the model to produce a fluent, condensed summary while anchoring every factual claim to the source text. It is not a general summarization prompt—it is specifically hardened for factuality by requiring the model to separate certain facts from uncertain interpretations and to explicitly mark any necessary inferences.

text
You are a precise evidence compressor. Your task is to produce a condensed, fluent summary of the provided source text. The summary must be significantly shorter than the original while preserving all claims critical to the user's task.

# SOURCE TEXT
[SOURCE_TEXT]

# USER TASK CONTEXT (OPTIONAL)
[TASK_CONTEXT]

# COMPRESSION TARGET
Target length: approximately [TARGET_LENGTH] [UNIT: words | sentences | tokens].

# OUTPUT FORMAT
Return a valid JSON object with the following schema:
{
  "summary": "The condensed abstractive summary string.",
  "certain_facts": ["List of factual claims directly and unambiguously supported by the source."],
  "uncertain_inferences": ["List of any necessary interpretations, implications, or connections you made that are not explicitly stated in the source. Include 'NONE' if empty."],
  "omitted_topics": ["List of major topics or entities present in the source that were intentionally omitted from the summary due to length constraints."]
}

# ABSOLUTE CONSTRAINTS (VIOLATING THESE IS A FAILURE)
1. DO NOT introduce any fact, figure, name, date, or event that is not present in the source text.
2. DO NOT express an opinion on the source material.
3. If the source is too short or empty to compress, set 'summary' to an empty string and explain why in 'uncertain_inferences'.
4. Every item in 'certain_facts' must be a verbatim or near-verbatim extraction from the source.
5. If you are unsure whether a claim is explicit, place it in 'uncertain_inferences', not 'certain_facts'.

To adapt this template, replace the bracketed placeholders with your runtime values. [SOURCE_TEXT] is the only strictly required input; without it, the prompt should be aborted before inference. [TASK_CONTEXT] is optional but highly recommended—it guides the model on which information is salient for the downstream task, preventing it from compressing away critical evidence. [TARGET_LENGTH] and [UNIT] let you enforce a specific budget. The JSON output schema is non-negotiable for production use because it separates the summary from the factuality audit trail (certain_facts and uncertain_inferences), which is essential for automated hallucination checks. Do not remove the 'ABSOLUTE CONSTRAINTS' section; these are the behavioral contract that prevents the model from treating this as a creative summarization task.

Before integrating this prompt into a production pipeline, test it against a golden dataset of source texts where you know the expected certain facts. A common failure mode is the model placing a true but slightly paraphrased fact into uncertain_inferences due to an overly strict interpretation of 'verbatim'. You may need to adjust the constraint wording for your specific model. After generation, always run a programmatic check: diff the certain_facts list against the source text to ensure every item is a substring or a near-exact match. Any fact that fails this check should be treated as a potential hallucination and either moved to uncertain_inferences or flagged for human review.

IMPLEMENTATION TABLE

Prompt Variables

Required inputs for the Abstractive Compression Prompt with Factuality Constraints. Each placeholder must be populated before inference. Validation checks prevent silent failures from missing or malformed inputs.

PlaceholderPurposeExampleValidation Notes

[SOURCE_TEXT]

The full evidence passage or document to be compressed

The quarterly report indicates revenue grew 12% year-over-year, driven primarily by the enterprise segment which expanded from $45M to $58M in recurring revenue. Customer churn declined to 2.1% from 3.4% in the prior period.

Must be non-empty string. Minimum 100 tokens recommended for meaningful compression. Check for null, empty, or whitespace-only input before assembly.

[COMPRESSION_RATIO]

Target reduction percentage for the output summary relative to source length

0.3

Must be a float between 0.1 and 0.9. Values below 0.1 risk information loss; values above 0.9 may not justify compression cost. Validate range before prompt assembly.

[OUTPUT_FORMAT]

Structure specification for the compressed output

{"summary": "string", "preserved_claims": ["string"], "dropped_information": ["string"], "factuality_score": "float"}

Must be a valid JSON schema string or structured format description. Parse check before inference. Reject if schema contains circular references or undefined types.

[FACTUALITY_CONSTRAINT]

Explicit instruction forbidding introduction of claims absent from source

Do not introduce any fact, figure, date, name, or causal claim not explicitly stated in the source text. If uncertain about a detail, omit it rather than infer.

Must be a non-empty string with explicit prohibition language. Check for presence of negation terms such as do not, must not, forbidden, or prohibited. Weak constraint language triggers retry.

[DOMAIN_TERMS]

List of domain-specific terms, entities, or definitions that must survive compression intact

["enterprise segment", "recurring revenue", "customer churn", "year-over-year"]

Must be a valid JSON array of strings. Each term must appear verbatim in [SOURCE_TEXT]. Validate term presence in source before compression. Missing terms indicate stale or mismatched domain list.

[MAX_OUTPUT_TOKENS]

Hard token ceiling for the compressed output

512

Must be a positive integer. Should be less than source token count multiplied by [COMPRESSION_RATIO] plus 20% buffer. Validate against model context limit. Overflow triggers preflight rejection.

[CITATION_REQUIREMENT]

Whether the compressed output must include source provenance markers

Must be boolean. When true, output schema must include citation fields. When false, factuality constraint still applies. Mismatch between citation requirement and output schema triggers assembly error.

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the abstractive compression prompt into a production pipeline with validation, retries, and factuality guardrails.

The abstractive compression prompt is not a standalone tool; it is a component inside a larger context engineering pipeline. In production, you will typically call this prompt after retrieval and before the final generation step. The harness must accept the original source text and any task-specific constraints, inject them into the template placeholders, and then validate the compressed output before it reaches downstream consumers. Because this prompt is designed to reduce token costs while preserving factual fidelity, the harness must treat the compression step as a lossy but auditable transformation. Always store the original source text alongside the compressed output so that factuality checks and citation verification can be performed later.

Wire the prompt into your application with a pre-inference validation layer that checks: (1) the source text is non-empty and within the model's maximum context window, (2) the compression ratio target is a sensible number between 0.1 and 0.9, and (3) any domain-specific terminology lists are properly formatted as JSON arrays or comma-separated strings. After the model returns the compressed summary, run a post-inference factuality check using a separate verification prompt (such as the Factuality Preservation Check Prompt After Compression from this content group) that compares the compressed output against the original source. If the factuality check flags additions, omissions, or semantic drift above a configurable threshold, trigger a retry with a stronger constraint instruction or escalate for human review. For high-stakes domains like healthcare or legal, require human approval before the compressed context is used in any downstream generation step.

Choose your model based on the compression ratio and latency requirements. For aggressive compression (ratios below 0.3), use a model with strong instruction-following and long-context handling, such as Claude 3.5 Sonnet or GPT-4o. For moderate compression in high-throughput pipelines, a smaller model like Claude 3 Haiku or GPT-4o-mini may suffice, but always validate factuality more aggressively with smaller models. Implement exponential backoff retries for transient API failures, but cap retries at three attempts for factuality failures to avoid infinite loops. Log every compression call with: the original source length in tokens, the compressed output length, the compression ratio achieved, the factuality check score, and whether human review was triggered. This telemetry will help you tune the compression aggressiveness over time and detect model drift. Finally, never pass the compressed output directly to end users without an explicit review step if the source material contains regulated content, conflicting evidence, or time-sensitive claims that could expire between compression and use.

IMPLEMENTATION TABLE

Expected Output Contract

Defines the structure, types, and validation rules for the abstractive compression output. Use this contract to parse, validate, and integrate the model response into downstream pipelines.

Field or ElementType or FormatRequiredValidation Rule

compressed_summary

string

Must be non-empty and contain fewer tokens than [ORIGINAL_CONTEXT]. Check via tokenizer count.

preserved_claims

array of objects

Each object must have 'claim' (string) and 'source_span' (string) fields. 'source_span' must be a verbatim substring of [ORIGINAL_CONTEXT].

preserved_claims[].claim

string

Must be a declarative sentence. Cannot be null or empty.

preserved_claims[].source_span

string

Must pass exact substring match against [ORIGINAL_CONTEXT]. If no match, flag as hallucinated claim.

dropped_information

array of strings

If present, each string must describe a fact or topic from [ORIGINAL_CONTEXT] that was intentionally omitted. Used for audit trail.

compression_ratio

number

Must be a float between 0.0 and 1.0. Calculated as compressed_tokens / original_tokens. Validate against actual token counts.

fidelity_warnings

array of strings

If present, each string must describe a potential fidelity risk (e.g., 'approximate date', 'merged two events'). Triggers human review if non-empty in high-stakes domains.

model_confidence

string

Must be one of enum: ['high', 'medium', 'low']. If 'low', downstream system should escalate for human review or reject the compression.

PRACTICAL GUARDRAILS

Common Failure Modes

Abstractive compression promises shorter context, but it introduces a new failure surface: hallucinated facts, dropped evidence, and semantic drift. These are the most common production failure modes and how to guard against them before the compressed output reaches a downstream task.

01

Hallucinated Facts Introduced During Compression

What to watch: The model generates fluent summaries that sound plausible but introduce claims, dates, or entities absent from the source. This is the most dangerous failure mode because downstream tasks trust the compressed context as ground truth. Guardrail: Run a factuality preservation check prompt that compares each claim in the compressed output against the original source and flags additions. Require the check to pass before the compressed context is used.

02

Critical Evidence Dropped Silently

What to watch: The compression drops a key fact, constraint, or entity that is essential for the downstream task, but the summary reads coherently so the omission goes unnoticed. This is especially common when the dropped evidence appears only once in the source. Guardrail: Implement a salience check that identifies task-critical entities and constraints before compression, then verify their presence in the output. Use a structured retention checklist rather than relying on summary fluency.

03

Semantic Drift in Technical Terminology

What to watch: Domain-specific terms, precise measurements, or legal language get paraphrased into looser equivalents that change meaning. A 'must' becomes a 'should,' a dosage becomes a range, or a contract clause loses its operative language. Guardrail: Add explicit terminology preservation instructions to the compression prompt. Follow up with a terminology fidelity check that extracts all domain terms from the source and confirms exact matches in the compressed output.

04

Citation Chain Broken After Compression

What to watch: The compressed context retains factual content but loses the mapping back to source passages, making downstream citations impossible or unverifiable. This breaks audit trails and compliance requirements. Guardrail: Require the compression prompt to preserve citation markers inline. Run a citation integrity verification that confirms every marker in the compressed output maps to a retrievable source passage with no orphaned references.

05

Compression Amplifies Source Bias

What to watch: When the source contains conflicting viewpoints or nuanced uncertainty, the compression model may select one perspective and drop qualifiers, producing a falsely confident summary. The compressed output becomes more biased than the original. Guardrail: Use a contradiction-aware compression approach that explicitly flags competing claims rather than resolving them. For high-stakes domains, route to a contradiction resolution prompt and require human review before compression proceeds.

06

Over-Compression Produces Useless Abstractions

What to watch: Aggressive compression ratios strip away all specifics, leaving only vague generalities that provide no actionable information for downstream tasks. The output is shorter but worthless. Guardrail: Set a minimum information density threshold. Run a compression ratio vs. quality trade-off evaluation at multiple compression levels to find the knee in the curve before deploying. Reject compressed outputs that fall below the task-specific quality score.

IMPLEMENTATION TABLE

Evaluation Rubric

Use this rubric to test the abstractive compression prompt before shipping. Each criterion targets a known failure mode for factuality-constrained summarization. Run these checks on a golden dataset of source passages paired with expected key facts.

CriterionPass StandardFailure SignalTest Method

Factual Precision

Zero hallucinated claims. Every assertion in the summary is directly supported by the source text.

Summary contains a named entity, date, or quantitative value not present in the source.

Human review or LLM-as-judge pairwise comparison between summary claims and source sentences. Flag unsupported claims.

Factual Recall

All [CRITICAL_FACTS] from the source are represented in the summary.

A [CRITICAL_FACT] is missing or semantically altered in the summary.

Automated string match or embedding similarity check between each [CRITICAL_FACT] and the summary. Set a minimum similarity threshold of 0.85.

Abstention Compliance

When [ABSTENTION_TRIGGERS] are met, the output is exactly the [ABSTENTION_MESSAGE] with no additional content.

The model generates a summary or partial summary when it should have abstained.

Exact string match against the [ABSTENTION_MESSAGE] for inputs containing known trigger conditions.

Compression Ratio

Output token count is less than or equal to [MAX_OUTPUT_TOKENS] and achieves the target compression ratio versus the input.

Output exceeds [MAX_OUTPUT_TOKENS] or is a near-verbatim copy of the input with minimal compression.

Token counting script comparing input token length to output token length. Fail if output tokens > [MAX_OUTPUT_TOKENS].

Source Attribution Integrity

No citation markers or source references are fabricated. All attributions map to the provided [SOURCE_ID].

Summary includes a citation marker like [1] or a URL that was not in the original source.

Regex extraction of citation patterns from the summary, cross-referenced against the [SOURCE_ID] and source text metadata.

Schema Conformance

Output is valid JSON matching the [OUTPUT_SCHEMA] with all required fields present and correctly typed.

JSON parse error, missing required field, or field type mismatch.

Automated JSON Schema validation against the [OUTPUT_SCHEMA]. Fail on any validation errors.

Uncertainty Language Control

No speculative language is introduced unless the source itself contains hedging. No 'may', 'might', or 'could' unless grounded in the source.

Summary adds hedging or speculative language to a fact the source states definitively.

Keyword scan for hedging terms. For each hit, verify the source contains equivalent uncertainty. Flag additions.

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Start with the base prompt and a single source passage. Remove the structured output schema and use plain text instructions: "Summarize the following passage. Do not add any facts not present in the source." Run 10-20 examples manually and spot-check for hallucinated claims.

Watch for

  • Invented statistics or dates that feel plausible but aren't in the source
  • Overly fluent prose that masks missing evidence
  • No systematic way to catch drift across runs
Prasad Kumkar

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.