Improving the Web Search Experience of LLM Applications: Practical Lessons from Self-Built Solutions
Self-built web search for LLM applications often feels slower and more disorganized than official web search products. This article covers four root causes: generating text before searching, conservative default limits, feeding raw web pages to the model, and weak fallback handling. It also includes a checklist for moving closer to the official web search experience.
Improving the Web Search Experience of LLM Applications: Practical Lessons from Self-Built Solutions
1. The Symptom: Why Self-Built Search Feels “Slow and Fragmented”
Many developers add web search to their LLM applications, AI assistants, or coding tools and then face the same puzzle. The official web version of a model product returns results almost instantly, with clear answers and source citations. A self-built solution, by contrast, often goes through pages one by one. It takes a long time and returns disorganized content.
This gap does not come from differences in model intelligence. It comes from differences in the search pipeline architecture. To replicate the official web search experience, you first need to break down the entire pipeline and find each unnecessary cost.
2. Root Cause 1: Letting the Model Write Out Text Before Searching
A common design mistake is to have the LLM generate a full block of text for each search, such as a search intent analysis or a query rewrite explanation. The system starts fetching sources only after that generation finishes.
This design has two problems:
- Serial blocking: Retrieval waits for the model’s generation. Generating token by token takes several seconds or longer. During that time, the search engine sits idle, and total latency grows significantly.
- Compounded token cost: The extra text generated before each search is billed by token. One practitioner estimated that this step alone can consume on the order of 10,000 tokens per search. During peak call volumes, this pay-per-use cost adds up.
The better approach is to decouple “query planning” from “retrieval execution.” Either trigger retrieval with a very short structured instruction instead of long text generation, or let lightweight rules or a small model handle query rewriting. This leaves the model’s generation budget for the final answer synthesis step.
3. Root Cause 2: Overly Conservative Default Parameters
The second problem lies in configuration defaults. Many integrations ship with conservative default limits. For example:
- Up to about 10 sub-queries per search;
- Up to about 10 web results retrieved per search;
- A combined limit of about 8,000 characters of extracted page content sent to the model.
Most tools let users adjust these limits in their settings, but most users never change them and keep the factory defaults. As a result, when a complex question requires broad research, the model sees a heavily compressed set of raw material. Its answers end up thin. Insufficient material also forces repeated searches over multiple rounds, which adds more latency.
Recommendation: Raise the recall count and content budget based on your use case. Pair this with deduplication, per-domain rate limiting, and relevance-based truncation to balance information coverage against token cost.
4. Root Cause 3: The Model Reads Raw Pages Instead of Organized Results
This is the largest gap compared with the official web version. In official web search, a server-side pipeline completes the whole process in one pass: query dispatch, page fetching, body text extraction, key point summarization, and source attribution. Dedicated retrieval and processing services handle all of these steps, and the model stays out of the intermediate work. The model receives a structured, distilled result block with citation numbers, not dozens of raw HTML pages. It only needs to write the final answer based on that block.
Self-built solutions often do the opposite. They insert raw fetched page content directly into the model’s context and let the model search and read at the same time. This consumes a large number of tokens and slows responses. Noise such as navigation bars, ads, and footers can also distract the model.
Recommendation: Add a post-retrieval processing layer between retrieval and the model. It should include at least three steps:
- Main content extraction: Strip HTML noise and keep only the main body.
- Summary compression: Extract key points from each result and control the total length sent to the model.
- Structured packaging: Organize results in a consistent format, such as number, title, summary, and source URL, so the model can cite sources directly by number.
An illustrative structure for packaged results looks like this:
{"results": [{"id": 1,"title": "Page title","snippet": "Extracted key information","url": "Source URL"}]}
5. Root Cause 4: No Graceful Fallback
One detail is easy to overlook: fault tolerance in the retrieval channel. In some implementations, if the upstream service does not return the expected structured result block, the code throws an error immediately. It never tries to extract usable content from the model’s response text. This hard-failure strategy breaks the user flow whenever network conditions fluctuate or an API changes.
A reliable design uses multiple fallback levels. First, use the server-side structured results when they are available. If they are not, fall back to fetching pages and extracting body text directly. If that also fails, answer only from the model’s existing knowledge and clearly tell the user that the answer is not based on web search.
6. Checklist: Moving Closer to the Official Web Search Experience
Based on the analysis above, work through this checklist to bring a self-built solution closer to the official web search experience:
- Remove the long text generation step before search so retrieval starts immediately.
- Raise the sub-query count, recall count, and context content budget instead of using factory defaults for broad searches.
- Move finding sources, opening pages, summarizing key points, and attributing sources into the server-side pipeline so the model only consumes organized results.
- Add concurrent fetching and streaming output so that multiple sub-queries run in parallel for broad searches.
- Improve fallback and timeout handling so that a single point of failure does not interrupt the entire flow.
The advantage of the official web version is not mysterious. It comes from a clear division of labor: the retrieval system does what it does well, and the model focuses on understanding and expression. Once that boundary is drawn clearly, a self-built solution can also be both fast and accurate.
