← Latest papers
🤖 machine learning

Do Transformers Need Three Projections? Systematic Study of QKV Variants

This paper systematically demonstrates that sharing query, key, and value projections in Transformers—particularly the Q-K=V variant—significantly reduces inference memory and KV cache requirements while maintaining competitive performance across vision and language tasks, thereby enabling efficient on-device deployment.

Original authors: Ali Kayyam, Anusha Madan Gopal, M Anthony Lewis

Published 2026-06-04
📖 5 min read🧠 Deep dive

Original authors: Ali Kayyam, Anusha Madan Gopal, M Anthony Lewis

Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer

Imagine a Transformer model (the brain behind modern AI) as a highly efficient librarian trying to answer a question based on a massive book. To do this, the librarian uses three specific tools for every word in the book:

  1. The Query (Q): A question card asking, "What am I looking for?"
  2. The Key (K): A label on the book's spine to see if it matches the question.
  3. The Value (V): The actual page content to read if the match is good.

Traditionally, the librarian creates a brand new, unique tool for every single word for each of these three steps. This is the standard "QKV" setup. It works great, but it's heavy. The librarian has to carry three heavy toolkits for every word, which takes up a lot of space in their backpack (memory) and slows them down.

This paper asks a simple, bold question: "Do we really need three separate tools, or can we combine them?"

The researchers tested three ways to simplify the librarian's toolkit:

The Three Experiments

1. The "Same Question, Same Label" Approach (Q = K - V)

  • The Idea: The librarian uses the same tool for asking the question and checking the label. They still have a separate tool for reading the page.
  • The Result: This is the big winner. It turns out that the "Question" and the "Label" tools are so similar that they can be the same object without hurting performance.
  • The Benefit: The librarian now only needs to carry two tools instead of three. This cuts the memory needed to store the "labels" and "pages" in half. It's like realizing you can use your left hand to both hold the map and point at the destination, saving you from carrying a second map.

2. The "Same Question, Same Page" Approach (Q - K = V)

  • The Idea: The librarian uses the same tool for the label and the page content, but keeps a separate tool for the question.
  • The Result: This also works well, but it's slightly less efficient for language tasks than the first option. It's like using the same key to unlock the door and open the safe, which is clever, but the "Question" tool still needs to be unique to keep the direction of the search correct.

3. The "One Tool for Everything" Approach (Q = K = V)

  • The Idea: The librarian tries to use just one single tool to ask the question, check the label, and read the page.
  • The Result: This is a disaster for language tasks. It's like trying to use a hammer to ask a question, check a label, and read a book all at once. The AI gets confused because it loses the ability to tell "what I'm looking for" apart from "what I found." The performance drops significantly.

Why This Matters: The "Backpack" Problem

The most exciting part of this paper isn't just about making the AI smarter; it's about making it lighter.

When an AI generates text (like writing a story or answering a chat), it has to remember everything it has written so far. This memory is called the KV Cache.

  • Standard AI: Carries a heavy backpack with separate compartments for "Labels" and "Pages."
  • New AI (Q-K=V): Carries a backpack where the "Labels" and "Pages" are merged into one compartment.

The Real-World Impact:

  • Double the Memory: Because the backpack is lighter, you can fit twice as many words in the AI's memory without running out of space.
  • Cheaper Servers: If you are running a company that uses AI, you can serve twice as many customers on the same number of computers. The paper calculates this could save companies thousands of dollars a month.
  • Running on Phones: This efficiency makes it much more realistic to run powerful AI models directly on your phone or a small edge device, rather than needing a giant supercomputer in a data center.

The "Double Dip" Bonus

The paper also discovered that this new "lighter backpack" trick works perfectly alongside another existing trick called Head Sharing (used by models like Llama 2 and Mistral).

  • Head Sharing is like having fewer librarians but making them work harder.
  • Projection Sharing (this paper's idea) is like making each librarian's toolkit smaller.

When you combine them, you get a massive win. The researchers showed that by combining these two methods, you can shrink the memory needed by 97%. This is the "holy grail" for running AI on small devices.

Summary

The paper proves that the standard AI design is slightly over-engineered. By merging the "Question" and "Label" tools into one, we can cut the memory cost in half with almost no loss in intelligence. It's a simple tweak that makes AI faster, cheaper, and ready to run on your pocket device.

Drowning in papers in your field?

Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.

Try Digest →