What Is Stanford CS336: Language Modeling from Scratch?

Updated

Stanford CS336 is an official Stanford University course whose website (cs336.stanford.edu) serves as the hub for a hands-on class that walks students through building a language model from scratch. The site is useful if you want to understand the course's scope, find its logistics and schedule, or locate assignments and materials. The current listing is for Spring 2026, with previous offerings from Spring 2025 and Spring 2024 also referenced.

What the course covers

The course is built around the idea that language models are the cornerstone of modern NLP and a general-purpose approach to many downstream tasks. Rather than treating a model as a black box, CS336 takes inspiration from operating systems courses that build an entire OS from scratch: students go through every stage of language model creation.

The stated pipeline includes:

  • Data collection and cleaning for pre-training
  • Transformer model construction
  • Model training
  • Evaluation before deployment

The goal is a comprehensive understanding of language models by developing one end to end.

Who it's for and what you need first

CS336 assumes a strong technical background. The site lists two prerequisites:

  • Proficiency in Python. Most assignments are in Python, and the course provides minimal scaffolding. The site states students will write at least an order of magnitude more code than in other AI classes, so software engineering skill matters.
  • Experience with deep learning and systems optimization. A significant part of the course involves making neural language models run quickly and efficiently on GPUs across multiple machines. Strong familiarity with PyTorch and basic systems concepts such as the memory hierarchy is expected.

If you are looking for an introductory survey of NLP, this is likely not the right fit. If you want to implement and optimize the full training stack yourself, it is aimed at you.

Course staff

The Spring 2026 offering lists:

  • Tatsunori Hashimoto — Instructor
  • Percy Liang — Instructor
  • Herman Brunborg — CA
  • Marcel Rød — CA
  • Steven Cao — CA

Logistics at a glance

Item Detail
Lectures Monday/Wednesday, 3:00–4:20pm, Skilling Auditorium
Recordings YouTube playlist
Contact Course questions in public Slack channels; announcements also in Slack
Personal matters [email protected]

Office hours are listed per staff member, for example Percy Liang on Fridays 11am–12pm in Gates 366 and Tatsu Hashimoto on Tuesdays 11–12am in Gates 364, with additional CA hours at various Gates locations.

What you can find on the site

The site organizes information under Course Staff, Logistics, Content, Coursework, and Schedule (with a YouTube playlist). In practice, that means you can use it to:

  • Confirm the course's scope and prerequisites before committing
  • Check lecture times, locations, and office hours
  • Follow the schedule and watch recordings via the linked playlist
  • Locate assignments and course materials

The site also links to external GPU/compute pricing pages (Modal, Lambda, RunPod, Together) in its materials, which is relevant given the course's emphasis on running models across multiple machines. Note that those are third-party pricing pages; the course site itself does not state that compute is free or included.

How to decide if it's worth your time

Use the prerequisites as a filter. If you are comfortable writing substantial Python and PyTorch code and understand GPU memory and multi-machine training basics, CS336 offers a structured, from-scratch path through the entire language model lifecycle. If those foundations are missing, the minimal scaffolding and heavy coding load will make the course difficult to follow — consider strengthening Python, PyTorch, and systems fundamentals first.