The Behavior of Large Language Models When Prompted to Generate Code Explanations

Priti Oli, Rabin Banjade, Jeevan Chapagain, Vasile Rus
11/2/2023
cs.SEcs.AI

No confident code implementation found for this paper. 4 possible matches can be shown below.

Abstract

This paper systematically investigates the generation of code explanations by Large Language Models (LLMs) for code examples commonly encountered in introductory programming courses. Our findings reveal significant variations in the nature of code explanations produced by LLMs, influenced by factors such as the wording of the prompt, the specific code examples under consideration, the programming language involved, the temperature parameter, and the version of the LLM. However, a consistent pattern emerges for Java and Python, where explanations exhibit a Flesch-Kincaid readability level of approximately 7-8 grade and a consistent lexical density, indicating the proportion of meaningful words relative to the total explanation size. Additionally, the generated explanations consistently achieve high scores for correctness, but lower scores on three other metrics: completeness, conciseness, and specificity.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. 4 weaker matches are hidden by default — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{oli2023behavior,
  title  = {The Behavior of Large Language Models When Prompted to Generate Code Explanations},
  author = {Priti Oli and Rabin Banjade and Jeevan Chapagain and Vasile Rus},
  year   = {2023},
  eprint = {2311.01490},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2311.01490v2}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2311.01490.svg)](https://codeofpaper.com/paper/2311.01490)

Discussion