Transformer

Models token relationships using attention, allowing each position to weight information from other positions.

Method

Project tokens into queries, keys and values; compute scaled dot-product attention; stack attention and feed-forward blocks; train with task-specific objectives.

Applications

Language models, translation, search, code, vision, scientific sequences.

Advantages

Parallelizable training; strong long-context representation; transferable pretraining.

Limitations

High compute and memory; data dependence; hallucination, bias and context-window limits.

Alternatives

RNN, state-space models, CNN, retrieval-augmented systems, hybrid architectures.

Example

Translation: word 'bank' attends to 'river' vs 'money' to disambiguate.

Sources

Educational reference only, not professional advice.

All algorithms