# Transformer

> The Transformer is a neural network architecture that processes sequences with self-attention, letting every position draw information directly from every other position instead of through recurrence or convolution. Most large language models are built on it.

- Identifier: PTL-0268
- Category: Foundations
- Canonical URL: https://protologue.com/t/transformer/
- Also known as: Transformer architecture, transformer model, decoder-only transformer
- Introduced: 2017

## Description

Vaswani et al. introduced the Transformer in 2017 as an encoder-decoder model for machine translation, built from stacked layers of multi-head self-attention and position-wise feed-forward networks, with residual connections, layer normalization and positional encodings to represent token order. Because attention over a whole sequence can be computed in parallel, it trains much faster than recurrent networks. The authors reported 28.4 BLEU on WMT 2014 English-to-German and a single-model 41.8 BLEU on English-to-French after training for 3.5 days on eight GPUs. Most large language models use a decoder-only variant trained to predict the next token. The cost of standard self-attention grows quadratically with sequence length, which has motivated variants such as sliding window, grouped-query and multi-head latent attention, and kernels such as FlashAttention.

## Narrower terms

- [Sliding Window Attention](https://protologue.com/t/sliding-window-attention/)
- [Multi-Head Latent Attention](https://protologue.com/t/multi-head-latent-attention/)
- [Looped Transformer](https://protologue.com/t/looped-transformer/)

## Related terms

- [Large Language Model](https://protologue.com/t/large-language-model/)
- [Token](https://protologue.com/t/token/)
- [Context Window](https://protologue.com/t/context-window/)
- [KV Cache](https://protologue.com/t/kv-cache/)
- [Rotary Position Embedding](https://protologue.com/t/rotary-position-embedding/)
- [Grouped-Query Attention](https://protologue.com/t/grouped-query-attention/)
- [FlashAttention](https://protologue.com/t/flashattention/)
- [Mixture of Experts](https://protologue.com/t/mixture-of-experts/)

## Sources

- Vaswani et al. (2017). Attention Is All You Need. https://arxiv.org/abs/1706.03762

## Cite this entry

Protologue. (2026). Transformer. In Protologue: A Taxonomy of Prompting and LLM Techniques (v1.9.1, PTL-0268). https://protologue.com/t/transformer/

License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/)
