Modern RL progress is driven by scaling compute and data using a 'brosity' policy gradient mechanism that learns from experience without needing explicit human instructions.
The core of modern reinforcement learning (RL) is a "fancy form of guess-and-check" where an agent samples actions (the guess), observes the outcome, and uses policy gradients to nudge the probability distribution toward higher rewards (the check).
This is for engineers and researchers who want to move past treating RL as a "black box." It explains the mechanics of how an agent learns from raw pixels, why certain algorithms (like Policy Gradients) are preferred over others, and the fundamental difference between how humans learn via abstraction versus how AI learns via brute force. You will be able to identify why some environments are "hard" for RL and how to architect systems that handle non-differentiable components like hard attention or memory I/O.
The central thesis is that progress in AI is not primarily driven by "new amazing ideas," but rather by the scaling of four pillars: Compute, Data, Algorithms, and Infrastructure. For example, AlexNet was essentially a scaled-up version of 1990s ConvNets; similarly, modern RL success comes from applying standard components (like CNNs as function approximators) to massive amounts of data and compute.
The logic of the "Pong" experiment demonstrates that we can train an agent to play a game using only raw pixels and a binary reward signal (+1 for win, -1 for loss). By treating the policy as a stochastic distribution, we use the Score Function Gradient Estimator. This allows us to nudge the parameters ($\theta$) in the direction of $\nabla_{\theta} \log p(x)$ multiplied by the scalar score $f(x)$. In plain English: if an action led to a win, we increase its probability; if it led to a loss, we decrease it.
To train an agent, substitute "fake" labels (the action actually sampled) into a supervised learning loss, modulated by an Advantage ($A$):
Use this variation of PG for more consistent results:
Before reaching for the "Bazooka" of Policy Gradients:
The agent learns to wait for the ball, then rapidly dashes to catch it at the edge of the screen to launch it with high vertical velocity. Lesson: Brute force discovery can lead to highly effective, non-intuitive strategies.
This game is notoriously difficult for RL because the agent cannot easily "stumble" into rewards like jumping or climbing. Lesson: Without prior knowledge or dense rewards, brute force search fails.
AlphaGo uses supervised learning first (learning from human experts) before switching to Policy Gradients. Lesson: Combining supervision with RL can overcome the "stumbling" problem of pure exploration.
"The progress in RL is not driven as much as you might reasonably assume by new amazing ideas." Why it matters: It highlights that scaling compute/data is currently more effective than seeking a "magic" algorithm.
"At the core the approach we use is also really quite profoundly dumb." Why it matters: It strips away the mysticism of AI, revealing it as a simple gradient-based nudge of probabilities.
"Policy Gradients are a brute force solution, where the correct actions are eventually discovered and internalized into a policy." Why it matters: It defines the fundamental limitation of current RL—it requires frequent positive rewards to learn.
This week
Ongoing
Reflection questions
Flashcards Q: What are the four primary drivers of AI progress? A: Compute, Data, Algorithms, and Infrastructure. Q: Why is Policy Gradient preferred over Q-Learning in this context? A: It is end-to-end, has an explicit policy, and directly optimizes expected reward. Q: What is the "Credit Assignment Problem"? A: The difficulty of determining which specific action in a long sequence caused a final reward. Q: How does the agent "see" motion in the Pong experiment? A: By using difference frames (current frame minus last frame). Q: Why is sampling non-differentiable? A: Because the outcome of different samples is unknown during the forward pass. Q: What is the "BB gun" recommendation? A: Try the Cross-entropy method (CEM) first before using Policy Gradients.
Confidence: High. This summary is grounded strictly in the provided notes. I am certain about the distinction between human/AI learning, the mechanics of Policy Gradients, and the specific Pong experiment details. Note that "Pong from Pixels" refers to a blog post/experiment by Karpathy rather than a formal textbook.
#333 – Andrej Karpathy Tesla AI, Self-Driving, Optimus, Aliens, and AGILex Fridman PodcastA from-scratch tour of Bitcoin in PythonAndrej KarpathyA Recipe for Training Neural NetworksAndrej KarpathyA Survival Guide to a PhDAndrej KarpathyBiohacking LiteAndrej KarpathyDeep Neural Nets 33 Years Ago and 33 Years From NowAndrej KarpathymicrogptAndrej Karpathy
No Priors Ep. 80 With Andrej Karpathy from OpenAI and TeslaNo PriorsShort Story on AI A Cognitive DiscontinuityAndrej KarpathyShort Story on AI Forward PassAndrej Karpathy
Skill Issue Andrej Karpathy on Code Agents, AutoResearch, and the Loopy Era of AINo PriorsSoftware 2.0Andrej Karpathy