CodeMidas: Building RL Environments from Source Code Alone

CodeMidas transforms open-source repositories into executable reinforcement learning environments without requiring issues, commits, or existing tests. By analyzing source code directly, the system generates 5,545 diverse coding tasks with hidden verifiers, then uses them to train coding agents through reinforcement learning. The result is substantial performance gains across five benchmarks, with the most dramatic improvements on repository-level repair and whole-program construction tasks.
Script
Training a coding agent requires practice environments, but building them usually depends on bug reports, commit histories, or existing tests. CodeMidas takes a radical shortcut: it generates thousands of executable tasks directly from source code itself, with no development artifacts required.
The pipeline is entirely agentic. An agent analyzes repository structure, identifies functional entry points, removes core implementations to create development starting points, then builds executable verifiers by tracing the original behavior. Every task passes through consistency checks and adversarial leakage detection before entering the training set.
The resulting dataset contains 5,545 tasks spanning 23 languages and 15 technical domains. The median reference solution is 142 lines, and nearly two thirds of tasks require editing multiple files. This is repository-level implementation work, not isolated function completion.
Training MiMo with reinforcement learning on CodeMidas improves every external benchmark. DeepSWE pass rate more than doubles from 10 percent to 21.7 percent. ProgramBench nearly quintiples from 4.5 to 21.5 percent on the Almost Solved metric, meaning solutions that pass at least 95 percent of tests.
Trajectory analysis reveals how the agent changes. Exploration increases: the trained policy reads 40 repository files before editing, up from 27. Drafting increases: 63 percent of code appears first in reasoning, up from 36 percent. Self-verification increases and correlates with a 4.2 percentage point higher success rate.
The ablation delivers the sharpest insight: a filtered 5,000 task pool outperforms an unfiltered 8,000 task pool by over 4 points on both DeepSWE and the held-out evaluation. Quality beats quantity when environments are constructed from code itself. Visit EmergentMind.com to explore the paper in depth and create your own research videos.