Practice track

RAG building blocks

Dense and sparse retrieval scores that a RAG system ranks with. 3 problems, about 52 minutes. Do them in order: each problem uses ideas from the problems before it.

0 / 3 solved

  1. 01
    Cosine similarity top-k search

    Normalize embedding rows, score queries against documents with cosine similarity, and return the top k documents with a fixed tie rule.

    From Embeddings & Vector Representations

    ImplementEasy15 min
  2. 02
    Reciprocal rank fusion

    Merge several ranked lists of document ids into one ranking with reciprocal rank fusion, optional list weights and a fixed tie rule.

    From Hybrid Retrieval with BM25 and Dense Embeddings

    ImplementEasy12 min
  3. 03
    BM25 ranking

    Score tokenized documents against a query with BM25: the lesson idf, term frequency saturation with k1, length normalization with b, and a ranked list.

    From Information Retrieval and Search

    ImplementMedium25 min