INQUIRING LINE

Trimming a long document down to 'just the relevant parts' can backfire by wrecking the cost savings of reusing cached work.

Why do long-context inputs truncated for relevance lose cache reuse benefits?

This explores a trade-off between two ways of handling long inputs: cutting them down to only the relevant parts for each request, or keeping them stable so the provider can reuse cached work across requests. The question is why the first approach tends to cancel out the savings of the second.


This explores a trade-off between two ways of handling long inputs: cutting them down to only the relevant parts for each request, or keeping them stable so the provider can reuse cached work across requests. The corpus has no paper that studies this collision directly, but several notes cover each side, and together they explain the tension. One piece comes from how prompt caching works rather than from the corpus. Providers generally reuse cached work only when the start of a new prompt matches, token for token, the start of one they have already processed. Change something early in the prompt and everything after it has to be computed again.

The cost side is clear. A benchmark across OpenAI, Anthropic and Google found that caching cut costs for multi-turn agent tasks by 41–80% and made the first token arrive 13–31% sooner. It also found that naive full-context caching can make latency worse, because it caches content that changes and will never be reused Does prompt caching actually reduce agentic LLM costs?. That is the core of the answer. Caching pays off only for the parts of a prompt that stay the same. Trimming for relevance turns stable material into material that changes with every question, because each query keeps a different slice of the long input. Once that slice differs, the prompts no longer share a starting sequence, so there is nothing to reuse.

Prompt compression shows the same pattern. LLMLingua shrinks prompts up to 20x with little accuracy loss by scoring each token and pruning those a small model considers least useful, while compressing instructions and questions less than examples Can prompts be compressed without losing model performance?. The result depends on the question, so the compressed prompt changes whenever the question does. That is the opposite of what a cache can use. You can save tokens or save cached compute, but rarely both on the same content unless you deliberately split the prompt into a fixed part and a changing part.

The less obvious point is that the field is partly moving away from trimming. LongRAG argues that the old design of precise retrieval feeding a small reader was a leftover from short context windows. Feeding long, coarse chunks to a long-context reader now works better Can long-context models resolve retriever-reader imbalance?. Long-context models can also match standard RAG on meaning-based lookup, though they still fail at database-style queries that join tables Can long-context LLMs replace retrieval-augmented generation systems?. If you can afford to keep a large, stable context, it becomes cheap to reuse. The catch is that reasoning gets worse as inputs grow, even far below the context limit Does reasoning ability actually degrade with longer inputs?. So trimming saves money per call and keeps the model sharper, while a stable full context saves money across calls.

Two designs in the corpus try to get both. Recursive Language Models keep the long prompt outside the model in a code environment and query it with code Can models treat long prompts as external code environments?. The Thread Inference Model prunes its internal cache with fixed rules as it works through subtasks, instead of rebuilding the prompt each time Can recursive subtask trees overcome context window limits?. Both deal with relevance after the input is in place rather than by changing the input. That suggests a design lesson: put fixed material first, add the changing, relevance-picked material at the end, and let the model choose what to use instead of rewriting the input for every request.


Sources 7 notes

Does prompt caching actually reduce agentic LLM costs?

A benchmark across OpenAI, Anthropic, and Google found caching reduces API costs 41–80% and improves time-to-first-token 13–31% in multi-turn agentic tasks. However, naive full-context caching can increase latency by caching dynamic content that will never be reused.

Can prompts be compressed without losing model performance?

LLMLingua achieves up to 20x prompt compression with only 1.5-point performance drops by allocating less compression to instructions and questions, more to demonstrations, then pruning tokens using a small model's perplexity scoring aligned to the target LLM.

Can long-context models resolve retriever-reader imbalance?

LongRAG shows that 4K-token units and long-context readers outperform 100-word retrieval on standard benchmarks. The optimal RAG design shifts from precise retrieval to coarse ranking plus deep reading as context windows expanded.

Can long-context LLMs replace retrieval-augmented generation systems?

The LOFT benchmark shows LCLMs match RAG on semantic retrieval without explicit training, but cannot execute relational queries requiring joins across structured tables. Context length alone cannot bridge this gap.

Does reasoning ability actually degrade with longer inputs?

FLenQA shows reasoning accuracy drops from 92% to 68% at just 3000 tokens of padding, far below context window capacity. The degradation is task-agnostic, uncorrelated with language modeling performance, and persists even with chain-of-thought prompting.

Show all 7 sources
Can models treat long prompts as external code environments?

Recursive Language Models store long prompts in a Python REPL and query them via code execution, avoiding attention degradation. RLMs outperform base models even on shorter prompts while handling inputs two orders of magnitude beyond context windows.

Can recursive subtask trees overcome context window limits?

The Thread Inference Model demonstrates that reasoning structured as recursive subtask trees with rule-based KV cache pruning sustains accurate reasoning beyond context limits, even when manipulating 90% of the cache. This enables single models to replace multi-agent systems by handling full recursive reasoning internally.

Papers this line draws on 8

The research behind the notes this line reads — ranked by how closely each paper relates.