← cd ~ ~/42-firenze/rag-against-the-machine
42 firenze · milestone 4 · python · rag

RAG Against the Machine

A retrieval-augmented generation (RAG) system, built end to end, that answers questions about the vLLM 0.10.1 codebase. It retrieves the most relevant passages from 13,885 code-aware chunks with BM25, then has Qwen3-0.6B answer from those five passages only, so every answer points back to the exact lines it came from. The right source lands in the top 5 for 86% of documentation questions and 83% of code questions. No embeddings and no GPU: the whole repo is indexed in about 3 seconds.

ragpythonbm25qwen3-0.6basttransformerspydantic
retrieval trace
question
vllm 0.10.1 · one circle per file
answer · qwen3-0.6b
top 5 · span in file · bm25
click a result to see its score split by term
source
identifier kept whole + split stopword dropped brighter term = weighs more in bm25 files matching the current term brighter = higher score ✓ground-truth source abcanswer text found in the source

16 real runs, including a rank-2 hit (metrics) and a wrong answer (multi-model serving): scores, rankings and answers come from the project's own index and Qwen3-0.6B, on questions from the public dataset. Circle area = number of chunks in the file. Layout after GitHub Next's repo visualizer.

how it works

view source on github ↗teemoteeo/quarantadue/milestone_4/RAG_against_the_machine