acceptodds
Under review as a conference paper at ICLR 2027

Delete or Preserve? An Empirical Study of the Effects of Deletion and Preservation Instructions on AI-Generated Code

Abstract

The two leading AI coding tools embed contradictory one-line instructions in their system prompts: Anthropic's Claude Code tells the model to "delete unused code completely," while OpenAI's Codex tells it to "never revert existing changes ... unless explicitly requested." Both ship to millions of developers; neither provider has published measurements of the effect. We test these instructions as a controlled manipulation across five LLMs (Claude Sonnet 4, Gemini 2.5 Pro, Qwen3-32B, Gemma 4-31B, and GPT-5-mini; n=10 per task per condition, 3,600 runs total) on 24 code repair tasks that each require a subtractive fix. The preservation instruction degrades code correctness on every model and by 13-15 percentage points on three of five (Claude p_Holm=0.006, Cliff's d=0.14; Gemini p_Holm=0.0003, d=0.14; Qwen3 p_Holm=0.004, d=0.13). The largest effect is on GPT-5-mini (the only OpenAI model in our panel, running its vendor's own prompt): a 39 pp correctness drop (p_Holm<10^-22, d=0.39). The effect survives Holm correction across the full 30-pairwise-test grid. The deletion instruction is neutral-to-helpful and never harms correctness. We complement this with an observational analysis of 57,371 commits from the AIDev dataset. OpenAI Codex, whose vendor ships a preservation instruction, has the lowest deletion ratio in deployed use, as the prompt-level mechanism predicts; strikingly, Claude Code deletes below the human rate as well, despite a vendor prompt that explicitly encourages deletion – evidence that base-model shyness can persist even against a pro-deletion instruction. GitHub Copilot and the autonomous agent Devin delete more than humans, while Cursor sits at the human deletion rate. We further analyze which additive failure modes the preservation prompt triggers – wrapping and downstream patching dominate – using a taxonomy of eight such modes as an analytical instrument. A follow-up experiment (Phase 2; three local models, 36 tasks per cell at n=5) tests six scope-limited variants against a three-part pre-registered gate (mean correctness recovery, over-deletion safety on benefit-measuring (BM) tasks – whose gold fixes preserve code – within 1 pp of blanket, and same-direction robustness on every panel model). All six candidates recover correctness on average (mean recovery 80-92%) and improve correctness over blanket on every model, but every one regresses BM safety on Llama 4 (+7 to +17 pp); exploratory per-model targeted prompts reproduce the same recovery-safety trade-off on Llama 4 and Qwen 3, so no instruction we tested is cross-model Pareto-improving over blanket preservation. The headline implication is that a single line in a system prompt imposes a measurable, replicable correctness penalty on the code produced by leading AI coding tools, and that the prompt's authors have a clean engineering choice with quantifiable consequences.

Primary area:
infrastructure, software libraries, hardware, systems, etc.
Keywords:
software engineering, AI-assisted software engineering

Reviews

Among:
Shape:
1234this paper, Bottom 1%
Figure 1. Mean review rating of the reviewed papers at ICLR 2027. This paper averages 1.00 over 3 reviews, above 0% of the others.
Reviewer_ghGWOpenReview ↗
Rating
1
Confidence
3
Informativeness
2
Presentation
2
Soundness
2
Read review
Paper summary

This paper investigates how deletion and preservation instructions affect the performance of large language models (LLMs) on code repair tasks in ShyBench. It further analyzes editing behaviors and code commits from real-world software projects.

Critical strengths
  • The paper explores how editing instructions influence code repair.

  • Comparative experiments across multiple models provide useful evidence, and the subsequent evaluation considers the risk of over-deletion.

Critical weaknesses
  • The correctness metric conflates functional correctness with compliance with specific editing requirements enforced by meta-tests. As acknowledged in Appendix E, some patches are functionally correct but are marked as failures because they preserve existing code. Since the saved records do not include the generated code or the specific failed tests, it is impossible to determine from these records what proportion of the reported performance drop stems from functional errors versus failure to meet editing requirements. Functional test results and structural check results should be reported separately.

  • The preservation prompt not only asks the model to keep existing code but also explicitly requires fixes to be implemented by adding code rather than deleting it. However, all tasks in ShyBench are centered on deleting or simplifying code. Consequently, the observed trend is unsurprising, and the experiments do not separate the effects of the preservation constraint from the requirement for additive repairs. While the empirical contribution has some value, it is somewhat limited. Further clarification is needed regarding the specific insights gained from the cross-model experiments and the experiments with scope-limited preservation prompts.

Questions for authors
  • Table 2 reports the proportion of passing patches that use additive edits within predefined task categories. This does not directly establish that the patches actually use wrapping or downstream patching. Could the authors verify these behaviors or limit the conclusions to additive-editing rates?

  • The shyness rate uses the number of patches that passed the tests as the denominator. However, the preservation instruction itself changes the overall pass rate. For GPT-5-mini, the pass rate drops from approximately 94% to 55%, while the shyness rate increases from 13% to 26%. The proportion of all outputs that pass the tests and use additive edits therefore changes from approximately 12% to 14%. Could the authors report the proportions of different types of edits across all outputs, along with their respective test-pass rates? This would help distinguish changes in editing behavior from changes in the denominator.

  • The criteria for determining over-deletion on the BM tasks are insufficiently clear. Phase 2 needs to distinguish deletions that violate preservation requirements from permitted cleanup operations. Which requirements are protected, and how are violations checked?

  • The paper does not report results for the original deletion instruction on the BM tasks, so its over-deletion cost remains unclear. Could the authors provide BM results for this same instruction to allow a direct comparison with preservation?

  • For Llama 4, each BM condition involves only 60 runs. A single change in outcome corresponds to approximately 1.7 percentage points, exceeding the gate’s 1-percentage-point tolerance. Furthermore, the differences between the six candidates and blanket preservation are not statistically significant after Holm correction. Do the current results support a stable trade-off between correctness and safety? Could the authors include additional independent BM tasks and report confidence intervals for the differences in over-deletion rates?

  • The main text and Appendix D.2 require an average correctness recovery of at least 75% across models, but the caption for Figure 3 requires all three model points to fall within the gate region, effectively requiring each model to reach at least 75%. Which criterion is actually applied?

  • Appendix D.2 notes that the number of BM tasks was expanded from the six originally preregistered tasks to twelve before the pilot was completed. Were any results examined before this expansion, and how were the new tasks selected? Are the conclusions consistent between the original six tasks and the expanded set?

Reviewer_sy7YOpenReview ↗
Rating
1
Confidence
3
Informativeness
2
Presentation
2
Soundness
1
Read review
Paper summary

-This work studies whether instructions encouraging code preservation or deletion affect LLM performance.

  • To do so, they compare prompt variants across synthetic Python tasks and find that code preservation prompts reduced benchmark pass rates, while deletion was less detrimental.
Critical strengths
  • The paper addresses a practical concern as instructions that are intended to preserve existing code may make AI coding tools less effective at fixing other code.
Critical weaknesses
  • There is extensive prior work demonstrating that prompts/instructions affect model behavior, limiting novelty of this work.
  • The prompts are constructed by the authors, making the observed effects on the controlled study quite expected.
  • The primary result is on 24 synthetic, single-file Python tasks, which do not reflect real-world agent workflows. Furthermore, while the paper references Claude Code and codex as motivation, it only tests single LLM responses.
  • Referring to model behavior and the benchmark as “shyness” anthropomorphizes a metric that does not capture true human-like qualities.
  • The real-world data analysis lacks claims about “correctness” to show that synthetic, controlled experiments generalize to realistic data.
Questions for authors

Please address weaknesses above.

Reviewer_CeXnOpenReview ↗
Rating
1
Confidence
3
Informativeness
1
Presentation
1
Soundness
1
Read review
Paper summary

The paper studies how instructions to delete or preserve code affect LLM bug fixes. It tests five models on 24 Python tasks, with ten runs for each model, task, and prompt condition. The preservation prompt lowers the score on tests that check both program behavior and patch structure. The paper also compares code deletion in AI and human commits and tests additional prompts meant to preserve only relevant code.

Critical strengths
  • The paper brings out that hidden system prompts in various harnesses can have an impact on performance and studies one such prompt instruction for dealing with dead code.

  • The paper presents a new dataset [25 tasks which require deletion based repairs] with structural tests in addition to functional tests.

  • Adding preservation-required tasks in Phase 2 is useful because it recognizes that removing code can also be harmful.

Critical weaknesses
  • My main concern is the one-sided task selection. All 24 main tasks have reference fixes that remove code, so they favor the deletion instruction. A fair comparison should also include cases where deletion is harmful. The 12 preservation-required tasks help, but Phase 2 uses a different model panel and omits the original deletion instruction. The two phases therefore do not provide a common comparison across tasks, prompts, and models.

  • There is no evaluation of various types of system prompts on standard coding benchmarks. The small SWE-bench check is very limited: it selects eight net-deleting tasks, has parseable baseline responses on only four, and measures deletion ratios rather than repair success.

  • Important details are missing about task construction and metric definitions. Please explain how the tasks were created and independently checked. Section 6 also needs concrete details on the 12 benefit measuring tasks and what correctness means for these tasks. It is unclear whether correctness recovery is measured on the original 24 tasks or all 36 tasks. It is also unclear what over-deletion means.

  • The main correctness metric mixes functional errors with failures to follow a preferred patch structure. In this paper, a patch can fail for retaining a function or adding a wrapper even if its behavior is correct. The effect on program behavior is the more important result than structural tests (which seem specifically tailored for this problem). Please report functional errors separately from structural failures.

  • The modified prompts do not test the original Claude and Codex guidance. The experiment broadens preservation to all existing functions and favors additive changes. It also removes the certainty requirement from the deletion instruction. There is no clear rationale for these changes. The example baseline already asks for dead-code cleanup, while the preservation instruction allows explicitly requested removal, which makes the experiment biased. Also, testing only these two modified instructions in Phase 1 does not establish that the results hold for other prompt variations.

Questions for authors
  • How much of the reported score drop comes from functional errors rather than structural failures?
  • Why were the instructions changed in these particular ways, and how should the preservation exception apply when the task already asks to delete dead code?
  • How were the tasks and tests created and validated? Were any revised after inspecting model outputs?

From OpenReview, CC BY 4.0. Authors as signed there; shown unedited.

Related papers

Loading the map…

Discussion (0)

Sign in to comment.