RAP-Gen
CodeT5 patch generator that repairs buggy code with the help of a retrieved earlier bug fix.
Language · 1,480 operations Checked
Click or tap a spot to read it up close. Scroll or drag inside the diagram to move through it. Zoom with + and − or Ctrl and scroll. Press 0 for the whole graph. Swipe inside the diagram to move through it. Use + and − to zoom.
At a glance
- Task
- Language
- Parameters
- 222.9M
- Operations
- 1,480
- Framework
- PyTorch
- Recurrent
- No
- Published
- ESEC/FSE 2023
- Cited by
- 90 (as of 27 October 2026)
- Authors
- Weishi Wang, Yue Wang, Shafiq Joty, Steven C.H. Hoi
- Source
- GitHub: wang-weishi/RAP-Gen
- License
- MIT
- Checked
- Passed: the trace was replayed operation by operation and matched the model's own output for this input.
Files
The file opened in a new tab. Use your browser's Save command there to keep it.
The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.
Details
- Stable ID
- m19596
- Graph hash
- 290b23638c1258987c9318a8bccb1e239faa3fd12ff4a487a2b6f674a9a24bde
- Skeleton hash
- e6e059a6f9f499d7b92587c765a3835af28822f4e475eb569d6aa2a31816283b
- Architecture hash
- 5fc658a20a5518ff135b2fdfa0e901f4081d9e118273f86c5d38dfb8ab5a3ff0
- Diagram SHA-256
- 99e287fd66be4304aac55cf1c0236cff3f4a19dc0cf41a2828a0336b80db7a3d
- TorchLens version
- 2.36.0
- Renderer
- graphviz 2.43.0+pyvips 3.2.0+libvips 8.18.7+render-opts@06c1f0d3
- Check
- Forward pass replayed in PyTorch
What it is
RAP-Gen (Retrieval-Augmented Patch Generation) is a framework for automatic program repair that guides a language model with relevant fix patterns retrieved from a codebase of earlier bug-fix pairs. The authors argue that deep learning repair models are often limited by a fixed set of parameters that has to model the highly complex search space of program repair.
Repair proceeds in stages: a patch retriever first retrieves a relevant bug-fix pair, the pair is added to the buggy input of a CodeT5 patch generator, and the generator produces a ranked list of candidate patches. The retriever is a hybrid of sparse BM25 retrieval for lexical matching and dense DPR retrieval for semantic matching, both on raw source code. It is language-agnostic, since it requires no code-specific features such as abstract syntax trees. The encoder of CodeT5 serves as the dense retriever.
The generator is CodeT5-base, with 12 encoder layers and 12 decoder layers, and the paper gives its parameter size as 220M. The paper evaluates RAP-Gen on three benchmarks in two programming languages: TFix in JavaScript, and Code Refinement and Defects4J in Java. On TFix it reports an accuracy of 54.15%, against 49.70% for T5-large, and on Defects4J it reports repairing 15 more bugs out of 818.
Key idea. RAP-Gen retrieves a relevant earlier bug-fix pair with a hybrid lexical and semantic retriever and adds it to the buggy input of a CodeT5 patch generator.
- RAP-Gen
- Retrieval-Augmented Patch Generation
- automatic program repair
- APR
- program repair
- bug fixing
- patch generation
- retrieval-augmented generation
- code repair
AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.
Cite the paper
@misc{wang2023rapgenretrievalaugmentedpatchgeneration,
title={RAP-Gen: Retrieval-Augmented Patch Generation with CodeT5 for Automatic Program Repair},
author={Weishi Wang and Yue Wang and Shafiq Joty and Steven C. H. Hoi},
year={2023},
eprint={2309.06057},
archivePrefix={arXiv},
primaryClass={cs.SE},
url={https://arxiv.org/abs/2309.06057},
}