# How Kapa.ai Taught a Small LLM to Prune 68% of RAG Context

Original title: Pruning RAG context down to what the answer actually needs

> Hacker News story 48809354 · language: en · submitted 2026-07-06
> Web version: https://zeli.app/story/48809354
> About this feed: https://zeli.app/llms.txt · Agent guide: https://zeli.app/skill.md

▲ 103 · by [emil_sorensen](<https://news.ycombinator.com/user?id=emil_sorensen>) · 💬 24
[original](<https://www.kapa.ai/blog/how-we-prune-rag-context>) · [HN discussion](<https://news.ycombinator.com/item?id=48809354>)

## Summary

We added a small, cheap LLM step to our retrieval pipeline that reads the question and all retrieved chunks together to discard irrelevant ones. This approach drops about 68% of the context while keeping 96% of recall, cutting query costs by a third. Unlike traditional rerankers that score chunks in isolation, our method evaluates the entire set, ensuring we only pay for what the answer actually needs.

## Key quote

> The real question is never whether a chunk is relevant by itself, but whether it belongs to a set that together answers the question.

## HN discussion (24 comments)

### [agentdev001](<https://news.ycombinator.com/item?id=48812119>)

> Am I wrong to be somewhat peeved by the use of "RAG" in these contexts? I always read things like this, and wonder if instead the author should be saying "Semantic Retrieval" or something something Vector, etc. Retrieval augmented generation captures tool-use, and; semantic search of course is really just a tool under the hood.
>
> To make an anology, in my mind, this is akin to saying "fuel air mixture system" when referring to direct fuel injection specifically, when of course, a carburetor also lives in that category.

### [grewil2](<https://news.ycombinator.com/item?id=48815214>)

> "Three knobs matter:"
>
> I can't help reading articles with the radar on for signs of AI-generation nowadays. I have noticed that Claude sometimes uses the word knob for parameter, so here I get suspicious.

### [alansaber](<https://news.ycombinator.com/item?id=48816083>)

> Would be cool to see a retrieval comparison to IE a claude code agent trace for the same query, even a cherry picked one.

### [wolvoleo](<https://news.ycombinator.com/item?id=48814240>)

> I think this is really where energy saving comes into play. Context is so incredibly energy and processing time sensitive.

### [Avery29](<https://news.ycombinator.com/item?id=48815604>)

> Bad or only loosely related context can make the final answer worse than having less context.

---

## Cite

- Page: https://zeli.app/story/48809354
- Date: 2026-07-06
- Source: kapa.ai (https://www.kapa.ai/blog/how-we-prune-rag-context)
- Hacker News: https://news.ycombinator.com/item?id=48809354

## Other languages

- zh: https://zeli.app/zh/story/48809354 · markdown: https://zeli.app/zh/story/48809354.md
- ja: https://zeli.app/ja/story/48809354 · markdown: https://zeli.app/ja/story/48809354.md
- ko: https://zeli.app/ko/story/48809354 · markdown: https://zeli.app/ko/story/48809354.md
- de: https://zeli.app/de/story/48809354 · markdown: https://zeli.app/de/story/48809354.md
- es: https://zeli.app/es/story/48809354 · markdown: https://zeli.app/es/story/48809354.md
