ChatPaper.aiChatPaper

LEGO-RL: 코딩 에이전트를 위한 하네스 네이티브 강화학습

LEGO-RL: Harness-Native Reinforcement Learning for Coding Agents

August 18, 2026
저자: Yiming Du, Yuxin Jiang, Tao Yuan, Jianbo Dai, Shaowei Wang, Jierun Chen, Chaofan Tao, Xianzhi Yu, Lifeng Shang, Kam-Fai Wong, Xiaohui Li, Haoli Bai
cs.AI

초록

코딩 에이전트를 위한 강화학습은 도구 통합, 리포지토리 컨텍스트, 실행 피드백을 관리하기 위해 점점 더 장기 실행 에이전트 하네스에 의존하고 있다. 그러나 이러한 하네스의 네이티브 실행 환경은 정책 경사 학습과 본질적으로 정렬되지 않는다. 환경 크래시와 보상 해킹은 결과 신호를 오염시키는 반면, 학습-추론 불일치는 롤아웃 행동을 정책 업데이트와 분리시킨다. 이러한 문제를 해결하기 위해, 우리는 내부 제어 흐름을 수정하지 않으면서 네이티브 코딩 에이전트 하네스와 확장 가능한 정책 경사 최적화를 연결하는 프레임워크인 LEGO-RL을 제시한다. LEGO-RL은 세 가지 축으로 구축된다: (1) 하네스 측 압축 또는 재직렬화 상황에서도 토큰 수준 정렬과 강건한 트레이너 측 로그 확률 재계산을 위해 원시 생성 스트림을 포착하는 프로세스 내 LLM 프록싱을 통한 충실한 최적화, (2) 보상 해킹을 완화하기 위한 이미지 캐싱과 단계별 방어를 갖춘 확장 가능한 샌드박스 오케스트레이션을 통한 신뢰할 수 있는 실행, 그리고 (3) 세분화된 궤적 진단을 위한 라이브 UI와 결합된 검증 및 모니터링을 자동화하는 통합 플러그인을 통한 관찰 가능한 학습. 우리는 세 가지 네이티브 코딩 에이전트 하네스에서 GSPO를 사용하여 희소 MoE 모델인 Qwen3.5-35B-A3B를 학습시켜 LEGO-RL을 평가한다. LEGO-RL은 SWE-bench Verified에서 OpenHands SDK(64.0%에서 70.4%로), Claude Code(62.4%에서 68.2%로), OpenCode(57.2%에서 66.6%로) 전반에 걸쳐 Qwen3.5-35B-A3B의 성능을 향상시키면서, 롤아웃-학습 확률 상관관계를 0.99 이상으로 유지한다.
English
Reinforcement learning for coding agents increasingly relies on long-running agent harnesses to manage tool integration, repository contexts, and execution feedback. However, the native execution environments of these harnesses are inherently misaligned with policy-gradient training: environmental crashes and reward hacking corrupt outcome signals, while train-inference discrepancies decouple rollout behavior from policy updates. To address this, we present LEGO-RL, a framework that bridges native coding-agent harnesses with scalable policy-gradient optimization without modifying their internal control flow. LEGO-RL is built upon three pillars: (1) faithful optimization via in-process LLM proxying that captures raw generation streams for token-level alignment and robust trainer-side log-probability recomputation, even under harness-side compaction or re-serialization; (2) reliable execution via scalable sandbox orchestration featuring image caching and stage-wise defenses to mitigate reward hacking; and (3) observable training through an integrated plugin that automates validation and monitoring, paired with a Live UI for granular trajectory diagnostics. We evaluate LEGO-RL by training the sparse MoE model Qwen3.5-35B-A3B with GSPO across three native coding-agent harnesses. LEGO-RL improves Qwen3.5-35B-A3B across OpenHands SDK (64.0% to 70.4%), Claude Code (62.4% to 68.2%), and OpenCode (57.2% to 66.6%) on SWE-bench Verified, while maintaining a rollout-training probability correlation above 0.99.