Hybrid-Gym: Training Coding Agents to Generalize Across Tasks
Abstract
When assessing the quality of coding agents, predominant benchmarks focus on solving single issues on GitHub, such as SWE-Bench. In contrast, in real use these agents solve more various and complex tasks that involve other skills such as exploring codebases, testing software, and designing architecture. In this paper, we first characterize some transferable skills that are shared across diverse tasks by decomposing trajectories into fine-grained components, and derive a set of principles for designing auxiliary training tasks to teach language models these skills. Guided by these principles, we propose a training environment, Hybrid-Gym, consisting of a set of scalable synthetic tasks, such as function localization and dependency search. Experiments show that agents trained on our synthetic tasks effectively generalize to diverse real-world tasks that are not present in training, improving a base model by 25.4% absolute gain on SWE-Bench Verified, 7.9% on SWT-Bench Verified, and 5.1% on Commit-0 Lite. Hybrid-Gym also complements datasets built for the downstream tasks (e.g., improving SWE-Play by 4.9\% on SWT-Bench Verified). We provide the code at https://github.com/Hybrid-Gym/Hybrid-Gym.
Lay Summary
Today’s coding agents are often judged by whether they can fix a single issue on GitHub. But real software work is broader: agents may need to understand unfamiliar code, find where a problem comes from, run tests, trace dependencies, and make design choices. We started this research because existing benchmarks do not fully prepare or measure agents for these everyday software-engineering skills. We tackled the problem by breaking agent behavior into smaller, reusable abilities that appear across many coding tasks. From this, we developed guidelines for creating practice tasks that teach these abilities directly. We then built Hybrid-Gym, a training environment with scalable synthetic tasks, such as locating the right function in a large codebase or searching for related code. These tasks are artificial, but they are designed to teach skills that transfer to real-world programming work. Our results show that agents trained in Hybrid-Gym perform better on several real software benchmarks, even when those tasks were not included in training. This matters because it suggests coding agents can be improved not only by giving them more examples of final tasks, but by teaching them the underlying skills needed to navigate and solve complex software problems.