All models

RewardRepair

Program repair model whose training loss rewards patches that compile and pass tests.

Language · 1,522 operations Checked

100%

Showing the top corner; full diagram not loaded yetShowing a small copy; full diagram not loaded yetLarge diagram, not loaded yet

Open SVG

Loading diagram (89 KB)

Open in a new tab

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

Parameters
222.9M
Operations
1,522
Framework
PyTorch
Recurrent
No
Published
ICSE 2022
Cited by
161 (as of 3 November 2026)
Authors
He Ye, Matias Martinez, Martin Monperrus
Checked
Passed: the trace was replayed operation by operation and matched the model's own output for this input.

Files

The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.

Details
Stable ID
m19850
Graph hash
3333902de015eeb9401d8fe9e75e90ab6c026574688e0c6c25b3b56e96c93d29
Skeleton hash
350ab55457b9d2d5f981af1a93b0b6eaa4628aac9f40d3c481988f0e2dade012
Architecture hash
b37c83177327e4254622c629c8a1c7587c465882de1de12ca80e07c74a983546
Diagram SHA-256
9b8de0af69194f662e7d3de837f0aa74c102587a0df7cca7479858af3ef33b55
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

RewardRepair is a neural program repair model: it takes a maximum of 512 input tokens from buggy code and its context and generates a patch of at most 100 tokens. The paper starts from a limitation of earlier neural machine translation approaches to repair, which optimize a purely syntactic loss based on characters and tokens and so often generate low-quality patches, for example patches that do not compile.

RewardRepair's change is the loss function, which is based on program compilation and test execution information. Training has two phases: syntactic training with a cross-entropy loss, then semantic training, in which a discriminative model made of four discriminators assesses each generated patch. The discriminators run in series and check whether the patch differs from the buggy code, compiles, passes the human-written tests and passes automatically generated regression tests; the outcome becomes a reward signal that modulates the cross-entropy loss before backpropagation.

The patch generator is a Transformer-based encoder-decoder taken from Hugging Face. The paper reports that RewardRepair correctly repairs 207 bugs over four benchmarks and produces up to 45.3% compilable patches, compared with 39% for CURE, the earlier model it names on compilability. The repository README adds that the actual compilable rate should be higher than the reported numbers, because many uncompilable cases were due to spaces in operators.

Key idea. The paper trains a neural program repair model with a loss that scales cross-entropy by a reward computed from compiling generated patches and running tests on them.

  • RewardRepair
  • neural program repair
  • automatic program repair
  • execution-based backpropagation
  • patch generation
  • bug fixing
  • compilable patches
  • Defects4J

AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.

Cite the paper

@misc{ye2022neuralprogramrepairexecutionbased,
      title={Neural Program Repair with Execution-based Backpropagation}, 
      author={He Ye and Matias Martinez and Martin Monperrus},
      year={2022},
      eprint={2105.04123},
      archivePrefix={arXiv},
      primaryClass={cs.SE},
      doi={https://doi.org/10.1145/3510003.3510222},
      url={https://arxiv.org/abs/2105.04123}, 
}