@shao__meng: Stanford University CS 312 "Deep Learning Alchemy" Fall New Course Professors @tatsu_hashimoto and @kothasuhas lead the…
Summary
斯坦福大学新开设 CS 312「Deep Learning Alchemy」课程,由 Tatsunori Hashimoto 和 Suhas Kotha 主讲,聚焦深度学习中以经验为主的知识——超参数缩放、优化器不变性(μP、Muon)、损失景观与训练稳定性等,全部作业代码、测验和讲义公开,可视为 CS 336 的续作。
View Cached Full Text
Cached at: 10/16/26, 12:18 AM
Stanford University CS 312 “Deep Learning Alchemy” Fall New Course
Professors @tatsu_hashimoto and @kothasuhas lead the course, primarily addressing a common issue: most core knowledge in deep learning is empirical, theoretical explanations fall short, and reading papers can’t replace hands-on practice.
The course uses two creeds as its fulcrum: alchemy must be learned by hand; prediction is understanding—to accurately predict results before running experiments is true mastery.
Course website:
https://deep-learning-alchemy.github.io
Main course schedule
Seven units: hyperparameter tuning and scaling laws → optimizers and hyperparameter invariants (NQM, μP, Muon, weight decay) → loss landscapes → training stability → architecture capacity → data-efficient generalization (switching to DNA modality) → undisclosed unit. The reading list serves as a map of empirical deep learning, with multiple authors (μP, Muon, weight decay series) right in the team.
Homework code, quizzes, and lecture notes are all publicly available, course videos released by @StanfordOnline, and self-learners can use Modal to rent GPUs for full reproduction. It can be seen as a sequel to CS 336 (building LMs from scratch): that course teaches how to build models, this one teaches how to understand model behavior.
Stanford CS 312 | Deep Learning Alchemy
Source: https://deep-learning-alchemy.github.io/ 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.1. Perform leave-one-out ablations on the role of each component in our current model. 2. ... 3. ... 4. Understand the role of the residual connection. Can you come up with different schemes that improve the loss benefit of the residual connection?
Relevant code snippet``` class Block(nn.Module): def init(self, width, …): super().init() self.attn_norm = RMSNorm(width) self.attn = Attention(width, …) self.mlp_norm = RMSNorm(width) self.mlp = MLP(width, …)
def update(self, x):
attn = self.attn(self.attn_norm(x))
mlp = self.mlp(self.mlp_norm(x + attn))
return attn + mlp
def forward(self, x):
return x + self.update(x)
class Transformer(nn.Module): def init(self, vocab_size, depth=8, …): super().init() self.token_embed = nn.Embedding(vocab_size, …) self.position_embed = nn.Embedding(…) self.blocks = nn.ModuleList( [Block(…) for _ in range(depth)] ) self.final_norm = RMSNorm(…) self.lm_head = nn.Linear(…, vocab_size)
def forward(self, tokens):
positions = torch.arange(
tokens.size(1), device=tokens.device
)
x = self.token_embed(tokens)
x = x + self.position_embed(positions)
for block in self.blocks:
x = block(x)
return self.lm_head(self.final_norm(x))
**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\.1. Baseline
2. No prenorm
3. No residual
4. No MLP
5. No attention
6. No positional embeddings
No prenorm diff```
@@ -10,4 +10,4 @@ class Block.update
def update(self, x):
- attn = self.attn(self.attn_norm(x))
+ attn = self.attn(x)
- mlp = self.mlp(self.mlp_norm(x + attn))
+ mlp = self.mlp(x + attn)
return attn + mlp
No residual diff``` @@ -16,2 +16,2 @@ class Block.forward def forward(self, x):
- return x + self.update(x)
- return self.update(x)
No MLP diff```
@@ -10,4 +10,3 @@ class Block.update
def update(self, x):
attn = self.attn(self.attn_norm(x))
- mlp = self.mlp(self.mlp_norm(x + attn))
- return attn + mlp
+ return attn
No attention diff``` @@ -10,4 +10,3 @@ class Block.update def update(self, x):
- attn = self.attn(self.attn_norm(x))
- mlp = self.mlp(self.mlp_norm(x + attn))
- return attn + mlp
- mlp = self.mlp(self.mlp_norm(x))
- return mlp
No positional embeddings diff```
@@ -22,2 +22,1 @@ Transformer.__init__
self.token_embed = nn.Embedding(vocab_size, ...)
- self.position_embed = nn.Embedding(...)
@@ -30,8 +29,4 @@ Transformer.forward
def forward(self, tokens):
- positions = torch.arange(
- tokens.size(1), device=tokens.device
- )
x = self.token_embed(tokens)
- x = x + self.position_embed(positions)
for block in self.blocks:
x = block(x)
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``` @@ -34,3 +34,9 @@ Transformer.forward x_two_back = None for i, block in enumerate(self.blocks):
- x = block(x)
- update = block.update(x)
- residual = (
-
x if i == 0 -
else 0.5 * x + 0.5 * x_two_back - )
- x_two_back, x = x, residual + update
*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\!*
> **Tatsunori Hashimoto (@tatsu_hashimoto):**
> Deep learning is often taught as a sanitized collection of facts and math. But work at the frontier of AI is messy and empirical.
>
> Our new class, Deep Learning Alchemy, aims to teach the art and science of deep learning in the hands-on spirit of Language Modeling From Scratch.
Similar Articles
@StanfordAILab: Great chance to plug @tatsu_hashimoto and @kothasuhas's CS 312: Deep Learning Alchemy All recordings and class material…
Stanford AI Lab announces the public release of recordings and materials for CS 312: Deep Learning Alchemy course, including assignments and quizzes on deep learning concepts like transformer components.
@RuiWu560670: Long-time CS336 fan here. My favorite part was distilling the empirical findings in frontier labs' technical reports. T…
A long-time CS336 fan praises the course's empirical focus and expresses excitement for Stanford's new CS312 'Deep Learning Alchemy' class, announced by Tatsunori Hashimoto, which aims to teach the messy, empirical side of frontier deep learning research.
@MichaelRan15: Stanford CS312 Deep Learning Alchemy is worth following. It's not just another 2022 deep learning course. The instructo…
Stanford University announced a new deep learning course, CS312, with a unique grading system emphasizing quizzes and practical experiments over assignments.
@srush_nlp: I've been really fascinated by the DL Alchemy course (https://deep-learning-alchemy.github.io). The decision to put the…
A Stanford CS 312 "Deep Learning Alchemy" course shifts the burden of theory construction onto students (and their Claude assistants), having them empirically probe transformer components via ablations on a 614M-token depth-8 transformer — prompting reflection that maybe memorized ML knowledge was never that critical.
@0xcryptowizard: Stanford's latest course, worth checking out. About self-evolving AI, covering scaling laws, chain-of-thought, RLHF, reasoning models, etc. YouTube link: https://youtu.be/6YnLB0XbTnI?si=Dg-aSXbDxymA4U…
Recommending Stanford University's CS329A course, about self-improving AI agents, covering scaling laws, chain-of-thought, RLHF, reasoning models, and more.