Abstract
This research paper explores to what extent large language models (LLMs) can generate line-by-line explanations of code examples used in intro-to-programming courses such as CS1 (Computer Science) and CS2. While it is known that LLMs can generate code explanations, a systematic analysis of those explanations and their appropriateness for instructional and learning purposes is needed, which is the goal of this paper. Specifically, the paper explores how different types of prompts impact the nature and quality of line-by-line explanations relative to human expert explanations. We report a quantitative and qualitative analysis that compares AI-generated explanations with explanations produced by human experts. Furthermore, we investigate to what degree LLM can generate explanations for learners of various levels of mastery.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Similar content being viewed by others
References
Abdi, S., Khosravi, H., Sadiq, S., Demartini, G.: Evaluating the quality of learning resources: a learner sourcing approach. IEEE Trans. Learn. Technol. 14(1), 81–92 (2021)
Aleven, V.A., Koedinger, K.R.: An effective metacognitive strategy: learning by doing and explaining with a computer-based cognitive tutor. Cogn. Sci. 26(2), 147–179 (2002)
Barke, S., James, M.B., Polikarpova, N.: Grounded copilot: how programmers interact with code-generating models. Proc. ACM Programm. Lang. 7(OOPSLA1), 85–111 (2023)
Chi, M.T.: Self-explaining expository texts: the dual processes of generating inferences and repairing mental models. Adv. Instr. Psychol. 5, 161–238 (2000)
Denny, P., Kumar, V., Giacaman, N.: Conversing with copilot: exploring prompt engineering for solving CS1 problems using natural language. In: Proceedings of the 54th ACM Technical Symposium on Computer Science Education, vol. 1, pp. 1136–1142 (2023)
Denny, P., Luxton-Reilly, A., Simon, B.: Quality of student contributed questions using PeerWise. In: Proceedings of the Eleventh Australasian Conference on Computing Education-Volume 95, pp. 55–63 (2009)
Denny, P., Prather, J., Becker, B.A.: Error message readability and novice debugging performance. In: Proceedings of the 2020 ACM Conference on Innovation and Technology in Computer Science Education, ITiCSE 2020, pp. 480–486. Association for Computing Machinery, New York, NY, USA (2020)
Denny, P., et al.: On designing programming error messages for novices: readability and its constituent factors. In: Proceedings of the 2021 CHI Conference on Human Factors in Computing Systems (2021)
Finnie-Ansley, J., Denny, P., Becker, B., Luxton-Reilly, A., Prather, J.: The robots are coming: exploring the implications of OpenAI codex on introductory programming. In: Proceedings of the 24th Australasian Computing Education Conference, pp. 10–19 (2022)
Golchin, S., Surdeanu, M.: Time travel in LLMs: tracing data contamination in large language models. arXiv e-prints (2023)
Graesser, A.C., Chipman, P., Haynes, B.C., Olney, A.: AutoTutor: an intelligent tutoring system with mixed-initiative dialogue. IEEE Trans. Educ. 48(4), 612–618 (2005)
Hicks, A., Akhuseyinoglu, K., Shaffer, C., Brusilovsky, P.: Live catalog of smart learning objects for computer science education. In: Sixth SPLICE Workshop “Building an Infrastructure for Computer Science Education Research and Practice at Scale” (2020)
Johansson, V.: Lexical diversity and lexical density in speech and writing: a developmental perspective. In: Working papers/Lund University, Department of Linguistics and Phonetics, vol. 53, pp. 61–79 (2008)
Leinonen, J., et al.: Comparing code explanations created by students and large language models (2023)
Leinonen, J., Pirttinen, N., Hellas, A.: Crowdsourcing content creation for SQL practice. In: Proceedings of the 2020 ACM Conference on Innovation and Technology in Computer Science Education, pp. 349–355 (2020)
MacNeil, S., et al.: Experiences from using code explanations generated by large language models in a web software development e-book. In: Proceedings of the 54th ACM Technical Symposium on Computer Science Education, vol. 1, pp. 931–937 (2023)
MacNeil, S., Tran, A., Mogil, D., Bernstein, S., Ross, E., Huang, Z.: Generating diverse code explanations using the GPT-3 large language model. In: Proceedings of the 2022 ACM Conference on International Computing Education Research-Volume 2, pp. 37–39 (2022)
Murphy, L., McCauley, R., Fitzgerald, S.: ‘Explain in plain English’ questions: implications for teaching. In: Proceedings of the 43rd ACM Technical Symposium on Computer Science Education, pp. 385–390 (2012)
Oli, P., Banjade, R., Chapagain, J., Rus, V.: The behavior of large language models when prompted to generate code explanations. arXiv preprint arXiv:2311.01490 (2023)
Peng, H., Li, G., Zhao, Y., Jin, Z.: Rethinking positional encoding in tree transformer for code representation. In: Proceedings of the 2022 Conference on Empirical Methods in Natural Language Processing, December 2022
Pirttinen, N., Kangas, V., Nikkarinen, I., Nygren, H., Leinonen, J., Hellas, A.: Crowdsourcing programming assignments with CrowdSorcerer. In: Proceedings of the 23rd Annual ACM Conference on Innovation and Technology in Computer Science Education, pp. 326–331 (2018)
Roy, M., Chi, M.T.: The self-explanation principle in multimedia learning. In: The Cambridge Handbook of Multimedia Learning, pp. 271–286 (2005)
Rugaber, S.: The use of domain knowledge in program understanding. Ann. Softw. Eng. 9(1), 143–192 (2000)
Rus, V., et al.: An intelligent tutoring system for source code comprehension. In: The 20th International Conference on Artificial Intelligence in Education, 25–29 June, Chicago, IL, USA (2019)
Rus, V., Niraula, N., Banjade, R.: DeepTutor: an effective, online intelligent tutoring system that promotes deep learning. In: Proceedings of the AAAI Conference on Artificial Intelligence, vol. 29 (2015)
Sarsa, S., Denny, P., Hellas, A., Leinonen, J.: Automatic generation of programming exercises and code explanations using large language models. In: Proceedings of the 2022 ACM Conference on International Computing Education Research-Volume 1, pp. 27–43 (2022)
Sridhara, G., Hill, E., Muppaneni, D., Pollock, L., Vijay-Shanker, K.: Towards automatically generating summary comments for Java methods. In: Proceedings of the 25th IEEE/ACM International Conference on Automated Software Engineering, pp. 43–52 (2010)
Tack, A., Piech, C.: The AI teacher test: measuring the pedagogical ability of blender and GPT-3 in educational dialogues. arXiv preprint arXiv:2205.07540 (2022)
Tian, H., et al.: Is ChatGPT the ultimate programming assistant – how far is it? (2023). arXiv:2304.11938
Vaithilingam, P., Zhang, T., Glassman, E.L.: Expectation vs. experience: evaluating the usability of code generation tools powered by large language models. In: CHI Conference on Human Factors in Computing Systems Extended Abstracts, pp. 1–7 (2022)
VanLehn, K., Jones, R.M., Chi, M.T.: A model of the self-explanation effect. J. Learn. Sci. 2(1), 1–59 (1992)
Zhang, T., Kishore, V., Wu, F., Weinberger, K.Q., Artzi, Y.: BERTScore: evaluating text generation with BERT. arXiv preprint arXiv:1904.09675 (2019)
Acknowledgements
This work has been supported by the following grants awarded to Dr. Vasile Rus: the Learner Data Institute (NSF award 1934745); CSEdPad (NSF award 1822816); and iCODE (IES award R305A220385). The opinions, findings, and results are solely those of the authors and do not reflect those of NSF or IES.
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2024 The Author(s), under exclusive license to Springer Nature Switzerland AG
About this paper
Cite this paper
Chapagain, J., Sajib, M.I., Prodan, R., Rus, V. (2024). A Study of LLM Generated Line-by-Line Explanations in the Context of Conversational Program Comprehension Tutoring Systems. In: Ferreira Mello, R., Rummel, N., Jivet, I., Pishtari, G., Ruipérez Valiente, J.A. (eds) Technology Enhanced Learning for Inclusive and Equitable Quality Education. EC-TEL 2024. Lecture Notes in Computer Science, vol 15159. Springer, Cham. https://doi.org/10.1007/978-3-031-72315-5_5
Download citation
DOI: https://doi.org/10.1007/978-3-031-72315-5_5
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-031-72314-8
Online ISBN: 978-3-031-72315-5
eBook Packages: Computer ScienceComputer Science (R0)