LLMs for Code: Faithful and Minimal Code Editing

Every patch passes the tests, but edit fidelity varies widely.

LLMs are increasingly asked to edit code that already exists, not just to write it from scratch. There, correctness alone is not enough: a good repair should also be minimal, reviewable, and faithful to the original implementation. This project looks beyond whether generated code passes the tests and asks how faithfully models edit what is already there.

In When Models Edit Too Much: On the Fidelity of Minimal Code Edits (EMNLP 2026), we study over-editing: repairs that pass the tests but change far more code than the bug requires. We build a benchmark from 400 BigCodeBench problems with injected AST-level corruptions, so that the minimal patch is known by construction, and score repairs on Pass@1, excess edit distance, and added cognitive complexity. Over-editing is widespread even among frontier models, a single preservation instruction helps substantially, and reinforcement learning teaches minimal editing that generalizes out of domain better than supervised fine-tuning. The over-editing repository provides the benchmark, evaluation, and training code.

Tongyao Zhu
Tongyao Zhu
IPP Doctoral Student (Jan ‘23; SEA)
Co-Supervised by Qian Liu.
Research Achievement Award (RAA, ‘25)

PhD Candidate January 2023 Intake

Wei Hern Lim
Wei Hern Lim
FYP Student (Aug ‘25) Thesis: When Models Edit Too Much: On the Fidelity of Minimal Code Edits
OUR Prize Awardee

FYP Student

Min-Yen Kan
Min-Yen Kan
Associate Professor

WING lead; interests include Digital Libraries, Information Retrieval and Natural Language Processing.