AWS Reports RAG Compression Savings With a Latency Trade-Off
In this article
AWS engineers Aakanksha Veesam and Amit Maindola describe adding a smaller-model compression call before a RAG answer call. Their 21 August evaluation reports lower cost, with slower responses and slightly lower composite quality. The figures below are their reported results; AI Mastery has not reproduced the evaluation or deployed the reference implementation.
Correction, 22 October 2026: The earlier text treated temperature zero as a determinism guarantee, extraction instructions as hallucination prevention and one experiment as a basis for broad adoption predictions. Those guarantees and predictions are withdrawn. The benchmark's latency, quality and corpus limits remain explicit.
The Two-Call Architecture
The pattern inserts a Lambda function between retrieval and the final answer. It makes two sequential Bedrock Converse calls, first to Claude Haiku for compression and then to Claude Sonnet for answering. A retriever, such as a Bedrock Knowledge Base backed by OpenSearch Serverless, supplies the full top-k chunks. The compression prompt asks Haiku to return relevant verbatim spans with [CHUNK_ID: <id>] markers. Those markers support source association; they do not guarantee that extraction or the final citation is correct. Sonnet then receives the compressed evidence rather than the raw retrieval output.
The compression call uses temperature=0.0 and instructions forbidding paraphrasing or summarization, with NO_RELEVANT_EVIDENCE for chunks without useful spans. These settings express the extraction contract; they do not guarantee deterministic execution or faithful output. Validate output spans against the source chunks and check whether required evidence was omitted. The Lambda reads model IDs from environment variables and initializes the Bedrock Runtime client with adaptive retries. The prompt-optimization discussion covers retaining evaluation criteria when changing such instructions.
Benchmark Results Across 500 Questions and 500,000 Documents
The authors' evaluation used more than 500,000 documents across nine enterprise source types, including chat messages, email, issue tickets, shared-drive documents, CRM records, meeting transcripts, code and wikis. It used 500 questions across ten categories. An LLM judge scored correctness, completeness, citation accuracy and conciseness. The hallucination measure was the share of answers with at least one claim unsupported by the reference, distinct from a guarantee of evidence faithfulness in production.
| Metric | Baseline | Compression | Rerank + Compression |
|---|---|---|---|
| Cost (relative) | 100% | 67% | 64% |
| Tokens to primary model (relative) | 100% | 12% | 10% |
| Latency delta | 0% (reference) | +19% slower | +12% slower |
| Composite quality (4 dimensions) | 100% | 97.5% | 97.6% |
| Hallucination rate | 51% | 44% (−7 pts) | 38% (−13 pts) |
AWS reports 8.6× fewer tokens reaching the primary model and 33% lower cost with compression alone. Rerank plus compression gives 10.1× fewer tokens and 36% lower cost. The composite quality measures are 97.5% and 97.6% of baseline; correctness stays within 0.07 on the reported 1-to-5 judge scale. These are not claims that quality is unchanged or that a different workload will improve.
Latency is 19% slower with compression and 12% slower with rerank plus compression. The hallucination measure falls by seven and thirteen percentage points, to 44% and 38%. The experiment does not establish that shorter context universally prevents unsupported claims. Reported cost savings fall on harder queries: 37% to 26% for compression, and 40% to 30% for rerank plus compression. Results concern one corpus, domain and query distribution assessed with an LLM judge.
The Economics and Where They Break Down
In the source's simplified token model, retrieved context has R tokens, compression ratio c is greater than one and the final answer has A tokens. The baseline is R × P_large_in + A × P_large_out; compression is R × P_small_in + (R/c) × P_small_out + (R/c) × P_large_in + A × P_large_out. This assumes a fixed final-answer length and omits other prompt tokens, caching and infrastructure charges. It is not a complete service bill.
Our algebraic rearrangement gives a useful threshold under those assumptions. When P_large_in > P_small_in, compression saves token cost only if c > (P_large_in + P_small_out) / (P_large_in - P_small_in). If that denominator is zero or negative, the assumed positive token saving does not follow. Use actual metered inputs and current prices before making a deployment decision; no live price was substituted in this example.
AWS describes possible fits including policy assistants retrieving 8,000 to 15,000 token bulletins for narrow questions, customer-support copilots, internal runbook assistants and financial-document research. These are workload examples, not additional measured deployments. For sub-second chat with small context, compare the added call with alternatives such as caching or routing. The authors recommend evaluating representative de-identified queries against the same retrieved context before promoting a configuration.
For a proposed deployment test, retain the exact retrieved context and compare answers with and without compression. Score missing evidence and broken citations separately from fluent wording, and retain end-to-end latency as well as token cost. A smaller model can be a candidate for this stage, but extraction is still a task whose accuracy needs to be measured. The reported savings do not establish a universal best architecture.
Frequently asked questions
Does temperature zero guarantee verbatim, error-free extraction?
No. It is a generation setting, not a guarantee of factual consistency. Validate extracted spans against source chunks and test missing-evidence cases.
Did compression improve latency in AWS's evaluation?
No. Compression alone added 19 percent latency; rerank plus compression added 12 percent. Both reduced reported cost in that evaluation.
Was answer quality unchanged?
The reported composite scores were 97.5 and 97.6 percent of baseline. The hallucination measure remained 44 and 38 percent, respectively. These are AWS's results, not a reproduction here.
Related Reading
AWS Shows Document Preprocessing Before a Bedrock Knowledge Base
AWS describes a document-preprocessing workflow for Bedrock. Verify the actual parser path, supported file formats and answer quality.
Three Async Patterns Cut Lambda Idle Cost in Bedrock AgentCore Pipelines
AWS authors show how task-token callback, direct integration, and durable functions cut Lambda idle cost when calling Bedrock AgentCore agents.
FBG Reports Support Improvements From a Multi-Agent System
FBG reports internal containment and resolution improvements. Its AWS case study describes specialist tools, escalation and jurisdiction-specific retrieval.