← Back to concept explainers

Concept Fable

Context pruning

Conclusion first:Context Pruning / Prompt Compression reduces prompt length by removing, summarizing, or compressing less relevant content before inference. It lowers prefill latency, token cost, and KV cache usage, especially for long-context applications. The risk is losing facts or constraints that the model needed, so pruning must be relevance-aware and auditable.

Context Pruning / Prompt Compression · Inference

Read the story first. There is no rush to give a definition here; let the question grow on its own first.

Fable

The archive learned to compress the message box before opening the volume

The legal secretary organized case files for the county magistrate. When the original files were carried into the hall, the magistrate could not find the key points after half a day of searching. At first the secretary worked from thick background materials, relying on familiar people and familiar paths, and when the days were small, he rarely made mistakes. The secretary discovered that being able to hold the case files did not mean good judgment could be made; what was truly useful were the facts, constraints, sources, and open questions that could change the current decision.

Later, cases took longer and longer to review, with old testimony, repeated gossip and irrelevant family matters crowded together. The materials grew longer and longer; repeated narration crowds out key evidence and increases prefill cost, while blind truncation may delete decisive dates and conditions.

The first fix was rushed: he trimmed the file at random and cut out the key dates too. Cutting the file down by page count shortened the input, but deleted the key dates and constraints along with it. Yet new problems followed, everyone focused only on what was most visible, and small deviations in the distance piled up deeper and deeper.

Later he filtered, merged, and summarized according to the current question, keeping only the skeleton that affected judgment, and marked the source and reason for compression; when necessary, he could still return to the original scroll to verify.

Later the clerk reorganized by threads: keeping the people, points of dispute, sources of evidence, and unresolved questions, and keeping only the clearest version of repeated statements. This step was troublesome and at first slowed the work; but after several rounds, rework decreased, and the craftsmen no longer changed rules on a whim. Even after the case files grew shorter, they still retained the skeleton of judgment, so the magistrate could read quickly and also trace back to the original evidence.

From then on, context optimization was no longer about being as short as possible, but about making auditable trade-offs among tokens, latency, KV cache, and evidence completeness.

The county magistrate could read faster, and when following up he could return to the original scroll to verify. From then on, when materials were too long, cutting was not random hacking but keeping the skeleton that would affect judgment.

Concept Anchor

This story is about: context pruning

Context Pruning / Prompt Compression reduces prompt length by removing, summarizing, or compressing less relevant content before inference. It lowers prefill latency, token cost, and KV cache usage, especially for long-context applications. The risk is losing facts or constraints that the model needed, so pruning must be relevance-aware and auditable.

What matters is that it is not just a term, but a structural problem that repeatedly appears in real AI / Agent systems. Understanding it lets you judge when to add a model, when to change a process, and when to add governance.

Story Mapping

  • Reading table: model context window and KV cache budget
  • Full box of case files: long prompt / retrieved context
  • A bigger table: using larger context windows without selection
  • Keep only the most recent case files: naive truncation
  • Cut, merge, summarize: context pruning and prompt compression
  • Mark sources and review: preserving evidence and auditability

Andy Ren Xu's judgment

The practical value of this concept is that it helps you break "AI features that look smart" into deliverable, verifiable, and governable units of work.

prompt compressionKV cachelong contextLLMLingua

Related distinctions

This concept is easily confused with adjacent concepts; it is recommended to continue to the comparison page.

京ICP备2026014272号