<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/your-rag-pipeline-isn-t-broken-your-context-is--nae7rmvii" -->

---
title: Your RAG Pipeline Isn’t Broken. Your Context Is. | daily.dev
description: Failing RAG pipelines are usually a context engineering problem, not a prompting problem. The piece distinguishes prompt engineering (writing instructions)...
canonical: https://daily.dev/posts/your-rag-pipeline-isn-t-broken-your-context-is--nae7rmvii
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Your RAG Pipeline Isn’t Broken. Your Context Is. | daily.dev
og:description: Failing RAG pipelines are usually a context engineering problem, not a prompting problem. The piece distinguishes prompt engineering (writing instructions)...
og:url: https://daily.dev/posts/your-rag-pipeline-isn-t-broken-your-context-is--nae7rmvii
og:image: https://api.daily.dev/og/posts/naE7rMvii.png
og:image:alt: Your RAG Pipeline Isn’t Broken. Your Context Is.
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Your RAG Pipeline Isn’t Broken. Your Context Is.

**[Medium](https://daily.dev/sources/medium_js)** · 14 min read · 3 upvotes · 0 comments

## Summary

Failing RAG pipelines are usually a context engineering problem, not a prompting problem. The piece distinguishes prompt engineering (writing instructions) from context engineering (deciding what enters the context window: retrieval, tool definitions, memory, token budget). It names four ways long context degrades output silently — poisoning, distraction, confusion, and clash — then covers fixes: hybrid BM25+dense retrieval fused with Reciprocal Rank Fusion, cross-encoder reranking (with cited Weaviate BEIR numbers showing Success@1 rising from 0.43 to 0.52), structure-aware chunking, moving retrieval inside an agentic tool-calling loop with capped iterations, and managing context over time via context editing, compaction, memory, and prompt caching (where a single volatile token like a timestamp early in the prefix invalidates cache hits). It closes by arguing evaluation — fifty real questions, separate retrieval and faithfulness metrics, a frozen holdout set — is the piece most teams skip, and that these boring engineering skills, not prompt tricks, are what remain durable.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://medium.com/@mahnoormuhammadnaeem99/your-rag-pipeline-isnt-broken-your-context-is-ff5238ac3cf2>

## Questions this post answers

### Why does dense vector search alone fail for RAG when a user asks for a specific error code or product SKU?

Dense embeddings capture semantic meaning but blur specific identifiers, so a query for an exact error code or SKU returns several chunks about similar-sounding codes instead of the exact match. BM25 keyword search returns the precise one because lexical matching preserves exact tokens, which is exactly what embeddings trade away for semantic generalization. Fusing both methods with Reciprocal Rank Fusion outperforms either alone.

_Anyone debugging retrieval misses in a RAG system can compare hybrid search approaches surfaced on daily.dev before rebuilding the pipeline._

### How much does adding a cross-encoder reranker improve retrieval accuracy in a hybrid search RAG pipeline?

Weaviate's BEIR benchmarks show adding reranking on top of hybrid search moved Success@1 from 0.43 to 0.52 and nDCG@10 from 0.61 to 0.70. A cross-encoder reads the query and document together rather than comparing independently computed vectors, making it slower per pair but considerably more accurate, with a typical sweet spot of reranking 20-50 candidates down to 5-10.

_Engineers weighing reranking tradeoffs for their RAG stack can track benchmark-backed comparisons like this on daily.dev._

### Why would prompt caching stop working even though the system prompt hasn't changed?

Prompt caching is prefix matching, so a single byte changed anywhere in the cached prefix invalidates everything after it. A common culprit is placing volatile content like a timestamp from datetime.now(), request IDs, or the actual question before stable content such as the system prompt and tool definitions; putting stable content first and volatile content last preserves cache hits, and a flat zero cache-read token count signals this exact mistake.

_Teams chasing unexplained LLM cost spikes can find caching gotchas like this surfaced on daily.dev._

## Similar posts on daily.dev

- [RAG Is Dead. Long Live Context Engineering for LLM Systems](https://daily.dev/posts/rag-is-dead-long-live-context-engineering-for-llm-systems-gz1hukbw8) · Callstack Blog · 3 upvotes · 0 comments
- [RAG Isn’t Enough — I Built the Missing Context Layer That Makes LLM Systems Work](https://daily.dev/posts/rag-isn-t-enough-i-built-the-missing-context-layer-that-makes-llm-systems-work-rtksjn2c9) · Towards Data Science · 2 upvotes · 0 comments
- [RAG isn’t dead, but context engineering is the new hotness](https://daily.dev/posts/rag-isn-t-dead-but-context-engineering-is-the-new-hotness-thzi0osnl) · The New Stack · 1 upvotes · 0 comments
- [RAG vs. Fine-Tuning vs. Long Context: A Practical Decision Framework](https://daily.dev/posts/rag-vs-fine-tuning-vs-long-context-a-practical-decision-framework-annywruz9) · Medium · 3 upvotes · 0 comments

---

Tags: [#ai-agents](https://daily.dev/tags/ai-agents), [#prompt-engineering](https://daily.dev/tags/prompt-engineering), [#rag](https://daily.dev/tags/rag), [#context-engineering](https://daily.dev/tags/context-engineering)

[View this post on daily.dev](https://daily.dev/posts/your-rag-pipeline-isn-t-broken-your-context-is--nae7rmvii)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Your RAG Pipeline Isn’t Broken. Your Context Is.","url":"https://daily.dev/posts/your-rag-pipeline-isn-t-broken-your-context-is--nae7rmvii","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/your-rag-pipeline-isn-t-broken-your-context-is--nae7rmvii"},"datePublished":"2026-09-12T16:11:20.881Z","dateModified":"2026-09-12T16:24:43.214Z","description":"Failing RAG pipelines are usually a context engineering problem, not a prompting problem. The piece distinguishes prompt engineering (writing instructions)...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/d6ab0a9a223ee01bc82d647f54feb2d2?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/d6ab0a9a223ee01bc82d647f54feb2d2?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Medium","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Medium","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/medium","url":"https://daily.dev/sources/medium_js"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/your-rag-pipeline-isn-t-broken-your-context-is--nae7rmvii","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":3},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"ai-agents,prompt-engineering,rag,context-engineering","timeRequired":"PT14M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Medium","item":"https://daily.dev/sources/medium_js"},{"@type":"ListItem","position":3,"name":"Your RAG Pipeline Isn’t Broken. Your Context Is."}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/your-rag-pipeline-isn-t-broken-your-context-is--nae7rmvii#faq","mainEntity":[{"@type":"Question","name":"Why does dense vector search alone fail for RAG when a user asks for a specific error code or product SKU?","acceptedAnswer":{"@type":"Answer","text":"Dense embeddings capture semantic meaning but blur specific identifiers, so a query for an exact error code or SKU returns several chunks about similar-sounding codes instead of the exact match. BM25 keyword search returns the precise one because lexical matching preserves exact tokens, which is exactly what embeddings trade away for semantic generalization. Fusing both methods with Reciprocal Rank Fusion outperforms either alone. Anyone debugging retrieval misses in a RAG system can compare hybrid search approaches surfaced on daily.dev before rebuilding the pipeline."}},{"@type":"Question","name":"How much does adding a cross-encoder reranker improve retrieval accuracy in a hybrid search RAG pipeline?","acceptedAnswer":{"@type":"Answer","text":"Weaviate's BEIR benchmarks show adding reranking on top of hybrid search moved Success@1 from 0.43 to 0.52 and nDCG@10 from 0.61 to 0.70. A cross-encoder reads the query and document together rather than comparing independently computed vectors, making it slower per pair but considerably more accurate, with a typical sweet spot of reranking 20-50 candidates down to 5-10. Engineers weighing reranking tradeoffs for their RAG stack can track benchmark-backed comparisons like this on daily.dev."}},{"@type":"Question","name":"Why would prompt caching stop working even though the system prompt hasn't changed?","acceptedAnswer":{"@type":"Answer","text":"Prompt caching is prefix matching, so a single byte changed anywhere in the cached prefix invalidates everything after it. A common culprit is placing volatile content like a timestamp from datetime.now(), request IDs, or the actual question before stable content such as the system prompt and tool definitions; putting stable content first and volatile content last preserves cache hits, and a flat zero cache-read token count signals this exact mistake. Teams chasing unexplained LLM cost spikes can find caching gotchas like this surfaced on daily.dev."}}]}
```

