Key Matrix
What is Key Matrix?
In one sentence: The key matrix is a grid of learned weights that turns each word's numbers into its key.
Just like the query matrix, it is multiplied with each token's embedding, but it produces the "name tag" that others search. Training shapes it so related words produce keys that match each other's queries.
What does Key Matrix look like?
The key matrix learns to give words like "she" and "Sara" keys that match well when they refer to the same person.
Why does Key Matrix matter?
Together with the query matrix, it decides where attention goes.
Last updated · Fact-checked by The AI Math
Linking to this page from a lesson or article? <a href="https://getaimath.com/dictionary/key-matrix/">Key Matrix, explained simply</a> (The AI Math Dictionary)