(Note · · 6 min read)
Context engineering is mostly deciding what to leave out
Context windows got large, and the first instinct was to fill them. Retrieve twenty passages instead of five, keep the whole conversation, attach the full document. Answers get worse, not better, and the bill grows while it happens. The work is selection, not accumulation.
By Md. Habibur Rahman Shohel, full-stack & AI product engineer in Dhaka
Why more context lowers quality
Every passage you add is another candidate explanation. Add fifteen marginally relevant ones around the correct one and you have not helped the model find the answer; you have hidden it among plausible alternatives and asked the model to pick. Contradictions do the most damage, because retrieval cannot resolve them and the model will confidently pick a side.
The practical consequence: when answers are vague or wrong, retrieving more is the wrong reflex. Look at what was retrieved and ask whether the answer was in there at all, and whether anything in there argued against it.
Make relevance a threshold, not a ranking
Taking the top five results always returns five results, including when nothing relevant exists. Set a floor instead, and let the set be empty — an empty result routed to an honest refusal or to a person is worth more than five weak passages that produce a confident invention.
On the chatbots I have built, this is the single most useful control: the question is not which passages ranked highest but whether any of them clears the bar for being used at all.
Chunking decides what relevance can even mean
Retrieval can only return the units you created. Split a procedure in half and the best possible match is half a procedure, which produces an answer that reads like a confident guess because it is assembled from fragments.
Chunk along the document's own boundaries where it has them, keep enough surrounding context that a passage is interpretable alone, and remember that a chunk nobody could answer from is a chunk that will still be retrieved.
Fetch live facts, do not retrieve them
Anything that changes — prices, stock, order status, balances — should be fetched from the system that owns it at the moment of asking. Retrieved text is a snapshot of when it was written, and a correct quotation of a stale price is still a wrong answer.
Keeping that category out of retrieval also shrinks what is competing for space, which improves everything else.
Conversation history is context too
A long conversation carried verbatim into every call spends the window on exchanges nobody needs again, and old corrections can contradict current retrieval. Summarise what the conversation established and carry the summary, keeping recent turns verbatim.
The test for anything in the window is the same: if this were removed, would the answer change? Anything that would not is cost without benefit, on every single call.
Common questions
Does a bigger context window mean I should retrieve more?
No. Each additional passage is another candidate explanation, so marginal passages hide the correct one among plausible alternatives and contradictions make it worse. Retrieve what is relevant, not what fits.
What should happen when nothing relevant is retrieved?
The system should decline or hand over to a person rather than answer. Taking a fixed number of top results always returns results even when nothing relevant exists, so use a relevance floor and allow the set to be empty.
Why are my RAG answers vague rather than wrong?
Usually chunking. Retrieval can only return the units you created, so a procedure split in half retrieves as a fragment and the answer is assembled from pieces. Chunk along the document's own boundaries and keep chunks interpretable alone.
Should live data like prices go into the knowledge base?
No. Fetch anything that changes from the system that owns it at the moment of asking. Retrieved text is a snapshot of when it was written, and an accurate quotation of a stale price is still a wrong answer.