Junior interview questionAsked by candidates · YouTube
What is a context window, and why can't GPT-2 small take a 1,025th token even with plenty of memory?
Model answer
It's the most tokens a model can read at once, shared by prompt, history and output: 1,024 for GPT-2 small. Attention alone ignores order, so GPT-2 adds a learned position vector from a table with exactly 1,024 rows. Position 1,025 has no row; on our CPU run it raised an IndexError.
Practise the rest
11 Context & KV cache questions, 492 in all, each with a model answer. Free.
More Context & KV cache interview questions
- Users say your summariser 'takes ages to start' on long documents but then writes quickly. Explain what's happening in terms of prefill and decode.
- What does the KV cache store, why is using it exact rather than an approximation, and how much does it save?
- You're sizing GPUs for a chat service. How do you estimate KV-cache memory, and which levers would you pull if it doesn't fit?
- Request A has a 960-token prompt and 10 output tokens. Request B has a 16-token prompt and 200 output tokens. Same model and machine: which finishes first, and what does that tell you about a chat app that resends the full history every turn?
- What are multi-head and grouped-query attention, and what does GQA do to the KV cache?
- Here's a small transformer with a few bugs. Fix them, then add a KV cache for decoding.