Stanford CS Professor: AI Can Code. That’s Why You Should Learn | Chris Piech
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 →Transcript
Intro
- 00:00Hi, you know I'm Chris Peach. I'm a
- 00:02professor here at Stanford University. I
- 00:04teach some large intro to computer
- 00:05science classes, some intro to math for
- 00:08AI. Code in place, if people don't know,
- 00:11it's an online class where you can learn
- 00:12to program. And the special thing about
- 00:14code and place is that it's the class in
- 00:16the world with the most teachers and
- 00:17there's about 17,000 students and more
- 00:20than a thousand teachers. We've been
- 00:21doing code and place for 6 years. So we
- 00:22did code in place before cursor and
- 00:24cloud code and code in place after. A
- 00:26few observations. one, our enrollment
- 00:28basically doubled. Oh my gosh, all these
- 00:30people want to learn how to code. You
- 00:33can expand the question. You could say,
- 00:35should I learn to program? You can also
- 00:36say, should I learn probability? Like,
- 00:38AI [music] can code, but AI can also do
- 00:40probability. Should I learn to write? AI
- 00:42can write. I think the wrong answer
- 00:45would be no. No, no. We're not giving up
- 00:47on the next generation being smart. Yes,
- 00:48you should learn how to formalize an
- 00:50argument. Yes, you should learn the
- 00:52depth of probabistic reasoning. And yes,
- 00:54you should learn how to program. If AI
- 00:56is able to do those things, your
- 00:58abilities may be magnified, but I
- 01:01imagine in the future it will still be
- 01:04important to be smart in those spaces.
- 01:06I'm [music] seeing more people with a
- 01:08motivational crisis than I have in the
- 01:10past. And that makes sense. There's more
- 01:12uncertainty in the world. You know, you
- 01:14can think about what can I contribute
- 01:17with AI of 2026, but I think students
- 01:19are faced with a much harder problem of
- 01:20thinking about, well, if I'm starting a
- 01:224-year program, I have to think about
- 01:24what jobs are going to exist in 2030
- 01:26when AI is 4 years more advanced and and
- 01:29that's a lot of uncertainty for [music]
- 01:30students and I empathize with this quite
- 01:32a lot. I think naturally that leads to
- 01:34some motivational problems. When am I
- 01:37actually getting something out of AI and
- 01:39when have I given away [music] too much
- 01:41of the growth? I suppose if I start
- 01:44outsourcing, [music] at what point will
- 01:46I no longer be able to do that? Like
- 01:48that really critical piece. I think all
- 01:50students have felt like this. Like if
- 01:52you have AI write too many of your
- 01:53essays, at what point are you no longer
- 01:56able to write an essay? If you have AI
- 01:58write too much of your code, at what
- 01:59point can you no longer do that valuable
- 02:01piece of the architecture? So I suppose
- 02:03that's the part where like I think it's
- 02:05fun to use AI. I think people should be
- 02:07playing around with it, but you should
- 02:09be self-aware [music]
- 02:10and you should be self-aware of like are
- 02:12you also growing alongside the AI and
- 02:14you should care so much about your own
- 02:16personal [music] growth.
- 02:26I was born in Nairobi, Kenya. When I was
Can AI Make You Want to Learn?
- 02:2812, I moved to Koalaur, Malaysia, and
- 02:30ended up coming to the US for
- 02:32university. I was just a curious human.
- 02:35I wasn't set on being a professor from
- 02:38day one. I just like learning and I
- 02:41liked interesting problems. When I came
- 02:43to Stanford, I I'd done a little bit of
- 02:46coding, but I I really didn't know how
- 02:47to program. But like I had to fill an
- 02:50elective, so I just had to take a class
- 02:52and I was like, "Okay, I'll do the the
- 02:54programming class." And my teacher did
- 02:56the most wonderful thing. They said, "At
- 02:58this point, I'm going to have a
- 03:00challenge. everyone in class, go make
- 03:02the most wonderful things with what
- 03:04you've learned in the first two weeks of
- 03:05programming. And I found myself able to
- 03:08put like 40 hours of extra work beyond
- 03:11my normal schooling into this challenge
- 03:12because I was so excited. Uh, and then
- 03:16eventually I discovered uh that I was so
- 03:19curious about how people learned and I
- 03:22decided Professor was the right thing
- 03:23for me.
- 03:24So, Carol speaks this thing called
- 03:26Python uh which we're going to be using
- 03:28as our programming language throughout
- 03:30the course. So Carol is our lovable
- 03:32robot and Carol lives in a world. We
- 03:35think of the world as kind of having a
- 03:37north, west, south, and east [music] and
- 03:39having compass directions. Come on,
- 03:41Carol. Turn left and then turn left and
- 03:44then turn left. Oh, and we got to turn
- 03:48right.
- 03:48It's the class in the world with the
- 03:49most teachers. There's one teacher for
- 03:51every 10 students and there's about
- 03:5317,000 students and more than a thousand
- 03:55teachers. So what problem was I trying
- 03:57to solve? Let's go back in time. It's
- 04:00early days in the pandemic. I'm about to
- 04:02teach Stanford's flagship intro to
- 04:04coding class and I'm been told that
- 04:07everything's [music] going to be online.
- 04:09And in this moment, we're thinking the
- 04:11world is suffering. While we're putting
- 04:13the class online, is there something
- 04:14that we can also do to help the world?
- 04:16We can just put our videos online. And
- 04:18we thought people might get a little bit
- 04:20out of it, but we know that it would be
- 04:22a lot less than what our Stanford
- 04:24students get because our Stanford
- 04:25students get the special sauce of
- 04:27Stanford education. And the special
- 04:29sauce of Stanford education for introcs
- 04:32is you get a section leader. You get
- 04:34somebody who's just a little bit older
- 04:36than you, a little bit further along in
- 04:37their career, who's going to take time
- 04:39to help you grow. One of the common
- 04:42misconceptions is just thinking that AI
- 04:44tutors will solve everything. We
- 04:46basically have AI tutors already, but
- 04:49that isn't moving the needle in the way
- 04:51people expected. [music] So over the
- 04:53last 6 years, so we've now done this six
- 04:55times, we've tried a lot of different
- 04:57experiments where we gave people
- 04:58different dosage of AI and we have
- 05:00learned something very surprising. If we
- 05:02give people AI in just like here's a
- 05:04chatbot, use it to learn. Predictably,
- 05:07people will drop out. People get
- 05:09demotivated. It is demotivating to have
- 05:11AI thrown at you at the wrong moment of
- 05:13your learning. We have found very
- 05:16nuanced ways where we can use AI that
- 05:18actually helps people learn. But if you
- 05:19contrast that with humans, so if I throw
- 05:22AI at you, you're probably going to
- 05:24become a little bit demotivated
- 05:25statistically.
- 05:26But what happens if I throw a human at
- 05:28you? Imagine you're just programming in
- 05:30code in place. You might get a popup and
- 05:32it says, "Hey, there's a teacher online
- 05:33and they'd like to spend 10 minutes with
- 05:35you. Do you want to talk to them?" If
- 05:36you hit yes, your probability of
- 05:38completing the course goes up 10
- 05:40percentage points. So you must be
- 05:41thinking, "Oh, the humans must be saying
- 05:43the right things and the AI must be
- 05:44saying the wrong things." We've looked
- 05:46at these conversations. The AI was
- 05:47correct. It wasn't hallucinating. not
- 05:49for intro programming and the the humans
- 05:50weren't always correct,
- 05:53but the human touch is special. It's
- 05:56motivating and I think we all need
- 05:57motivation right now. Everyone needs
- 06:00something to convince them, I'm not
- 06:02going to make Claude do all the thinking
- 06:05for me. Like to actually do the thinking
- 06:07yourself takes extra energy.
- 06:10Crown jewel of education has always been
- 06:11motivation. And it's a lot more
- 06:13motivating for me to [music] say, I care
- 06:15about you being a smart person. I'm not
- 06:17giving up on you being a smart person
- 06:18this time of AI. [music] Um, let's work
- 06:21on your foundations and then when you're
- 06:22done with your foundations, I'll teach
- 06:24you how to code [music] with AI. That
- 06:25works so much better. When I look at
- 06:29chat bots, I think they do a [music]
- 06:30good job of answering my question. But
- 06:32one challenge I would pose to anybody
- 06:34thinking about how to make these work
- 06:35better for education is how do you get
- 06:38it to [music] inspire? Sometimes I will
- 06:40inspire my students in a deep way. And
- 06:42it could be like you come into my office
- 06:43and be like, "Hey, do you want to see
- 06:44something really cool about
- 06:45probability?" and I just showed them
- 06:47something really neat and they weren't
- 06:48even thinking about that wasn't the
- 06:49question they came in with. But then
- 06:50they they feel that like love and like
- 06:52that that inspiration and [music] as I
- 06:54said if I can flip the switch of getting
- 06:57the student so curious that they can't
- 06:59help but learn like the rest of the day
- 07:01all they can think about is the problem
- 07:03that I just posed to them or that cool
- 07:04thing I showed to them. If that
- 07:06curiosity gets ignited uh then I feel
- 07:08like they'll get there. And when I look
- 07:10at current chat bots [music] they are
- 07:11not igniting curiosity that much. It's
- 07:14it's not like you never show up to chat.
- 07:15[music] It's like, "Hey, do you want to
- 07:16just see something that is going to make
- 07:18your mind explode [music] that will like
- 07:20you know pull you in?" Now, as a
- 07:23teacher, I can do that because I have
- 07:24some context on my students. I know
- 07:27largely where they are and largely where
- 07:29they're trying to go. So, I can be very
- 07:31delicate [music] in the choice of the
- 07:33inspiring example or the inspiring
- 07:36challenge to pose to my students. If you
- 07:37just think an AI tutor will solve the
- 07:40clarity problem, you might miss it. the
- 07:42bigger piece of the puzzle. And I feel
- 07:44like if we leverage this, we can have a
- 07:46nicer world.
Granola, the AI meeting assistant
- 07:48The deepest understanding doesn't come
- 07:50in the moment. It's built beforehand.
- 07:52Same goes for us. Before the main
- 07:54interview, we always do a pre-in call
- 07:58and Granola quietly transcribes it in
- 08:00[music] the background. No bot ever
- 08:02joining, turning it into clean notes.
- 08:04So, we built our own recipe for this.
- 08:06It's called interview prep. We wrote the
- 08:08prompt once with everything we want
- 08:10before a shoot. And now it's one click
- 08:12every time.
- 08:14Then minutes before the cameras roll, we
- 08:16[music] run it right on that pre-in
- 08:18call. In seconds, it surfaces the story
- 08:21worth telling, [music] the threads worth
- 08:22pulling, and the questions worth asking.
- 08:25It's like having the whole transcript in
- 08:27your head without ever opening it. So,
- 08:29we sit down already knowing where it
- 08:31should go. It's not a generic checklist.
- 08:33Every line [music] is drawn from the
- 08:35real discussion we just had, shaped by
- 08:37exactly how we like to prep. Less time
- 08:39scrambling to remember, more time fully
- 08:41present in the room. Turns out, the more
- 08:43you prepare, the more you understand.
- 08:46Try recipes today. New users get 100%
- 08:49off their first month at the link in the
- 08:51description.
Why Now Is the Best Time to Learn Coding
- 08:57I'm seeing more people with a
- 08:59motivational crisis than I have in the
- 09:01past. And that makes sense. there's more
- 09:03uncertainty in the world. You know, you
- 09:06can think about what can I contribute
- 09:08with AI of 2026, but I think students
- 09:10are faced with a much harder problem of
- 09:12thinking about well, if I'm starting a
- 09:134-year program, I have to think about
- 09:15what jobs are going to exist in 2030
- 09:18when AI is 4 years more advanced. And
- 09:20and that's a lot of uncertainty for
- 09:21students, and I empathize with this
- 09:23quite a lot. In 5 to 10 years, many
- 09:26things will change. The future has
- 09:27always been unpredictable. It's always
- 09:29been the case that if you ask people to
- 09:30project what jobs will be the right jobs
- 09:335 to 10 years people always get it
- 09:35wrong. Here's an interesting anecdote
- 09:37though. So when I was young I'm old man
- 09:40now but when I was young and this in my
- 09:42PhD is around the time that one of my
- 09:44now colleagues [music] was making some
- 09:46of the first major milestones in
- 09:48self-driving cars and this is back in
- 09:50like 2011 2012. And at that moment, you
- 09:53would see this car drive and [music] you
- 09:55think, "Oh my god, what does it mean to
- 09:56be a taxi driver or what does it mean to
- 10:00be a truck driver?" But in fact, what
- 10:03happened is the truck driver profession
- 10:04has been growing at a very healthy rate.
- 10:07Um, now I don't know what the future
- 10:08holds for truck drivers. Maybe one day
- 10:10we'll come to an inflection point. But
- 10:11there was a lot of reasons that people
- 10:13underestimated.
- 10:15They underestimate like, well, if you
- 10:17have valuable cargo, you need a person
- 10:19who's responsible or the longtail sort
- 10:21of experiences. There's always something
- 10:22different happening on highway. 99% of
- 10:24the experiences can be the same, but
- 10:26like that 1% of things that are
- 10:27different. It's so hard to have a AI
- 10:30master all of them. I think one day
- 10:32eventually we'll have fully self-driving
- 10:34cars and we'll live in a world where all
- 10:35our cars are driven by an AI system. But
- 10:38what I was surprised about was how
- 10:41grossly we overestimate how quickly we
- 10:44get there. I think everyone who's worked
- 10:47deeply with AI has had this experience
- 10:49of by outsourcing a lot of thinking to
- 10:52AI, I am getting more separated from
- 10:56problem solving myself. A good example
- 10:58right now is [music] I program with AI a
- 11:00lot, but I happen to know a lot about
- 11:03programming and architecture. And if I
- 11:05don't know a lot about programming
- 11:06architecture, AI will start to make some
- 11:08poor decisions, which I might not
- 11:09experience the first time I make a
- 11:11prototype, but like five weeks down the
- 11:13line when students are actually using my
- 11:14thing, they might start to hit weird
- 11:16bugs. And if I don't understand the
- 11:17architecture, I can't help them. I
- 11:19suppose if I start outsourcing, at what
- 11:22point will I no longer be able to do
- 11:24that? like that really critical piece.
- 11:27Uh I think all students have felt like
- 11:29this. Like if you have AI write too many
- 11:31of your essays, at what point are you no
- 11:33longer able to write an essay? Uh if you
- 11:35have AI write too much of your code, at
- 11:37what point can you no longer do that
- 11:38valuable piece of the architecture? Um
- 11:41so I suppose that's the part where like
- 11:44I think it's fun to use AI. I think
- 11:45people should be playing around with it,
- 11:47but you should be self-aware and you
- 11:49should be self-aware of like are you
- 11:51also growing alongside the AI and you
- 11:53should care so much about your own
- 11:54personal growth. When you're learning
- 11:57how to program [music] largely you can
- 11:58separate into two pieces. One piece is
- 12:01you're learning the syntax of how do we
- 12:03tell computers to do things and the
- 12:06other thing you're learning is basically
- 12:08problem solving like how do you take big
- 12:09problems and break them down into small
- 12:11pieces. um how do you set it up so that
- 12:14data can [music] speak to algorithms?
- 12:16How do you think about algorithms? So
- 12:19I'm going to say AI is going to get
- 12:20really really good at just the syntax.
- 12:22It's less important in the future that
- 12:24you've memorized every command. [music]
- 12:26It's probably more important that you
- 12:27know how to problem solve. So while
- 12:29you're learning to program, really focus
- 12:31on that problem solving ability. There's
- 12:34one thing about coding that's special.
- 12:37You get immediate falsifiable feedback.
- 12:40Like if your logic is wrong, your thing
- 12:42doesn't work and you get to see that and
- 12:44you get to iterate quickly. Whereas if
- 12:46you apply problem solving to life, you
- 12:48could make a poor decision, but the
- 12:50feedback cycle is so slow that you don't
- 12:52get to practice getting better and
- 12:54better at making decisions. So there's a
- 12:55couple things about coding that makes it
- 12:57particularly good at teaching how to
- 12:59problem solve. The the question, how do
- 13:00you become like a really high
- 13:03contributor [music]
- 13:04engineer? You might not find my answer
- 13:06that surprising, but it's like it's time
- 13:08on task. It's like how much time are you
- 13:10spending actually creating things? And
- 13:12I'm going to separate you creating
- 13:14versus you giving it to Claude Code.
- 13:16Now, by the way, you know what I would
- 13:18do if I was a young person? I would make
- 13:20a lot of prototypes with cloud code and
- 13:21I'd say, "Cloud code, teach me all the
- 13:23most important things that you did in
- 13:25order to create this." And I would
- 13:26iterate that way and I get lots of
- 13:28experience so I can try and figure out
- 13:30what are the most important concepts.
- 13:32I'll give your young engineers a
- 13:33particular challenge. As I said, it's a
- 13:36confusing time, but there's an
- 13:37opportunity that didn't exist before.
- 13:38One of the things that's happened is
- 13:40barriers to entries have been cut. You
- 13:42could be a 12th grader, so an
- 13:4418-year-old with a friend. You might be
- 13:47able to make a high quality startup. The
- 13:49two of you could make a pretty
- 13:50impressive codebase that solves an
- 13:52interesting problem. There is a real art
- 13:54form to knowing what is a valuable
- 13:57problem to solve. uh and I think more
- 13:59and more junior [music] engineers get to
- 14:02engage with that art form like what is
- 14:05worth actually making what do users want
- 14:07what's the feature that will help them
- 14:10make progress in whatever their problems
- 14:12are so that ability to interface between
- 14:14what are computers able to do and what
- 14:17do humans actually need has always been
- 14:19a critical high order skill and I think
- 14:22if I were a junior engineer I would
- 14:24start working on that skill now I
- 14:26wouldn't wait till I was a senior
- 14:27engineer
- 14:31If you start with the premise that my
Start With This Axiom: The Next Generation Will Be Smarter Than Us
- 14:34children will become smart people and
- 14:35your children will become smart people.
- 14:37If you don't have children then maybe
- 14:38your nephews and nieces will become
- 14:39smart people. You start from the premise
- 14:40that the next generation will be filled
- 14:42with people who are smarter than we are.
- 14:44Then you're like, okay, how do we get
- 14:46them to that point? And then you look at
- 14:48any subject, probability, computer
- 14:50science, and when you look at any
- 14:52subject, there's often [music]
- 14:53foundational concepts and then you'll
- 14:55have layers of complexity built on top
- 14:57of it. If you expect them to become
- 14:59smarter than you are, it's really hard
- 15:01to skip the foundations. And one way of
- 15:03thinking about that is we've had
- 15:04calculators to do multiplication for a
- 15:05long time. Kids still need to learn
- 15:07multiplication. Now, there's a subtle
- 15:09difference. The concept of
- 15:10multiplication is so critical, but
- 15:13actually knowing how to do the wrote,
- 15:15you know, if I ask you like what's 13*
- 15:177? [music] Go quick. That's not as
- 15:18important as just knowing what is
- 15:20multiplication. But you can't skip the
- 15:21foundations, but you can maybe
- 15:23[music]
- 15:23uh be more artful about what you focus
- 15:25on. I kind of take it as an axiom that
- 15:30I'm not giving up on the next
- 15:31generation. Honestly, the people I've
- 15:33seen get most lost and most demotivated
- 15:35in this motiv AI are sometimes the ones
- 15:37who are overthinking it. I had a
- 15:39student, he was just doing such
- 15:40wonderful things. He was using AI, he
- 15:42was solving problems, he was learning
- 15:43amazing things. I asked, "Hey, wonderful
- 15:45student like what are you thinking
- 15:46about?" And he says, "I actually don't
- 15:48think about it. I don't really think
- 15:50about the future of AI and that allows
- 15:51me to thrive."
- 15:53And that gave me pause. I think about AI
- 15:55all the time. I feel like I think about
- 15:56AI 10 times a day and then the
- 15:58simplicity of like no I'm just going to
- 16:01be curious and learn since that day I
- 16:03start my day with the axiom. I don't ask
- 16:06why I care about the next generation be
- 16:08smarter. I take it as a truth. I want
- 16:10this and I will work towards it. It's a
- 16:12tool and it will multiply
- 16:16humans. So when humans are at our best,
- 16:18we can use this tool to multiply us.
- 16:20Like the doctor who really cares about
- 16:22their patient now has a tool that they
- 16:24can do more faster, more accurately. The
- 16:27teacher who really cares about their
- 16:29students, who is passionate about them
- 16:31learning, they can go further with their
- 16:33students and they can do more. Also, I
- 16:35get to see young people all the time.
- 16:38And I would say that gives me
- 16:41inspiration. Seeing their
- 16:42self-awareness, how critical they're
- 16:45thinking, seeing them blossoming, it
- 16:48gives you optimism. If I was a young
- 16:50person right now, the most valuable
- 16:52thing is that you have the
- 16:52self-awareness. You should also have the
- 16:54goal that I will become smarter. Chris
- 16:56is not giving up on you, you should not
- 16:58give up on yourself either.
- 17:00I have two kids under five. [music] And
- 17:03you know what? They're going to live in
- 17:05an awesome world. Like, we're going to
- 17:06adapt. We're going to figure things out.
- 17:08They're going to still have curiosities.
- 17:11They're going to still grow their minds.
- 17:12And [music] we're going to keep every
- 17:14day working towards that.
- 17:17The top engineer might not be the person
- 17:19who knows all the code. Maybe the top
- 17:21engineer is a person who can relate the
- 17:23real world human problems [music] into
- 17:25the world of apps into the world of data
- 17:28science and into the world of research.
- 17:30[music] So go make stuff. Make stuff
- 17:33that people use. Make stuff that people
- 17:34love. And in that process of iteration,
- 17:37you have an opportunity to become
- 17:39excellent at coding and excellent at
- 17:42problem solving. Just take [music]
- 17:43axioms. You will become smarter than you
- 17:46were yesterday. Start your day like
- 17:48that.