Stanford CS336: Building Transformer From Scratch

stanfordnlp · x · 2026-07-20

This image showcases Assignment 1 of Stanford CS336, themed "Building a Transformer Language Model from Scratch." The assignment requires students to implement a BPE tokenizer, Transformer LM, cross-entropy loss, and AdamW optimizer, along with training loops and saving/loading of model and optimizer states. It also requires training the tokenizer and model on TinyStories, performing sample generation and perplexity evaluation, and further training on OpenWebText to submit perplexity scores to a leaderboard. This indicates the course emphasizes a complete model training pipeline rather than just calling existing libraries.

Original post →

More from Research

Research channel →