arXiv:2509.21170cs.SEcs.AI2025-09综述被引 2

用最大熵机制增强代码评审的多维度推理能力。

Fine-Tuning LLMs to Analyze Multiple Dimensions of Code Review: A Maximum Entropy Regulated Long Chain-of-Thought Approach

  • 通过长链式思维构建结构化评审信息,提升模型多维分析能力。
  • 14B小模型经微调后性能媲美671B大模型,准确率显著超越现有方法。
  • 适合关注代码质量与自动化评审的研究者和开发者使用。

大型语言模型(LLMs)在代码审查自动化中展现出巨大潜力,因其具备出色的上下文理解与推理能力。然而,由于训练数据的影响,其能力仍远不及人类认知水平。近期研究通过使用代码审查数据微调模型,显著提升了性能。但相比人类评审者常同时分析多个维度以更精准发现问题,现有方法受限于微调时使用的有限或模糊信息。本文提出 MelcotCR,一种基于链式思维(COT)的微调方法,通过长链式思维技术提供丰富结构化信息,使模型具备多维度代码审查推理能力。为解决长链提示中常见的上下文丢失与逻辑断裂问题,提出结合最大熵(ME)建模原则与预定义推理路径的方案,有效利用上下文知识并强化推理连贯性。在自建 MelcotCR 数据集与公开 CodeReviewer 数据集上的实证评估显示,仅需14B参数的基线模型(如14B Qwen2.5),经MelcotCR微调后,在识别与描述代码问题的准确率上已超越当前最优方法,性能与671B DeepSeek-R1模型相当。

原文摘要 · Abstract (English)

Large Language Models (LLMs) have shown great potential in supporting automated code review due to their impressive capabilities in context understanding and reasoning. However, these capabilities are still limited compared to human-level cognition because they are heavily influenced by the training data. Recent research has demonstrated significantly improved performance through fine-tuning LLMs with code review data. However, compared to human reviewers who often simultaneously analyze multiple dimensions of code review to better identify issues, the full potential of these methods is hampered by the limited or vague information used to fine-tune the models. This paper contributes MelcotCR, a chain-of-thought (COT) fine-tuning approach that trains LLMs with an impressive reasoning ability to analyze multiple dimensions of code review by harnessing long COT techniques to provide rich structured information. To address context loss and reasoning logic loss issues that frequently occur when LLMs process long COT prompts, we propose a solution that combines the Maximum Entropy (ME) modeling principle with pre-defined reasoning pathways in MelcotCR to enable more effective utilization of in-context knowledge within long COT prompts while strengthening the logical tightness of the reasoning process. Empirical evaluations on our curated MelcotCR dataset and the public CodeReviewer dataset reveal that a low-parameter base model, such as 14B Qwen2.5, fine-tuned with MelcotCR can surpass state-of-the-art methods in terms of the accuracy of detecting and describing code issues, with its performance remarkably on par with that of the 671B DeepSeek-R1 model.

代码审查链式思维大模型微调最大熵

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