← All Chapters
20 topics

AI and ML

From gradient descent to attention, RLHF and RAG, watch models train, sample and retrieve live.

  1. 01Gradient DescentWalking downhill, and why the starting point decides which minimum you reach
  2. 02Neural NetworksWatch a tiny network train live: loss drops, weights shift, the boundary sharpens
  3. 03Why Activations MatterTurn the activation off and the boundary is a straight line that fails; turn ReLU on and it bends to fit, gaining more bends with more units
  4. 04Overfitting and GeneralizationSlide model complexity from underfit to good fit to overfit, and watch test error trace a U
  5. 05Decision BoundaryDrag a point and watch a real logistic regression, fit live by gradient descent, chase it: the boundary is the learned object, defined by three numbers
  6. 06Confusion MatrixPrecision, recall, and the threshold that trades one for the other
  7. 07TokenizationHow text is split into tokens, each with an integer ID, before a model ever sees it
  8. 08Why Models Struggle with MathSee one side compute the right answer step by step while a model predicts answer tokens and lands on a plausible but wrong one
  9. 09TensorsClimb the dimensionality ladder from a scalar to a batch of images, watching the shape and index math build up rank by rank
  10. 10BroadcastingPick two array shapes and watch them align from the right, stretching size-1 dimensions to see whether they combine and what result shape they make
  11. 11EmbeddingsWords as points in space, where closeness means similar meaning
  12. 12AttentionHow a transformer decides which words to focus on, like "it" reaching back to "animal"
  13. 13Positional EncodingAttention ignores word order, so each token gets a sine and cosine fingerprint of its position; pick a position and watch its pattern shift
  14. 14Transformers and Multi-Head AttentionMany attention heads in parallel, each head watching a different relationship over the same sentence
  15. 15Encoders and DecodersAn encoder sees the whole sentence at once; a decoder can only look back. Toggle the attention mask and watch which words each word is allowed to see
  16. 16RLHFPick the answers you prefer and watch your feedback reshape the model
  17. 17Temperature and SamplingMove a temperature slider and watch the next-word distribution sharpen or flatten
  18. 18Beam Search vs Greedy DecodingWatch greedy decoding lock onto the locally best token while beam search keeps a wider set of candidates alive and finds a more probable sequence overall
  19. 19RAG (Retrieval-Augmented Generation)Retrieve relevant document chunks by similarity, drop them into the prompt, and watch the model answer from real sources instead of memory
  20. 20QuantizationDrop the bit width and watch every weight snap to a coarser grid