Free self-study · No account needed · Progress stays in this browser. Back it up before clearing site data or changing devices.

← All weeks

LLM Engineering / Week 07

Embeddings and RAG

Build a searchable local knowledge base. Index a supplied corpus and compare lexical, dense, hybrid, and reranked retrieval on fixed queries.

Your lessons

  1. 01

    Embeddings and searchable document chunks

    60 minutes planned · 7 sections
    Start →
  2. 02

    Combining retrieval methods

    60 minutes planned · 7 sections
    Start →
  3. 03

    Grounding answers and measuring retrieval

    60 minutes planned · 7 sections
    Start →

// Put it into practice

A searchable local knowledge base

  1. Download week07.py from a lesson's practice section. Follow its setup instructions before running it.
  2. Lesson 1: Embed and index a supplied document set; rank a paraphrase and an exact-code query.
  3. Lesson 2: Compare lexical, dense, and hybrid retrieval over the same corpus, then rerank candidates.
  4. Lesson 3: Build a fixed query set with relevant passages, expected answers, and unanswerable cases.
  5. Run the supplied assertions and record actual results; a simulated contract check does not certify real model quality.
Download week 7 Python lab ↓

Read the script’s setup instructions and run it on your own computer. The website does not execute code or verify your results.

// Independent work

W07-LAB

Week 7: A searchable local knowledge base

Index a supplied corpus and compare lexical, dense, hybrid, and reranked retrieval on fixed queries.

Extend the guided artifact rather than start a second project. Report retrieval and answer metrics separately; citations and permission filtering are checked.

What to produce

  • A searchable local knowledge base
  • Setup commands, data or generation procedure, versions, and recorded outputs
  • Acceptance results and a precise limitation

Check your work

  • Report retrieval and answer metrics separately; citations and permission filtering are checked.
  • Each claimed execution is supported by actual saved output.
  • Fixture results and real model results are identified separately.
  • Setup and reproduction use the taught tools without private credentials.
Self-assessment rubric
Technical correctness · 35 points
Implementation or analysis follows the relevant technical mechanism and handles the stated case.
Evaluation and evidence · 30 points
Reproducible tests, appropriate baseline, and accurate interpretation.
Engineering quality · 20 points
Clear structure, safe boundaries, and usable reproduction instructions.
Explanation and reflection · 15 points
Explains tradeoffs, limitations, and next experiment with evidence.

// Retrieve before you reread

Week 7 knowledge check

Try all 6 questions. Check your answers, review the explanations, and retry whenever you like. Answers are checked on this device.

1. A query [0, 2] is compared with passages [0, 5] and [5, 0] using cosine. Which passage has higher similarity?
2. An index switches to a new encoder with the same dimension but different learned coordinates. What preserves meaningful query-document comparison?
3. An unauthorized incident passage is sent to a reranker, then removed before the answer model. Which assessment is correct?
4. With reciprocal-rank fusion constant 20, candidate M appears second in one list and fourth in another. What contribution does it receive?
5. Three passages are labeled relevant. The top four results contain two of them. What is recall at four?
6. An assistant correctly states a real twelve-day policy, but its authorized corpus contains no evidence for that policy. How does a grounding rubric classify it?

Next: week 8 →