Where Q, K and V come from, and why divide by the square root of d_k

EasyConcept10 minRERSMLE

The question

In a decoder's causal self attention, where do the queries, keys and values come from? Why are scores divided by the square root of d_k, and what happens without it?

What the interviewer is looking for

  • All three are projections of the same hidden states in self attention
  • Dot products grow with d_k under unit variance inputs
  • Large scores saturate softmax and shrink gradients
  • Mentions alternatives such as QK norm

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.