arXiv:2508.03487cs.SEcs.AI2025-08

用大模型自动修复代码警告,提升企业开发效率。

BitsAI-Fix: LLM-Driven Approach for Automated Lint Error Resolution in Practice

  • 基于树突解析上下文,大模型生成可直接应用的修复补丁。
  • 上线后每周超1000人使用,修复超1.2万问题,准确率达85%。
  • 支持持续学习与效果追踪,适合大规模工程团队落地。

随着企业代码库规模和复杂度不断增长,静态分析产生的警告数量远超工程师手动修复能力,导致技术债累积并阻碍开发效率。本文提出 BitsAI-Fix,一种基于大语言模型(LLM)的自动化代码警告修复流程,旨在解决工业级环境中的这一关键挑战。该方案采用 Tree-sitter 进行上下文扩展,通过特定训练的 LLM 生成搜索-替换格式的补丁,并经由 lint 扫描重新验证后输出最终修复结果。此外,我们设计了一种创新的渐进式强化学习训练策略,可在项目冷启动阶段自动获取可验证训练数据,并在系统上线后通过反馈持续收集在线样本进行模型迭代。同时,引入基于规则的奖励机制,结合格式与正确性奖励,并惩罚冗余修改;还提出“代码差分匹配”方法以持续追踪线上效果。在字节跳动生产环境中部署后,该方案已支持超过 5,000 名工程师,修复超过 12,000 个静态分析问题,实现约 85% 的修复准确率,每周活跃采纳者约 1,000 人。本工作证明了基于 LLM 的代码修复方案在企业场景下的可行性,为大规模工业级自动化代码修复提供了参考。

原文摘要 · Abstract (English)

As enterprise codebases continue to grow in scale and complexity, the volume of lint errors far exceeds engineers' manual remediation capacity, leading to continuous accumulation of technical debt and hindered development efficiency. This paper presents BitsAI-Fix, an automated lint error remediation workflow based on Large Language Models (LLMs), designed to address this critical challenge in industrial-scale environments. BitsAI-Fix employs tree-sitter for context expansion and generates search-and-replace format patches through specially trained LLMs, followed by lint scan re-verification to output final remediation results. Additionally, our approach introduces an innovative progressive reinforcement learning (RL) training strategy that can automatically acquire verifiable training data during the project cold-start phase and continuously iterate the model by collecting online samples through feedback after system deployment. Furthermore, we designed a targeted rule-based reward mechanism that combines format rewards and correctness rewards while penalizing redundant modifications. We also propose a "code diff matching" methodology to continuously track online effectiveness. In production deployment at ByteDance, our solution has supported over 5,000 engineers, resolved more than 12,000 static analysis issues, achieved approximately 85% remediation accuracy, with around 1,000 weekly active adopters. This work demonstrates the practical feasibility of LLM-based code remediation solutions in enterprise environments and serves as a reference for automated code fix in large-scale industrial scenarios.

代码修复大模型自动化工业落地

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。