Retrieval-augmented generation (RAG) answers a question by first retrieving passages relevant to it from a document collection and then generating the answer from a prompt that contains them (Lewis and co-authors, 2020). BM25 is the standard lexical retrieval score: for each query term found in a passage, the term’s inverse document frequency times a saturating function of its count in the passage, normalised by the passage’s length (Robertson and Zaragoza, 2009).
ml_llm.retrieval.