Definition

Retrieval top-k is the number of highest-ranked results a retrieval stage returns or keeps. If k is 10, that stage produces at most ten candidates for the next part of the pipeline.

The name describes a count in retrieval. It is different from top-k sampling, which limits the token candidates considered during text generation.

Simple example

A vector search requests the top 30 passages for reranking. The application then keeps 5 of those passages for context assembly. Retrieval top-k is 30. The later selection count is 5.

Why it matters

A small value can omit evidence required to answer the question. A large value can increase latency, reranking cost, duplication, and context pressure. Choose the count with both retrieval recall and later-stage budgets in mind.

One important nuance

Top-k is not a quality threshold. A retriever may still return five poor results when asked for five. Scores, filters, diversity rules, or a “no adequate evidence” outcome may be needed in addition to the count. Choose values per stage using representative queries, and measure whether the required facts survive into the final model context rather than assuming that more results always improve the answer.