mlsanityData to 7 Oct 2026

TRIM: Reducing AI-Generated CodeSlop via Agent Trajectory Minimization

arXiv 2607.18161 ↗First posted 20 Jul 2026cs.SE cs.AI cs.OScited by 0

On the map: LLM agents and tool use → Software engineering coding agents

Abstract (arXiv)

Coding agents are increasingly used to accelerate code generation in many downstream tasks, such as fixing bugs, building applications, and prototyping. However, despite their value as coding assistants, agent-generated code tends to be larger and more verbose than the corresponding human-written implementation. In this work, we show that the cause lies in the agent's own search process: while iterating toward a passing solution, an agent accumulates speculative edits, abandoned hypotheses, and temporary changes that persist into the final patch. This may seem harmless for a single patch, but the problem compounds as agents take responsibility for ever-larger portions of a codebase-a codebase that was once minimal and well-maintained slowly accumulates redundancy faster than it can be cleaned up, drifting to a state that is harder to maintain. Given the magnitude of this problem, we take a step towards alleviating this issue. First, we formally define this phenomenon as CodeSlop-the residual and functionally unnecessary edits commonly seen in AI-generated code. We then introduce our algorithm TRIM (Trajectory-guided Redundancy Identification and Minimization). Rather than minimizing CodeSlop directly, TRIM instead minimizes agent trajectories. As we show empirically, this indirect technique of minimizing CodeSlop is highly effective: TRIM cuts CodeSlop by 17.9%-32.9% across agentic scaffolds, with negligible performance regression. TRIM is also highly efficient, requiring roughly half the validation cost of algorithmic baselines such as Delta Debugging.

Key facts. No citing papers in the map yet (data through 7 Oct 2026). Placed in Software engineering coding agents, one of 16 directions in LLM agents and tool use. Builds on 20 of its 35 references that are in the map. First posted on arXiv 20 Jul 2026.

Builds on

20 of 35 references.

Closest ancestors · 10

Same direction, newest first

  1. 2026SlopCodeBench: Benchmarking How Coding Agents Degrade Over Long-Horizon Iterative Tasks25 Mar
  2. 2026What to Cut? Predicting Unnecessary Methods in Agentic Code Generation19 Feb
  3. 2026Why Agentic-PRs Get Rejected: A Comparative Study of Coding Agents4 Feb
  4. 2025Live-SWE-agent: Can Software Engineering Agents Self-Evolve on the Fly?17 Nov
  5. 2025Speed at the Cost of Quality: How Cursor AI Increases Short-Term Velocity and Long-Term Complexity in Open-Source Projects6 Nov
  6. 2025Trae Agent: An LLM-based Agent for Software Engineering with Test-time Scaling31 Jul
  7. 2025Code Researcher: Deep Research Agent for Large Systems Code and Commit History27 May
  8. 2025Agentic AI Software Engineers: Programming with Trust19 Feb
  9. 2024OpenHands: An Open Platform for AI Software Developers as Generalist Agents23 Jul
  10. 2024SWE-agent: Agent-Computer Interfaces Enable Automated Software Engineering6 May

Other references · 10

  1. 2023SWE-bench: Can Language Models Resolve Real-World GitHub Issues?cited by 3,193
  2. 2024What's Wrong with Your Code Generated by Large Language Models? An Extensive Studycited by 52
  3. 2024KGym: A Platform and Dataset to Benchmark Large Language Models on Linux Kernel Crash Resolutioncited by 12
  4. 2026Compressing Code Context for LLM-based Issue Resolutioncited by 12
  5. 2025A Taxonomy of Inefficiencies in LLM-Generated Python Codecited by 8
  6. 2018Debloating Software through Piece-Wise Compilation and Loadingcited by 6
  7. 2025Measuring AI "Slop" in Textcited by 6
  8. 2026Novice Developers Produce Larger Review Overhead for Project Maintainers while Vibe Codingcited by 3
  9. 2026Faster Code, Deeper Debt? A Multivocal Literature Review on Technical Debt and Its Early Signs in LLM-Assisted Software Developmentcited by 3
  10. 2026Outrunning LLM Cutoffs: A Live Kernel Crash Resolution Benchmark for Allcited by 2

Built on by

Not cited yet.

Similar, not cited

Close in wording, no citation either way

  1. 2026Latent Programming Horizons in Coding Agents
  2. 2025AI Agentic Programming: A Survey of Techniques, Challenges, and Opportunities
  3. 2026Understanding the Architecture of Coding Agents: An Exploratory Study Using a Research Prototype
  4. 2026AutoCompact: Learning When to Compact Context in Long-Horizon Coding Agents
  5. 2026Does Code Cleanliness Affect Coding Agents? A Controlled Minimal-Pair Study
  6. 2026Coherence Collapse: Diagnosing Why Code Agents Fail After Reaching the Right Code
  7. 2025SEW: Self-Evolving Agentic Workflows for Automated Code Generation
  8. 2026CodeScout: An Effective Recipe for Reinforcement Learning of Code Search Agents