← All posts

QKV and Multi-head Attention in LLM

Nov 2023·~1007 words in full

In the realm of Natural Language Processing (NLP), Large Language Models (LLMs) like GPT-3 and BERT have revolutionized how machines understand and generate human language. At the heart of these models lies the concept that QKV and Multi-Head Attention are the key. It sounds cryptic to me at the very beginning and it takes me a few weeks to figure it out.

The following is what has been explained in the paper.

Before we get to QKV, we start with word embeddings — numerical representations of words that capture meaning in multi-dimensional space

Query (Q):

This is an excerpt — the full article continues on Medium.

Read the full article on Medium →

© 2026 Nedved Yang

Vibe-coded with AI + Next.js + Tailwind CSS

Singapore