cs.LGApr 13, 2026

The Past Is Not Past: Memory-Enhanced Dynamic Reward Shaping

Authors: Yang Liu, Enxi Wang, Yufei Gao, Weixin Zhang, Bo Wang, Zhiyuan Zeng, Yikai Zhang, Yining Zheng, 

Organizations: Fudan University · Shanghai Innovation Institute

Abstract

Despite the success of reinforcement learning for large language models, a common failure mode is reduced sampling diversity, where the policy repeatedly generates similar erroneous behaviors. Classical entropy regularization encourages randomness under the current policy, but does not explicitly discourage recurrent failure patterns across rollouts. We propose MEDS, a Memory-Enhanced Dynamic reward Shaping framework that incorporates historical behavioral signals into reward design. By storing and leveraging intermediate model representations, we capture features of past rollouts and use density-based clustering to identify frequently recurring error patterns. Rollouts assigned to more prevalent error clusters are penalized more heavily, encouraging broader exploration while reducing repeated mistakes. Across five datasets and three base models, MEDS consistently improves average performance over existing baselines, achieving gains of up to 4.13 pass@1 points and 4.37 pass@128 points. Additional analyses using both LLM-based annotations and quantitative diversity metrics show that MEDS increases behavioral diversity during sampling.

Figures & tables

Appendix figures & tables1 asset

Supplementary material from the paper’s appendix.

Appendix

Explore similar work

CardsList
  1. DyJR: Preserving Diversity in Reinforcement Learning with Verifiable Rewards via Dynamic Jensen-Shannon Replay

    Mar 17, 2026Long Li, Zhijian Zhou, Tianyi Wang +7Behavioral Diversity in RLReinforcement Learning

  2. DSDR: Dual-Scale Diversity Regularization for Exploration in LLM Reasoning

    Feb 23, 2026Zhongwei Wan, Yun Shen, Zhihao Dou +9Reinforcement LearningRL for Language Model Reasoning

  3. Reasoning or Memorization? Direction-Aware Diversity Exploration in LLM Reinforcement Learning

    Jun 9, 2026Jiangnan Xia, Yucheng Shi, Yu Yang +3Memorization in Language ModelsRL for Language Model Reasoning