Leveraging Print Debugging to Improve Code Generation in Large Language Models

Xueyu Hu, Kun Kuang, Jiankai Sun, Hongxia Yang, Fei Wu
1/10/2024
cs.CLcs.SE

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

Abstract

Large language models (LLMs) have made significant progress in code generation tasks, but their performance in tackling programming problems with complex data structures and algorithms remains suboptimal. To address this issue, we propose an in-context learning approach that guides LLMs to debug by using a "print debugging" method, which involves inserting print statements to trace and analysing logs for fixing the bug. We collect a Leetcode problem dataset and evaluate our method using the Leetcode online judging system. Experiments with GPT-4 demonstrate the effectiveness of our approach, outperforming rubber duck debugging in easy and medium-level Leetcode problems by 1.5% and 17.9%.

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. 2 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{hu2024leveraging,
  title  = {Leveraging Print Debugging to Improve Code Generation in Large Language Models},
  author = {Xueyu Hu and Kun Kuang and Jiankai Sun and Hongxia Yang and Fei Wu},
  year   = {2024},
  eprint = {2401.05319},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2401.05319v1}
}

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/2401.05319.svg)](https://codeofpaper.com/paper/2401.05319)

Discussion