coding
Inference interview questions tagged coding, across every topic.
19 questions · 5 unlocked for you
Concepts behind "coding"
Concept pages for the mechanisms these questions lean on.
Foundational
Attention With a KV Cache, From ScratchA from-scratch implementation of causal multi-head attention with grouped-query KV heads and a KV cache, in about 35 lines of numpy. Covers the offset causal mask when queries are fewer than keys, why the cache turns quadratic recompute into linear work, and the tests an interviewer runs against it.⌨️ Implementation Patterns
Advanced
Property-Testing Engine ComponentsHow to test serving-engine code the way graders do: state invariants, generate random operation sequences, compare against a slow reference within a tolerance derived from the number format, and shrink failures to a minimal repro. Includes a runnable stateful test for a KV block pool.⌨️ Implementation Patterns🔒 Premium
Advanced
Sampling: Temperature, Top-k and Top-pHow LLM token sampling works and how to implement it correctly: temperature rescales logits, top-k keeps the k largest, top-p keeps the smallest prefix of the sorted distribution reaching probability p. Covers order of operations, ties at the cutoff, temperature 0, fully masked vocabularies and the cost at full vocabulary size.⌨️ Implementation Patterns🔒 Premium