arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2510.18895cs.SEcs.AIcs.HC
收藏

CosmoCore 情感梦境回放强化学习用于代码生成

CosmoCore Affective Dream-Replay Reinforcement Learning for Code Generation

Microsoft Corporation(微软公司)

Santhosh Kumar Ravindran

AI总结:

CosmoCore 是一种受神经科学启发的强化学习架构,通过情感信号标记代码生成轨迹并优先重放高负效价事件,将幻觉代码减少 48%、自我纠正速度提升 45%,用于更情感感知的代码助手。

摘要:

我们引入了 CosmoCore,一种受神经科学启发的强化学习(RL)架构,该架构整合情感信号以增强大型语言模型(LLMs)中的代码生成。受人类和动物学习过程的启发——例如,观察到小狗在一次训斥后能避免重复错误,即错误带来的尴尬感驱动快速纠正——CosmoCore 使用轻量级多层感知器(MLP)为代码生成轨迹标记效价(valence)和惊喜度(surprise)。高负效价(令人尴尬的)事件,如有缺陷的代码输出,在梦境队列(Dream Queue)中被优先处理,在离策略更新期间进行五倍重放,而低惊喜度的成功样本则被剪枝以防止过度自信和缓冲区膨胀。在 HumanEval 和 BigCodeBench 等代码生成基准测试上,结合自定义数据管道环境的模拟评估,CosmoCore 将幻觉代码(如语法错误或逻辑错误)减少了 48%,并将自我纠正速度提升了 45%。在 PySpark 环境中使用 Hugging Face 模型进行的本地实验验证了这些改进,并提供了用于复现的代码片段。消融实验证实,效价标记增强了探索中的好奇心,而剪枝则缓解了低效问题。该框架扩展了基于人类反馈的强化学习(RLHF),用于开发更具情感感知能力的代码助手,在集成开发环境(IDEs)和数据管道中具有应用前景。代码和自定义迷你世界模拟已发布。

英文摘要:

We introduce CosmoCore, a neuroscience-inspired reinforcement learning (RL) architecture that integrates affective signals to enhance code generation in large language models (LLMs). Motivated by human and animal learning where embarrassment from mistakes drives rapid correction, as observed in training a puppy to avoid repeating errors after a single scolding CosmoCore tags code generation trajectories with valence and surprise using a lightweight multi-layer perceptron (MLP). High-negative valence (cringe) episodes, such as buggy code outputs, are prioritized in a Dream Queue for five-fold replay during off-policy updates, while low-surprise successes are pruned to prevent overconfidence and buffer bloat. Evaluated on code generation benchmarks like HumanEval and BigCodeBench, alongside simulations with a custom data pipeline environment, CosmoCore reduces hallucinated code (e.g., syntax errors or logical bugs) by 48\% and accelerates self-correction by 45\%. Local experiments using Hugging Face models in a PySpark environment validate these gains, with code snippets provided for replication. Ablations confirm valence tagging boosts curiosity in exploration, and pruning mitigates inefficiency. This framework extends RL from human feedback (RLHF) for more emotionally aware code assistants, with applications in IDEs and data pipelines. Code and the custom mini-world simulation are released.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑