This is the series where I build landmark transformer architectures from scratch in PyTorch — one codebase that grows paper by paper. Not slides or pseudocode: runnable code, with the diffs that actually matter between each generation.
Full source for each chapter is on GitHub — abhibisht89/llamasearch-blogs, folder the-evolving-transformer/.
The curated arc: Transformer, GPT-2, CLIP, LLaMA, Mistral, Mixtral, DeepSeek V2/V3, PaliGemma, and Qwen3-Next — 9 stops where the architecture moved in a fundamental way, plus a training capstone on how any of them learn from text.
I hope to release a matching YouTube series — one video per chapter — so you can follow the intuition alongside the code.
Chapters will drop here sequentially as they are ready. Only finished ones are linked below; the timeline is the full roadmap of models we plan to cover.
The encoder-decoder Transformer that started everything. Sinusoidal PE, multi-head attention, LayerNorm, ReLU FFN — all built from scratch in PyTorch.
Decoder-only. Learned positional embedding replaces sinusoidal. Pre-norm (LayerNorm before sub-blocks). GELU replaces ReLU.
Dual encoders map images and text into one contrastive space — patch ViT + causal text tower, L2-normalised dot products, symmetric InfoNCE.
RoPE replaces learned PE. RMSNorm replaces LayerNorm. SwiGLU replaces GELU. Grouped Query Attention. No bias, no embedding scaling.
Sliding window attention (W=4096) replaces full causal. Rolling buffer KV cache bounds memory. Otherwise identical to LLaMA.
First sparse MoE at scale. Replace each dense FFN with 8 expert FFNs and a router that picks top-2 per token. ~46.7B stored, ~12.9B active.
V2 introduces MLA and DeepSeekMoE (236B, 21B active). V3 scales to 671B with auxiliary-loss-free routing, MTP, and FP8 training.
SigLIP vision encoder + LinearProjector + Gemma decoder. Image patch tokens prepended as prefix; generative VLM via next-token prediction.
80B total / 3B active. Hybrid 3:1 Gated DeltaNet + Gated Attention. High-sparsity MoE + shared expert. MTP. 256K context.