podcasts / The attention family / episode / question
Question

How are the W_Q, W_K and W_V weight matrices learned in an LLM?

Answered from Q, K, V intuition - self attention with trainable weights | The attention family series - Lecture 6 · The attention family · 2026-09-18

Sreedath Panat says nobody knows the query, key and value weight matrices in advance. They begin as random matrices and their values evolve during large language model training, and he calls finding good transformation matrices one big part of the art of training an LLM: good projections make the resulting dot products meaningful. In the lecture's Colab notebook the matrices are simply drawn at random with PyTorch to show the mechanics.

Source: our own transcription of the episode. The full conversation is on The attention family (2026-09-18). Read the whole episode summary →

▸More from this episode

Q1What do query, key and value mean in self-attention, according to Vizuara?Q2Why can't self-attention use raw input embeddings for attention scores?Q3How does a key weight matrix change attention scores in Vizuara's dog and ball example?Q4What does an attention-weighted sum of value vectors mean in the transformer formula?Q5Can the query, key and value space have a different dimension from the input embeddings?
Transcribe your links. Paste a YouTube, Google Drive or podcast link and WhipScribe gives you the transcript. Transcribe a link →