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