Valenx Interview Pass: free Week 0 sample
This is a trimmed excerpt of Week 0, the 7-day starter plan every member gets the moment they join. The full Week 0 has 17 questions over 7 days, plus a timed mock and a study plan. A new pack lands every Monday; data science and product manager packs are included.
How to use it: answer out loud or in writing before you read the outline, then compare. Score yourself 1 to 4 on structure, technical depth, quantification and follow-ups.
Get the 12-month Pass for $79Explain the KV cache and why it matters for inference.
What it tests: Whether you understand autoregressive decoding well enough to explain what is cached and why, can estimate memory with the formula, and know that the cache, not only the weights, often limits batch size and context length.
Strong-answer outline
- State the reason: during autoregressive decoding the keys and values of earlier tokens do not change.
- State the saving: store and reuse them, so each new token computes only its own Q, K and V instead of recomputing the whole prefix.
- State the cost: memory per sequence is roughly 2 x layers x kv_heads x head_dim x tokens x bytes per value.
- State the consequence: it often limits batch size and context length more than the weights do.
- Name the mitigations: grouped-query attention, KV quantization and paged allocation (as in vLLM's PagedAttention).
Model answer (short)
During autoregressive decoding, the keys and values of earlier tokens do not change, so they are stored and reused; each new token computes only its own Q, K, V. This turns per-step attention from recomputing the whole prefix into one pass over cached tensors. The trade-off is memory: per sequence it is roughly 2 x layers x kv_heads x head_dim x tokens x bytes per value, and it often limits batch size and context length more than the weights do. Grouped-query attention, KV quantization and paged allocation (as in vLLM's PagedAttention) exist to shrink or pack it.
Likely follow-up: Estimate KV-cache memory for a 32-layer model, 8 KV heads, head_dim 128, 8k tokens, fp16. 2 x 32 x 8 x 128 x 8192 x 2 bytes, about 1 GiB per sequence.
Common mistakes
- Saying queries are cached; only keys and values of earlier tokens are reused.
- Describing the speed benefit without the memory cost.
- Assuming model weights are the only memory constraint when serving long contexts or large batches.
- Not being able to do the back-of-envelope memory estimate.
- Confusing the KV cache with response caching or prompt caching for shared prefixes, which are application-level cost levers.
How do you debug poor RAG answer quality?
What it tests: Whether you debug systematically by stage instead of rewriting the prompt, and whether you know where RAG usually breaks.
Strong-answer outline
- Collect failing questions and, for each, the document that should answer it.
- Ingestion and parsing: was the document indexed, and is its text intact (tables, PDFs, scans)?
- Chunking: is the answer inside one sensible chunk with its context?
- Retrieval and ranking: did the chunk appear in the top-k, and was it ranked high enough to reach the prompt?
- Generation: was it in the prompt and did the model use it? Fix the earliest failing stage, then add the case to the eval set.
Model answer (short)
Trace a failing question: was the right document ingested and parsed correctly, was it chunked sensibly, did it appear in the top-k, was it ranked high enough, was it included in the prompt, and did the model use it? Fix the earliest failing stage. Most issues are parsing, chunking or retrieval, not the generator.
Likely follow-up: The right chunk is retrieved but the answer is still wrong. What next? Check its position and the amount of competing context, tighten instructions to answer from sources, and evaluate faithfulness on that case.
Common mistakes
- Starting by changing the model or prompt.
- Debugging without labeled failing cases.
- Not inspecting parsed text for tables and PDFs.
- Fixing a case without adding it to the eval set.
How do you evaluate a RAG system?
What it tests: Whether you split evaluation into retrieval and generation, know concrete metrics for each, build a golden set from real questions, and can trace a failing answer to the stage that broke.
Strong-answer outline
- Evaluate retrieval and generation separately.
- Retrieval: recall@k, precision@k, MRR or nDCG against labelled question-to-source pairs.
- Generation: faithfulness (claims supported by the retrieved context), answer relevance, correctness against a reference, citation accuracy.
- Data and grading: a golden set from real user questions, an LLM judge calibrated against human labels, plus latency and cost per answer.
- Debugging: trace a failing question stage by stage and fix the earliest failing stage.
Model answer (short)
Separately. Retrieval: recall@k, precision@k, MRR or nDCG against labelled question-to-source pairs. Generation: faithfulness (claims supported by retrieved context), answer relevance, correctness against a reference, and citation accuracy. Build a golden set from real user questions, use an LLM judge calibrated against human labels, and track latency and cost per answer.
Likely follow-up: How do you debug poor RAG answer quality? Trace a failing question through ingestion, parsing, chunking, retrieval, ranking, prompt assembly and generation, and fix the earliest failing stage.
Common mistakes
- Scoring only the final answer, so you cannot tell whether retrieval or generation failed.
- Building the eval set from invented questions instead of real user questions.
- Using an uncalibrated LLM judge as the source of truth.
- Ignoring latency and cost per answer.
- Changing the prompt or model before checking whether the right chunk was even retrieved.
Practice prompt and scoring rubric
"Explain the RAG architecture end to end, then tell me the first three things you would check if users say the answers are wrong." (5 minutes, out loud.)
Score yourself: 1 = names the parts only; 2 = indexing and query paths in order; 3 = adds metadata, re-ranking and a decline path; 4 = also separates retrieval from generation evaluation and fixes the earliest failing stage first (aie-026, aie-040, aie-031).
Want a second opinion? Paste your answer into the free answer check.
Get every Monday's pack
12-month Pass
About $6.58 a month, about 22 cents a day. You pay once. It does not renew.
Get the 12-month Pass for $79One-time payment, no auto-renew. Written only. Practice material, not a promise of any interview result. Full details on the Interview Pass page.
Valenx Press