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 spans domains with differing and sometimes conflicting training signals, challenging a single monolithic pipeline. KAT-Coder-V2 specializes five expert domains before unifying them through on-policy distillation, and closely rivals strong coding models across multiple scaffolds and benchmarks.

  • Problem

    Agentic coding domains require differing, sometimes conflicting training signals, making it impractical for one monolithic pipeline to reach every domain’s optimum.

    Source: §1 · p. 2
  • Method

    KAT-Coder-V2 independently trains experts for five agentic coding domains, then consolidates them into one model through on-policy distillation.

    Source: §1 · p. 2
  • Results

    Across multiple scaffolds and benchmarks, KAT-Coder-V2 closely rivals strong proprietary coding models, with 88.7 on PinchBench versus GLM-5 at 86.4 and MiniMax M2.7 at 87.1.

    Source: §1 · p. 3, §5 · p. 20
  • Takeaways & Limitations

    The report concludes that one model retains expert-level performance across SWE, frontend generation, terminal reasoning, and general tasks.

    Source: §5 · p. 20

    The unified model incurs slight performance degradation relative to isolated experts, primarily due to capacity constraints and cross-domain interference.

    Source: §3.4 · p. 16

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

KAT-Coder-V2 combines specialized agent training with on-policy unification, modular infrastructure, and agentic RL scaling methods, and reports results across coding, frontend, and generalist benchmarks.

1. Introduction

  • Agentic coding requires end-to-end alignment of multi-step tool use with engineering outcomes, while training faces fragmented capabilities, coupled infrastructure, and scaling challenges.SWE, WebCoding, and Terminal require distinct skills and potentially conflicting training signals; infrastructure must support diverse sandboxes and scaffolds, while RL must scale task complexity, prompt diversity, and scaffold generalization despite MoE instability and redundant tree computation.Source: §1 · p. 2
  • KAT-Coder-V2 specializes five domains—SWE, WebCoding, Terminal, WebSearch, and General—with independent training, then unifies their experts into one deployable model through on-policy distillation.The report describes the distillation as combining on-policy exploration with step-by-step expert supervision to achieve lossless fusion without offline imitation’s exposure bias.Source: §1 · p. 2
  • KwaiEnv decouples datasets, sandboxes, scaffolds, and verifiers; Agentic Scaling yields over 100K samples, while MCLA reduces log-probability variance and Tree Training achieves up to 6.2× speedup.KwaiEnv sustains tens of thousands of concurrent sandbox instances; training samples span multiple agent frameworks and are diverse and high-difficulty.Source: §1 · p. 2

2. KwaiEnv: Infrastructure for Agentic Code Intelligence … 2.3. Core Modules

KwaiEnv is a modular, configurable infrastructure for agentic coding that decouples datasets, sandboxes, scaffolds, and verification, supporting workflows from model evaluation through RL training.

2.1. Background and Design Motivation

  • Multi-step sandbox rollouts, heterogeneous datasets, proliferating scaffolds, and high-throughput demands motivate KwaiEnv’s modular decoupling of datasets, sandboxes, scaffolds, and verification.Agentic coding requires environment initialization, tool calling, state management, and result verification.Source: §2.1 · p. 3

2.2. System Overview

  • KwaiEnv combines models, scaffolds, and datasets through a unified interface and autonomously collects trajectories, evaluates rollouts, and formats results for the RL engine.Users configure the dataset, model, and scaffold; the system orchestrates sandboxes, proxies model requests, records interactions, and invokes verification.Source: §2.2 · p. 3

2.3.1. Dataset

  • The Dataset module unifies benchmark and proprietary data through an interface that masks differences in task formats, image dependencies, and scoring logic.New datasets can be integrated by implementing the interface’s standard methods.Source: §2.3.1 · p. 4

2.3.2. Verifier

  • The Verifier supports deterministic scoring, LLM-as-Judge with configurable rubric dimensions and weights, and SWE evaluation using sandboxed test suites and pass rates.Deterministic scoring can use golden patches, test execution, or standard-output comparison.Source: §2.3.2 · p. 4

2.3.3. Scaffold

  • KwaiEnv integrates Coding Agent scaffolds as black boxes through network-layer model-request proxying, requiring API endpoint and authentication configuration rather than code changes.The integration supports compatibility across scaffold versions.Source: §2.3.3 · p. 5

2.3.4. Sandbox

  • The Sandbox module creates, assigns, monitors, and reclaims isolated, dataset-image-mounted containers, supporting tens of thousands of concurrent instances for RL rollouts.It can trigger a massive number of remote sandboxes within seconds.Source: §2.3.4 · p. 5

2.3.5. Trajectory Manager

  • The Trajectory Manager records LLM I/O, tool-call sequences, token usage, and timestamps, then assembles, reorders, or truncates trajectories for RL algorithm requirements.It bridges KwaiEnv and the RL engine by collecting, formatting, and outputting trajectories.Source: §2.3.5 · p. 5

2.4. Decoupling and Scalability

KwaiEnv decouples five core modules through standardized interfaces, enabling independent iteration and flexibility in scaling data, scaffolds, evaluation, and RL algorithms.

2.4. Decoupling and Scalability

  • Standardized interfaces let KwaiEnv’s five core modules evolve independently under a Separation of Concerns design.This modularity supports independent iteration across the infrastructure.Source: §2.4 · p. 5
  • Data scaling requires only a unified data interface, while onboarding new Coding Agents requires configuring container commands and API endpoints.Neither data changes nor scaffold onboarding requires changes to the other components.Source: §2.4 · p. 5
  • Shared evaluation and training infrastructure improves consistency and shortens iteration cycles, while decoupled formatting logic supports new RL algorithms through registered trajectory-formatting rules.Evaluation and training use the same infrastructure; algorithm changes need not alter the formatting logic.Source: §2.4 · p. 5

3. Post-Training Methodology · 3.1. Training Pipeline Overview

KAT-Coder-V2 extends KAT-Coder-V1 [10] through a specialize-then-unify post-training pipeline: five domain experts receive independent specialized training, then their capabilities are consolidated into one model.

3.1. Training Pipeline Overview

  • KAT-Coder-V2 specializes training across five orthogonal domains: SWE, WebCoding, Terminal, WebSearch, and General.Each domain undergoes independent data construction and specialized training.Source: §3.1 · p. 6

3. Post-Training Methodology

  • The pipeline uses supervised fine-tuning, reinforcement learning, and on-policy distillation to produce a unified KAT-Coder-V2.The model is built on KAT-Coder-V1 [10] through continued post-training and a specialize-then-unify paradigm.Source: §3.1 · pp. 5–6

3.1. Training Pipeline Overview

  • For supervised fine-tuning, KwaiEnv trajectories and domain-specific data synthesis produce a dedicated expert model for each domain.The pipelines construct large-scale, high-quality training data.Source: §3.1 · p. 6
  • Environment-feedback reinforcement learning uses KwaiEnv sandboxes and verifiers to improve decision quality in multi-turn interactions and long-horizon tasks.Source: §3.1 · p. 6
  • On-policy distillation consolidates the domain experts into a single model for deployment while retaining expert-level performance across domains.Source: §3.1 · p. 6
  • The following subsections detail data construction and training methodology for each expert domain.Source: §3.1 · p. 6

3.2. Supervised Fine-Tuning

Section 3.2 trains five supervised-fine-tuned domain experts—SWE, WebCoding, Terminal, WebSearch, and General—each targeting a distinct capability for agentic coding.

3.2.1. SWE Expert: Autonomous Issue Resolution

  • The pipeline produces 30k verified training samples from over 8,000 open-source repositories, while Issue–PR construction yields over 2M training samples for retrieval and editing tasks.The 30k samples pair reproducible Docker environments and build scripts, buggy-state code, leak-free instructions, and dual rule-based and GRM verification. Issue–PR tasks include Issue-to-code retrieval, repair generation, and long-range codebase context.Source: §3.2.1 · pp. 7–8, Figure 3 · p. 7

3.2.2. WebCoding Expert: Aesthetic-Aware UI Generation

  • A tri-perspective label system maps colloquial design intent through rationale to implementation, while a reference-free benchmark evaluates aesthetics from ordinary-user prompts.Prompt rewriting creates designer-annotated, professional-user, and ordinary-user variants for each design; trained designers score rendered pages under standardized interactive review, distinguishing aesthetic fidelity from code fidelity.Source: §3.2.2 · pp. 9–10

3.2.3. Terminal Expert: Interactive Command-Line Reasoning

  • Terminal training combines expert-authored and multi-agent synthetic tasks, AutoBuilder adaptations, and open-source datasets into verifiable command-line tasks.Samples include task instructions, reference solutions, automated tests, and reproducible Docker environments; sources span 12 technical domains and more than 420 CLI tools.Source: §3.2.3 · p. 11

3.2.4. WebSearch Expert: Agentic Search

  • WebSearch training builds over 100K samples from search-trajectory knowledge graphs, then filters for tool-dependent questions and intermediate difficulty.Rejection-sampling fine-tuning selects trajectories with correct answers, no failed tool calls, and no duplicate queries.Source: §3.2.4 · p. 11

3.2.5. General Expert: Instruction Following and Code-Math Reasoning

  • The General Expert preserves broad capability through instruction following, general QA, and code-math reasoning.Its training includes long-conversation samples with topic shifts and cross-turn dependencies, plus competition-level programming and mathematics problems verified by online judges.Source: §3.2.5 · pp. 11–12

3.3. Reinforcement Learning

The section scales agentic RL through diverse, realistic tasks, turn-aware optimization, and efficient tree-structured training infrastructure. It introduces methods for improving long-horizon credit assignment and MoE training stability while reducing redundant computation and sandbox-training costs.

3.3.1. Agentic RL

  • Over 100,000 diverse RL samples scale Autobuilder tasks across complexity, intent alignment, and scaffold generalization, using verified, difficult trajectories to provide learning signals.A closed-source model acts as Teacher and Judge, and easily solvable tasks are filtered out.Source: §3.3.1 · p. 12
  • Semantic augmentation maps each code commit to varied prompts, helping the model infer engineering intent from incomplete or ambiguous user instructions.LLMs rewrite standardized task specifications into variants ranging from detailed instructions to colloquial, underspecified queries.Source: §3.3.1 · p. 12
  • A unified 5-tuple represents the execution environment, tools, scaffold and system prompt, task instruction, and verification and reward signals for interaction-heavy coding tasks.Generating identical tasks across black-box and white-box scaffolds supports transferable, scaffold-agnostic behavior.Source: §3.3.1 · pp. 12–13
  • Turn-level GSPO computes independent importance ratios per interaction turn, retaining sequence-level variance reduction while enabling finer credit assignment in multi-turn tasks.Scaffold-specific turn boundaries support multi-scaffold data and are reported to accelerate convergence and improve self-correction in long-step debugging.Source: §3.3.1 · p. 13

3.3.2. Agentic Engineering

  • Up to 6.2× end-to-end training speedup comes from Tree Training’s DFS-flattened trajectories and per-token loss weights, with gradients equivalent to training root-to-leaf paths independently.Tree-structured attention masks and per-token position IDs preserve each token’s path and original sequence position.Source: Figure 5 · p. 14, §3.3.2 · p. 15

3.3.1. Agentic RL

  • MCLA averages K prefetched trajectory log-probabilities to reduce estimator variance, while complementary IcePop clipping mitigates training–inference mismatch for stable, faster-converging MoE RL.The identified instability includes noisy trajectory log-probability estimates associated with MoE routing, capacity dropping, and numerical variance.Source: §3.3.1 · pp. 13–14

3.3.2. Agentic Engineering

  • 2.8× lower unit sample cost is achieved by KRL’s interleaved rollout and training, supported by cache-aware scheduling, dynamic streaming, and large-scale sandbox orchestration.KRL assigns agent scaffolds to tasks, provisions isolated environments through KwaiEnv and Wanqing, and routes requests to SGLang inference servers.Source: §3.3.2 · pp. 14, 16

3.4. Expert Fusion via On-Policy Distillation

The section presents On-Policy Distillation (OPD) 7 as a way to unify specialized experts: the Student learns from environmental success rewards and dense, expert-guided supervision on its own trajectories. This joint optimization mitigates—but does not eliminate—the performance loss associated with consolidating experts.

3.4. Expert Fusion via On-Policy Distillation

  • OPD 7 combines RL’s active exploration with dense distillation supervision to address the forgetting, sparse-feedback, and exposure-bias limitations of alternative fusion approaches.Direct weight averaging risks catastrophic forgetting, standard RL feedback can be too sparse to locate intermediate reasoning errors, and off-policy SFT suffers from exposure bias.Source: §3.4 · p. 16
  • The Student generates trajectories on mixed-domain prompts and jointly optimizes RL success rewards with step-level log-probability supervision from the best-performing task-specific expert.Using the expert’s log-probabilities avoids full-logit distillation while providing unbiased optimization targets.Source: §3.4 · p. 16
  • Unifying experts still causes slight performance degradation from capacity constraints and cross-domain interference, but joint optimization mitigates catastrophic forgetting and minimizes the drop.The approach aligns the Student’s active reasoning with expert log-probabilities while grounding it in environmental task success.Source: §3.4 · p. 16

4. Evaluation

KAT-Coder-V2 was evaluated across multi-scaffold coding, agent task execution, frontend aesthetics, and general task processing, with results indicating strong performance across these dimensions. The reported findings include stable performance across scaffolds, strong execution under agent stress scenarios, leading aesthetics scores, and competitive scores on general benchmarks.

4.1. Multi-Scaffold Coding

  • KAT-Coder-V2 maintained stable performance across mainstream scaffolds and was compatible with over 10 AI coding scaffolds.Evaluations used native interaction protocols and system prompts on SWE-bench Verified, SWE-bench Multilingual, and a subset of Swe-rebench-V2; core metrics on Claude Code, OpenClaw, and OpenCode were comparable to the most advanced coding model.Source: §4.1 · p. 17, Table 2 · p. 17

4.2. Agent Task Execution

  • KAT-Coder-V2 showed strong execution efficiency and response stability on PinchBench and Claw-Eval under scheduled triggering, high concurrency, and long-chain task stress.Testing used the OpenClaw framework.Source: §4.2 · pp. 17–18, Table 3 · p. 18

4.3. Frontend Aesthetics Generation

  • KAT-Coder-V2 achieved leading aesthetic scores across Landing Pages, Slides, and Data Visualization.The reference-free benchmark used colloquial user queries and blind evaluations by professional UI/UX designers; Landing Pages covered 10 dimensions, and Slides and Data Visualization covered 5 each.Source: §4.3 · p. 18, Table 4 · p. 18

4.4. General Task Processing

  • KAT-Coder-V2 achieved competitive scores across general scenarios on Terminal-Bench Hard, τ2-Bench Telecom, AA-LCR, and IFBench.The evaluation targeted end-to-end complex tasks, multi-turn interactive reasoning, long-context understanding, and high-precision instruction following.Source: §4.4 · pp. 18–19, Table 5 · p. 19

5. Conclusion

KAT-Coder-V2 combines domain-specialized training with on-policy distillation to retain expert-level performance across coding domains in one model, supported by infrastructure and methods for stable, efficient training at scale.

5. Conclusion

  • KAT-Coder-V2 retains expert-level performance across SWE, frontend generation, terminal reasoning, and general tasks by fusing orthogonal expert domains through on-policy distillation.The report presents this Specialize-then-Unify approach as a principled path toward powerful coding agents.Source: §5 · pp. 19–20
  • KwaiEnv, MCLA, Tree Training, and agentic scaling across task complexity, prompt diversity, and scaffold generalization enable stable, efficient training at scale.Source: §5 · p. 20
  • Despite closely rivaling leading proprietary coding models across benchmarks, KAT-Coder-V2 retains gaps on some agent execution benchmarks, including Claw-Eval.Future work aims to narrow these gaps through further agentic RL scaling and richer environment interaction, extend the paradigm beyond coding, and explore more efficient expert fusion.Source: §5 · p. 20

6. Contribution

The report lists contributors alphabetically by first name and separately identifies core contributors and tech leads.

6. Contribution

  • Contributors’ names are listed in alphabetical order by first name.Source: §6 · p. 20

Core Contributors

  • Core contributors are Fengxiang Li, Han Zhang, Haoyang Huang, Jinghui Wang, Jinhua Hao, Kun Yuan, Mengtong Li, Minglei Zhang, Pengcheng Xu, Wenhao Zhuang, Yizhen Shao, and Zongxian Feng.Source: Core Contributors · p. 20

Tech Leads

Loading 2603.27703v1…