Transformer Architecture
Transformer is a neural network architecture proposed by a Google team in 2017 in the paper "Attention is All You Need". It is the foundation of nearly all large language models today, and it is fair to say that without Transformer there would be no ChatGPT.
What Problem It Solved
Before Transformer, text was mainly processed with RNN/LSTM, which had a problem: words had to be processed one by one in sequence, which was slow, and long texts easily "forgot" the beginning.
Transformer sidestepped this problem entirely with self-attention: all words are processed at the same time, and any two words can be directly linked.
Core Structure
- Self-Attention layer: lets every word "see" all the other words in the sentence and automatically decide which ones to focus on
- Multi-Head attention: understands relationships from several angles at once; some heads look at syntax, others at semantics
- Feed-forward network (FFN): handles nonlinear transformation and information processing
- Residual connections + layer normalization: keep deep networks training stably
- Positional encoding: because parallel processing loses order information, the model has to be told explicitly "who comes first and who comes later"
Three Major Variants
- Encoder-only: BERT, good at understanding tasks (classification, extraction)
- Decoder-only: the GPT series, good at generation tasks, and the current mainstream
- Encoder-Decoder: T5, good at transformation tasks such as translation and summarization
Why It Wins
Its greatest advantage is high parallelism. Sequential models cannot fully use GPUs, whereas Transformer can feed an entire passage in at once, improving training efficiency by orders of magnitude. That is what made "training trillion-parameter models on tens of thousands of GPUs" possible.