CLS Token in Vision Transformers
Trace how a learned CLS row joins image patches, gathers evidence through self-attention, and becomes the image-level classification readout.
Related
7 min read · beginner
Attention mechanisms, large language models, and multimodal architectures: the building blocks of modern AI.
Trace how a learned CLS row joins image patches, gathers evidence through self-attention, and becomes the image-level classification readout.
7 min read · beginner
Trace how local windows, shifted cross-window exchange, and patch merging turn one high-resolution token grid into a multi-scale vision hierarchy.
10 min read · advanced
How multi-head attention runs scaled dot-product attention in parallel across several representation subspaces to build context-aware token embeddings.
7 min read · intermediate
Explore how positional embeddings enable Vision Transformers (ViT) to process sequential data by encoding relative positions.
6 min read · intermediate
Follow one image patch through Q/K/V projection, scaled scores, row-wise softmax, value mixing, and the residual update inside a Vision Transformer.
10 min read · beginner
Learn ALiBi, the position encoding method that adds linear biases to attention scores for exceptional length extrapolation in transformers.
12 min read · intermediate
How Flash Attention, Multi-Head Attention (MHA), Grouped-Query Attention (GQA), and Multi-Query Attention (MQA) compare — algorithm vs architecture, KV-cache memory, quality trade-offs, and how to choose for production transformer inference.
5 min read · intermediate
Learn about attention sinks, where LLMs concentrate attention on initial tokens, and how preserving them enables streaming inference.
7 min read · advanced
Understand cross-attention, the mechanism that enables transformers to align and fuse information from different sources, sequences, or modalities.
7 min read · intermediate
Trace how grouped-query attention keeps independent query heads while sharing fewer key/value heads, projections, and compact KV-cache rows during LLM decoding.
11 min read · intermediate
Explore linear complexity attention mechanisms including Performer, Linformer, and other efficient transformers that scale to very long sequences.
7 min read · advanced
Trace causal attention from shifted next-token labels through the lower-triangular mask, pre-softmax blocking, parallel training, and incremental decoding.
10 min read · intermediate
Learn Multi-Query Attention (MQA), the optimization that shares keys and values across attention heads for massive memory savings.
6 min read · intermediate
Learn Rotary Position Embeddings (RoPE), the elegant position encoding using rotation matrices, powering LLaMA, Mistral, and modern LLMs.
9 min read · intermediate
Master scaled dot-product attention, the fundamental transformer building block. Learn why scaling is crucial for stable training.
6 min read · intermediate
Sliding Window Attention for long sequences: local context windows enable O(n) complexity, used in Mistral and Longformer models.
7 min read · intermediate
Explore sparse attention mechanisms that reduce quadratic complexity to linear or sub-quadratic, enabling efficient processing of long sequences.
6 min read · advanced
How vision-language models align visual and text representations using contrastive learning, cross-modal attention, and CLIP-style training.
7 min read
Interactive visualization of LLM context windows - sliding windows, expanding contexts, and attention patterns that define model memory limits.
6 min read · beginner
Interactive Flash Attention visualization - the IO-aware algorithm achieving memory-efficient exact attention through tiling and kernel fusion.
8 min read · advanced
Interactive KV cache visualization - how key-value caching in LLM transformers enables fast text generation without quadratic recomputation.
6 min read · intermediate
The modality gap in CLIP and vision-language models: why image and text embeddings occupy separate regions despite contrastive training.
6 min read
Discover how multimodal vision-language models like CLIP, ALIGN, and LLaVA scale with data, parameters, and compute following Chinchilla-style power laws.
7 min read · advanced
Interactive exploration of tokenization methods in LLMs - BPE, SentencePiece, and WordPiece. Understand how text becomes tokens that models can process.
6 min read · beginner
Master LoRA, bottleneck adapters, and prefix tuning for parameter-efficient fine-tuning of vision-language models like LLaVA with minimal compute and memory.
10 min read
Understanding sparse mixture of experts models - architecture, routing mechanisms, load balancing, and efficient scaling strategies for large language models
12 min read · advanced
A small draft model proposes tokens, the target model checks them all in one pass, and a rejection rule keeps the output distribution exactly the target's.
10 min read · intermediate
CLIP, BLIP-2, LLaVA and Flamingo align images with text by different routes. Compare their objectives, bridges, data, and which parts train or stay frozen.
10 min read · intermediate