Skip to content
Query Feedz
  • News
  • Business
    • Digital Marketing
      • Marketing & Sales
      • SEO
      • Content Marketing
      • AEO and GEO
    • Startups
      • Founder Stories
      • Funding & VC
      • Product & Growth
    • Money
      • Investing
      • Markets & Economy
      • Saving & Budgeting
  • AI & Technology
    • Technology
      • Consumer Tech
      • CRM
      • Cyber Security
      • Software Engineering
      • WordPress
      • Hardware
    • Artificial IntelligenceAI Glossary
      • LLMs
      • Machine Learning
      • AI Fundamentals
      • Generative AI
      • Deep Learning
    • AI Use Cases
      • Automation
      • Content
      • Customer Support
      • Finance
      • Marketing
      • View All
  • Tools & Software
  • Account
    • Submit Guest Post
    • Submit a tool
    • My listing
  • Contact
QueryFeedz
  • News
  • Business
    • Digital Marketing
      • Marketing & Sales
      • SEO
      • Content Marketing
      • AEO and GEO
    • Startups
      • Founder Stories
      • Funding & VC
      • Product & Growth
    • Money
      • Investing
      • Markets & Economy
      • Saving & Budgeting
  • AI & Technology
    • Technology
      • Consumer Tech
      • CRM
      • Cyber Security
      • Software Engineering
      • WordPress
      • Hardware
    • Artificial IntelligenceAI Glossary
      • LLMs
      • Machine Learning
      • AI Fundamentals
      • Generative AI
      • Deep Learning
    • AI Use Cases
      • Automation
      • Content
      • Customer Support
      • Finance
      • Marketing
      • View All
  • Tools & Software
  • Account
    • Submit Guest Post
    • Submit a tool
    • My listing
  • Contact
QueryFeedz
  1. Home /
  2. AI Glossaries /
  3. LLMs /
  4. What is Multi-Head Attention?
LLMs

What is Multi-Head Attention?

Updated September 26, 2026 Read 3 min

Multi-head attention runs several attention operations in parallel, each with its own learned projections, so a model can capture different kinds of relationships at once and then combine them.

Contents 10
  1. 01Key takeaways
  2. 02Multi-head attention explained in simple terms
  3. 03How it works
  4. 04Dimensions: a worked example
  5. 05What different heads learn
  6. 06Efficiency variants
  7. 07Limitations
  8. 08Common Use Cases
  9. 09Frequently Asked Questions
  10. 10Related Terms

Multi-head attention runs several attention operations in parallel, each with its own learned projections, and combines their results. Each “head” can focus on a different kind of relationship, such as grammatical agreement, references between words or topic similarity. Their outputs are concatenated and passed through a final linear layer.

Key takeaways

  • One attention operation captures one pattern of relevance; several heads capture several.
  • Each head works in a smaller dimension, so total cost is similar to one full-size head.
  • The original 2017 transformer used 8 heads with a model dimension of 512.
  • Modern efficiency variants include multi-query attention (MQA) and grouped-query attention (GQA).
  • Heads are combined by concatenation followed by a learned output projection.

Multi-head attention explained in simple terms

Ask one expert to review a contract and you get one perspective. Ask a lawyer, an accountant and a project manager to review it in parallel and you get three different sets of observations, which you then merge. Multi-head attention is that panel of reviewers, and each head learns for itself what to look for.

How it works

  1. Split the work into h heads.
  2. For each head, project the input into smaller queries, keys and values using its own learned matrices.
  3. Run scaled dot-product attention in each head independently.
  4. Concatenate all head outputs.
  5. Pass the result through a final linear layer, W_O.

Dimensions: a worked example

Take a model dimension of 512 with 8 heads, as in the original transformer.

  • Each head’s key and value dimension: 512 ÷ 8 = 64.
  • Each head attends over the sequence using 64-dimensional vectors.
  • Concatenating 8 × 64 gives back 512 before the output projection.

So multi-head attention divides the representation rather than multiplying the cost. A model with a dimension of 4,096 and 32 heads gives each head 128 dimensions.

What different heads learn

Studies of trained transformers have found heads with recognisable jobs: attending to the previous token, tracking syntactic relations, matching a word to its earlier occurrence, or copying patterns seen earlier in the text (often called induction heads). Many heads are less interpretable, and some can be removed with little loss, as research on head pruning has shown.

Efficiency variants

VariantIdeaBenefit
Multi-head attention (MHA)Every head has its own keys and valuesMost expressive
Multi-query attention (MQA)All heads share one set of keys and valuesMuch smaller KV cache, faster inference
Grouped-query attention (GQA)Heads share keys and values in groupsBalance of quality and speed; widely used in recent LLMs

These variants mainly reduce the key-value memory that grows with context length during generation.

Limitations

  • More heads do not always help; capacity per head shrinks.
  • Some heads are redundant and can be pruned.
  • Head behaviour is only partly interpretable.
  • Still carries attention’s quadratic cost in sequence length.

Common Use Cases

01

Language models

Track syntax, references and topic links simultaneously.

02

Translation

Align words and phrases across languages in different ways.

03

Long-context reading

Let different heads follow different threads in a document.

04

Vision transformers

Capture local detail and global layout at once.

05

Efficient serving

Use GQA or MQA to shrink KV cache and speed up inference.

06

Interpretability research

Study individual heads to understand model behaviour.

Frequently Asked Questions

Running several attention operations in parallel, each with its own projections, then combining their outputs.

Different heads can capture different relationships, such as grammar, references and topic similarity.

The original used 8. Modern models often use 16 to 128, depending on model size.

A variant where groups of heads share keys and values, reducing memory use during inference with little quality loss.

Not much. Each head works in a smaller dimension, so total computation stays similar.

Related Terms

  • Self-Attention
  • Attention Head
  • Transformer
  • Attention Mechanism
  • LLM Inference
  • Context Window

Related AI Terms

What is an Attention Head?An attention head is a single attention unit inside a transformer layer, with its own query, key and…What is Prefix Tuning?Prefix tuning is a parameter-efficient fine-tuning method that learns trainable vectors inserted into the attention keys and values…What is an Attention Mechanism?An attention mechanism is a technique that lets a neural network focus on the most relevant parts of…What is Self-Attention?Self-attention is a mechanism where each position in a sequence attends to every other position in the same…What is RoPE (Rotary Positional Embedding)?RoPE (rotary positional embedding) encodes a token's position by rotating its query and key vectors by an angle…What is an Encoder-Decoder Model?An encoder-decoder model, also called a sequence-to-sequence model, uses one component to read and understand the input and…

Contents

  1. 01Key takeaways
  2. 02Multi-head attention explained in simple terms
  3. 03How it works
  4. 04Dimensions: a worked example
  5. 05What different heads learn
  6. 06Efficiency variants
  7. 07Limitations
  8. 08Common Use Cases
  9. 09Frequently Asked Questions
  10. 10Related Terms

AI Topic

  • LLMs

Related Terms

  • What is an Attention Head?
  • What is Prefix Tuning?
  • What is an Attention Mechanism?
  • What is Self-Attention?
  • What is RoPE (Rotary Positional Embedding)?
  • What is an Encoder-Decoder Model?

Quick Navigation

  • Common Use Cases
  • Frequently Asked Questions
  • Related Terms
  • Back to top

Details

Updated
September 26, 2026
Read
3 min
  • Forum
  • Submit a tool
  • Submit Guest Post
  • List Your Startup
  • Privacy Policy
  • Editorial Policy
  • Account
  • Contact
  • AI Productivity
  • AI Video
  • AI Coding
  • AI Chatbots
  • Sales
  • AI Business
  • View All Tools

Subscribe our Newsletter

Get weekly exclusive content - No spam.

Copyright © 2026 -  Query Feedz

Manage Consent
To provide the best experiences, we use technologies like cookies to store and/or access device information. Consenting to these technologies will allow us to process data such as browsing behavior or unique IDs on this site. Not consenting or withdrawing consent, may adversely affect certain features and functions.
Functional Always active
The technical storage or access is strictly necessary for the legitimate purpose of enabling the use of a specific service explicitly requested by the subscriber or user, or for the sole purpose of carrying out the transmission of a communication over an electronic communications network.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
The technical storage or access that is used exclusively for statistical purposes. The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
The technical storage or access is required to create user profiles to send advertising, or to track the user on a website or across several websites for similar marketing purposes.
  • Manage options
  • Manage services
  • Manage {vendor_count} vendors
  • Read more about these purposes
View preferences
  • {title}
  • {title}
  • {title}