Developers

Why AI agents struggle when drowning in data

Research shows that loading AI agents with massive amounts of information often backfires, degrading accuracy even when the right answer is buried in the pile. The solution lies not in bigger context windows, but in smarter retrieval.

14 min read
Why giving AI agents more data can actually make them less reliable

A widespread belief in agent design holds that if a language model can process text, it should receive everything: documentation wikis, ticket histories, product guides, and archived communications. Larger context windows have made this approach increasingly tempting. Yet empirical evidence suggests the opposite: more information frequently produces worse results.

As context expands, identifying relevant evidence becomes harder. Outdated information, contradictions, and distracting material compete for the model's attention. An agent may possess the correct information but still arrive at the wrong conclusion. Simply upgrading to a more capable model or expanding the context window won't solve this problem. Instead, agents need to receive precisely the evidence required for their task, without extraneous noise obscuring it.

This challenge requires understanding what relevance truly means—and why it demands more than finding documents similar to a query.

More context, worse answers: what the research shows

Studies of long-context language models have documented multiple ways additional information undermines accuracy.

  • Position matters significantly. Stanford's 2023 "Lost in the Middle" study placed the answer in one of 20 documents and moved it to different positions. Models performed best when the answer appeared first or last, with accuracy dropping roughly 20 percentage points when positioned in the middle.
  • Similar but incorrect content causes the most damage. Chroma's 2025 "Context Rot" report tested 18 frontier models, including GPT-4.1, Claude 4, Gemini 2.5, and Qwen3. All degraded unevenly as input grew, with distractors closely resembling the correct answer doing the most harm. Research from LMU Munich and Adobe Research found the same pattern.
  • Length itself reduces performance. A 2025 paper from the Empirical Methods in Natural Language Processing conference titled "Context Length Alone Hurts LLM Performance Despite Perfect Retrieval" had models recite relevant evidence verbatim before answering. Despite perfect recall, accuracy fell from 13.9% to 85% across five models as input lengthened. Performance declined even when extra tokens were blank whitespace.
  • Incomplete evidence triggers overconfident responses. Google's "Sufficient Context" paper found that frontier models answer well when retrieved context is complete. When context is incomplete, they tend to answer anyway rather than admitting uncertainty, and additional context can make them even less likely to acknowledge limitations.

These constraints become more critical for agents than for traditional chatbots. While a chatbot retrieves information once to answer a question, an agent may make a dozen or more retrieval calls during a single task as it plans, verifies results, and adjusts its approach. Each call introduces additional tokens, latency, and opportunities for irrelevant or misleading information to influence subsequent decisions. An incorrect intermediate result can cascade through the workflow, compounding errors.

Reliable agents depend on two properties of their context: sufficiency (the evidence needed to complete the task is present) and relevance (the information provided is useful for that task). Filling the context window prioritizes coverage over relevance, betting that more information will include everything the agent needs. Effective retrieval pursues both: enough evidence to support the task, without unnecessary information that could distract or mislead.

What we mean when we say relevance

Relevance appears straightforward but ranks among the hardest retrieval challenges to solve correctly.

Vespa CEO Jon Bratseth observes that "relevance is your moat." As models become more capable and widely available, companies increasingly access roughly equivalent underlying intelligence. Differentiation comes from proprietary information and how effectively systems deploy it. For AI agents, this means identifying evidence that actually helps complete a task, not merely information on the same topic.

Consider a question like: "Can I enable this feature on our current deployment without upgrading?"

Semantic search might return feature documentation, the release announcement, and a technical deep dive on how the feature operates. All are topically relevant, and some rank highly because their language matches the query closely. Yet none truly answer the question. The agent needs evidence about which versions support the feature, which version this customer runs, and any licensing or configuration requirements.

This illustrates the distinction between topical similarity and task relevance. The difference between relevance and sufficiency becomes practical here:

  • Relevant but insufficient: The agent finds feature documentation but misses the version requirements needed to answer.
  • Sufficient but noisy: The agent retrieves all necessary evidence, but it's mixed with outdated release notes, deprecated instructions, and other material that could lead toward the wrong conclusion.
  • Sufficient and relevant: The agent retrieves current feature requirements and deployment details without unnecessary distractions.

Achieving the last outcome requires more than selecting a good embedding model or retrieving additional documents. Bratseth describes four dimensions of relevance that explain the engineering involved: recall (finding the right candidates), ranking (prioritizing the most useful results), freshness (ensuring information is current), and authority (distinguishing authoritative sources from less reliable ones).

Similarity tells you whether a piece of text is related to a question. Relevance tells you whether it will help the agent answer the question correctly.

Jon Bratseth

Relevance is not an intrinsic property of a document. It depends on what the agent is trying to accomplish. Achieving it requires engineering the entire path from available information to evidence that reaches the model. Most agent failures occur in the gap between similarity and relevance.

Where common retrieval approaches fall short

Many retrieval approaches work adequately initially. Limitations become apparent as data volumes grow, information changes, and agents handle more complex multistep tasks. The problem often lies not in individual technologies but in how they're combined. A retrieval pipeline can fail even when the information needed to complete a task exists in the system.

These failures generally fall into three categories.

1. The right evidence never gets retrieved

An agent cannot use information that never enters the candidate set. Several common design choices cause this:

  • Relying on vector similarity alone. Vector search excels at finding conceptually related information, but similarity doesn't capture every task requirement. Exact product names, error codes, version numbers, and business rules may matter more than semantic similarity. Without lexical matching, metadata constraints, or other relevance signals, a system retrieves documents that sound right while missing those containing the answer.
  • Filtering after retrieval. Many stacks retrieve top results by similarity and apply permissions or date filters afterward. The result set shrinks unpredictably, sometimes to nothing, and the agent concludes the information doesn't exist. Applying constraints during retrieval ensures the candidate set contains eligible information.
  • Expecting reranking to fix poor retrieval. A sophisticated reranker can improve candidate order, but cannot recover a document retrieval missed. If the right document never reaches the ranking stage, no downstream scoring can bring it back.

These are fundamentally recall problems. The information may be available and current, but the retrieval process fails to surface it.

2. The right evidence gets buried

Finding the right information is only half the challenge. The system must distinguish the most useful evidence from other results that are related to the query but less useful for completing the task.

  • Merging result lists instead of ranking them together. Many hybrid setups run keyword and vector search separately, then merge the two lists using fusion methods like reciprocal rank fusion. Fusion only considers where each result ranks in each list, not why. It cannot determine that one document is the official specification and another is a forum post, or that one matches the customer's version and another is two releases old. Weighing authority, version compatibility, and freshness requires ranking that scores candidates directly on those signals.
  • Losing context through chunking. Small passages can improve retrieval precision, but may omit surrounding information needed to interpret them correctly. For example, a configuration instruction might appear relevant until the preceding paragraph reveals it applies only to an older software version. Ranking passages without access to document-level information can prioritize the wrong evidence.

These are ranking and evidence-selection problems. The right information has been found, but less useful information may be prioritized or selected instead.

3. The agent receives the wrong amount of context

Even when retrieval finds and prioritizes useful evidence, the system must decide how much information to send to the model.

  • Using long context as a substitute for retrieval. Large context windows permit providing more information, but do not eliminate the need to select what matters. Including outdated, contradictory, or loosely related material makes it harder for the model to use the right evidence. For agents making repeated model calls, unnecessary context also increases token costs and latency.
  • Returning whole documents. Sending complete documents preserves surrounding context but can fill the model's context window with material unrelated to the task.
  • Sending a fixed number of results. A rule like "Always send 10 chunks" assumes every question needs the same amount of evidence. Some need one passage, while others may need 15. A fixed cutoff can leave an agent with insufficient evidence or overwhelm it with unnecessary information.

These are context-selection problems. The objective isn't to minimize tokens at all costs, but to provide enough relevant evidence for the agent to complete the task without unnecessary distractions.

Across all three categories, the underlying issue remains constant: Retrieving information differs from delivering sufficient, relevant evidence. A larger context window won't fix missing candidates, poor ranking, or incomplete evidence. Reliable agents need retrieval pipelines that find the right information, prioritize it appropriately, and select what the model actually needs.

Engineering retrieval for relevant, sufficient evidence

Relevance is not a setting to enable. It results from several techniques working together, within a latency budget and against constantly changing data. Getting it right requires engineering the entire retrieval pipeline, from finding candidates to deciding which evidence reaches the model.

Five practices prove particularly important.

1. Combine retrieval methods

Integrate keyword matching and vector search within the same query. Keyword matching captures exact names, codes, and version numbers. Vector search captures paraphrases and intent. Agents ask both kinds of questions, often in the same session, so both retrieval types need to work together, not as two systems merged afterward. Combining retrieval methods within a unified query and ranking pipeline also lets you evaluate candidates using shared relevance signals.

2. Apply constraints during retrieval

Dates, customers, permissions, regions, and product versions are hard rules, not hints. Applying filters during retrieval prevents a limited top-K candidate set from being reduced unpredictably by post-filtering. It also ensures the system searches among eligible documents rather than finding the most similar results first and discarding those that don't qualify. Filtering at retrieval time complements access controls; it doesn't replace them.

3. Rank in phases, on more than similarity

Retrieving the right candidates is only the beginning. The system still needs to determine which results provide the most useful evidence for the task.

Multiphase ranking makes it possible to balance relevance quality with computational cost. An inexpensive first phase evaluates candidates using signals such as keyword relevance, vector similarity, freshness, or source authority. More sophisticated ranking functions or machine-learned models can then evaluate a smaller set of promising results.

The signals and their relative importance depend on the task. Making these signals explicit allows developers to inspect, evaluate, and tune relevance rather than relying entirely on a model to infer what matters from the text.

4. Select passages, not entire documents

Finding the right document doesn't mean the agent needs to read it all. A lengthy technical guide might contain only two passages relevant to the question.

Returning entire documents preserves context but can consume the model's token budget with unnecessary information. Retrieving isolated chunks can be more precise, but those chunks may lack the surrounding information needed to interpret or rank them correctly.

A better approach is to preserve document-level information while ranking and selecting the most useful passages to send to the model. This helps retain the context needed to evaluate evidence without requiring the agent to process every paragraph.

5. Measure relevance and sufficiency separately

Don't judge retrieval quality solely by whether the model produces a convincing answer.

Build an evaluation set from real agent tasks and measure whether retrieval finds the necessary evidence, whether ranking places it near the top, and whether the selected passages collectively contain enough information to complete the task.

Retrieval and ranking evaluation can help identify where relevant evidence is lost. Recall measures whether retrieval finds the right candidates. Ranking metrics such as normalized discounted cumulative gain (NDCG), which rewards placing the most useful results near the top, help assess how effectively the system prioritizes useful results. Evidence sufficiency requires an additional check: whether the selected information collectively supports the answer.

Test difficult cases deliberately. What happens when evidence is missing, outdated, contradictory, or spread across multiple sources? Does the agent retrieve more information, acknowledge uncertainty, or confidently produce an unsupported answer?

A convincing answer based on the wrong evidence is still wrong.

None of these techniques is new to search. Web search and e-commerce teams have spent decades refining retrieval, ranking, and relevance evaluation. What's different with agents is how frequently these decisions are made and how directly they influence subsequent actions. A single task can involve repeated retrieval calls, with each result shaping what the agent does next.

Before you give your agent a bigger context window

Before increasing the amount of information an agent can process, make sure it's getting the right information in the first place. A few practical checks can reveal whether the real limitation is context size or retrieval quality.

  • Index everything the agent might need, and keep it current. Bring all the relevant sources into the searchable corpus: docs, tickets, release notes, and customer and deployment records. Apply additions, updates, and deletions as they happen, not in periodic batches. Retrieval can't surface evidence that was never indexed. An index that lags behind reality will hand the agent instructions that no longer apply. A comprehensive index doesn't mean a bigger context. It gives retrieval more to choose from so it can be more selective about what the agent reads.
  • Use more than semantic similarity. Combine vector search with keyword matching when exact names, error codes, versions, or identifiers matter. Apply permissions and other constraints during retrieval so the right candidates make it into the results.
  • Make recency and authority rankable. Capture metadata like update timestamps and source types so ranking can distinguish current, authoritative information from outdated or less trustworthy material.
  • Treat context as a limited resource. Set a token budget for each step and prioritize the most useful passages rather than entire documents. Put the strongest evidence first, rather than burying it among less relevant material.
  • Match the amount of evidence to the task. Some questions need one authoritative source; others require information from several. Don't assume a fixed number of retrieved chunks will always be sufficient.
  • Let agents search again. Let agents refine queries and retrieve missing information instead of loading everything into the initial prompt. When the evidence is incomplete, another targeted search may be more useful than a larger context window.
  • Make uncertainty an acceptable outcome. When evidence is missing, outdated, or contradictory, the agent should acknowledge the limitation rather than produce an unsupported answer. A reliable agent needs to recognize when it doesn't have enough information to proceed.

The goal is to provide enough reliable evidence to complete the task without making the agent sort through information it doesn't need.

What's next

Large context windows offer genuine value. They give agents headroom for long tasks and complex instructions, but they're capacity, not judgment. An agent can only be as reliable as the evidence it's given, and that evidence comes from your retrieval and ranking system.

More data gives an agent more to read. Relevant data gives it what it needs to get the answer right.

This is why relevance deserves more attention than it usually gets. It isn't a single feature or a better embedding model. It's comprehensiveness, freshness, recall accuracy, and ranking quality working together, plus the permission and sufficiency checks agents need on top. Each one takes deliberate engineering.

Source: The New Stack · Reporting supplemented by The Silicon Ledger staff.