MLREF: Efficient Module Reuse for Reward Design in Reinforcement Learning via Large Language Models

Chenglin Liu, Xun Wang, Ruishuo Chen, Zhuoran Li, Longbo HuangarXiv 2026

TL;DR

Designing effective reward functions is one of the biggest bottlenecks in reinforcement learning (RL). While Large Language Models (LLMs) can automate this process, existing methods rewrite reward functions from scratch in each iteration, throwing away good components and causing massive performance oscillations. MLREF fixes this by introducing a persistent "module pool" that tracks, refines, and reuses successful reward components across iterations, leading to a 25.2% performance boost in locomotion tasks.

What Problem Does This Paper Address?

In reinforcement learning, an agent learns by trial and error to maximize a reward signal. If the reward is too sparse (e.g., "win the game"), the agent learns nothing; if it is too dense, it requires tedious manual tuning by human experts.

Recently, frameworks like EUREKA have used LLMs to automatically generate and iteratively refine reward functions based on code feedback. However, these methods treat reward functions as monolithic programs. If an LLM discovers a great reward component in iteration 2, it might completely overwrite or break it in iteration 3. This lack of module-level tracking leads to highly unstable optimization trajectories and redundant searches.

MLREF addresses this meta-optimization challenge by shifting the focus from optimizing a single function to managing a persistent repository of reusable reward modules.

Comparison of design properties across LLM-based reward design methods.

Methods

MLREF introduces the Module Level Reward Evolution Framework, which models a reward function as a weighted linear combination of distinct reward modules (e.g., distance-to-target, energy penalty).

The core architecture consists of a Module Pool and an iterative pipeline driven by three key mechanisms:

  1. Reflection-Based Refinement: Before writing code, the LLM performs a two-part chain-of-thought analysis: Task Reflection (identifying success conditions and failure patterns) and Environment Reflection (extracting valid state variables from the environment code).
  2. Hybrid Weight Optimization: Instead of letting the LLM guess weights, MLREF uses a hybrid credit assignment strategy. It combines the LLM's semantic judgment with empirical training data by calculating the Pearson correlation between each module's reward sequence and the actual policy performance curve (including time-lag compensation). An Upper Confidence Bound (UCB) strategy balances the exploration of new modules with the exploitation of proven ones.
  3. Merge Strategy with Rollback: In each iteration, MLREF generates multiple pool variants in parallel. It discards underperforming variants, merges successful modules from surviving pools, and crucially, rolls back to the previous best pool if an entire iteration fails or regresses.
Overview of the MLREF pipeline showing initialization and iterative optimization phases.

Datasets

The authors evaluated MLREF across 17 representative tasks from two standard physics simulation benchmarks:

  • Isaac Gym: Focused on locomotion challenges (e.g., Ant, Humanoid, Anymal, Quadcopter).
  • Bi-DexHands: Focused on complex, dual-arm dexterous manipulation tasks (e.g., Shadow Hand, Block Stack, Door Close Outward, Kettle).

Key Insights and Ideas

  • Function-level optimization is inherently unstable: Rewriting code monolithically prevents the stable inheritance of good traits. Treating reward design like software engineering—where you maintain a library of clean, modular components—fundamentally stabilizes the evolution process.
  • Separating Planning from Coding Matters: MLREF forces the LLM to generate a natural-language specification (metadata, inputs, intent) before writing the actual Python code. This decomposition significantly reduces syntax errors and hallucinations.
  • Rollback is the Secret to Monotonic Improvement: RL training is noisy, and LLMs occasionally generate harmful code. By explicitly incorporating a failure recovery (rollback) mechanism, MLREF ensures steady upward progress rather than wild performance swings.

Key Results

MLREF was tested against state-of-the-art baselines like EUREKA and RF-Agent using DeepSeek-V4-Flash as the backend LLM.

  • Locomotion: MLREF achieved a 25.2% average improvement over the best baseline. On the Franka Cabinet task, it achieved a near-perfect normalized score of 0.997 compared to EUREKA's 0.397.
  • Manipulation: MLREF yielded a 6.6% average improvement across 10 complex manipulation tasks, showing particularly strong results on Block Stack and Lift Underarm.
Performance comparison across 17 locomotion and manipulation tasks.

Ablation studies confirmed that removing the module pool (No Pool) or the reflection step (No Reflection) caused massive performance drops, proving that modular tracking and structured reasoning are both vital to the framework's success.

Ablation results on three representative tasks.

Limitations and Future Work

While MLREF sets a new state-of-the-art, the authors note a few areas for improvement:

  • Sparse-Reward Bottlenecks: On exceptionally sparse manipulation tasks like Block Stack, absolute performance remains modest, indicating a need for stronger early-stage exploration strategies.
  • Single LLM Dependency: The current framework relies on a single LLM instance. The authors suggest that multi-LLM collaboration (e.g., different models acting as designers, critics, and coders) could leverage diverse reasoning capabilities to produce even better rewards.

Summary updated

BibTeX
@misc{liu2026mlref,
  author = {Chenglin Liu and Xun Wang and Ruishuo Chen and Zhuoran Li and Longbo Huang},
  title = {{MLREF: Efficient Module Reuse for Reward Design in Reinforcement Learning via Large Language Models}},
  year = {2026},
  eprint = {2608.18827},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2608.18827},
}
Figure