Jargon-free science · Research made clear

Big ideas.
Clearly explained.

Understand important research papers without getting lost in academic jargon. Clear explanations, thoughtful visuals, and the ideas that matter.

Explore:

Our purpose

Research should be easier to understand.

MICROMATH turns important research into structured, approachable explanations—without losing the ideas, evidence, or nuance that make the science valuable.

Browse the library

Explore by subject

Find clear explanations across mathematics, physics, artificial intelligence, and computer science.

The research library

Research Papers

Explore research explained with context, accessible language, visuals, and source references.

About MICROMATH

Research should be easier to understand.

MICROMATH turns important research into structured, approachable explanations—without losing the ideas, evidence, or nuance that make the science valuable.

Our approach

We explain the problem a paper addresses, the key idea behind its method, the evidence supporting its claims, and the limitations readers should understand. Technical terms and equations are introduced in context.

Editorial team

MICROMATH editorial content is developed to help students and curious readers build understanding while keeping links to original research available.

Legal

Privacy Policy

Replace this demo copy with MICROMATH's reviewed privacy policy before publishing.

Legal

Terms of Service

Replace this placeholder with the final terms applicable to MICROMATH.

Contact

Get in touch

Add the official MICROMATH contact address here before publishing.

Artificial Intelligence · Paper Explained

Attention Is All You Need

How the Transformer architecture changed machine learning by allowing models to focus on relationships between words—without relying on recurrence.

A guided explanation for students and researchers
Abstract mathematical equations representing machine learning and attention
Conceptual illustration: machine learning connects information by learning which relationships matter.

Original paper abstract

The dominant sequence transduction models are based on complex recurrent or convolutional neural networks in an encoder-decoder configuration. The best performing models also connect the encoder and decoder through an attention mechanism. The authors propose the Transformer, a network architecture based solely on attention mechanisms, dispensing with recurrence and convolutions entirely.

Experiments on machine translation show improved quality, greater parallelizability, and reduced training time. The paper reports 28.4 BLEU on WMT 2014 English-to-German and 41.8 BLEU on WMT 2014 English-to-French, and also evaluates the architecture on English constituency parsing.

Imagine translating a sentence while keeping every word in context. A word can mean different things depending on the words around it. The word “bank,” for example, may refer to a financial institution or the side of a river. A useful language model must learn which surrounding words matter for the current meaning.

Before Transformers, many sequence models processed text step by step. The paper Attention Is All You Need, published by researchers at Google in 2017, proposed a different design: the Transformer. Its central mechanism, called attention, lets each token weigh information from other tokens directly.

The central idea is simple: instead of processing a sentence only one step at a time, let its parts compare and exchange information with one another.

1. The problem with processing words sequentially

Consider the sentence: “The animal didn’t cross the road because it was tired.” To interpret “it,” a model needs information from earlier in the sentence. If a model handles tokens sequentially, information must travel through a chain of processing steps. Long chains can make training harder and limit parallel computation.

Recurrent neural networks (RNNs) process one token after another. Convolutional models can process multiple positions together, but relating distant words may require several layers. The Transformer was designed to make relationships between any two positions easier to learn.

2. What does attention mean?

Think of attention as a context-aware highlighting system. When processing one word, the model assigns different weights to other words. A relevant word can receive a larger weight; a less relevant word can receive a smaller one. The weighted information is then combined into a representation of the current word.

Person studying information on a computer screen
Attention is a learned way to select context—not a human-like conscious act.

Queries, keys, and values

The paper describes attention using three vectors: a Query (Q), a Key (K), and a Value (V). A query represents what a token is looking for. Keys describe the information available from tokens. Values carry the information that will be combined.

  • Query: what this token is looking for.
  • Key: what each token can be matched on.
  • Value: the information contributed by each token.

The model compares queries with keys to calculate attention scores, converts those scores into weights, and uses the weights to combine values. These are learned numerical operations; the model is not manually given a dictionary of word relationships.

3. The key equation

The paper’s scaled dot-product attention is written as:

\[\operatorname{Attention}(Q,K,V)=\operatorname{softmax}\!\left(\frac{QK^{\mathsf T}}{\sqrt{d_k}}\right)V\]

Here, \(QK^{\mathsf T}\) measures compatibility between queries and keys. Dividing by \(\sqrt{d_k}\) controls the scale of the scores, where \(d_k\) is the key-vector dimension. The softmax function turns scores into weights, and multiplying by \(V\) combines the corresponding information.

Reading note: this page uses a plain-text formula for a dependency-free demo. A production implementation can render LaTeX with a math renderer.

4. Why use multi-head attention?

A sentence can contain several kinds of relationships at once: grammar, references between pronouns and nouns, and links between distant concepts. Multi-head attention runs several attention operations in parallel. Each head can learn a different pattern, and their outputs are combined.

Computer code and structured information on a screen
Conceptual visual for parallel attention heads. Replace this stock image with an original, labeled architecture diagram in a published article.

5. The Transformer architecture

The original Transformer uses an encoder–decoder structure. The encoder builds contextual representations of the input sequence. The decoder generates the output sequence while attending to encoder representations and previously generated tokens.

Core components

ComponentPurpose
Self-attentionConnects information across token positions.
Multi-head attentionLearns multiple relationship patterns in parallel.
Feed-forward networkTransforms each position’s representation.
Positional informationProvides information about token order.
Residual connections and normalizationSupport stable and effective training.

6. Why did this design matter?

Attention can connect distant tokens without requiring information to pass through a long recurrent chain. During training, the model can also process many token positions in parallel. This made the architecture well suited to large-scale training on modern accelerators.

However, standard full self-attention compares each token with every other token. Its attention computation and memory use grow approximately quadratically with sequence length. That is an important limitation for very long inputs.

7. What followed from the paper?

The Transformer became a foundation for many later language and multimodal systems. Encoder-focused models, decoder-focused language models, and encoder–decoder systems use related ideas in different ways. Their training objectives and designs vary, so not every modern model is identical to the original architecture.

Key takeaways

  • Attention lets tokens use context from other tokens directly.
  • Queries, keys, and values provide a mechanism for scoring and combining information.
  • Multi-head attention can learn different types of relationships in parallel.
  • The original Transformer combines attention with feed-forward layers, positional information, residual connections, and normalization.
  • Parallel computation is a major advantage, while quadratic attention cost is a key limitation.

Original paper and references

  1. Vaswani, A., Shazeer, N., Parmar, N., Uszkoreit, J., Jones, L., Gomez, A. N., Kaiser, Ł., & Polosukhin, I. (2017). Attention Is All You Need. Advances in Neural Information Processing Systems 30, 5998–6008.
  2. arXiv:1706.03762. First submitted 12 June 2017; latest revision v7 posted 2 August 2023.
Artificial IntelligenceDeep LearningNatural Language Processing