mirror of
https://github.com/rohitg00/ai-engineering-from-scratch.git
synced 2026-10-02 01:54:39 +08:00
Every "Test Your Understanding" quiz placed the correct answer in option B.
Across the 2026 questions in 338 quiz files the correct answer sat at index 1
in 61.5% of cases (uniform would be ~25%), and 107 files had every answer at B,
making the quizzes guessable without reading them.
scripts/debias_quizzes.py rewrites each question's option order with a
deterministic, content-seeded permutation and updates the correct index to
follow the moved answer. It is idempotent: options are canonicalised to a sorted
base before permuting, so re-running produces byte-identical output. Questions
whose options reference each other by position ("all of the above", "both A and
B") are left untouched. The correct-answer value, the option set, and every
explanation are preserved exactly; only order and the index change.
Result: A 23.8% / B 26.3% / C 23.5% / D 26.4%.
The script doubles as a CI guard: `--check` exits non-zero if any quiz is not
de-biased, wired into the curriculum workflow so new lessons cannot regress.
Fixes #368
79 lines
2.6 KiB
JSON
79 lines
2.6 KiB
JSON
{
|
|
"lesson": "06-sglang-radixattention",
|
|
"title": "Prefix-Cache Serving — RadixAttention and KV Reuse",
|
|
"questions": [
|
|
{
|
|
"stage": "pre",
|
|
"question": "What core data structure backs SGLang's KV cache reuse?",
|
|
"options": [
|
|
"A radix tree where each node owns a token range and its KV blocks",
|
|
"A skip list keyed by request id",
|
|
"A hash table keyed by full prompt",
|
|
"A B-tree of attention scores"
|
|
],
|
|
"correct": 0,
|
|
"explanation": ""
|
|
},
|
|
{
|
|
"stage": "check",
|
|
"question": "Why is FCFS scheduling wrong for prefix-heavy traffic on SGLang?",
|
|
"options": [
|
|
"FCFS is the recommended SGLang policy",
|
|
"FCFS can evict a hot prefix branch before the next long-prefix request hits, breaking radix-tree reuse",
|
|
"FCFS only works on AMD GPUs",
|
|
"FCFS is incompatible with PagedAttention"
|
|
],
|
|
"correct": 1,
|
|
"explanation": ""
|
|
},
|
|
{
|
|
"stage": "check",
|
|
"question": "What eviction granularity does SGLang's cache-aware scheduler use to match radix shape?",
|
|
"options": [
|
|
"Per-request only",
|
|
"Random eviction",
|
|
"Single tokens",
|
|
"Whole branches, starting from shortest-used leaves"
|
|
],
|
|
"correct": 3,
|
|
"explanation": ""
|
|
},
|
|
{
|
|
"stage": "check",
|
|
"question": "What is the most direct engineer's lever for keeping the radix-tree shared prefix discoverable?",
|
|
"options": [
|
|
"Always use static batching",
|
|
"Fix prompt-template ordering so immutable content (system, tools, schemas) is always first",
|
|
"Lower the GPU memory utilization knob",
|
|
"Disable continuous batching"
|
|
],
|
|
"correct": 1,
|
|
"explanation": ""
|
|
},
|
|
{
|
|
"stage": "post",
|
|
"question": "Which workload pattern does the lesson NOT expect RadixAttention to win on?",
|
|
"options": [
|
|
"Agents with shared tool schemas",
|
|
"Single-shot generation with unique prompts and no shared system prompt",
|
|
"RAG with a shared retrieval preamble",
|
|
"Voice workloads with repeated preambles"
|
|
],
|
|
"correct": 1,
|
|
"explanation": ""
|
|
},
|
|
{
|
|
"stage": "post",
|
|
"question": "ProjectDiscovery's deployment moved from 7% to 74% prefix-cache hit rate by doing what?",
|
|
"options": [
|
|
"Increasing GPU count from 8 to 16",
|
|
"Disabling continuous batching",
|
|
"Moving dynamic content out of the cacheable prefix",
|
|
"Switching from vLLM to SGLang without any prompt changes"
|
|
],
|
|
"correct": 2,
|
|
"explanation": ""
|
|
}
|
|
]
|
|
}
|