惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
小众软件
小众软件
博客园_首页
博客园 - 聂微东
V
V2EX
WordPress大学
WordPress大学
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
罗磊的独立博客
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园 - 司徒正美
博客园 - 三生石上(FineUI控件)
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
S
SegmentFault 最新的问题
J
Java Code Geeks
Last Week in AI
Last Week in AI
The Cloudflare Blog
月光博客
月光博客
雷峰网
雷峰网
宝玉的分享
宝玉的分享
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Hugging Face - Blog
Hugging Face - Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
有赞技术团队
有赞技术团队
人人都是产品经理
人人都是产品经理
博客园 - Franky
腾讯CDC
Jina AI
Jina AI
博客园 - 叶小钗
大猫的无限游戏
大猫的无限游戏
阮一峰的网络日志
阮一峰的网络日志
量子位
爱范儿
爱范儿
美团技术团队
T
Tailwind CSS Blog
博客园 - 【当耐特】
D
Docker
IT之家
IT之家
V
Visual Studio Blog
P
Proofpoint News Feed
L
LangChain Blog
Engineering at Meta
Engineering at Meta
C
Check Point Blog
G
Google Developers Blog
Google DeepMind News
Google DeepMind News
云风的 BLOG
云风的 BLOG
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Microsoft Azure Blog
Microsoft Azure Blog
B
Blog RSS Feed
Recorded Future
Recorded Future

GoPenAI - Medium

Group Relative Policy Optimization (GRPO) Your agent fleet can build trustworthy state with their own keys Epistemic Backbone #1: Why AI Systems Need Shared Memory, Not Just Models Transformers Beyond NLP: Fun and Trendy Use Cases Your First Transformer: The Road to Attention Part 4. From Seats to Agents: Early Evidence on the Future of Work in the Agentic AI Era The AI Trust Gap: Why Faster Code Is Creating Less Confidence From Bytes to BPE: A From-Scratch Tour of LLM Tokenization ️ Grok Voice Think Fast 1.0: The First Voice AI That Actually Thinks While Talking .NET 10.0.7 OOB Security Update: The Kind of Bug You Can’t Afford to Ignore Writing Custom Pallas Kernels for vLLM on TPU — A Step-by-Step Guide Contrastive Learning Day 39: Advanced Ensemble Learning Techniques — Stacking, Random Forest, AdaBoost, and Gradient… Localization: Beyond Translation, Into the Territory of Growth Hacking Can We Translate Our Sentiments? Training the first modern architecture encoder for South Slavic languages What Is Data, and Why Does It Matter for AI? A Complete Guide to Prompt Engineering: Best Practices & Tips DeepSeek TileKernels: The Hidden Tech Making AI Models Insanely Fast Can AI Growth Really Become Economic Growth? Evaluating API Test Generation Across Leading AI Tools Pin Clustering in .NET MAUI Maps: Finally Making Maps Usable (With Example) Unsupervised Learning What is an LLM? Tokens, Context Window, and Why They Matter Build a reactive AI agent harness — Part 1. Conversation. From Hallucination to Citation… RAG Made Simple: How AI Finds the Right Answers CLI Coding Agents Tierlist Google Deep Research Max: Build Autonomous AI Research Agents Hermes Agent vs Every AI Assistant: Why Memory Changes Everything I Watched a Startup Burn $1,200 in a Week. The Culprit Was 800 Tokens. Fine-Tuning LLMs Explained: How Companies Teach AI to Think Like Them ️ xAI Just Dropped the Fastest Voice AI Ever Essential Code Patterns in Generative Artificial Intelligence Exploratory Data Analysis: A basic Understanding Day 36: Introduction to Ensemble Learning — Why Multiple Models Perform Better than One Concept to build a Student IQ — Agent Framework Workflow + Microsoft Foundry Agents 20 API Concepts Every Software Engineer Should Know From Human-Feedback Control to Declared No-Meta Agency: A Scientific Exposition GPT-5.5 Is Here — And It’s Not Just Smarter… It Works For You Test Cases in Data Science Projects: A Basic Understanding Artificial Intelligence UseCases in Testing A Comprehensive Guide for Beginners into Artificial Intelligence Day 33: DBSCAN — Clustering Beyond Boundaries The Attention Breakthrough — How Language Models Finally Learned to Focus I rebuilt Strava (and Strava Premium) for fun, and now I want your feedback .NET April 2026 Updates: The Kind of Release You Should Never Ignore .NET 11 Preview 3: Small Changes That Quietly Improve Everything ChatGPT Images 2.0 Isn’t an Update — It’s a Revolution Claude Mythos: The AI Model Too Powerful to Release Basic Understanding of Key Parameters: Artificial Intelligence Part-2 Kimi K2.6: The Most Powerful Open-Source LLM Is Here (And It’s Not What You Expect) Elephant in the room — Openrouter’s Elephant-Alpha I Built a RAG System From Scratch in 4 Weeks — Here’s Everything I Learned Graphify: Build a Knowledge Graph From Your Entire Codebase — Without Sending Your Code to Anyone Deep Learning Interview Q&A Part -1 Deep Learning Interview Q&A Part -2 Anthropic Just Launched Claude Routines Microsoft Just Dropped a Cheaper AI Image Model — And This Changes Everything Building a Local-first Knowledge Management System with LLM and Obsidian Basic Understanding of Key Parameters: Artificial Intelligence Part-1 Copy These 7 Prompt Formulas and Never Struggle With AI Again Claude Opus 4.7 vs Mythos — The Benchmark Truth Nobody Explains The ROI on Reading is Broken. I Built an AI Learning OS to Fix It Beyond Scatter: Metrics That Allows to Measure Creativity in LLMs. Banish the RNN: The Road To Attention Part 3. You Typed a Few Words. The AI Painted a World. Here’s Exactly How. 46% of Code Is Now AI-Generated. The Other 54% Is the Part That Will Get You Fired. Claude Opus 4.7: The Quiet Leap Toward Autonomous AI Workflows Is bitnet.cpp the Game Changer for Running LLMs on Your Laptop? Machine Learning Algorithms : A Comprehensive Guide Building REPI (Real Estate Pain Point Intelligence Platform) — From Scraping 5 Noisy Data Sources… Hermes Agent: The AI That Actually Remembers You (Not Another OpenClaw) MiniMax M2.7 Just Went Open-Weight — Run a Powerful AI Agent on Your Own Machine XML Is Everywhere — You Just Never Noticed It The Missing Infrastructure for GUI Agents: Unpacking the ClawGUI Framework Wayfarer: Building an AI-Powered Travel Intelligence Platform with Agentic Orchestration, Bayesian… Attention from First Principles: DeltaNet Project Glasswing and Claude Mythos Preview: Anthropic’s Bet on AI-Powered Cyber Defense Deep Learning-Based Binary Classification of Forest Fires GenAI Q and A Interview Questions Part -2 How Google Maps Knows There Is Traffic Before You Even Reach There 5 AI Freelance Services Clients Actually Pay For I Accidentally Built a World Where AIs Govern Themselves (And I Have No Idea What’s Happening… Meta’s “Compute Desk” Is the Tell: When AI Stops Being Software and Becomes Resource Strategy The Last Human Stronghold Falls: Inside the GrandCode Multi-Agent System ASP.NET Core 2.3 End of Support: What It Really Means for Developers Andrej Karpathy’s LLM Wiki: The Idea That Could Kill RAG Forever I Built an Open-Source Kubernetes Control Plane for AI Agents. Here’s What It Took. GLM-5.1 Just Changed Coding Forever — The AI That Gets Smarter the Longer It Works Goodbye Llama? Meta Just Dropped Muse Spark — And It Changes Everything Anthropic Accidentally Leaked All of Claude Code’s Source Code Stop Sending Your Data to the Cloud — Build This Instead Today Physical AI Cosmos Reason2 2B World Model inference in Azure Machine Learning LangChain vs LlamaIndex vs LangGraph: The Difference Nobody Explains Clearly Cloud Services Interview Q and A Part- 1 Cloud Services Interview Q and A Part- 2 Gemma-4 — disabling thinking with gemma-4–26b-a4b-it Mixture of Experts Explained: The Secret Architecture Making AI 10x Smarter Without Using 10x More… Diffusion Models Demystified: How AI Paints Masterpieces from Pure Noise (No Math Needed)
Q, K, V: The Three Matrices That Quietly Run Every Modern LLM
Charan Panth · 2026-04-27 · via GoPenAI - Medium
Self-attention, explained from cocktail-party intuition to the full math. Why every attention variant since 2017 is a remix of the same three letters. If you’ve ever stared at this equation and nodded along without really understanding it: Attention(Q, K, V) = softmax(QKᵀ / √dₖ) V You’re in good company. It’s the most consequential equation in modern AI. It powers GPT-4, Claude, Llama, Gemini, and every frontier model you’ve interacted with. It’s in every deep learning course, every transformer paper, every ML engineer’s interview prep. And yet — most people who work with LLMs every day can’t actually explain what Q, K, and V do. They know the shape of the math without the soul of it. This post fixes that. We’re going from cocktail-party intuition to the full equation, step by step, with no hand-waving. (This is a companion piece to my Inside the Transformer post. If you haven’t read that one yet, it walks through the full architecture end-to-end. This one zooms into the single most important mechanism inside it.) Why self-attention matters Before 2017, if you wanted an AI to understand a sentence, you fed it one word at a time. RNNs, LSTMs, GRUs — they all worked this way. Sequential. Slow. Forgetful. Then “Attention Is All You Need” came out in June 2017. One paper. One mechanism. It replaced every prior approach and became the backbone of GPT-2, GPT-3, GPT-4, Claude, Llama, Gemini, and every frontier model since. The mechanism — self-attention — answers a deceptively simple question: When I’m trying to understand this word, which other words in the sentence should I pay attention to? And the answer turns out to be a matrix multiplication. Actually, three matrix multiplications. That’s the whole trick. The intuition, before any math Imagine you’re at a cocktail party with 20 people. Someone says: “The animal didn’t cross the street because it was too tired.” Your brain does something remarkable. To understand “it” , you instantly figure out that “it” refers to “the animal” — not “the street.” You don’t consciously compute this; it just happens. How? You compare “it” against every other word in the sentence. Some words are relevant ( “animal” , “tired” ). Some aren’t ( “the” , “because” ). You weight them accordingly and combine the relevant ones into your understanding of “it” . That’s self-attention. Every token in a sentence looks at every other token, decides which ones matter, and blends them into its own representation. Repeat this for all tokens simultaneously, and you’ve built a mechanism that captures context in one parallel operation. The genius is in how the model decides what’s relevant. That’s where Q, K, and V come in. Meet the three matrices For every input token, the Transformer creates three different vectors by multiplying the token’s embedding by three learned weight matrices. Each vector has a specific job. Query (Q) — “What am I looking for?” The Query vector represents what this token wants to know about the rest of the sentence. If the current token is “it” , its Query might encode: “I’m a pronoun. I need to find my referent. Show me nouns that could be antecedents.” The model doesn’t actually think in English — the Query is a vector of numbers — but that’s the conceptual job. Key (K) — “What do I contain?” The Key vector represents what this token has to offer. It’s a description of the token’s relevant content. If a token is “animal” , its Key might encode: “I’m a concrete noun. I’m a possible antecedent for pronouns. I carry the concept of a living creature.” Value (V) — “What information do I actually contribute?” The Value vector is the token’s actual contribution to the output — the information that gets passed forward if a match is made. Think of it as: the Key is a title , the Value is the contents . A librarian compares your question (Query) to book titles (Keys), finds the matches, and hands you the books (Values). Same token, three vectors, three jobs. The famous equation, decoded Let’s go back to the equation: Attention(Q, K, V) = softmax(QKᵀ / √dₖ) V It’s four steps, and you already understand three of them. Step 1: Score every pair — QKᵀ For every Query, the model computes its match with every Key. Mathematically, that’s the dot product. If Q and K are aligned (pointing in similar directions in vector space), the dot product is large — they match. If they’re unrelated, the dot product is small or negative. The result is an attention score matrix: an N × N grid of numbers, where N is the number of tokens. Entry (i, j) tells you how much token i should attend to token j. For the sentence “The animal didn’t cross the street because it was too tired” : score[it, animal] = high ✅ score[it, street] = low ❌ score[it, tired] = medium Step 2: Scale — divide by √dₖ This step looks weird but matters. If the dimension of your Key vectors (dₖ) is large — say 512 or 1024 — the raw dot products can get enormous. When you feed huge numbers into softmax (next step), you get a distribution where one entry is basically 1.0 and everything else is basically 0. That’s bad. Gradients vanish during training, and the model can’t learn. Q, K, V: The Three Matrices That Quietly Run Every Modern LLM was originally published in GoPenAI on Medium, where people are continuing the conversation by highlighting and responding to this story.