DHRCL:Training Code LLMs with Dense Hierarchical Rewards and Curriculum Learning

📄 arXiv: 2607.26457v1 📥 PDF

作者: Shuhang Wang, Ziming Li, Hui Cheng

分类: cs.LG

发布日期: 2026-07-29


💡 一句话要点

提出DHRCL框架以优化代码大语言模型的训练效果

🎯 匹配领域: 支柱二:RL算法与架构 (RL & Architecture) 支柱九:具身大模型 (Embodied Foundation Models)

关键词: 强化学习 代码生成 层次奖励 课程学习 模型训练 程序评估 AST结构 自动化测试

📋 核心要点

  1. 现有的代码生成强化学习方法依赖稀疏奖励或静态组合信号,无法有效评估不同编程能力。
  2. DHRCL框架通过密集层次奖励和课程学习,将反馈信号分解并组织为三阶段课程,自动调整阶段持续时间。
  3. 实验结果表明,DHRCL在不同模型容量下均表现出一致的优势,超越了多种基线方法。

📝 摘要(中文)

强化学习是代码导向的大语言模型后训练的自然范式,因为生成的程序可以通过解析、执行、单元测试和结构分析进行评估。然而,现有方法往往依赖稀疏的结果奖励或静态组合异构的密集信号,尽管语法有效性、可执行性、功能正确性和结构组织描述了不同且逐步依赖的编程能力。我们提出了DHRCL,一个具有密集层次奖励和课程学习的强化学习框架。DHRCL将反馈分解为语法验证、执行成功、单元测试通过率和基于AST的结构相似性,并通过三阶段的语法、执行、通过与结构课程组织这些信号。阶段持续时间根据最近的验证趋势自动确定,而不是手动指定能力阈值。我们进一步引入了基于阶段的概率性令牌信用再分配机制,强调在语法优化期间建立的令牌模式,并在最终功能优化期间对不太成熟的令牌决策分配更多的信用或责备。

🔬 方法详解

问题定义:现有的代码生成强化学习方法在反馈信号的使用上存在不足,通常依赖稀疏的结果奖励或静态组合不同的信号,无法有效评估和提升模型的编程能力。

核心思路:DHRCL框架通过密集层次奖励和课程学习,将反馈信号分解为多个维度,逐步提升模型的编程能力,并通过自动化的阶段调整来优化学习过程。

技术框架:DHRCL的整体架构包括三个主要阶段:语法验证、执行成功和单元测试通过率,以及基于AST的结构相似性。每个阶段的持续时间根据最近的验证趋势自动调整,而不是手动设定。

关键创新:DHRCL的核心创新在于其将反馈信号进行层次化处理,并引入阶段感知的概率性令牌信用再分配机制,这与现有方法的静态信号组合形成了本质区别。

关键设计:在设计中,DHRCL采用了基于阶段的信用再分配策略,强调在语法优化期间的稳定令牌模式,并在功能优化阶段对不成熟的决策给予更多的信用或责备。

🖼️ 关键图片

fig_0
fig_1
fig_2

📊 实验亮点

实验结果显示,DHRCL在Qwen3-4B、Qwen3-8B和Qwen3-14B模型上均表现出显著优势,相较于二元、通过率、基于奖励模型和可验证的密集奖励基线,提升幅度明显,验证了其有效性和一致性。

🎯 应用场景

DHRCL框架的潜在应用领域包括代码生成、自动化软件测试和智能编程助手等。通过提升代码生成模型的训练效果,该研究有助于提高程序的质量和可靠性,推动智能编程技术的发展,具有重要的实际价值和未来影响。

📄 摘要(原文)

Reinforcement learning is a natural post-training paradigm for code-oriented large language models because generated programs can be evaluated through parsing, execution, unit tests, and structural analysis.However, existing methods often rely on sparse outcome rewards or statically combine heterogeneous dense signals, even though syntax validity, executability, functional correctness, and structural organization describe different and progressively dependent programming capabilities. We propose DHRCL, a reinforcement learning framework with Dense Hierarchical Rewards and Curriculum Learning. DHRCL decomposes feedback into syntax validation, execution success, unit-test pass rate, and AST-based structural similarity, and organizes these signals through a three-stage Syntax, Execution, Pass & Structural curriculum. Stage duration is determined automatically from recent validation trends rather than manually specified capability thresholds. We further introduce stage-aware probability-based token credit redistribution. The mechanism follows a consolidation-to-refinement principle: it emphasizes established token patterns during syntax-oriented optimization, applies uniform propagation for non-local execution feedback, and allocates more credit or blame to less-established token decisions during final functional optimization. Under a unified Qwen3-8B and KodCode protocol, the experiments compare DHRCL with binary, pass-rate, reward-model-based, and verifiable dense-reward baselines. We further evaluate DHRCL across Qwen3-4B, Qwen3-8B, and Qwen3-14B backbones, showing that its advantage remains consistent as model capacity increases.