research29 min studyLesson 765 in Engineering

Context compression and summary loss

Account for token reduction while preserving evidence provenance and testing which task-relevant distinctions a summary discards.

On this page

What you’ll understand

  • Distinguish token deletion, abstractive summaries, and learned compressed state.
  • Explain why a lossy representation cannot answer every source-dependent question.
  • Measure retained requirements and provenance separately from token compression ratio.

Compression can make a large source fit within a smaller prompt budget, but fitting is not the same as preserving every answerable distinction. Extractive token removal, abstractive summaries, and learned compressed representations have different information and compatibility contracts. LLMLingua studies a concrete prompt-compression method, while recursive summarization studies another route to processing large sources. Their results motivate task-specific evaluation rather than a universal lossless-summary claim.

Name the representation that replaces the source

Token deletion preserves selected original symbols but can remove a negation, unit, reference target, or dependency needed to interpret them. An abstractive summary can synthesize statements and introduce unsupported details; a learned state may not be directly readable or compatible with another model. Record the compressor, tokenizer, prompt, model version, and target length. A compression ratio says how many tokens remain under that tokenizer, not how many facts or constraints survive. A concise fluent result can still omit the one exception the downstream query requires.

Query-aware compression can retain the evidence needed for a known question, but a reusable summary must support questions not known when it was created. Those objectives differ. If two source records with different required answers map to the same summary, a downstream function seeing only that summary cannot distinguish them. More capable generation can add prior knowledge, yet that does not reconstruct a missing fresh value reliably. Keep the original material available when exact recovery or new questions are part of the system contract.

CR⁡=NsourceNcompressed,Ncompressed>0\operatorname{CR}=\frac{N_{\mathrm{source}}}{N_{\mathrm{compressed}}},\qquad N_{\mathrm{compressed}}>0
CR is a dimensionless token compression ratio under one declared tokenizer and counting policy. It excludes generation cost and does not quantify factual retention, uncertainty, downstream accuracy, or losslessness.↔ Scroll wide equations horizontally.

Provenance survives only if it is recorded

Attach source identities, versions, and supporting spans to retained claims so later answers can verify them against the original. A summary citation to an entire document may be too coarse to support a precise date or exception. Distinguish quoted evidence from generated inference, retain uncertainty, and avoid converting a source’s tentative statement into a categorical one. When sources disagree, collapsing them into one clean sentence can destroy both the disagreement and its provenance. A downstream citation should resolve to the actual source, not merely repeat the summary’s authority.

Evaluate omissions and additions separately. Missing a necessary fact can cause failure without any hallucinated text, while a confident unsupported addition can poison later answers. Construct paired sources differing only in a task-relevant detail and test whether compression preserves that distinction. Also vary question types: a summary good for broad themes may fail exact lookup, numeric comparisons, or multi-document reconciliation. Recursive summaries can compound loss across levels, so inspect both intermediate and final representations rather than validating only the last fluent paragraph.

g(x1)=g(x2)⟹h(g(x1))=h(g(x2))g(x_1)=g(x_2)\quad\Longrightarrow\quad h(g(x_1))=h(g(x_2))
For a deterministic compressor g and downstream deterministic answer function h, a collision in compressed representation forces identical outputs. If the required source-grounded answers differ for x1 and x2, h cannot be correct on both using that representation alone. This is a stated information-path argument, not a measured summary error rate.↔ Scroll wide equations horizontally.

Evaluate the complete compression pipeline

Include the compressor’s inference cost, source retrieval, provenance storage, and downstream generation in the resource comparison. A smaller final prompt can still cost more end to end if compression is expensive or repeated for every query. Cache reusable summaries only under a versioned source and question-scope contract, and invalidate them when the source changes. Report task quality alongside token reduction, including exact constraints and citations, so a favorable average does not hide loss of rare but important details.

The probability lab illustrates only an assumed independent retention model. Reset, set per-detail retention probability to 0.9 and detail count to 10, predict the probability all survive, then Step: approximately 0.3487. Compare a fresh Reset with both probability at 0.9 and count at 20 before Step: approximately 0.1216. Real compression errors can be correlated and the rate is not known from this instrument. It does not summarize text, assess provenance, or establish an actual retention probability.

Fit a prompt while losing required details

A source contains 8,000 tokens. A compressor produces 1,000 tokens. The request also needs 500 instruction tokens and a 500-token output reserve. In a declared twelve-requirement audit, the compressed representation retains nine requirements with verified source support.

  1. The token compression ratio is 8,000/1,000 = 8. The uncompressed budget would be 8,000 + 500 + 500 = 9,000 tokens.

  2. The compressed budget is 1,000 + 500 + 500 = 2,000 tokens, so it fits a hypothetical 4,096-token total window under this counting model.

  3. The audited requirement retention is 9/12 = 75%. The three omitted requirements can still be decisive for a later question; fitting and an eightfold token reduction do not establish losslessness or successful answers.

The result

Token efficiency, task-relevant retention, and source support need separate measurements.

Explore the model

Interactive lab

Interactive lab · probability

Compound retention under a declared independence assumption

Reset, set p = 0.9 and n = 10, predict P(all retained), then Step: 0.9¹⁰ ≈ 0.3487. Compare a fresh Reset with both p = 0.9 and n = 20 before Step: approximately 0.1216. This exact binomial model does not compress text or estimate real detail-retention probabilities.

Compound retention under a declared independence assumptionThese are exact binomial probabilities for independent trials with one fixed success probability. Playback tours the distribution; it does not resample outcomes. Current readings: Mean · np: 5; Variance · np(1−p): 2.5; Total probability: 1. All parameters are adjustable with the labeled controls below.03581000.070.150.220.3Successes kP(X = k)k = 0 · P = 9.77e-4
Exact probabilityHighlighted outcomeMean np
Mean · np
5
Variance · np(1−p)
2.5
Total probability
1
t = 0 s

These are exact binomial probabilities for independent trials with one fixed success probability. Playback tours the distribution; it does not resample outcomes. Parameter changes pause playback and recompute the model at the current elapsed time. Reset restores both parameters and returns time to zero. Playback starts paused. Adjust either parameter, then choose Play or Step.

Look forAn average retention assumption does not guarantee that every required detail survives, especially when actual errors are correlated.

Check your understanding

Two source records requiring different exact answers produce the same deterministic summary. What can a downstream system infer from the summary alone?

Try it yourself

A 6,000-token source becomes 1,500 tokens, and sixteen of twenty audited task requirements remain with verified support. Compute compression ratio and audited retention. Name one reason those numbers do not certify future answers.

Take a moment to make a prediction or work it out on paper. Open a hint when you need one.

Give me a hint

Token ratio and requirement coverage use different denominators.

Compare with the solution

Compression ratio is 6,000/1,500 = 4, while audited retention is 16/20 = 80%. A later question may depend on one of the four omitted requirements, and the audit may not cover every future distinction. Unsupported additions, lost uncertainty, changed source versions, or missing span provenance can also make an answer fail despite those favorable summary statistics.

Take it with you

  • Compression ratio measures tokens, while usefulness depends on retained task distinctions.
  • Summaries need source provenance, uncertainty, and separate omission/addition checks.
  • Preserve another information path when future questions require details that compression can discard.

Read further

Original sources and deeper explanations to follow at your own pace.

Optional progress, saved in this browser when available. Revisit any lesson at any time.

Lesson not marked complete.