Stanford CS Professor: AI Can Code. That’s Why You Should Learn | Chris Piech

EO18:09Added Aug 31, 2026

Granola is the AI notepad for professionals in back-to-back meetings. New users get 100% off their first month → https://granola.ai?via=KUzb8NmChris Piech, a...

Watch on YouTube →
Contributed by 刘嘉琪

Transcript

Transcript format
  1. Intro

  2. 00:00Hi, you know I'm Chris Peach. I'm a
  3. 00:02professor here at Stanford University. I
  4. 00:04teach some large intro to computer
  5. 00:05science classes, some intro to math for
  6. 00:08AI. Code in place, if people don't know,
  7. 00:11it's an online class where you can learn
  8. 00:12to program. And the special thing about
  9. 00:14code and place is that it's the class in
  10. 00:16the world with the most teachers and
  11. 00:17there's about 17,000 students and more
  12. 00:20than a thousand teachers. We've been
  13. 00:21doing code and place for 6 years. So we
  14. 00:22did code in place before cursor and
  15. 00:24cloud code and code in place after. A
  16. 00:26few observations. one, our enrollment
  17. 00:28basically doubled. Oh my gosh, all these
  18. 00:30people want to learn how to code. You
  19. 00:33can expand the question. You could say,
  20. 00:35should I learn to program? You can also
  21. 00:36say, should I learn probability? Like,
  22. 00:38AI [music] can code, but AI can also do
  23. 00:40probability. Should I learn to write? AI
  24. 00:42can write. I think the wrong answer
  25. 00:45would be no. No, no. We're not giving up
  26. 00:47on the next generation being smart. Yes,
  27. 00:48you should learn how to formalize an
  28. 00:50argument. Yes, you should learn the
  29. 00:52depth of probabistic reasoning. And yes,
  30. 00:54you should learn how to program. If AI
  31. 00:56is able to do those things, your
  32. 00:58abilities may be magnified, but I
  33. 01:01imagine in the future it will still be
  34. 01:04important to be smart in those spaces.
  35. 01:06I'm [music] seeing more people with a
  36. 01:08motivational crisis than I have in the
  37. 01:10past. And that makes sense. There's more
  38. 01:12uncertainty in the world. You know, you
  39. 01:14can think about what can I contribute
  40. 01:17with AI of 2026, but I think students
  41. 01:19are faced with a much harder problem of
  42. 01:20thinking about, well, if I'm starting a
  43. 01:224-year program, I have to think about
  44. 01:24what jobs are going to exist in 2030
  45. 01:26when AI is 4 years more advanced and and
  46. 01:29that's a lot of uncertainty for [music]
  47. 01:30students and I empathize with this quite
  48. 01:32a lot. I think naturally that leads to
  49. 01:34some motivational problems. When am I
  50. 01:37actually getting something out of AI and
  51. 01:39when have I given away [music] too much
  52. 01:41of the growth? I suppose if I start
  53. 01:44outsourcing, [music] at what point will
  54. 01:46I no longer be able to do that? Like
  55. 01:48that really critical piece. I think all
  56. 01:50students have felt like this. Like if
  57. 01:52you have AI write too many of your
  58. 01:53essays, at what point are you no longer
  59. 01:56able to write an essay? If you have AI
  60. 01:58write too much of your code, at what
  61. 01:59point can you no longer do that valuable
  62. 02:01piece of the architecture? So I suppose
  63. 02:03that's the part where like I think it's
  64. 02:05fun to use AI. I think people should be
  65. 02:07playing around with it, but you should
  66. 02:09be self-aware [music]
  67. 02:10and you should be self-aware of like are
  68. 02:12you also growing alongside the AI and
  69. 02:14you should care so much about your own
  70. 02:16personal [music] growth.
  71. 02:26I was born in Nairobi, Kenya. When I was
  72. Can AI Make You Want to Learn?

  73. 02:2812, I moved to Koalaur, Malaysia, and
  74. 02:30ended up coming to the US for
  75. 02:32university. I was just a curious human.
  76. 02:35I wasn't set on being a professor from
  77. 02:38day one. I just like learning and I
  78. 02:41liked interesting problems. When I came
  79. 02:43to Stanford, I I'd done a little bit of
  80. 02:46coding, but I I really didn't know how
  81. 02:47to program. But like I had to fill an
  82. 02:50elective, so I just had to take a class
  83. 02:52and I was like, "Okay, I'll do the the
  84. 02:54programming class." And my teacher did
  85. 02:56the most wonderful thing. They said, "At
  86. 02:58this point, I'm going to have a
  87. 03:00challenge. everyone in class, go make
  88. 03:02the most wonderful things with what
  89. 03:04you've learned in the first two weeks of
  90. 03:05programming. And I found myself able to
  91. 03:08put like 40 hours of extra work beyond
  92. 03:11my normal schooling into this challenge
  93. 03:12because I was so excited. Uh, and then
  94. 03:16eventually I discovered uh that I was so
  95. 03:19curious about how people learned and I
  96. 03:22decided Professor was the right thing
  97. 03:23for me.
  98. 03:24So, Carol speaks this thing called
  99. 03:26Python uh which we're going to be using
  100. 03:28as our programming language throughout
  101. 03:30the course. So Carol is our lovable
  102. 03:32robot and Carol lives in a world. We
  103. 03:35think of the world as kind of having a
  104. 03:37north, west, south, and east [music] and
  105. 03:39having compass directions. Come on,
  106. 03:41Carol. Turn left and then turn left and
  107. 03:44then turn left. Oh, and we got to turn
  108. 03:48right.
  109. 03:48It's the class in the world with the
  110. 03:49most teachers. There's one teacher for
  111. 03:51every 10 students and there's about
  112. 03:5317,000 students and more than a thousand
  113. 03:55teachers. So what problem was I trying
  114. 03:57to solve? Let's go back in time. It's
  115. 04:00early days in the pandemic. I'm about to
  116. 04:02teach Stanford's flagship intro to
  117. 04:04coding class and I'm been told that
  118. 04:07everything's [music] going to be online.
  119. 04:09And in this moment, we're thinking the
  120. 04:11world is suffering. While we're putting
  121. 04:13the class online, is there something
  122. 04:14that we can also do to help the world?
  123. 04:16We can just put our videos online. And
  124. 04:18we thought people might get a little bit
  125. 04:20out of it, but we know that it would be
  126. 04:22a lot less than what our Stanford
  127. 04:24students get because our Stanford
  128. 04:25students get the special sauce of
  129. 04:27Stanford education. And the special
  130. 04:29sauce of Stanford education for introcs
  131. 04:32is you get a section leader. You get
  132. 04:34somebody who's just a little bit older
  133. 04:36than you, a little bit further along in
  134. 04:37their career, who's going to take time
  135. 04:39to help you grow. One of the common
  136. 04:42misconceptions is just thinking that AI
  137. 04:44tutors will solve everything. We
  138. 04:46basically have AI tutors already, but
  139. 04:49that isn't moving the needle in the way
  140. 04:51people expected. [music] So over the
  141. 04:53last 6 years, so we've now done this six
  142. 04:55times, we've tried a lot of different
  143. 04:57experiments where we gave people
  144. 04:58different dosage of AI and we have
  145. 05:00learned something very surprising. If we
  146. 05:02give people AI in just like here's a
  147. 05:04chatbot, use it to learn. Predictably,
  148. 05:07people will drop out. People get
  149. 05:09demotivated. It is demotivating to have
  150. 05:11AI thrown at you at the wrong moment of
  151. 05:13your learning. We have found very
  152. 05:16nuanced ways where we can use AI that
  153. 05:18actually helps people learn. But if you
  154. 05:19contrast that with humans, so if I throw
  155. 05:22AI at you, you're probably going to
  156. 05:24become a little bit demotivated
  157. 05:25statistically.
  158. 05:26But what happens if I throw a human at
  159. 05:28you? Imagine you're just programming in
  160. 05:30code in place. You might get a popup and
  161. 05:32it says, "Hey, there's a teacher online
  162. 05:33and they'd like to spend 10 minutes with
  163. 05:35you. Do you want to talk to them?" If
  164. 05:36you hit yes, your probability of
  165. 05:38completing the course goes up 10
  166. 05:40percentage points. So you must be
  167. 05:41thinking, "Oh, the humans must be saying
  168. 05:43the right things and the AI must be
  169. 05:44saying the wrong things." We've looked
  170. 05:46at these conversations. The AI was
  171. 05:47correct. It wasn't hallucinating. not
  172. 05:49for intro programming and the the humans
  173. 05:50weren't always correct,
  174. 05:53but the human touch is special. It's
  175. 05:56motivating and I think we all need
  176. 05:57motivation right now. Everyone needs
  177. 06:00something to convince them, I'm not
  178. 06:02going to make Claude do all the thinking
  179. 06:05for me. Like to actually do the thinking
  180. 06:07yourself takes extra energy.
  181. 06:10Crown jewel of education has always been
  182. 06:11motivation. And it's a lot more
  183. 06:13motivating for me to [music] say, I care
  184. 06:15about you being a smart person. I'm not
  185. 06:17giving up on you being a smart person
  186. 06:18this time of AI. [music] Um, let's work
  187. 06:21on your foundations and then when you're
  188. 06:22done with your foundations, I'll teach
  189. 06:24you how to code [music] with AI. That
  190. 06:25works so much better. When I look at
  191. 06:29chat bots, I think they do a [music]
  192. 06:30good job of answering my question. But
  193. 06:32one challenge I would pose to anybody
  194. 06:34thinking about how to make these work
  195. 06:35better for education is how do you get
  196. 06:38it to [music] inspire? Sometimes I will
  197. 06:40inspire my students in a deep way. And
  198. 06:42it could be like you come into my office
  199. 06:43and be like, "Hey, do you want to see
  200. 06:44something really cool about
  201. 06:45probability?" and I just showed them
  202. 06:47something really neat and they weren't
  203. 06:48even thinking about that wasn't the
  204. 06:49question they came in with. But then
  205. 06:50they they feel that like love and like
  206. 06:52that that inspiration and [music] as I
  207. 06:54said if I can flip the switch of getting
  208. 06:57the student so curious that they can't
  209. 06:59help but learn like the rest of the day
  210. 07:01all they can think about is the problem
  211. 07:03that I just posed to them or that cool
  212. 07:04thing I showed to them. If that
  213. 07:06curiosity gets ignited uh then I feel
  214. 07:08like they'll get there. And when I look
  215. 07:10at current chat bots [music] they are
  216. 07:11not igniting curiosity that much. It's
  217. 07:14it's not like you never show up to chat.
  218. 07:15[music] It's like, "Hey, do you want to
  219. 07:16just see something that is going to make
  220. 07:18your mind explode [music] that will like
  221. 07:20you know pull you in?" Now, as a
  222. 07:23teacher, I can do that because I have
  223. 07:24some context on my students. I know
  224. 07:27largely where they are and largely where
  225. 07:29they're trying to go. So, I can be very
  226. 07:31delicate [music] in the choice of the
  227. 07:33inspiring example or the inspiring
  228. 07:36challenge to pose to my students. If you
  229. 07:37just think an AI tutor will solve the
  230. 07:40clarity problem, you might miss it. the
  231. 07:42bigger piece of the puzzle. And I feel
  232. 07:44like if we leverage this, we can have a
  233. 07:46nicer world.
  234. Granola, the AI meeting assistant

  235. 07:48The deepest understanding doesn't come
  236. 07:50in the moment. It's built beforehand.
  237. 07:52Same goes for us. Before the main
  238. 07:54interview, we always do a pre-in call
  239. 07:58and Granola quietly transcribes it in
  240. 08:00[music] the background. No bot ever
  241. 08:02joining, turning it into clean notes.
  242. 08:04So, we built our own recipe for this.
  243. 08:06It's called interview prep. We wrote the
  244. 08:08prompt once with everything we want
  245. 08:10before a shoot. And now it's one click
  246. 08:12every time.
  247. 08:14Then minutes before the cameras roll, we
  248. 08:16[music] run it right on that pre-in
  249. 08:18call. In seconds, it surfaces the story
  250. 08:21worth telling, [music] the threads worth
  251. 08:22pulling, and the questions worth asking.
  252. 08:25It's like having the whole transcript in
  253. 08:27your head without ever opening it. So,
  254. 08:29we sit down already knowing where it
  255. 08:31should go. It's not a generic checklist.
  256. 08:33Every line [music] is drawn from the
  257. 08:35real discussion we just had, shaped by
  258. 08:37exactly how we like to prep. Less time
  259. 08:39scrambling to remember, more time fully
  260. 08:41present in the room. Turns out, the more
  261. 08:43you prepare, the more you understand.
  262. 08:46Try recipes today. New users get 100%
  263. 08:49off their first month at the link in the
  264. 08:51description.
  265. Why Now Is the Best Time to Learn Coding

  266. 08:57I'm seeing more people with a
  267. 08:59motivational crisis than I have in the
  268. 09:01past. And that makes sense. there's more
  269. 09:03uncertainty in the world. You know, you
  270. 09:06can think about what can I contribute
  271. 09:08with AI of 2026, but I think students
  272. 09:10are faced with a much harder problem of
  273. 09:12thinking about well, if I'm starting a
  274. 09:134-year program, I have to think about
  275. 09:15what jobs are going to exist in 2030
  276. 09:18when AI is 4 years more advanced. And
  277. 09:20and that's a lot of uncertainty for
  278. 09:21students, and I empathize with this
  279. 09:23quite a lot. In 5 to 10 years, many
  280. 09:26things will change. The future has
  281. 09:27always been unpredictable. It's always
  282. 09:29been the case that if you ask people to
  283. 09:30project what jobs will be the right jobs
  284. 09:335 to 10 years people always get it
  285. 09:35wrong. Here's an interesting anecdote
  286. 09:37though. So when I was young I'm old man
  287. 09:40now but when I was young and this in my
  288. 09:42PhD is around the time that one of my
  289. 09:44now colleagues [music] was making some
  290. 09:46of the first major milestones in
  291. 09:48self-driving cars and this is back in
  292. 09:50like 2011 2012. And at that moment, you
  293. 09:53would see this car drive and [music] you
  294. 09:55think, "Oh my god, what does it mean to
  295. 09:56be a taxi driver or what does it mean to
  296. 10:00be a truck driver?" But in fact, what
  297. 10:03happened is the truck driver profession
  298. 10:04has been growing at a very healthy rate.
  299. 10:07Um, now I don't know what the future
  300. 10:08holds for truck drivers. Maybe one day
  301. 10:10we'll come to an inflection point. But
  302. 10:11there was a lot of reasons that people
  303. 10:13underestimated.
  304. 10:15They underestimate like, well, if you
  305. 10:17have valuable cargo, you need a person
  306. 10:19who's responsible or the longtail sort
  307. 10:21of experiences. There's always something
  308. 10:22different happening on highway. 99% of
  309. 10:24the experiences can be the same, but
  310. 10:26like that 1% of things that are
  311. 10:27different. It's so hard to have a AI
  312. 10:30master all of them. I think one day
  313. 10:32eventually we'll have fully self-driving
  314. 10:34cars and we'll live in a world where all
  315. 10:35our cars are driven by an AI system. But
  316. 10:38what I was surprised about was how
  317. 10:41grossly we overestimate how quickly we
  318. 10:44get there. I think everyone who's worked
  319. 10:47deeply with AI has had this experience
  320. 10:49of by outsourcing a lot of thinking to
  321. 10:52AI, I am getting more separated from
  322. 10:56problem solving myself. A good example
  323. 10:58right now is [music] I program with AI a
  324. 11:00lot, but I happen to know a lot about
  325. 11:03programming and architecture. And if I
  326. 11:05don't know a lot about programming
  327. 11:06architecture, AI will start to make some
  328. 11:08poor decisions, which I might not
  329. 11:09experience the first time I make a
  330. 11:11prototype, but like five weeks down the
  331. 11:13line when students are actually using my
  332. 11:14thing, they might start to hit weird
  333. 11:16bugs. And if I don't understand the
  334. 11:17architecture, I can't help them. I
  335. 11:19suppose if I start outsourcing, at what
  336. 11:22point will I no longer be able to do
  337. 11:24that? like that really critical piece.
  338. 11:27Uh I think all students have felt like
  339. 11:29this. Like if you have AI write too many
  340. 11:31of your essays, at what point are you no
  341. 11:33longer able to write an essay? Uh if you
  342. 11:35have AI write too much of your code, at
  343. 11:37what point can you no longer do that
  344. 11:38valuable piece of the architecture? Um
  345. 11:41so I suppose that's the part where like
  346. 11:44I think it's fun to use AI. I think
  347. 11:45people should be playing around with it,
  348. 11:47but you should be self-aware and you
  349. 11:49should be self-aware of like are you
  350. 11:51also growing alongside the AI and you
  351. 11:53should care so much about your own
  352. 11:54personal growth. When you're learning
  353. 11:57how to program [music] largely you can
  354. 11:58separate into two pieces. One piece is
  355. 12:01you're learning the syntax of how do we
  356. 12:03tell computers to do things and the
  357. 12:06other thing you're learning is basically
  358. 12:08problem solving like how do you take big
  359. 12:09problems and break them down into small
  360. 12:11pieces. um how do you set it up so that
  361. 12:14data can [music] speak to algorithms?
  362. 12:16How do you think about algorithms? So
  363. 12:19I'm going to say AI is going to get
  364. 12:20really really good at just the syntax.
  365. 12:22It's less important in the future that
  366. 12:24you've memorized every command. [music]
  367. 12:26It's probably more important that you
  368. 12:27know how to problem solve. So while
  369. 12:29you're learning to program, really focus
  370. 12:31on that problem solving ability. There's
  371. 12:34one thing about coding that's special.
  372. 12:37You get immediate falsifiable feedback.
  373. 12:40Like if your logic is wrong, your thing
  374. 12:42doesn't work and you get to see that and
  375. 12:44you get to iterate quickly. Whereas if
  376. 12:46you apply problem solving to life, you
  377. 12:48could make a poor decision, but the
  378. 12:50feedback cycle is so slow that you don't
  379. 12:52get to practice getting better and
  380. 12:54better at making decisions. So there's a
  381. 12:55couple things about coding that makes it
  382. 12:57particularly good at teaching how to
  383. 12:59problem solve. The the question, how do
  384. 13:00you become like a really high
  385. 13:03contributor [music]
  386. 13:04engineer? You might not find my answer
  387. 13:06that surprising, but it's like it's time
  388. 13:08on task. It's like how much time are you
  389. 13:10spending actually creating things? And
  390. 13:12I'm going to separate you creating
  391. 13:14versus you giving it to Claude Code.
  392. 13:16Now, by the way, you know what I would
  393. 13:18do if I was a young person? I would make
  394. 13:20a lot of prototypes with cloud code and
  395. 13:21I'd say, "Cloud code, teach me all the
  396. 13:23most important things that you did in
  397. 13:25order to create this." And I would
  398. 13:26iterate that way and I get lots of
  399. 13:28experience so I can try and figure out
  400. 13:30what are the most important concepts.
  401. 13:32I'll give your young engineers a
  402. 13:33particular challenge. As I said, it's a
  403. 13:36confusing time, but there's an
  404. 13:37opportunity that didn't exist before.
  405. 13:38One of the things that's happened is
  406. 13:40barriers to entries have been cut. You
  407. 13:42could be a 12th grader, so an
  408. 13:4418-year-old with a friend. You might be
  409. 13:47able to make a high quality startup. The
  410. 13:49two of you could make a pretty
  411. 13:50impressive codebase that solves an
  412. 13:52interesting problem. There is a real art
  413. 13:54form to knowing what is a valuable
  414. 13:57problem to solve. uh and I think more
  415. 13:59and more junior [music] engineers get to
  416. 14:02engage with that art form like what is
  417. 14:05worth actually making what do users want
  418. 14:07what's the feature that will help them
  419. 14:10make progress in whatever their problems
  420. 14:12are so that ability to interface between
  421. 14:14what are computers able to do and what
  422. 14:17do humans actually need has always been
  423. 14:19a critical high order skill and I think
  424. 14:22if I were a junior engineer I would
  425. 14:24start working on that skill now I
  426. 14:26wouldn't wait till I was a senior
  427. 14:27engineer
  428. 14:31If you start with the premise that my
  429. Start With This Axiom: The Next Generation Will Be Smarter Than Us

  430. 14:34children will become smart people and
  431. 14:35your children will become smart people.
  432. 14:37If you don't have children then maybe
  433. 14:38your nephews and nieces will become
  434. 14:39smart people. You start from the premise
  435. 14:40that the next generation will be filled
  436. 14:42with people who are smarter than we are.
  437. 14:44Then you're like, okay, how do we get
  438. 14:46them to that point? And then you look at
  439. 14:48any subject, probability, computer
  440. 14:50science, and when you look at any
  441. 14:52subject, there's often [music]
  442. 14:53foundational concepts and then you'll
  443. 14:55have layers of complexity built on top
  444. 14:57of it. If you expect them to become
  445. 14:59smarter than you are, it's really hard
  446. 15:01to skip the foundations. And one way of
  447. 15:03thinking about that is we've had
  448. 15:04calculators to do multiplication for a
  449. 15:05long time. Kids still need to learn
  450. 15:07multiplication. Now, there's a subtle
  451. 15:09difference. The concept of
  452. 15:10multiplication is so critical, but
  453. 15:13actually knowing how to do the wrote,
  454. 15:15you know, if I ask you like what's 13*
  455. 15:177? [music] Go quick. That's not as
  456. 15:18important as just knowing what is
  457. 15:20multiplication. But you can't skip the
  458. 15:21foundations, but you can maybe
  459. 15:23[music]
  460. 15:23uh be more artful about what you focus
  461. 15:25on. I kind of take it as an axiom that
  462. 15:30I'm not giving up on the next
  463. 15:31generation. Honestly, the people I've
  464. 15:33seen get most lost and most demotivated
  465. 15:35in this motiv AI are sometimes the ones
  466. 15:37who are overthinking it. I had a
  467. 15:39student, he was just doing such
  468. 15:40wonderful things. He was using AI, he
  469. 15:42was solving problems, he was learning
  470. 15:43amazing things. I asked, "Hey, wonderful
  471. 15:45student like what are you thinking
  472. 15:46about?" And he says, "I actually don't
  473. 15:48think about it. I don't really think
  474. 15:50about the future of AI and that allows
  475. 15:51me to thrive."
  476. 15:53And that gave me pause. I think about AI
  477. 15:55all the time. I feel like I think about
  478. 15:56AI 10 times a day and then the
  479. 15:58simplicity of like no I'm just going to
  480. 16:01be curious and learn since that day I
  481. 16:03start my day with the axiom. I don't ask
  482. 16:06why I care about the next generation be
  483. 16:08smarter. I take it as a truth. I want
  484. 16:10this and I will work towards it. It's a
  485. 16:12tool and it will multiply
  486. 16:16humans. So when humans are at our best,
  487. 16:18we can use this tool to multiply us.
  488. 16:20Like the doctor who really cares about
  489. 16:22their patient now has a tool that they
  490. 16:24can do more faster, more accurately. The
  491. 16:27teacher who really cares about their
  492. 16:29students, who is passionate about them
  493. 16:31learning, they can go further with their
  494. 16:33students and they can do more. Also, I
  495. 16:35get to see young people all the time.
  496. 16:38And I would say that gives me
  497. 16:41inspiration. Seeing their
  498. 16:42self-awareness, how critical they're
  499. 16:45thinking, seeing them blossoming, it
  500. 16:48gives you optimism. If I was a young
  501. 16:50person right now, the most valuable
  502. 16:52thing is that you have the
  503. 16:52self-awareness. You should also have the
  504. 16:54goal that I will become smarter. Chris
  505. 16:56is not giving up on you, you should not
  506. 16:58give up on yourself either.
  507. 17:00I have two kids under five. [music] And
  508. 17:03you know what? They're going to live in
  509. 17:05an awesome world. Like, we're going to
  510. 17:06adapt. We're going to figure things out.
  511. 17:08They're going to still have curiosities.
  512. 17:11They're going to still grow their minds.
  513. 17:12And [music] we're going to keep every
  514. 17:14day working towards that.
  515. 17:17The top engineer might not be the person
  516. 17:19who knows all the code. Maybe the top
  517. 17:21engineer is a person who can relate the
  518. 17:23real world human problems [music] into
  519. 17:25the world of apps into the world of data
  520. 17:28science and into the world of research.
  521. 17:30[music] So go make stuff. Make stuff
  522. 17:33that people use. Make stuff that people
  523. 17:34love. And in that process of iteration,
  524. 17:37you have an opportunity to become
  525. 17:39excellent at coding and excellent at
  526. 17:42problem solving. Just take [music]
  527. 17:43axioms. You will become smarter than you
  528. 17:46were yesterday. Start your day like
  529. 17:48that.