CS 312: Deep Learning Alchemy
Stanford / Fall 2026
Course Staff
Logistics
- Lectures: Tues/Thurs, 1:30-2:50pm in CoDa B90
- Recordings: TBA (All class materials will be made public)
- Contact: TBA
Content
What is this course about?
Deep learning is now the foundation of all of machine learning and AI, making it more important than ever for students to obtain mastery of the empirical phenomena and experimental skills involved in deep neural networks. How can students acquire the skills necessary to invent the next generation of architectures or develop new broad theories of how deep learning works? This course takes the stance that knowledge or math abilities alone are not enough, and there is no substitute to getting your hands dirty and running many, many experiments. To this end, we will work through computationally tractable domains and take students through the process of obtaining mastery in this domain through efficient experimentation and experiment outcome prediction. The class will alternate between assignments (where students run experiments to understand deep learning phenomena), quizzes (where students are tested for their ability to predict held-out experiment outcomes), lectures, and tutorials.
Prerequisites
Note: This is a 5-unit class. It will require running a lot of experiments and taking seven difficult quizzes, and we don't intend to apply inflated grading curves. Please make a well-informed decision if you have the appropriate background and time to take this class.
- Machine learning: This class is a non-standard introduction to deep learning. Since we want to spend more time teaching experiment design and deep learning intuition, we will spend little time explaining precise details that other deep learning classes cover (e.g. backpropagation rules, efficient implementations, etc.). Therefore, it will be helpful to have familiarity with deep learning prior to enrolling (via courses such as CS 221, CS 229, CS 230, CS 124, CS 224N). Nonetheless, all the assignments are self-contained and we are particularly excited for this course to be a first introduction for students with no deep learning background (though it will require more work at the start of the course).
- Math: Students should be familiar with college calculus and linear algebra (e.g. MATH 51, CME 100) and basic probability/statistics (e.g. CS 109 or equivalent).
- Programming: All class assignments and quizzes will be in Python. Since we will provide scaffolding and support AI usage for assignments, it is not critical to be skilled at implementation. However, quizzes will assume understanding of the provided codebase and any short implementation diffs.
Coursework
Structure
The goal of this class is to develop human intuition for the variety of strange deep learning phenomena that exist in the real world. Our two core beliefs are:
- Alchemy is learned by hand: Deep learning has many mysteries and surprises that are not well understood by the best researchers, let alone deep learning classes. As such, many classes teach mental models that are not supported by an empiricist's experience (e.g. classic bias-variance tradeoff disagrees with the current scaling era). This class will teach students how to design clean experiments that enable them to build intuition for themselves.
- Prediction is understanding: To build a scientific understanding is to be able to predict the outcome of an experiment before running it. Therefore, this class assesses human understanding via quizzes where students have to predict experiment outcomes.
In this class, students will alternate between running experiments to understand a given unit (e.g. architecture stability) and taking quizzes testing their understanding. Course staff will support student learning with lectures on each unit and tutorials for interactive discussion.
Example schedule
-
At the introductory meeting and after each quiz: The assignment for the next unit is released
- The assignment scopes out empirical phenomena that students will best understand through designing clean experiments.
- Students will eventually submit a report with plots/tables explaining the experiments they ran.
- One or two class meetings: Lectures explain common intuitions for the unit
-
Once a week: 30 minute tutorial
- Every week, each student is required to meet with three other students and one course staff for 30 minutes.
- During this session, the instructor will ask questions about what experiments each student is running as well as cover practice problems that will help for the quiz. This time can also serve as group office hours.
- Students will receive a full grade given active participation.
-
The day before the quiz: Student reports are due
- Note that the assignment is not graded and is only useful for partial credit on the quiz.
- The reports may inspire questions that appear on the quiz.
-
At the end of the unit: A 40-minute experiment prediction quiz is administered
- Each quiz question will correspond to a thematic held-out experiment run by the instructors. The student will be given a description of the experiment (including code diff) and asked to predict the outcome of the experiment.
- Quiz questions will span easy, medium, and hard difficulty depending on how much extrapolation they require from the assignment suggestions.
- During this quiz, students will not be allowed to refer to any external resources including their report. Students can cite their report in the quiz and can receive partial credit if their reasoning appears sound.
- Immediately after the quiz, the instructors will cover the answers and discuss mental models with the class.
Example problem and questions
Example Assignment Problem: Start from the baseline depth 8 transformer that we pre-train on 614M tokens. This transformer (implementation provided below) features multiple components such as prenorm, attention, MLP, residuals, and positional embeddings. In this problem, we want to understand how much each component improves loss. Explore the following directions.
Relevant code snippet
|
Example Quiz Question (Difficulty Easy): We train each of the following depth-8 transformer variants using the same training recipe and hyperparameters. Rank the variants from lowest to highest final validation loss. Use <, >, or = between the letters; use = when the losses are within 0.01.
No prenorm diff
No residual diff
No MLP diff
No attention diff
No positional embeddings diff
Example Quiz Question (Difficulty Hard): We train the default 8 layer transformer as well as a variant where instead of having the residual connection come from the previous layer, we take 0.5 contribution from the previous layer and 0.5 contribution from two layers before (except for the first layer). For each method, we take the best loss over six learning rates {10−4, 3 × 10−4, 10−3, 3 × 10−3, 10−2, 3 × 10−2}. What is your prediction of the loss difference between each method (Lmixed residual − Ldefault)? Core diff
Note: both of these questions are hard, do not get discouraged if you do not have intuition for them without running experiments from the assignment! |
Assignments
Current assignment topics are tentative. Assignments 1 through 4 will study language model pre-training at a small scale reflective of larger-scale phenomena. Assignments 5 through 7 will switch to DNA.
- Basics: Hyperparameter tuning and scaling
- Optimization 1: Sharp and flat basins
- Optimization 2: Hyperparameter invariants
- Architecture 1: Extending model capacity
- Architecture 2: Stability across depth/time
- Generalization: Data-efficient algorithms
- Exotic: ???
Grading
- 15% will come from tutorial participation (with 2 permitted absences)
- 85% will come from quizzes (with 2 drops out of 7 quizzes)
- 0% will come from assignments (except for their use as partial credit when cited in a quiz)
Attendance is mandatory on quiz and tutorial sessions. There will be no rescheduling or make-up opportunities except for those covered by accommodations.
Honor code
Like all other classes at Stanford, we take the student Honor Code seriously. Please respect the following policies:- Collaboration: We encourage students to discuss experiment ideas with each other over the week and at tutorial. However, since we believe that running experiments confers deeper understanding, we require all submitted experiments to be run by the student. If you discussed experiments with anyone, please put their names at the top of your assignment.
- AI tools: We view assignments as instrumental to improving human understanding. Therefore, we support AI usage on assignments for implementation, visualization, mock quizzes, etc. However, since grades will be primarily determined by quiz performance, we encourage students to be thoughtful about what AI usage enhances their ability to digest phenomena (as measured by their ability to predict experiment outcomes).
Submitting coursework
- All coursework is submitted via Gradescope by the deadline (not by email). You can submit as many times as you'd like until the deadline: we will only grade the last submission.
- Since assignment reports are not necessary to take the quiz, we will not accept any late reports.
- If you believe that the course staff (and their models) made an objective error in grading, you may submit a regrade request on Gradescope within 3 days after the grades are released.
GPU compute for self-study
If you are following along at home, you can access GPU compute from a cloud provider to complete the assignments.
Here are a few options (public pricing for a single B200 GPU on March 28, 2026):
- Modal: $6.25/hour. Offers $30 of free monthly compute. You are only charged for actual compute (no idle resources) and their UX makes switching between local dev and large-scale gpu experiments simple. (Modal Pricing)
- Lambda Labs: $6.69/hour (Lambda Pricing)
- RunPod: $4.99/hour (RunPod Pricing)
- Nebius: $5.50/hour ($3.05/hour preemptible) (Nebius Pricing)
- Together: $7.49/hour, minimum 8 GPUs, cheaper for longer commitments (Together Pricing)
Sponsor
We would like to thank Modal for sponsoring compute for this class.
Schedule (YouTube playlist TBA)
| # | Date | Description | Materials | Assignments |
|---|---|---|---|---|
| 1 | Tue September 22 | Lecture: Introduction | TBA | Assignment 1 out (due 09/28) |
| 2 | Thu September 24 | Lecture: Basics | TBA | |
| 3 | Tue September 29 | Quiz: Basics | TBA | Assignment 2 out (due 10/07) |
| 4 | Thu October 1 | Lecture: Optimization 1 | TBA | |
| Tue October 6 | Lecture: Optimization 1 | TBA | ||
| 5 | Thu October 8 | Quiz: Optimization 1 | TBA | Assignment 3 out (due 10/19) |
| 6 | Tue October 13 | Lecture: Optimization 2 | TBA | |
| Thu October 15 | Lecture: Optimization 2 | TBA | ||
| 7 | Tue October 20 | Quiz: Optimization 2 | TBA | Assignment 4 out (due 10/28) |
| 8 | Thu October 22 | Lecture: Architecture 1 | TBA | |
| Tue October 27 | Lecture: Architecture 1 | TBA | ||
| 9 | Thu October 29 | Quiz: Architecture 1 | TBA | Assignment 5 out (due 11/09) |
| Tue November 3 | No class (Democracy Day) | |||
| 10 | Thu November 5 | Lecture: Architecture 2 | TBA | |
| 11 | Tue November 10 | Quiz: Architecture 2 | TBA | Assignment 6 out (due 11/18) |
| 12 | Thu November 12 | Lecture: Generalization | TBA | |
| Tue November 17 | Lecture: Generalization | TBA | ||
| 13 | Thu November 19 | Quiz: Generalization | TBA | Assignment 7 out (due 12/02) |
| Tue November 24 | No class (Thanksgiving Recess) | |||
| Thu November 26 | No class (Thanksgiving Recess) | |||
| 14 | Tue December 1 | Lecture: Exotic | TBA | |
| 15 | Thu December 3 | Quiz: Exotic | TBA |