mlsanityData to 7 Oct 2026

LecPrompt: A Prompt-based Approach for Logical Error Correction with CodeBERT

arXiv 2410.08241 ↗First posted 10 Oct 2024cs.SE cs.AI cs.PLcited by 2

Not on the map. Why?

Abstract (arXiv)

Logical errors in programming don't raise compiler alerts, making them hard to detect. These silent errors can disrupt a program's function or cause run-time issues. Their correction requires deep insight into the program's logic, highlighting the importance of automated detection and repair. In this paper, we introduce LecPrompt to localize and repair logical errors, an prompt-based approach that harnesses the capabilities of CodeBERT, a transformer-based large language model trained on code. First, LecPrompt leverages a large language model to calculate perplexity and log probability metrics, pinpointing logical errors at both token and line levels. Through statistical analysis, it identifies tokens and lines that deviate significantly from the expected patterns recognized by large language models, marking them as potential error sources. Second, by framing the logical error correction challenge as a Masked Language Modeling (MLM) task, LecPrompt employs CodeBERT to autoregressively repair the identified error tokens. Finally, the soft-prompt method provides a novel solution in low-cost scenarios, ensuring that the model can be fine-tuned to the specific nuances of the logical error correction task without incurring high computational costs. To evaluate LecPrompt's performance, we created a method to introduce logical errors into correct code and applying this on QuixBugs to produce the QuixBugs-LE dataset. Our evaluations on the QuixBugs-LE dataset for both Python and Java highlight the impressive capabilities of our method, LecPrompt. For Python, LecPrompt achieves a noteworthy 74.58% top-1 token-level repair accuracy and 27.4% program-level repair accuracy. In Java, LecPrompt delivers a 69.23% top-1 token-level repair accuracy and 24.7% full program-level repair accuracy.

Key facts. Cited by 2 papers in the map (data through 7 Oct 2026). Builds on 23 of its 43 references that are in the map. First posted on arXiv 10 Oct 2024.

Builds on

23 of 43 references.

References · 23

  1. 2019RoBERTa: A Robustly Optimized BERT Pretraining Approachcited by 13,266
  2. 2021Evaluating Large Language Models Trained on Codecited by 8,053
  3. 2022PaLM: Scaling Language Modeling with Pathwayscited by 5,304
  4. 2021Prefix-Tuning: Optimizing Continuous Prompts for Generationcited by 3,878
  5. 2021The Power of Scale for Parameter-Efficient Prompt Tuningcited by 3,769
  6. 2022Competition-Level Code Generation with AlphaCodecited by 1,427
  7. 2020CodeBERT: A Pre-Trained Model for Programming and Natural Languagescited by 1,286
  8. 2019BERT Rediscovers the Classical NLP Pipelinecited by 1,046
  9. 2020Exploiting Cloze Questions for Few Shot Text Classification and Natural Language Inferencecited by 934
  10. 2021CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generationcited by 890
  11. 2022CodeGen: An Open Large Language Model for Code with Multi-Turn Program Synthesiscited by 876
  12. 2021CodeXGLUE: A Machine Learning Benchmark Dataset for Code Understanding and Generationcited by 732
11 more
  1. 2021GPT Understands, Toocited by 715
  2. 2022GPT-NeoX-20B: An Open-Source Autoregressive Language Modelcited by 711
  3. 2019Large Batch Optimization for Deep Learning: Training BERT in 76 minutescited by 671
  4. 2021Transformer in Transformercited by 632
  5. 2022A Systematic Evaluation of Large Language Models of Codecited by 360
  6. 2019Neural Machine Translation: A Review and Surveycited by 99
  7. 2021Larger-Scale Transformers for Multilingual Masked Language Modelingcited by 86
  8. 2021Self-Supervised Bug Detection and Repaircited by 59
  9. 2021Applying CodeBERT for Automated Program Repair of Java Simple Bugscited by 44
  10. 2021What do pre-trained code models know about code?cited by 36
  11. 2018AVATAR : Fixing Semantic Bugs with Fix Patterns of Static Analysis Violationscited by 22

Built on by

Cited by year

Citing papers per year: 2025: 2.

2 papers.