Deep Learning

CNNs, RNNs & Transformers

CNNs exploit local spatial patterns, RNNs process sequences through state, and Transformers use attention so tokens can interact directly. Each architecture family encodes a different assumption about the data.
  • CNNs are built for locality and translation
  • RNNs process sequences step by step
  • LSTMs and GRUs gate memory
  • Transformers use attention over tokens
  • Architecture choice is an inductive-bias choice
  • Transformers are not automatically best for everything
Architecture-family cheat sheet
FamilyAssumptionTypical use
CNNNearby values form local patternsImages, spectrograms, grids
RNN/LSTM/GRUOrder matters and state evolvesSequences, time series, older NLP
TransformerTokens need flexible pairwise interactionLLMs, modern NLP, multimodal models
MLPNo special structure assumedDense features, simple baselines
Different ways to use structure
Architecture is how the model exploits known structure in the input.
Sources
  • Deep LearningConvolutional Networks; Sequence Modeling
  • Dive into Deep LearningCNNs; RNNs; Attention
  • Attention Is All You NeedTransformer architecture