Thoughts on Generative AI in Programming Courses

Over the past couple of years, rapid advancements in artificial intelligence, namely the rise of transformers and large language models, have called into question what software engineering (among nearly every other discipline) will look like in the future. Generative models promise huge boosts in programming efficiency, making them attractive to the tech industry. They also enable anyone to describe a desired end product in natural language and watch as the code is synthesized before their eyes. Changes like these are alarming, and they evoke many strong, often emotion-driven, opinions. You don’t have to look hard to find a sea of confident, contradictory claims about the utility of these tools and how we should grapple with their promises, their shortcomings, and their externalities.

As an educator, I am not sure of the best way to proceed, and this is only further complicated by the ever-accelerating developments in the field. I am sure many of you face similar uncertainties; you want (and deserve) to get an education that is relevant and sets you up well for a great career, but it’s unclear what this career will look like. You see the vast array of AI-enabled tools before you that have made it faster than ever to write code but aren’t sure whether this is a complement or a detriment to our discipline. Rather than answering these questions (which isn’t really possible) or confidently asserting my own opinions, I want to use this page to catalog some of my current thoughts and observations. The key word here is current; likely, some of these feelings may change over the next few years or even during this semester. I hope that this can be of some benefit to you, and I encourage you to come chat with me about your own thoughts, concerns, or questions.

1. Generative AI is here to stay

The promises of productivity gains make generative AI too beneficial a tool for the software engineering field to ignore. Much of the code that we write follows the same structures, design patterns, algorithms, etc. Reproducing this code by hand is not efficient, and offloading this to automated tools will allow us to focus on the higher-level design choices that differentiate the software we are writing. Becoming comfortable (I’m reluctant to use the word fluent, since it’s unclear how to gain fluency with tools that change every few months) with generative AI will be an important and marketable skill, just like computer proficiency was for many industries in decades past.

2. Generative AI is non-deterministic and lacks the ability to fully reason

At their core, large language models are complex functions that predict the next token (i.e., small snippet) of text given a sequence of preceding text. They are trained on large corpora (i.e., datasets) of text (e.g., vast collections of books, articles, social media posts, source code, etc.) so that they largely mimic their textual patterns. Somewhat remarkably (or unsurprisingly, depending on who you ask), this does a good job generating realistic, meaningful text (and similar ideas can be used to produce images, audio, etc.). However, at their core, these models are inherently non-deterministic. Rather than computing a fixed sequence of output tokens, they sample the tokens randomly from a computed distribution. This is why the same LLM prompt can elicit very different answers. In addition, token predictors alone do not reason about the validity or self-consistency of the text they are producing. While we are developing tools on top that can perform such checks and improve the reliability of the output, we are a long way from solving this problem (or even reasonably approximating a solution). As you have surely seen, LLMs are prone to hallucinations, so their output is accompanied by the caveat that it should not be relied upon.

3. Generative AI can benefit education

As a student, you have access to so many beneficial resources that did not exist even five years ago. You can use LLMs as tools to help explain concepts in other words, or to help generate additional questions for your studying (*keeping in mind point 2). The AI-enhanced IDEs (integrated development environments, like IntelliJ) have auto-complete and code analysis tools that help write code faster and better. While we are still writing all of the course materials and assignments by hand, generative AI promises educators the ability to more quickly create materials for our students.

4. Generative AI can harm learning

Much of the way that we learn comes from “struggling” with the material, sitting with a question or a prompt that can seem insurmountable at first and then slowly, and iteratively, making progress. When you are struggling on part of an assignment, you are compelled to look back at the lecture notes and to synthesize and apply those ideas. In doing this, you gain an understanding of how and when to apply the different tools from the course, so that you’ll be able to get “unstuck” faster the next time you’re in a similar situation. Assignments are carefully designed to scaffold this learning into a sequence of challenges. The understanding that comes from earlier parts helps inform decisions in the later parts. In the end, the value of these assignments comes not from the finished product, but the process to get there and the metacognition (i.e., thinking about how you thought about completing the assignment and what you learned from this) that accompanies this.

The nonpragmatic use of generative AI shortcuts this process. It enables you to reach a product without going through the process, thereby removing the opportunity to apply ideas from course material and limiting exposure to the course learning outcomes. If your goal is to walk away from the course with the expected level of comfort and capability with its material, you should avoid this. Of course, there is a nuance here. If you ever find yourself stuck (a level beyond struggling, where you’ve exhausted your resources and can’t find a way to navigate forward), then it’s important to seek help to get unstuck. A carefully constructed AI prompt (or a conversation in office hours, or a thread on Ed) can help with this. When you get this guidance, it’s important to engage in some metacognition to reflect on why you were stuck, what new idea helped you proceed, and how you can use this in a similar situation going forward.

5. Generative AI is more useful for experts than beginners

It has been widely reported that people with more programming experience are able to more effectively use AI to augment their process and increase their productivity. For beginners, it sometimes has the opposite effect. Experts are able to craft more detailed prompts, since they can better envision what the end-product should look like. Moreover, they are more adept at spotting and correcting hallucinations before they can adversely affect the project. Without content knowledge and experience (the things that assignments are meant to provide), errors slip by and can compound over multiple iteration cycles. In addition, by offloading planning and thinking to AI (something that experts are more reluctant to do, since they are more likely to see the value in the design phase), you can lose the ability to navigate the codebase during debugging, creating a deleterious feedback loop where reliance on AI increases, while the confidence in and quality of its outputs decreases.

I am worried that this is a phenomenon that we are experiencing in our courses. Students coming in with more programming experience are able to leverage the power of AI to enhance their learning (and score well on assignments, which would have likely happened even without AI use, albeit requiring more time and effort). Less-experienced students feel that they need AI to “catch up” and fail to gain the foundational knowledge that is necessary to use them effectively. Anecdotally, over the past two years (coinciding with the rising prevalence of LLMs), scores on the same 2110 assignments have gone down around 5% while completion times have gone up around 50%. While I lack the data to prove causality, my firsthand experience working with many students leads me to attribute much of this shift to the phenomenon described in the previous paragraph. You are free to draw your own conclusions from this data.

6. Generative AI has created an unfortunate adversarial relationship between professors and students

The rise of generative AI has brought about new challenges for professors and students. For professors (here, I’m speaking mostly from my own perspective, not trying to reflect a consensus opinion), it challenges the value that we place on work outside of class. Most learning happens through assignments and projects, where there is time and space to experiment and synthesize ideas, and we accounted for this effort by weighting assignments highly toward course grades. With the rise of generative AI, where it is hard to definitely determine which work is a student’s own, and where foundational homework assignments meant as “strength training” can be automated with little effort, it becomes difficult to maintain this viewpoint. For students, it can be difficult to manage differing AI policies between courses and understand where and when generative AI can be used.

The common approach of banning AI on assignments requires extensive resource allocation to identify and pursue violations, and it puts professors in conflict with their students; one side takes more and more sophisticated measures to “catch” students misusing AI while the other uses more and more sophisticated measures to evade detection. This is not helpful for learning. Students are left worrying that the work that they completed honestly can be falsely “flagged”, and professors worry about the fairness of identifying some improper AI use while letting others proceed undetected. The subject has largely become taboo because of this adversarial stance. Instead, we should look to each other to explore how these tools can be both helpful and detrimental in the classroom. I must acknowledge that students will use these tools in my classes, and I hope my students will think critically about their learning and decide how using (or deliberately not using) AI tools will impact this.

7. Looking forward, transparency with AI use will grow more important

The world is grappling with the consequences of ceding some creative output to AI models, some positive and some negative. From this, there has developed a new appreciation of human ingenuity and creativity. For society to be pragmatic about the use of AI, its use must be transparently disclosed. For computer scientists, we must be forthright about what we have written ourselves, what is written with tooling assistance from AI, and what is AI-generated. All of these come with their own reliability, maintainability, and security concerns that the users of the code must contend with.

8. Human interactions will continue to be important in computer science

As we will discuss throughout the course, creating software is a collaborative effort. Projects quickly grow larger than any one person can manage, and software systems have lifetimes that exceed one developer’s career. Programmers need to be able to communicate and work together to get various components to interoperate. Moreover, talking through design decisions, trade-offs, algorithmic approaches, etc. leads to better software. Zooming in, the process of learning computer science is also collaborative. We should look to the experience and guidance of others to explain things in new ways. We should ask questions and request clarification when we are confused, as others can benefit from having misconceptions addressed. In the end, we (the course staff and our students) are 400 people all aligned with the same goal, which is a powerful force for learning. While it may be easy or convenient to offload questions or tasks onto generative AI, I challenge you to make connections and build community this semester.

How to Use Generative AI well in CS 2110

Here you’ll find some of my thoughts and suggestions about how to use generative AI effectively in CS 2110. This list is not meant to be exhaustive or complete. I welcome you to share your thoughts with me about what worked well for you or what did not. I’ll update this advice as I see fit throughout the semester.

Assignments

Lecture and Discussion Review

Quiz and Exam Preparation