10-405/605/805�ML FROM LARGE DATASETS
A few reminders
Study hints
The Evolution of Transformers: Summary
Questions
6
AI Stats 2010
RECAP
sigmoid units get “stuck”
7
AI Stats 2010
Histogram of gradients in a 5-layer network for an artificial image recognition task
RECAP
gradients vanish
Recap: Attention for “question answering”
Adding attention:
RECAP
Example: Machine Translation
2016
This model
RECAP
Example: Machine Translation
2016
a(s,h) = alignment score
RECAP
TRANSFORMERS
Transformer checklist
BERT: An Encoder-Only Transformer
2019
The model also predicts if sentence B is the “next sentence” after sentence A in the original document.
Prediction was done based on the output embedding of a special [CLS] token that was prepended to the input text.
Initial vocabulary from UTF-8
Step 1: Find all tokens in the corpus and save their frequency.
Step 2: Break all the tokens into characters (the initial vocabulary)
ascii
Latin alphabets, Greek, Hebrew, …,
mostly CJK
emojis …
All the bytes from UTF-8
Recap: Tokenization for Vision Transformers
Vision Transformers – Pros and Cons
Transformer checklist
LoRA (low rank adaptation) finetuning
Key ideas:
“full" finetuning
LoRA
finetuning
MF to adjust weights
cluster specific weight adjustment
n examples
0.1 | 0.9 |
0.8 | 0.1 |
.. | .. |
| |
| |
| |
| |
| |
… | … |
xn | yn |
a1 | a2 | .. | … | am |
b1 | b2 | … | … | bm |
v11 | … | | | |
… | … | | | |
| | | | |
| vij | | | |
| | | … | |
| | | | vnm |
~
original data set
soft indicators for r clusters
A
B
ΔW
HYPERPARAMETER SEARCH
Recap: Hyperparameter Selection
Recap: Hyperparameter Selection
Common adaptive selection loop:
A simple case:
Goal: find the best of the k values quickly
Explore the space intelligently
Recap: 5D Gaussian Processes�for Bayesian Optimization
Conditioned on a point
Conditioned on 4 points
What is Σ ?
Define covariance between xi and xj with a kernel, defined for all xi, xj
Gaussian Process Regression
Define covariance between xi and xj with a kernel, defined for all xi, xj
y1 is f(x), y2 is x
A = cov(Y1)
B = cov(Y1, Y2)
C = cov(Y2)
EMBARASSINGLY PARALLEL TRAINING
BTM: Key ideas
ELM = expert LM
ELMForest = group of ELMs
𝜃1, 𝜃2, …, 𝜃k
small GPT 𝜃
merged with parameter averaging
BTM: Training costs
2024
Branch and Train as in Branch-train-merge
Mix the expert LMs by
BTX results
Experiments with task analogies
λ1𝜏AmazonSentiment + (λ2𝜏YelpLM — λ3𝜏AmazonLM)
Experiments with task analogies
Collect 200 images of kings, queens, women, men.
Fine-tune CLIP models on each category, using 1000 ImageNet classes as negative examples
(class name ”something”)
Experiment: adding different task vectors
Note the training for the subtasks is embarrassingly parallel
MAKING MODELS SMALLER
Model compression
Distillation
Typically we distill a model on lots and lots of data only labeled by the teacher (transfer set)
The simple case: teacher predictions are “hard” labels (e.g., training a generative LLM).
Recap: making a large model smaller
simple quant rules
complex rules, learning
“32 bits everywhere”
“16 bits except for bias”
int8() except for outliers, defined as ….
SOTA optimizers for discrete or hybrid discrete/continuous spaces
Recap: making a large model smaller
simple optimization
complex optimization
Wanda: greedy weight pruning
shortened Llama: greedy layer pruning + LoRA
Magnitude: greedy weight pruning alternating with gradients
MiniTron: combine multiple approaches to pruning, distillation to pruned architectures
KEY VALUE CACHES
Recap: How to KV Cache
Recap: Transformers Are KV-Cache Optimized
Recap: Restricting attention with KV caching
Recap: Backstory in restricted attention
Recap: “Heavy Hitters” in KV Caches
sparsity: fraction of cache with < 1% of max attention score
Attention is sparse
Heavy Hitter KV Cache Entries are Important
Recap: “Heavy Hitters” in KV Caches
Recap: “Heavy Hitters” in KV Caches
Recap: making a large model smaller
simple optimization
complex optimization
+ start token
H2O: score by running accumulated attention
SnapKV: Adaptively pick specific weights based on observation window in prefilling
FastGen: Pick strategy per head and layer based on prefilling.
Score by recency (FIFO)
+ separator
Lots of detail but I tried to pick out “key ideas” for the papers
RAG AND CONTRASTIVE LEARNING
Recap: The Dense Passage Retriever (DPR)
Recap: Contriever vs DPR
Recap: The OG RAG paper
returns top K docs
Encoder-only vs decoder-only Transformers to Retrieval
Hypothetical Document Embedding (HyDE)
Decoder-only models as encoders?
2023
2025
PromptEOL
Echo embeddings
Recap: Fusion in Decoder (FiD)
O(N2 m2) ignoring k
O(N m)
O(N m2)
O(N m)
quadratic in N 🡪 linear in N
can afford to retrieve more docs
we lose cross-attention between tokens in different passages
Recap: FiD Optimized (FiDO)
2023
Recap: Fusion in Decoder (FiD)
FLOP analysis: Encoder is 6x as expensive as decoder!
…but at inference time decoding is slowest. Why?
What’s the fix?
Predicted by counting FLOPS for all the matmuls and assuming nt << ns and nt << d
Predicted by memory/FLOPs:
Multilayer perceptron
self-attention
cross-attention
Recap: Fusion in Decoder Optimized (FiDO)
Decoder
Encoder
Decoder
Recap: Fusion in Decoder Optimized (FiDO)
Recap: LUMEN: FiD with caching
The first N-K layers of the FiD encoder
The last K layers of the FiD encoder
FiD decoder
Passages are encoded and stored off-line for every document
Main ideas in FiD and extensions
FlashAttention (2023) and FlexAttention (2024)—also improve decoder bottlenecks
Parallel Context Windows (PCW) - 2023
TurboRAG, Blockwise Sparse Attention - 2024
Dynamic Blockwise Sparse Attention - 2025
Analog for decoder-only LLMs
2023
Key idea: cross-attend within a context window, and cross-attend between task tokens and all context windows.
Very similar to FiD
2025
Key idea: same as Block-Attention except
SCALABLE EVALUATION
Small preferences or weak guesses can be amplified in a network
PPI: Statistically Unbiased AI Judges
Arguments for:
Bayesian PPI
Difference estimate
(old)
Bayesian version
A practical problem with autoraters
ML models tend to hedge too much—put more weight in the middle of the distribution
Solution: split the data by autorater score and use two difference estimates
mean y - f
mean y - f
Bayesian PPI: QA evals
C I width
human labels: 3k AR labels
Background: Power Tuning for Difference Estimates
Difference estimate
(old)
Generalization (PPI++)
works for any λ, there is a good heuristic for setting it using cov of SN and Sn
λ=1 gives PPI
λ=0 gives classical statistic
PPI++ is robust to bad autoraters
a good autorater: FP/FN = 10%/8%
a bad autorater: FP/FN = 25%/25%
Final messages