Skip to content

Jiadalee/2024-Spring-CS336-ClassNotes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

14 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ“š Stanford CS336 (Spring 2024) โ€” My 160+ Pages of Handwritten Class Notes

Welcome! ๐Ÿ‘‹

This repository contains 160+ pages of handwritten notes that I created while taking Stanford CS336: Language Modeling from Scratch (Spring 2024).

The course, instructed by Percy Liang and Tatsunori Hashimoto, provides a comprehensive introduction to the principles and systems behind modern Large Language Models (LLMs), covering topics from pre-training datasets, tokenization, transformer architectures, LLM pretraining to distributed training, inference and LLM serving, memory optimization, GPU benchmarking and profiling, collective communcation, AI evaluation, and RL alignment and policy optimization, ect.


Why I Created These Notes?

My goal was not simply to pass the course, but to build a deep understanding of how LLMs are developed from the ground up.

Throughout the course, I handwrote detailed notes to reinforce my understanding of the mathematical foundations, implementation details, systems concepts, and engineering trade-offs. Looking back, these notes played an important role in shaping my knowledge of:

  • ๐Ÿง  Transformer core principles (attention, positional encoding, architecture design)
  • ๐Ÿ”ค Tokenization and vocabulary construction (BPE, SentencePiece)
  • โš™๏ธ PyTorch fundamentals and tensor ops (einops) for LLM implementation
  • ๐Ÿงน Dataset preparation, cleaning, filtering, and corpus engineering
  • ๐Ÿงช Data-centric techniques (data mixing, rewriting, SFT pipelines)
  • ๐Ÿ“ˆ Scaling laws and dataโ€“modelโ€“compute trade-offs
  • ๐Ÿ—๏ธ Pretraining objectives & training dynamics (causal LM, masked LM)
  • ๐ŸŽฏ Fine-tuning strategies (SFT, instruction tuning)
  • ๐Ÿค– Model alignment (RLHF, DPO, RL algorithms)
  • โšก Inference systems (latency vs throughput, batching, serving)
  • ๐Ÿ“ Evaluation methodologies (perplexity, downstream benchmarks)
  • ๐Ÿ’ป GPU & TPU architecture + memory optimization
  • ๐Ÿ“‰ Resource accounting (roofline), profiling & performance tuning
  • ๐ŸŒ Distributed training (data/model/pipeline parallelism)
  • ๐Ÿ”— Collective communication (AllReduce, NCCL)
  • ๐Ÿงฉ Mixture of Experts (MoE) and sparse architectures
  • ๐Ÿงฌ Kernel-level optimization (CUDA, Triton)
  • ๐Ÿง  Compiler stacks & graph optimization (XLA)
  • ๐Ÿš€ KV Cache, Flash Attention, efficient attention mechanisms
  • ๐Ÿ”ข Mixed precision training (FP16, BF16)
  • ๐Ÿ› ๏ธ Checkpointing, fault tolerance, training efficiency
  • ๐Ÿ“ฆ System-level optimization (throughput, latency, memoryโ€“compute balance)
  • ๐ŸŒ Deployment & LLM serving systems
  • ๐Ÿง  RL policy optimization and RL aligment
  • โž• and moreโ€ฆ

Check some sample pdf notes below:

Linkedin fig 1 Linkedin fig 2 Linkedin fig 3 Linkedin fig 4 Linkedin fig 5 Linkedin fig 6 Linkedin fig 7 Linkedin fig 8 Linkedin fig 9 Linkedin fig 10 Linkedin fig 102 Linkedin fig 11 Linkedin fig 12

Repository Contents

  • ๐Ÿ“„ Stanford_CS336_Handwritten_Notes.pdf โ€” Complete handwritten notes (160+ pages)

Who May Find This Helpful?

This resource is intended for:

  • Students studying Large Language Models
  • AI and LLM engineers
  • ML Systems engineers
  • Researchers and scientists interested in ML System and AI infrastructure
  • Anyone preparing to study or review Stanford CS336

Please note that these are personal study notes, not official course materials. They reflect my own understanding of the lectures and may contain omissions or mistakes.


Acknowledgments

Many thanks to Professor Percy Liang, Professor Tatsunori Hashimoto, the CS336 teaching staff, and everyone who contributed to making this outstanding course publicly available.

I am also grateful for the opportunity to contribute to the open-source CS336 course after taking it as a student.


License

These handwritten notes are shared for educational and non-commercial purposes. Please respect Stanford University's intellectual property and course policies. If you reuse or reference these notes, I would appreciate appropriate attribution.


โญ If you find these notes helpful, please consider giving this repository a Star. I hope they make your journey into LLM engineering a little easier.

About

160+ pages of handwritten notes from Stanford CS336: Language Modeling from Scratch, covering language modeling, LLM systems, and full-stack AI engineering from data to deployment and evaluation and RL alignment

Topics

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors