KV cache and why training and inference differ

MediumConcept15 minRERSMLEPro outline

The question

Explain the KV cache, how it speeds up generation, and why training does not need it. Estimate its size for a model you know.

What the interviewer is looking for

  • Explains that past keys and values are reused at each decode step
  • Contrasts parallel teacher forcing in training with sequential decoding
  • Gives a size formula with layers, heads, head dim, length and bytes
  • Mentions grouped-query attention and paging

Your answer

Saved in this browser only. Nobody else sees it.

Why this question

Written by BlogLLM in the style of a publicly reported ByteDance Seed question type: where Q, K and V come from in causal attention; why scale by the square root of d_k; KV cache and the difference between training and inference.

Reported in: nowcoder.com

Practice question written by BlogLLM based on publicly reported interview formats. Not an official ByteDance Seed question.