Where we left off
Every lesson so far graded a handful of chunks, on a five-document corpus, and it felt free. It isn't. Grading is an extra API call per chunk (or per strip, since Lesson 10) on top of embedding and generation, and this lesson measures what that actually costs, in real seconds, then projects it to a corpus size this course's fixtures were never meant to represent.
The code, piece by piece
n_samples = 3start = time.perf_counter()for _ in range(n_samples): grade_chunk(question, chunk_text)elapsed = time.perf_counter() - startper_call = elapsed / n_samplesA real, measured per-call latency, not a guessed number, the same "measure it, don't assume it" instinct naive_rag Lesson 19 used for timing linear scan.
strips_per_chunk = 8calls = k * strips_per_chunkStrip-level grading (Lesson 10) multiplies the call count by roughly however many strips a chunk splits into, here, 8, matching weather-station.md's own strip count from Lesson 10. That multiplier is the real cost of the extra precision strip-level grading buys.
Checkpoint
- Grading is not free, it's an extra model call per chunk (whole-chunk grading) or per strip (strip-level grading), on top of every embedding and generation call this pipeline already makes.
- The cost scales with
kand, for strip-level grading, with how many strips a chunk splits into, not directly with corpus size. - Two responses to this number, already partly built: Lesson 13's caching (skip re-grading identical question/chunk pairs) and Lesson 20's cheap pre-filter (skip grading altogether for chunks a similarity threshold already rules out).
If anything here still feels unclear, ask before moving to Lesson 20.