Comparing Code Explanations Created by Students and Large Language Models

By Juho Leinonen, Paul Denny, Stephen MacNeil, Sami Sarsa, Seth Bernstein, Joanne Kim, Andrew Tran, Arto Hellas. 2023

209 citations recorded by the source corpus.

Reasoning about code and explaining its purpose are fundamental skills for computer scientists. There has been extensive research in the field of computing education on the relationship between a student's ability to explain code and other skills such as writing and tracing code. In particular, the ability to describe at a high-level of abstraction how code will behave over all possible inputs correlates strongly with code writing skills. However, developing the expertise to comprehend and explain code accurately and succinctly is a challenge for many students. Existing pedagogical approaches that scaffold the ability to explain code, such as producing exemplar code explanations on demand, do not currently scale well to large classrooms. The recent emergence of powerful large language models (LLMs) may offer a solution. In this paper, we explore the potential of LLMs in generating explanations that can serve as examples to scaffold students' ability to understand and explain code. To evaluate LLM-created explanations, we compare them with explanations created by students in a large course (n ≈ 1000) with respect to accuracy, understandability and length. We find that LLM-created explanations, which can be produced automatically on demand, are rated as being significantly easier to understand and more accurate summaries of code than student-created explanations. We discuss the significance of this finding, and suggest how such models can be incorporated into introductory programming education.

Subfields: Artificial Intelligence, Information Systems, Information Systems and Management, Large Language Models, Code Generation & Program Synthesis

How researchers see this paper

The researchers whose trusted networks rank it highest, strongest advocate first. Every researcher gets a different order.

In Artificial Intelligence

  1. Luke S. Zettlemoyer
  2. Siva Reddy
  3. Mohit Bansal
  4. Percy Liang
  5. Jianfeng Gao
  6. Mirella Lapata
  7. Hannaneh Hajishirzi
  8. Kyunghyun Cho

In Information Systems

  1. Paul Denny
  2. Juho Leinonen
  3. Sami Sarsa
  4. Arto Hellas
  5. Andrew Luxton-Reilly
  6. Ming-Ho Yee
  7. James Prather
  8. Raymond Li

In Information Systems and Management

  1. Raymond Li
  2. Siva Reddy
  3. Tri Dao
  4. Dzmitry Bahdanau

In Large Language Models

  1. Paul Denny
  2. Juho Leinonen
  3. Sami Sarsa
  4. Arto Hellas
  5. Qian Liu
  6. James Prather
  7. Brett A. Becker
  8. Siva Reddy

In Code Generation & Program Synthesis

  1. Paul Denny
  2. Juho Leinonen
  3. Sami Sarsa
  4. Arto Hellas
  5. Qian Liu
  6. Raymond Li
  7. Carolyn Jane Anderson
  8. Arjun Guha

Citations in the corpus