GPT-3-Powered Type Error Debugging: Investigating the Use of Large Language Models for Code Repair

被引:11
|
作者
Ribeiro, Francisco [1 ]
Castro de Macedo, Jose Nuno [1 ]
Tsushima, Kanae [2 ]
Abreu, Rui [3 ]
Saraiva, Joao [1 ]
机构
[1] Univ Minho, HASLab, INESC TEC, Braga, Portugal
[2] Sokendai Univ, Natl Inst Informat, Tokyo, Japan
[3] Univ Porto, INESC ID, Porto, Portugal
关键词
Automated Program Repair; GPT-3; Fault Localization; Code Generation;
D O I
10.1145/3623476.3623522
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
Type systems are responsible for assigning types to terms in programs. That way, they enforce the actions that can be taken and can, consequently, detect type errors during compilation. However, while they are able to flag the existence of an error, they often fail to pinpoint its cause or provide a helpful error message. Thus, without adequate support, debugging this kind of errors can take a considerable amount of effort. Recently, neural network models have been developed that are able to understand programming languages and perform several downstream tasks. We argue that type error debugging can be enhanced by taking advantage of this deeper understanding of the language's structure. In this paper, we present a technique that leverages GPT-3's capabilities to automatically fix type errors in OCaml programs. We perform multiple source code analysis tasks to produce useful prompts that are then provided to GPT-3 to generate potential patches. Our publicly available tool, Mentat, supports multiple modes and was validated on an existing public dataset with thousands of OCaml programs. We automatically validate successful repairs by using Quickcheck to verify which generated patches produce the same output as the user-intended fixed version, achieving a 39% repair rate. In a comparative study, Mentat outperformed two other techniques in automatically fixing ill-typed OCaml programs.
引用
收藏
页码:111 / 124
页数:14
相关论文
共 33 条
  • [1] Investigating large language models capabilities for automatic code repair in Python']Python
    Omari, Safwan
    Basnet, Kshitiz
    Wardat, Mohammad
    CLUSTER COMPUTING-THE JOURNAL OF NETWORKS SOFTWARE TOOLS AND APPLICATIONS, 2024, 27 (08): : 10717 - 10731
  • [2] Evaluating Large Language Models for G-Code Debugging, Manipulation, and Comprehension
    Jignasu, Anushrut
    Marshall, Kelly
    Ganapathysubramanian, Baskar
    Balu, Aditya
    Hegde, Chinmay
    Krishnamurthy, Adarsh
    2024 IEEE LLM AIDED DESIGN WORKSHOP, LAD 2024, 2024,
  • [3] Investigating the Efficacy of Large Language Models for Code Clone Detection
    Khajezade, Mohamad
    Wu, Jie J. W.
    Fard, Fatemeh Hendijani
    Rodriguez-Perez, Gema
    Shehata, Mohamed Sami
    PROCEEDINGS 2024 32ND IEEE/ACM INTERNATIONAL CONFERENCE ON PROGRAM COMPREHENSION, ICPC 2024, 2024, : 161 - 165
  • [4] The use of large language models for program repair
    Zubair, Fida
    Al-Hitmi, Maryam
    Catal, Cagatay
    COMPUTER STANDARDS & INTERFACES, 2025, 93
  • [5] The Magic of IF: Investigating Causal Reasoning Abilities in Large Language Models of Code
    Liu, Xiao
    Yin, Da
    Zhang, Chen
    Feng, Yansong
    Zhao, Dongyan
    FINDINGS OF THE ASSOCIATION FOR COMPUTATIONAL LINGUISTICS (ACL 2023), 2023, : 9009 - 9022
  • [6] Enhanced automated code vulnerability repair using large language models
    de-Fitero-Dominguez, David
    Garcia-Lopez, Eva
    Garcia-Cabot, Antonio
    Martinez-Herraiz, Jose-Javier
    ENGINEERING APPLICATIONS OF ARTIFICIAL INTELLIGENCE, 2024, 138
  • [7] Large Language Models for Code Obfuscation Evaluation of the Obfuscation Capabilities of OpenAI's GPT-3.5 on C Source Code
    Kochberger, Patrick
    Gramberger, Maximilian
    Schrittwieser, Sebastian
    Lawitschka, Caroline
    Weippl, Edgar R.
    PROCEEDINGS OF THE 20TH INTERNATIONAL CONFERENCE ON SECURITY AND CRYPTOGRAPHY, SECRYPT 2023, 2023, : 7 - 19
  • [8] Large Language Models in Automated Repair of Haskell Type Errors
    Santos, Sofia
    Saraiva, Joao
    Ribeiro, Francisco
    2024 ACM/IEEE INTERNATIONAL WORKSHOP ON AUTOMATED PROGRAM REPAIR, APR 2024, 2024, : 42 - 45
  • [9] The (ab)use of Open Source Code to Train Large Language Models
    Al-Kaswan, Ali
    Izadi, Maliheh
    2023 IEEE/ACM 2ND INTERNATIONAL WORKSHOP ON NATURAL LANGUAGE-BASED SOFTWARE ENGINEERING, NLBSE, 2023, : 9 - 10
  • [10] Playing Games with Ais: The Limits of GPT-3 and Similar Large Language Models
    Sobieszek, Adam
    Price, Tadeusz
    MINDS AND MACHINES, 2022, 32 (02) : 341 - 364