# Key (K)

- **Canonical URL:** https://getaimath.com/dictionary/key-k/
- **Topics:** [Transformer Architecture](https://getaimath.com/dictionary/category/transformer-architecture/)
- **Last updated:** 2026-11-25

## What is Key (K)?

**In one sentence:** In attention, a key is a list of numbers that describes what a word offers, so queries can find it.

If queries are questions, keys are like name tags. The model compares each query with every key to score how well they match. A strong match means "this word is relevant, pay attention to it."

![Transformers & Attention: The Smart Highlighter — Simple cartoon diagram showing how a Transformer reads a whole sentence at once and shines a bright highlighter beam from the word "IT" back to "trophy" so it knows what "IT" means.](https://getaimath.com/diagrams/transformer-architecture.png)
*Napkin Diagram (Transformer Architecture): Older AI read word-by-word and often lost track of earlier words; a Transformer highlights which words connect to which.*

## What is an example of Key (K)?

The key for "ball" might signal "I am a round object that can bounce," which matches the query of "it" in "it was bouncy."

## Why does Key (K) matter?

Keys make it possible for attention to find the right information quickly.

## Related Concepts

- [Query (Q)](https://getaimath.com/dictionary/query-q/): In attention, the query is a list of numbers that represents what a word is looking for in other words.
- [Value (V)](https://getaimath.com/dictionary/value-v/): In attention, a value is the actual information a word passes along when another word pays attention to it.
- [Multi-Head Attention (MHA)](https://getaimath.com/dictionary/multi-head-attention-mha/): Multi-head attention runs several attention processes side by side, so the model can notice different kinds of relationships at once.
- [Query Matrix](https://getaimath.com/dictionary/query-matrix/): The query matrix is a grid of learned weights that turns each word's numbers into its query.
- [Attention Mechanism](https://getaimath.com/dictionary/attention-mechanism/): An attention mechanism is a way for a model to focus on the most useful parts of its input when producing each piece of output.
- [Key Matrix](https://getaimath.com/dictionary/key-matrix/): The key matrix is a grid of learned weights that turns each word's numbers into its key.

---
Source: The AI Math Dictionary (https://getaimath.com/dictionary/key-k/)
