Candidate generation (source code)

= Candidate generation

<Candidate generation> produces a manageable set of possible answers before a more expensive scoring or verification stage. In a <recommender system>, retrieving a few hundred items from millions lets a detailed ranking model examine each candidate. Candidates may come from several retrieval rules; their union can combine recent, popular and personally relevant items.<Candidate generation overview by Google>[Opening definition and Embedding space]{ref}

One mechanism represents a query by a <vector> $q$ and each item by a <vector> $v_i$, then retrieves large <inner products> $q^Tv_i$ using <nearest neighbor search>. If the <vectors> have unit <Euclidean norm>, maximizing $q^Tv_i$ also minimizes $\|q-v_i\|^2=2-2q^Tv_i$. Without normalization those rankings need not agree. A candidate omitted here cannot be restored by a later stage that only reorders the retrieved set, so retrieval coverage and computational cost must be assessed together.