大模型
arxiv.org ·
通过质量感知偏好学习提升 LLM 生成代码的非功能质量合规性
该 arXiv 论文提出质量感知偏好学习框架,引导 LLM 生成符合编码规范与最佳实践的代码,分三阶段:构建“违规—合规”配对样本数据集、设计自适应 token 加权以突出质量敏感代码区域、采用排序损失与语言建模损失及 KL 散度结合的混合优化目标。在 DeepSeek-Coder 与 Qwen2.5-Coder 上的实验显示,方法在保持功能正确性的同时显著提升目标非功能质量标准的合规性,Qwen2.5-Coder 在 MBPP-sanitized 上的 Quality Reciprocal Score 相对提升 75.7%;微调 7B 模型耗时不足三小时,消融实验与用户研究进一步支持其有效性。
AI推荐理由 arXiv 论文(v4,2026-09-19 修订),摘要给出明确方法三阶段(构造违规/合规配对数据、自适应 token 加权、排序损失+语言建模损失+KL 的混合目标)与可验证实验:在 DeepSeek-Coder 和 Qwen2.5-Coder 上提升非功能质量合规性,Qwen2.5-Coder 在 MBPP-sanitized 上 QRS 相对提升 75.7%,7B 模型微调不到三小时,并含消融与用户研究。新信息在于把偏好学习用于代码非功能质量(风格、可维护性)而非仅功能正确性,对代码生成落地有参考价值;局限是摘要未给出绝对基线数值、数据集规模与用户研究细节,效果需看全文验证。
78
正文
Computer Science > Software Engineering
arXiv:2503.09020 (cs)
[Submitted on 12 Mar 2025 (v1), last revised 19 Sep 2026 (this version, v4)]
Title:Enhancing the Non-Functional Quality Compliance of LLM-Generated Code through Quality-Aware Preference Learning
Authors:Liang Lu, Yuan Jiang, Christoph Treude
View a PDF of the paper titled Enhancing the Non-Functional Quality Compliance of LLM-Generated Code through Quality-Aware Preference Learning, by Liang Lu and 1 other authors
View PDF
HTML (experimental)
Abstract:Large Language Models (LLMs) have been widely adopted in commercial code completion engines, significantly enhancing coding efficiency and productivity. However, even functionally correct LLM-generated code may exhibit non-functional quality issues that violate coding standards and best practices, such as poor style and limited maintainability. To address this, we propose a framework for quality-aware preference learning that guides LLMs toward generating criteria-compliant code. Our approach consists of three phases. First, we construct a dataset of paired criteria-violating and criteria-compliant samples, where each pair contains code exhibiting a specific non-functional quality issue and its repaired version that resolves the issue. Second, we design an adaptive token weighting mechanism to emphasize quality-sensitive code regions. Third, we introduce a hybrid optimization objective that combines ranking loss with language modeling loss and KL divergence to enable effective comparative optimization. Extensive experiments on DeepSeek-Coder and Qwen2.5-Coder show that our method substantially improves compliance with the targeted non-functional quality criteria while maintaining functional correctness, achieving a 75.7% relative increase in Quality Reciprocal Score (QRS) on MBPP-sanitized for Qwen2.5-Coder. Fine-tuning a 7B model requires less than three hours, indicating strong practical viability. Ablation studies and a user study further support the effectiveness of the proposed framework.
Subjects:
Software Engineering (cs.SE); Artificial Intelligence (cs.AI)
Cite as:
arXiv:2503.09020 [cs.SE]
(or
arXiv:2503.09020v4 [cs.SE] for this version)
https://doi.org/10.48550/arXiv.2503.09020
Focus to learn more
arXiv-issued DOI via DataCite
Submission history
From: Yuan Jiang [view email]
[v1]
Wed, 12 Mar 2025 03:15:46 UTC (5,860 KB)
[v2]
Wed, 19 Mar 2025 07:24:48 UTC (7,504 KB)
[v3]
Sat, 15 Aug 2026 01:29:37 UTC (3,227 KB)
[v4]
Sat, 19 Sep 2026 15:49:03 UTC (3,228 KB)
Full-text links:
Access Paper:
View a PDF of the paper titled Enhancing the Non-Functional Quality Compliance of LLM-Generated Code through Quality-Aware Preference Learning, by Liang Lu and 1 other authors
View PDF
HTML (experimental)
TeX Source
view license
Current browse context:
cs.SE
new
|
recent
| 2025-03
Change to browse by:
cs
cs.AI
References & Citations
NASA ADS
Google Scholar
Semantic Scholar
export BibTeX citation
Loading...
BibTeX formatted citation
×
loading...
Data provided by:
Bookmark
Bibliographic Tools
Bibliographic and Citation Tools
Bibliographic Explorer Toggle
Bibliographic Explorer (What is the Explorer?)
Connected Papers Toggle
Connected Papers (What is Connected Papers?)
Litmaps Toggle
Litmaps (What is Litmaps?)
scite.ai Toggle
scite Smart Citations (What are Smart Citations?)
Code, Data, Media
Code, Data and Media Associated with this Article
alphaXiv Toggle
alphaXiv (What is alphaXiv?)
Links to Code Toggle
CatalyzeX Code Finder for Papers (What is CatalyzeX?)
DagsHub Toggle
DagsHub (What is DagsHub?)
GotitPub Toggle
Gotit.pub (What is GotitPub?)
Huggingface Toggle
Hugging Face (What is Huggingface?)
ScienceCast Toggle
ScienceCast (What is ScienceCast?)
Demos
Demos
Replicate Toggle
Replicate (What is Replicate?)
Spaces Toggle
Hugging Face Spaces (What is Spaces?)
Spaces Toggle
TXYZ.AI (What is TXYZ.AI?)
Related Papers
Recommenders and Search Tools
Link to Influence Flower
Influence Flower (What are Influence Flowers?)
Core recommender toggle
CORE Recommender (What is CORE?)
Author
Venue
Institution
Topic
About arXivLabs
arXivLabs: experimental projects with community collaborators
arXivLabs is a framework that allows collaborators to develop and share new arXiv features directly on our website.
Both individuals and organizations that work with arXivLabs have embraced and accepted our values of openness, community, excellence, and user data privacy. arXiv is committed to these values and only works with partners that adhere to them.
Have an idea for a project that will add value for arXiv's community? Learn more about arXivLabs.
Which authors of this paper are endorsers? |
Disable MathJax (What is MathJax?)