Member-only story
Python I Increased RAG Top-K From 3 to 50. What Actually Happened?
Gulsaba Fiha
10 min readNov 16, 2026
I tested six retrieval configurations using Python, Sentence Transformers, and an LLM. The results revealed an interesting relationship between retrieval recall, precision, and context size.
When I first started experimenting with Retrieval-Augmented Generation (RAG), I assumed that retrieving more documents would give an LLM more information and help it generate better answers.
It sounded reasonable.
If retrieving three documents gives an AI some context, retrieving ten or twenty should provide even more useful information.
But is that actually true?
I decided to investigate by building a small RAG pipeline and increasing the retrieval parameter, Top-K, from 3 to 50.
I wanted to understand:
Does retrieving more documents improve retrieval recall?
Does precision decrease as more documents enter the context?
Does a larger context improve answer quality?
How much additional…