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 条
  • [21] A Loosely Wittgensteinian Conception of the Linguistic Understanding of Large Language Models like BERT, GPT-3, and ChatGPT
    Gubelmann, Reto
    GRAZER PHILOSOPHISCHE STUDIEN-INTERNATIONAL JOURNAL FOR ANALYTIC PHILOSOPHY, 2023, 99 (04): : 485 - 523
  • [22] From BERT to GPT-3 Codex: Harnessing the Potential of Very Large Language Models for Data Management
    Trummer, Immanuel
    PROCEEDINGS OF THE VLDB ENDOWMENT, 2022, 15 (12): : 3770 - 3773
  • [23] Do Natural Language Processing models understand simulations? Application of GPT-3 to translate simulation source code to English
    Jackson, Ilya
    Rolf, Benjamin
    IFAC PAPERSONLINE, 2023, 56 (02): : 221 - 226
  • [24] Evaluating Large Language Models for Real-World Vulnerability Repair in C/C plus plus Code
    Zhang, Lan
    Zou, Qingtian
    Singhal, Anoop
    Sun, Xiaoyan
    Liu, Peng
    PROCEEDINGS OF THE 10TH ACM INTERNATIONAL WORKSHOP ON SECURITY AND PRIVACY ANALYTICS, IWSPA 2024, 2024, : 49 - 58
  • [25] On the Use of Large Language Models at Solving Math Problems: A Comparison Between GPT-4, LlaMA-2 and Gemini
    Navarro, Alejandro L. Garcia
    Koneva, Nataliia
    Hernandez, Jose Alberto
    Sanchez-Macian, Alfonso
    INTERNATIONAL JOURNAL OF INTERACTIVE MULTIMEDIA AND ARTIFICIAL INTELLIGENCE, 2025,
  • [26] GEE-OPs: An Operator Knowledge Base for Geospatial Code Generation on the Google Earth Engine Platform Powered by Large Language Models
    Hou, Shuyang
    Liang, Jianyuan
    Zhao, Anqi
    Wu, Huayi
    arXiv,
  • [27] Chat2VIS: Generating Data Visualizations via Natural Language Using ChatGPT, Codex and GPT-3 Large Language Models
    Maddigan, Paula
    Susnjak, Teo
    IEEE ACCESS, 2023, 11 : 45181 - 45193
  • [28] How large language models including generative pre-trained transformer (GPT) 3 and 4 will impact medicine and surgery
    Atallah, S. B.
    Banda, N. R.
    Banda, A.
    Roeck, N. A.
    TECHNIQUES IN COLOPROCTOLOGY, 2023, 27 (08) : 609 - 614
  • [29] How large language models including generative pre-trained transformer (GPT) 3 and 4 will impact medicine and surgery
    S. B. Atallah
    N. R. Banda
    A. Banda
    N. A. Roeck
    Techniques in Coloproctology, 2023, 27 : 609 - 614
  • [30] AE-GPT: Using Large Language Models to extract adverse events from surveillance reports-A use case with influenza vaccine adverse events
    Li, Yiming
    Li, Jianfu
    He, Jianping
    Tao, Cui
    PLOS ONE, 2024, 19 (03):