Top-k by similarity has a failure mode that looks like success. Your corpus contains the same policy paragraph in five documents, the query matches it, and all five slots go to near-identical text. The model gets one fact stated five ways and the answer is confidently incomplete.
Write mmr_select(query_vec, doc_vecs, k, lambda_=0.5) returning a list of k document indices, most valuable first.
Maximal Marginal Relevance picks greedily. Having already chosen a set S, the next document maximises:
You have read the opening. The rest is free with a Bezen account, and no card is needed.
Behind the sign-in