Vibeleaderboard
← All Intel
Intel / article

Alisa's book of LLMs

Source
Alisa Liu
Author
Alisa Liu
Date
Key takeaways · AI-distilled
  • The notebook derives the softmax plus cross-entropy gradient as dL/dz = p - one_hot(t): the predicted distribution minus the one-hot target.
  • It works through activation checkpointing's memory/compute tradeoff: using K = sqrt(N) segments brings activation memory to O(sqrt N).
  • Its backward pass for a linear layer Z = XW + b accounts for PyTorch storing weights transposed, and explains that per-example Jacobians contract over shared tensors and stack over unshared ones.
  • It also includes a from-scratch AdamW with bias correction and decoupled weight decay, and the online-softmax recurrence that FlashAttention builds on.
Terms in this piece · Glossary
  • transformerThe neural network architecture behind modern AI models, built on attention — letting every word directly consider every other word in parallel.
  • inferenceRunning a trained model to get answers — the phase where AI is actually used, as opposed to trained.
  • speculative decodingA speed trick where a small model drafts several tokens ahead and the big model verifies them in one pass, often doubling generation speed.
  • KV cacheThe memory a model keeps about text it has already read, so generating each new token doesn't require reprocessing the whole conversation.
Why it matters

Alisa Liu's public notebook derives the mechanics practitioners rely on, like the softmax+cross-entropy gradient, online-softmax numerics, and activation-checkpointing memory tradeoffs, in one place as a reference for building or debugging LLM training code.

Read the source alisawuffles.notion.site
Recommended reads
Comments

Checking sign-in…

Loading comments…