arXiv:2512.21351cs.SEcs.AI2025-12

用进化算法让代码生成模型更灵活,适应新API和库。

CosmoCore-Evo: Evolutionary Dream-Replay Reinforcement Learning for Adaptive Code Generation

  • 将强化学习轨迹视为基因,夜间重播时进行突变与选择。
  • 在迁移环境上提升35%创新解法,适应速度加快25%。
  • 适合需要持续学习的AI编程助手开发人员。

基于CosmoCore的情感化梦回强化学习框架,我们提出CosmoCore-Evo,通过引入进化算法增强代码生成任务中的适应性与新颖性。受人类早期演化中自然选择与适应机制启发,该方法将强化学习轨迹视为“基因”,在夜间重播阶段进行突变与选择。这一机制使智能体摆脱已有训练模式,催生新行为,在如API变更或新库出现等分布偏移环境中表现更优。我们扩展了梦境队列,加入突变操作与企业级适应度函数,综合考虑效率、合规性与可扩展性指标。在包含人类评估变体、BigCodeBench及自定义PySpark流水线模拟的扩展基准上,CosmoCore-Evo相较原版CosmoCore及PPO、REAMER等基线,实现最高35%的新颖性提升与25%更快的适应速度。消融实验验证了进化组件对弥合大模型智能体“意识鸿沟”的关键作用。代码已开源,含简化仿真环境。

原文摘要 · Abstract (English)

Building on the affective dream-replay reinforcement learning framework of CosmoCore, we introduce CosmoCore-Evo, an extension that incorporates evolutionary algorithms to enhance adaptability and novelty in code generation tasks. Inspired by anthropological aspects of human evolution, such as natural selection and adaptation in early hominids, CosmoCore-Evo treats RL trajectories as ``genomes'' that undergo mutation and selection during the nocturnal replay phase. This mechanism allows agents to break free from trained patterns, fostering emergent behaviors and improved performance in distribution-shifted environments, such as changing APIs or novel libraries. We augment the Dream Queue with evolutionary operations, including mutation of high-fitness trajectories and enterprise-tuned fitness functions that incorporate efficiency, compliance, and scalability metrics. Evaluated on extended benchmarks including HumanEval variants with shifts, BigCodeBench, and a custom PySpark pipeline simulation, CosmoCore-Evo achieves up to 35% higher novelty in solutions and 25% faster adaptation compared to the original CosmoCore and baselines like PPO and REAMER. Ablations confirm the role of evolutionary components in bridging the sentient gap for LLM agents. Code for replication, including a toy simulation, is provided.

代码生成进化算法强化学习自适应

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