teaching_llm_applications

Architectures (Stanford CS 336)

Intro

🎮 Practical

Zoo of models

Residual stream

The Residual Stream (yellow arrows)::

image

image

Pre vs. Post norm

Why Pre-norm?

image

Double norm

Why Layer Norm?

images

Bias terms

Zoo of activations

Serial vs Parallel

Position embeddings

image

image

Image from 🎥 Stanford CS336 course

image

🎮 Practical: implementation and code for ROPE

Consensus hyperparameters

Consensus hyperparameter 2

Aspect ratio

Vocabulary size

Dropout and regularization

Stability tricks

Attention softmax stability

🎮 Practical

QK-norm

image

\[\mathcal{L}_{z} = \lambda \cdot (\log Z)^2, \qquad \mathcal{L}_{\text{total}} = \mathcal{L}_{CE} + \mathcal{L}_z\]

😂 Lesson?

image

Logit soft-capping

Attention heads

image

image

Reading VERY GOOD

Multi-Query-Attention (MQA)

GQA

Multi-Head Attention (MHA)

TODO Practical based on how this affects performance

Sliding window attention

image

image