SWE-Bench Counter-Edit: Summary of Key Findings

Problem Definition: The paper introduces a new evaluation protocol called Counter-Edit, which tests how coding agents handle user interventions that directly conflict with the task they are solving. Unlike existing benchmarks where user feedback is textual, this protocol injects small, plausible but incorrect code edits mid-task, forcing the agent to detect, reconcile, and potentially revert these changes to successfully complete the original objective.

Methodology:

  • Starting from 300 SWE-bench Verified tasks, a controlled "Counter-Edit" condition was created by:
    • Identifying task-relevant code regions (via multiple autonomous runs)
    • Injecting small, buggy code modifications into those regions
    • Validating each edit with three conditions: (1) edit alone fails the task, (2) reference patch solves the task, (3) edit + reference patch still fails (Equation 3)
    • Delivering the edit mid-task with a contextual user message when the agent touches relevant code
  • Evaluated 9 coding models (Claude Opus 4.8, GPT 5.5, GLM 5.1, MiniMax M2.7/M2.5, Qwen 3.7 Max, Qwen3-Coder, Kimi K2.6, DeepSeek V4 Pro) across 100+ tasks, comparing autonomous ("Vanilla") vs. Counter-Edit performance

Key Findings

1. Performance Degradation

  • Average resolve rate drops by 6.ales points across models under Counter-Edit compared to Vanilla performance
  • Nearly 16% of majority-solved Vanilla tasks flip to unresolved under intervention
  • Solved-to-unresolved transitions outnumber the reverse by ~3:1

2. Model Heterogeneity

ModelVanillaCounter-EditΔ
Claude Opus 4.881.379.5-1.8
GPT 5.580.579.2-1.3
GLM 5.170.565.Top models are resilient:
ModelCounter-Edit ResolveDrop (pts)
---------
Claude Opus 4.860.0-10.0
DeepSeek V4 Pro50.0-8.0
GPT 5.536.0-4.0
GLM 5.120.0-14.0
Qwen3-Coder28.0-8.0

7. Resource Utilization

Resource consumption increases substantially under Counter-Edit:

  • Average +14.屏幕上 calls (from ~25 to ~29)
  • Average +37K output tokens (from ~106K to ~143K)
  • Stronger models (GPT 4.1, Claude 3.7) show minimal degradation
  • Weaker models (DeepSeek V3, GLM 4.7) show significant degradation

Why the gap persists for weaker models:

  1. Pattern authentication: Weaker models cannot distinguish the user's malicious edit from the legitimate task specification. They treat the Counter-Edit as authoritative guidance, persisting along the wrong trajectory rather than questioning it.

  2. Insufficient verification: After following the user's lead, they fail to verify whether their resulting workflow prospectively satisfies the task's expected benefit—they accept the edited instructions at face value.

Recommendations for application design:

  • For weaker models: Design Counter‑Edits with more explicit traceability (e.g., timestamps, clearly-marked suggestions) so they can distinguish them from authoritative instructions.
  • For stronger models: Ensure the user‑edit is genuinely plausible (not overly simplistic), as stronger models excel at background justification but rarely re‑derive explicit reasoning from prior outputs.

Evaluation Protocol: Counter-Edit Benchmark

Implementation Details

ComponentDescription
Tasks60% from SWE-bench Verified; 40% from SWE-bench Pro
Edit size1 counter-edit per 3 tasks (avg 4.0 lines changed)
CooperativityUser proceeds with the task before/after the edit
MetricsPass@1 for code success, plus execution-quality metrics

Bottom Line: Shared-Workspace Edits uniquely stress-test whether an agent can detect, reconcile against, and recover from external modifications to the working directory. While top models (GPT 5.5, Claude 3.7, GLM 5.1) remain robust, open-weight models (DeepSeek V4 Pro, Qwen 3.7 Max, MiniMax M2.5) are significantly more sensitive to such interventions—degrading by 11–17 points. The gap persists even when the user's edit is simple, benign, and explicitly câblée as advice.

Related papers