Transformer basics: attention scaling, memory and what slows decoding

MediumConcept20 minMLESWERSPro outline

The question

Explain scaled dot-product attention. Why do we divide by the square root of the head dimension?

Then tell me where the memory goes when a decoder-only model generates text, and why generating one token at a time is usually limited by memory bandwidth rather than compute.

What the interviewer is looking for

  • Writes softmax(QK^T / sqrt(d)) V and explains each shape
  • Explains that without scaling, dot products grow with d and push softmax into saturation
  • Knows the KV cache and can size it: 2 x layers x heads x head_dim x tokens x bytes
  • Explains that decode reads all weights and the KV cache for very few FLOPs per byte
  • Mentions remedies such as batching, grouped-query attention, quantized KV cache

Your answer

Saved in this browser only. Nobody else sees it.

Why this question

Written by BlogLLM in the style of a publicly reported NVIDIA (Research and AI engineering) question type: Transformer basics and GPU questions, sometimes with a question on handling model drift.

Reported in: datainterview.com

Practice question written by BlogLLM based on publicly reported interview formats. Not an official NVIDIA (Research and AI engineering) question.