---
title: Transformers: the 2017 idea that changed AI, explained without intimidating math
description: From Attention Is All You Need to modern generative AI: learn the Transformer story, self-attention, token relationships and what the architecture really does.
date: 2026-11-22
url: https://caminhosolo.com.br/en/2026/11/transformers-history-and-how-attention-works/
tags: [transformers, attention, ai-architecture, self-attention, ai-models]
---


> **Reference guide — created November 22, 2026.** The historical origins and core architectural concepts remain valuable. Implementations, attention optimizations and model families evolve; check the specific model's documentation before applying these ideas.

> **TL;DR:** A **Transformer** is a neural network architecture introduced in 2017 in *Attention Is All You Need*. It uses **attention** to relate sequence elements without relying on the recurrent, sequential processing at the heart of earlier architectures. The original design was an encoder-decoder model for translation; many later systems use selected parts or modifications rather than the exact 2017 design.

## 01 — The discovery: what came before Transformers?

Consider **"The customer returned the package because it arrived broken."** Understanding the sentence requires connecting **"it"** to the package, not merely recognising each word separately.

Neural language systems existed long before 2017. **Recurrent neural networks (RNNs)** and **LSTMs** processed sequences while carrying state from earlier steps. They were useful, yet sequential dependencies made parts of training difficult to parallelize and could complicate learning relationships over long distances.

Researchers had also developed **attention mechanisms**. A major contribution came from [Bahdanau, Cho and Bengio's work on neural machine translation](https://arxiv.org/abs/1409.0473), first circulated in 2014. It helped popularise allowing a translation system to focus on relevant portions of its input instead of relying on a single fixed summary.

**Attention was not invented in 2017.** The Transformer innovation was an architecture organised around attention, replacing the central recurrent or convolutional sequence-processing approach in the proposed design.

### The 2017 turning point

In June 2017, eight researchers released [*Attention Is All You Need*](https://arxiv.org/abs/1706.03762): Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Łukasz Kaiser and Illia Polosukhin.

The research addressed **machine translation**. It proposed relating words in an input sentence and generating a translation with attention as the key mechanism. The paper reported improvements in specific translation benchmarks and training-parallelization advantages. It did **not** demonstrate a modern general-purpose chatbot, coding assistant or video generator.

[Google Research's historical introduction](https://research.google/blog/transformer-a-novel-neural-network-architecture-for-language-understanding/) explains the motivation and why avoiding recurrence mattered.

Transformer-inspired architectures later became foundational to many language and multimodal systems, but **Transformer is not another word for a chatbot**, nor do all current models reproduce the original layout.

### Attention means learning relationships

Return to the customer and the package. Imagine words as people in a meeting, each potentially contributing information to the others.

**Self-attention** computes relationships among positions within the same sequence. Roughly, one position seeks information; others supply information that can be combined according to learned relevance scores.

This does **not** mean the model contains a conscious rule that "it" must refer to "package." Relationships arise from numerical representations and learned weights.

Three terms describe the calculation:

- **Query (Q):** what kind of information is this position seeking?
- **Key (K):** what matching characteristics does a position provide?
- **Value (V):** what information can it contribute?

Queries are compared with Keys to obtain scores. After scaling and normalization, the scores weight the Values. **These are learned vector operations, not literal questions in English.**

### Why multiple attention heads?

**Multi-head attention** uses several projections of Q, K and V, enabling different relationship patterns to be learned in parallel. One head might respond to proximity while another develops syntactic patterns. There is no guarantee that each head maps neatly to a human-labeled function.

Sequence order is another challenge. The original Transformer introduced **positional encodings** so representations contained position information. Later variants use other techniques.

Attention layers are also accompanied by **feed-forward layers, residual connections and normalization**. The paper's name does not imply that a Transformer contains nothing but a single attention calculation.

### Encoder, decoder and familiar model families

The original Transformer had two major sides:

- **Encoder:** builds contextual representations of the input, such as a source sentence.
- **Decoder:** produces output using relevant context and previously generated tokens, without looking ahead at future output tokens.

Subsequent variants include **encoder-only** systems (often used for representation and classification, as in BERT), **decoder-only** systems (often used for autoregressive text generation) and **encoder-decoder** systems (common in certain sequence transformation tasks). [Hugging Face's explanation](https://huggingface.co/docs/course/main/en/chapter1/4) distinguishes these architectures.

A decoder-only model may employ **causal attention**, preventing a token position from attending to later positions. This supports efficient parallel training over known sequences, but **generating an autoregressive response still typically proceeds step by step**, with each new token depending on earlier output.

### Why did this architecture matter?

Attention-based sequence processing helped models capture contextual relationships and made important training computations easier to parallelize. It contributed to later large-scale systems.

There are trade-offs. **Conventional dense attention** involves pairwise relationships whose count grows approximately quadratically with sequence length. Very long contexts can therefore demand substantial memory and optimizations. Modern kernels and architectures change practical costs, and not every implementation uses identical attention.

**Attention is not a guarantee of reasoning or factual truth.** Reliability depends on training, data, model design, retrieval, tools and evaluation.

## 02 — The Solo verdict

Solo builders **do not need to derive the equations to select a useful model**. Yet knowing the architecture helps you ask whether a system is intended for generation, classification or sequence transformation, how it processes long inputs and what inference resources it requires.

For classifying customer requests, a compact specialised model may suffice. For generating replies, an autoregressive architecture may be appropriate. For current business data, **retrieval may matter more than a model's architecture alone**.

## 03 — The workbench: one sentence, multiple relationships

No installation required. Use:

> "The customer returned the package because it arrived broken."

1. **Read each word.** Which ones depend on the rest of the sentence?
2. **Focus on "it."** Which earlier phrase helps interpret it?
3. **Change one word:** "The customer returned the package because it arrived late." The relationship remains, but the explanation changes.
4. **Remember the model receives tokens**, which may not align perfectly with complete words. Attention operates on their representations.
5. **Compare architectures** in the [Hugging Face course](https://huggingface.co/docs/course/main/en/chapter1/4): identify the encoder, decoder and model families that use them.

This is an **intuition exercise, not a visualization of computed attention weights**. Real heads in a specific model might attend differently from a person's grammatical interpretation.

Further reading: [Google Research](https://research.google/blog/transformer-a-novel-neural-network-architecture-for-language-understanding/), the [2017 paper](https://arxiv.org/abs/1706.03762) and [Hugging Face's architecture lesson](https://huggingface.co/docs/course/main/en/chapter1/4).

**Next:** with tokens and attention understood, explore actual model repositories to see **which architecture, tokenizer and weight files** each one distributes.

