Source-linked AI summary

KAT-Coder-V2 Technical Report

Fengxiang Li, Han Zhang, Haoyang Huang, Jinghui Wang, Jinhua Hao, Kun Yuan, Mengtong Li, Minglei Zhang, Pengcheng Xu, Wenhao Zhuang, Yizhen Shao, Zongxian Feng, Can Tang, Chao Wang, Chengxiao Tong, Fan Yang, Gang Xiong, Haixuan Gao, Han Gao, Hao Wang, Haochen Liu, Hongliang Sun, Jiabao Li, Jingwen Chang, Jun Du, Junyi Peng, Leizhen Cui, Meimei Jing, Mingqi Wu, Shangpeng Yan, Shaotong Qi, Suzhe Xu, Wenxuan Zhao, Xianda Sun, Xuan Xie, Yanbo Wang, Yao Xia, Yinghan Cui, Yingpeng Chen, Yong Wang, Yuze Shi, Zhiwei Shen, Ziyu Wang, Ming Sun, Lin Ye, Bin Chen

arXiv:2603.27703v1cs.CLcs.LG

TL;DR

Agentic coding must handle fragmented capabilities, heterogeneous environments, and long-horizon training demands. KAT-Coder-V2 specializes five expert domains, trains them with environment feedback, and unifies them through on-policy distillation with supporting infrastructure and algorithms. It achieves broad benchmark strength, including 79.6% on SWE-bench Verified and 88.7 on PinchBench, while retaining a performance gap relative to isolated experts.

  • Problem

    Agentic coding requires conflicting capabilities, heterogeneous scaffolds and environments, and scaling across task complexity, prompt diversity, and scaffold generalization.

  • Method

    KAT-Coder-V2 independently trains five domain experts, uses KwaiEnv and agentic RL with MCLA and Tree Training, then consolidates experts through on-policy distillation.

  • Results

    KAT-Coder-V2 shows broad performance across coding, frontend, terminal, and general benchmarks, including 79.6% on SWE-bench Verified and 88.7 on PinchBench.

  • Takeaways & Limitations

    Specialized training combined with large-scale agentic RL and unified distillation forms an effective path to a broadly capable coding agent.

  • Takeaways & Limitations

    Unified distillation incurs slight performance degradation relative to isolated experts because of capacity constraints and cross-domain interference.

Abstract

from arXiv · show

We present KAT-Coder-V2, an agentic coding model developed by the KwaiKAT team at Kuaishou. KAT-Coder-V2 adopts a "Specialize-then-Unify" paradigm that decomposes agentic coding into five expert domains - SWE, WebCoding, Terminal, WebSearch, and General - each undergoing independent supervised fine-tuning and reinforcement learning, before being consolidated into a single model via on-policy distillation. We develop KwaiEnv, a modular infrastructure sustaining tens of thousands of concurrent sandbox instances, and scale RL training along task complexity, intent alignment, and scaffold generalization. We further propose MCLA for stabilizing MoE RL training and Tree Training for eliminating redundant computation over tree-structured trajectories with up to 6.2x speedup. KAT-Coder-V2 achieves 79.6% on SWE-bench Verified (vs. Claude Opus 4.6 at 80.8%), 88.7 on PinchBench (surpassing GLM-5 and MiniMax M2.7), ranks first across all three frontend aesthetics scenarios, and maintains strong generalist scores on Terminal-Bench Hard (46.8) and tau^2-Bench (93.9). Our model is publicly available at https://streamlake.com/product/kat-coder.

1. Introduction

Agentic coding requires distinct capabilities, infrastructure, and training strategies across long-horizon software tasks and heterogeneous environments. KAT-Coder-V2 addresses these challenges by specializing across five domains, unifying the experts through on-policy distillation, and scaling training infrastructure and algorithms.

  • Agentic coding combines autonomous planning, execution, and verification in real-world development environments.
  • Capability fragmentation, infrastructure coupling, and multi-dimensional scaling make a single monolithic training pipeline inadequate across agentic coding domains.
  • KAT-Coder-V2 specializes training across SWE, WebCoding, Terminal, WebSearch, and General domains before consolidating experts through on-policy distillation.Each domain receives independent data construction, supervised fine-tuning, and environment-feedback reinforcement learning.
  • 6.2× training speedup is achieved by Tree Training, while KwaiEnv sustains tens of thousands of concurrent sandbox instances and MCLA stabilizes MoE reinforcement learning.
  • 79.6% on SWE-bench Verified, 88.7 on PinchBench, leading scores across three frontend aesthetics scenarios, and strong Terminal-Bench Hard and τ2-Bench scores demonstrate broad performance.The SWE-bench Verified comparison is 79.6% versus 80.8% for Claude Opus 4.6; PinchBench is 88.7 versus 86.4 for GLM-5 and 87.1 for MiniMax M2.7.

2. KwaiEnv: Infrastructure for Agentic Code Intelligence

KwaiEnv is a modular, configurable infrastructure for agentic coding that unifies datasets, sandboxes, scaffolds, verifiers, and trajectory handling. It autonomously supports evaluation and reinforcement-learning workflows at high rollout throughput.

  • Agentic coding rollouts require authentic repositories, dependencies, test suites, heterogeneous benchmarks, diverse scaffolds, and high-throughput sandbox execution.
  • KwaiEnv decouples datasets, sandboxes, scaffolds, and verification logic through modular interfaces, enabling flexible combinations across evaluation and reinforcement learning.
  • A configuration-driven workflow provisions remote sandboxes, deploys scaffolds, proxies model requests, records trajectories, scores results, and formats data for the RL engine.The pipeline operates autonomously without human intervention.
  • KwaiEnv masks benchmark differences through unified dataset interfaces and supports deterministic scoring, LLM-as-Judge evaluation, and SWE-specific verification.
  • Black-box network-layer integration supports leading coding-agent scaffolds without code modifications, requiring endpoint and authentication configuration.
  • Tens of thousands of concurrent isolated sandboxes provide the rollout throughput required for large-scale RL training.
  • The Trajectory Manager records requests, tool calls, token usage, and timestamps, then assembles, reorders, or truncates trajectories for different algorithms.

2.4. Decoupling and Scalability

KwaiEnv applies separation of concerns so its core modules can evolve independently through standardized interfaces. This decoupling supports scalable data and scaffold integration, agile evaluation, and algorithmic adaptability.

  • Standardized interfaces allow independent iteration of KwaiEnv’s five core modules.
  • Unified data interfaces scale training data without changing sandboxes or scaffolds, while configuration enables onboarding new coding agents.
  • Shared training and evaluation infrastructure improves consistency and shortens iteration cycles.
  • Decoupled trajectory formatting lets KwaiEnv support new reinforcement-learning algorithms by registering formatting rules.

3.1. Training Pipeline Overview

KAT-Coder-V2 trains specialized experts for five agentic coding domains and then unifies their capabilities through a three-stage pipeline. The stages combine domain-specific supervised learning, environment-feedback reinforcement learning, and on-policy distillation.

  • The five expert domains are SWE, WebCoding, Terminal, WebSearch, and General, covering software engineering, frontend aesthetics, command-line reasoning, search synthesis, and general code intelligence.
  • The pipeline comprises supervised fine-tuning, reinforcement learning, and on-policy distillation.
  • Supervised fine-tuning uses domain-specific data construction to produce a dedicated expert model for each capability.
  • Environment-feedback reinforcement learning improves decision quality in multi-turn interactions and long-horizon tasks using sandbox and verifier infrastructure.
  • On-policy distillation consolidates multiple domain experts into a unified deployable model.

3.2. Supervised Fine-Tuning

The supervised fine-tuning stage trains specialized experts on complementary agentic coding capabilities, using real-world repositories, synthesized tasks, and structured aesthetic supervision. For SWE, the pipelines combine retrieval, editing, comprehension, and verified task data; WebCoding adds hierarchical design labels and reference-free evaluation.

  • Five domain experts are trained through supervised fine-tuning, with each targeting a distinct capability required for agentic coding.The domains are SWE, WebCoding, Terminal, WebSearch, and General.
  • SWE Expert: Autonomous Issue Resolution: Over 2M Issue-PR samples reconstruct problem discovery, fault localization, and repair chains into retrieval and editing tasks.Merged PRs provide anchor points, semantic Issue-PR mappings, code diffs, and merge-based correctness supervision before quality filtering.
  • SWE Expert: Autonomous Issue Resolution: AutoBuilder synthesizes verifiable SWE tasks by configuring isolated environments, generating intent-only instructions, and applying multi-round filtering.Multi-agent environment setup uses dependency, configuration, and build-verification roles, while instructions are derived from diffs, issues, and code context.
  • SWE Expert: Autonomous Issue Resolution: 30k verified SWE samples span six mainstream language groups and tasks including bug fixing, feature development, and refactoring.Each sample includes a reproducible environment, buggy-state code, leak-free instructions, and dual verification.
  • SWE Expert: Autonomous Issue Resolution: Code Comprehension generates interactive trajectories from repositories through repository filtering, isolated Docker environments, and structured queries across six question types and four difficulty levels.The pipeline targets navigation, understanding, reasoning, and code-review skills in large-scale codebases.
  • WebCoding Expert: Aesthetic-Aware UI Generation: The WebCoding expert addresses aesthetic collapse by mapping colloquial user inputs through seven hierarchical levels from style guidance to technical implementation.The tri-perspective system links user perception, design rationale, and implementation, making generation a traceable structured derivation.
  • WebCoding Expert: Aesthetic-Aware UI Generation: Reference-free Text-to-UI evaluation separates code fidelity from aesthetic fidelity and tests whether models infer complete designs from ordinary colloquial prompts.The benchmark addresses the gap left by evaluations focused mainly on rendering correctness or pixel similarity.

3.3. Reinforcement Learning

The paper scales agentic reinforcement learning through diverse, high-difficulty data, turn-level policy optimization, MoE variance reduction, and efficient training over tree-structured trajectories.

  • Agentic Scaling: Over 100,000 diverse RL samples are synthesized by scaling task complexity, intent alignment, and scaffold generalization.Agentic Scaling uses a foundational task pool and produces high-quality training data across these three dimensions.
  • Agentic Scaling: Semantic augmentation rewrites each standardized task into detailed, colloquial, and underspecified prompts to improve intent inference from realistic inputs.The one-commit-to-multiple-prompts strategy exposes the model to incomplete and ambiguous user instructions.
  • Policy Optimization: Turn-level policy optimization partitions trajectories into interaction turns and computes independent importance ratios for finer credit assignment.The formulation retains sequence-level variance reduction while aligning probability evaluation with the agent’s interaction structure.
  • MoE Stabilization: MCLA averages trajectory log-probabilities across K prefetched forward passes, reducing estimator variance in MoE reinforcement learning.Combined with IcePop, it also mitigates rollout–training distributional inconsistency, yielding more stable training and faster convergence.
  • Efficient RL Training: KRL accelerates group sampling by removing redundant shared-prefix calculations and supports large-scale asynchronous sandbox training.The framework reports approximately 6× training acceleration and is designed for high-throughput agentic data collection.
  • Efficient RL Training: Tree Training serializes tree-structured trajectories into one DFS-flattened sequence with per-token loss weights, eliminating redundant shared-prefix computation while preserving baseline-equivalent gradients.The method addresses branches created by parallel sub-agents, multi-turn context retention, and discarded intermediate tokens.

3.4. Expert Fusion via On-Policy Distillation

After training specialized experts, the paper unifies them through on-policy distillation that combines expert guidance with environmental reinforcement learning. The resulting optimization mitigates catastrophic forgetting but still incurs slight degradation relative to isolated experts.

  • Unified Training: On-policy distillation unifies specialized experts by jointly optimizing the Student with environmental RL and expert-guided distillation losses.The Student generates complete mixed-domain trajectories, while the best-performing expert is selected dynamically as Teacher for each task.
  • Trade-offs: Slight performance degradation remains relative to isolated experts because unified weights face capacity constraints and cross-domain interference.Joint optimization mitigates catastrophic forgetting and minimizes this performance drop, but does not eliminate it.

4. Evaluation

KAT-Coder-V2 is evaluated across software engineering, agent execution, frontend aesthetics, and general-task settings. The results indicate stable multi-scaffold performance, strong execution under demanding OpenClaw scenarios, leading frontend aesthetics scores, and competitive general-task performance.

  • Multi-Scaffold Coding: KAT-Coder-V2 maintains stable performance across Claude Code, OpenClaw, and OpenCode scaffolds on software engineering benchmarks.The evaluation uses each scaffold’s native interaction protocols and system prompts.
  • Agent Task Execution: KAT-Coder-V2 demonstrates strong execution efficiency and response stability under scheduled triggering, high-concurrency requests, and long-chain tasks.These stress scenarios are evaluated with PinchBench and Claw-Eval under OpenClaw.
  • Frontend Aesthetics: KAT-Coder-V2 achieves leading aesthetic scores across Landing Pages, Slides, and Data Visualization scenarios.The benchmark uses colloquial user queries and blind evaluations by professional UI/UX designers.
  • General Tasks: KAT-Coder-V2 achieves competitive scores across Terminal-Bench Hard, tau^2-Bench Telecom, AA-LCR, and IFBench.The evaluation targets end-to-end task completion, multi-turn reasoning, long-context understanding, and instruction following.

5. Conclusion

The conclusion presents KAT-Coder-V2’s specialized training, large-scale agentic RL, and unified distillation as a path to powerful coding agents. It reports broad performance across coding domains while identifying remaining execution gaps and future extensions.

  • Core Conclusion: KAT-Coder-V2 combines orthogonal expert domains with on-policy distillation to retain expert-level performance across SWE, frontend generation, terminal reasoning, and general tasks.The conclusion frames this combination as a principled approach to building powerful coding agents.
  • Training System: KwaiEnv, MCLA, Tree Training, and systematic agentic scaling support stable and efficient training at scale.The cited infrastructure and algorithms address training infrastructure, MoE stability, trajectory computation, and scaling dimensions.
  • Evaluation: KAT-Coder-V2 closely rivals strong proprietary coding models across multiple scaffolds and benchmarks.The conclusion attributes this broad result to the combined specialized-training and distillation approach.
  • Limitations and Future Work: Gaps remain on some agent execution benchmarks such as Claw-Eval, motivating further scaling, richer environment interaction, and broader agentic-domain research.Future work also considers more efficient expert fusion beyond coding.

6. Contribution

The contribution section records the report’s contributors, with names listed alphabetically by first name. The supplied passages provide contributor attribution rather than technical contribution details.

  • Contributor Listing: Contributors’ names are listed in alphabetical order by first name.The supplied section text identifies the ordering convention explicitly.
  • Contributor Listing: The listed contributors include Fengxiang Li, Han Zhang, Haoyang Huang, Jinghui Wang, Jinhua Hao, Kun Yuan, and Mengtong Li.These names appear in the supplied contributor listing.
  • Contributor Listing: The listed contributors also include Minglei Zhang, Pengcheng Xu, Wenhao Zhuang, Yizhen Shao, Zongxian Feng, Ming Sun, Lin Ye, and Bin Chen.These names complete the supplied contributor listing.
Loading 2603.27703v1…