Teaching Coding Assistants What to Change: Fine-Tuning from Pairwise Preferences

Hongmo Tao, Hiroyuki Kamata


Abstract
Real code-editing requests typically mix the target program with other related materials, such as test results or documentation. However, models often make mistakes by incorrectly changing these supporting materials or missing the actual code that needs correction. To investigate this issue, we created multiple task scenarios where the code needing changes and the intended behavior remained constant, while only the surrounding supporting texts varied. This approach allowed us to test if supporting texts that resemble code can confuse the model, making it difficult to identify the correct code to modify. To address this, we developed a simple yet effective training method by showing the model examples of correct and incorrect edits. Specifically, Correct examples only modify the intended code, whereas incorrect examples mistakenly alter or duplicate supporting texts. Our results suggest that reliable code editing depends on the model’s early ability to distinguish between guidance materials and the actual code requiring changes.
Anthology ID:
2026.realm-1.95
Volume:
Proceedings of the Second Workshop for REsearch on Agent Language Models (REALM 2026)
Month:
October
Year:
2026
Address:
Budapest, Hungary
Editors:
Ehsan Kamalloo, Nicolas Gontier, Nikolai Rozanov, Maryam Hashemzadeh, Akhil Arora
Venues:
REALM | WS
SIG:
Publisher:
Association for Computational Linguistics
Note:
Pages:
1363–1374
Language:
URL:
https://aclanthology.org/2026.realm-1.95/
DOI:
Bibkey:
Cite (ACL):
Hongmo Tao and Hiroyuki Kamata. 2026. Teaching Coding Assistants What to Change: Fine-Tuning from Pairwise Preferences. In Proceedings of the Second Workshop for REsearch on Agent Language Models (REALM 2026), pages 1363–1374, Budapest, Hungary. Association for Computational Linguistics.
Cite (Informal):
Teaching Coding Assistants What to Change: Fine-Tuning from Pairwise Preferences (Tao & Kamata, REALM 2026)
Copy Citation:
PDF:
https://aclanthology.org/2026.realm-1.95.pdf