Efficient architectures practice problems

23 problems · 0 solved

Standard attention gets expensive as sequences grow, and dense models get expensive as they grow wider. Efficient architectures cut that cost by sharing work, skipping work or doing work only where it is needed. A mixture of experts, for example, is like a hospital that sends each patient to the right specialist instead of having every doctor see everyone. These problems cover the main tricks used in current LLMs. You will compare KV cache size for multi-head, grouped-query and latent attention, share keys and values with grouped-query attention, limit attention to a sliding window and decode with a ring-buffer KV cache, write causal linear attention with a running state, count total and active parameters in an MoE layer, route tokens to their top two experts, enforce expert capacity, compute the Switch load-balancing loss, route tokens with Mixture-of-Depths, and merge similar tokens. Start with the Easy problems on KV cache size and parameter counts. Then do grouped-query attention and expert routing, and finish with the ring buffer, load balancing and token merging. These designs decide serving cost in production, and interviewers ask about them often.

Easy 9

Medium 8

Hard 6

Related topics

All practice problems