mlsanityData to 7 Oct 2026

Domain Knowledge Matters: Improving Prompts with Fix Templates for Repairing Python Type Errors

arXiv 2306.01394 ↗First posted 2 Jun 2023cs.SEcited by 22

Not on the map. Why?

Abstract (arXiv)

Although the dynamic type system of Python facilitates the developers in writing Python programs, it also brings type errors at run-time. There exist rule-based approaches for automatically repairing Python type errors. The approaches can generate accurate patches but they require domain experts to design patch synthesis rules and suffer from low template coverage of real-world type errors. Learning-based approaches alleviate the manual efforts in designing patch synthesis rules. Among the learning-based approaches, the prompt-based approach which leverages the knowledge base of code pre-trained models via pre-defined prompts, obtains state-of-the-art performance in general program repair tasks. However, such prompts are manually defined and do not involve any specific clues for repairing Python type errors, resulting in limited effectiveness. How to automatically improve prompts with the domain knowledge for type error repair is challenging yet under-explored. In this paper, we present TypeFix, a novel prompt-based approach with fix templates incorporated for repairing Python type errors. TypeFix first mines generalized fix templates via a novel hierarchical clustering algorithm. The identified fix templates indicate the common edit patterns and contexts of existing type error fixes. TypeFix then generates code prompts for code pre-trained models by employing the generalized fix templates as domain knowledge, in which the masks are adaptively located for each type error instead of being pre-determined. Experiments on two benchmarks, including BugsInPy and TypeBugs, show that TypeFix successfully repairs 26 and 55 type errors, outperforming the best baseline approach by 9 and 14, respectively. Besides, the proposed fix template mining approach can cover 75% of developers' patches in both benchmarks, increasing the best rule-based approach PyTER by more than 30%.

Key facts. Cited by 22 papers in the map (data through 7 Oct 2026). First posted on arXiv 2 Jun 2023.

Builds on

No reference list yet.

Built on by

Cited by year (2026 to 7 Oct)

Citing papers per year: 2023: 1; 2024: 5; 2025: 10; 2026: 6.

22 papers.

Sort:

By area:

  1. 2023Unifying the Perspectives of NLP and Software Engineering: A Survey on Language Models for Codecited by 62
  2. 2024Automatic Programming: Large Language Models and Beyondcited by 35
  3. 2024Search-Based LLMs for Code Optimizationcited by 27
  4. 2024How secure is AI-generated Code: A Large-Scale Comparison of Large Language Modelscited by 23
  5. 2025Beyond Final Code: A Process-Oriented Error Analysis of Software Development Agents in Real-World GitHub Scenarioscited by 14
  6. 2025Reflections on the Reproducibility of Commercial LLM Performance in Empirical Software Engineering Studiescited by 12
  7. 2026SWE-MeM: Learning Adaptive Memory Management for Long-Horizon Coding Agentscited by 12
  8. 2024CodeArt: Better Code Models by Attention Regularization When Symbols Are Lackingcited by 7
  9. 2025Knowledge Augmented Complex Problem Solving with Large Language Models: A Surveycited by 6
  10. 2025ReCode: Improving LLM-based Code Repair with Fine-Grained Retrieval-Augmented Generationcited by 6
  11. 2026MulVul: Retrieval-augmented Multi-Agent Code Vulnerability Detection via Cross-Model Prompt Evolutioncited by 6
  12. 2025RAG or Fine-tuning? A Comparative Study on LCMs-based Code Completion in Industrycited by 4
10 more
  1. 2024Code Vulnerability Repair with Large Language Model using Context-Aware Prompt Tuningcited by 2
  2. 2025Improving Retrieval-Augmented Deep Assertion Generation via Joint Trainingcited by 2
  3. 2026AgenticTyper: Automated Typing of Legacy Software Projects Using Agentic AIcited by 2
  4. 2026FailureMem: A Failure-Aware Multimodal Framework for Autonomous Software Repaircited by 2
  5. 2025ViTAD: Timing Violation-Aware Debugging of RTL Code using Large Language Modelscited by 1
  6. 2025TREAT: A Code LLMs Trustworthiness / Reliability Evaluation and Testing Frameworkcited by 1
  7. 2025Collaborative Agents for Automated Program Repair in Rubycited by 1
  8. 2025Resource-Efficient Automatic Software Vulnerability Assessment via Knowledge Distillation and Particle Swarm Optimizationcited by 0
  9. 2026XSearch: Explainable Code Search via Concept-to-Code Alignmentcited by 0
  10. 2026CIT-CAD: Constraint Intent Tree-based CAD Code Generation and Verificationcited by 0