A large language model-driven reward design framework via dynamic feedback for reinforcement learning

Shengjie Sun, Runze Liu, Jiafei Lyu, Jingwen Yang, Liangpeng Zhang, Xiu Li

TL;DR

The researchers introduce CARD, a framework that leverages Large Language Models (LLMs) to iteratively design and refine reward functions for Reinforcement Learning (RL) without human intervention. By introducing a novel Trajectory Preference Evaluation (TPE) mechanism, CARD significantly reduces computational costs and outperforms expert-designed rewards across multiple complex robotic tasks.

What Problem Does This Paper Address?

Reinforcement Learning (RL) is powerful, but it relies heavily on well-defined reward functions. In many real-world scenarios, these functions don't exist and must be "engineered" by hand—a process often called a "black art" because it requires extensive trial-and-error and domain expertise.

While recent work has tried using LLMs to generate reward code, existing methods suffer from two major drawbacks:

  1. Human-in-the-loop: They often require humans to provide feedback or analyze trajectories to fix LLM "hallucinations."
  2. High Cost: They may require hundreds of LLM queries or full RL training runs for every minor reward tweak, making them prohibitively expensive in terms of both tokens and compute.

Methods

The authors propose CARD (Coder-EvAluator Reward Design), a closed-loop system that automates the entire refinement process.

The CARD framework consists of a Coder that generates reward code and an Evaluator that provides dynamic feedback.

The framework consists of two main agents:

  • The Coder: Queries the LLM (GPT-4) to generate initial reward code based on environment descriptions and task goals. It also includes a "Correctness Check" to catch syntax errors before training begins.
  • The Evaluator: This is the "brain" of the feedback loop. It provides three types of feedback:
  • Process Feedback: High-level trends like success rates and average returns.
  • Trajectory Feedback: Detailed step-by-step analysis of successful vs. failed attempts.
  • Trajectory Preference Evaluation (TPE): This is the secret sauce. TPE checks if a new reward function is "order-preserving"—meaning it should naturally assign higher rewards to successful trajectories than to failed ones. If a reward function fails this check, CARD skips the expensive RL training step and goes straight back to the Coder for a redesign.

Datasets

The framework was evaluated on 12 challenging robotic manipulation tasks across two major benchmarks:

  • Meta-World: Includes tasks like Door Unlock, Drawer Open, and Window Open.
  • ManiSkill2: Includes more complex physics-based tasks like Lift Cube, Turn Faucet, and Push Chair.

Key Insights and Ideas

  • Efficiency through TPE: By using TPE as a "gatekeeper," CARD avoids wasting hours of GPU time training on "bad" reward functions that don't even align with basic task success.
  • Multi-Granular Feedback: The LLM isn't just told "it failed." It receives a structured natural language report combining high-level statistics (Process) and low-level state-action details (Trajectory). This allows the LLM to understand why a specific reward component (like a distance penalty) might be overshadowing the main goal.
  • Self-Correction: The Coder maintains a dialogue history, allowing the LLM to "introspect" on its previous mistakes and refine its logic over multiple iterations.

Key Results

CARD demonstrated a remarkable balance between performance and efficiency.

Comparison of CARD against other LLM-based reward design methods.
  • Superior Performance: CARD matched or outperformed all baselines (including L2R, Text2Reward, and Eureka) across all 12 tasks. Remarkably, it outperformed human-expert "Oracle" rewards on 3 tasks and was comparable on 7 others.
  • Token Efficiency: Compared to Eureka, which uses massive parallel sampling, CARD is significantly more "green." It achieved better results while consuming roughly 46x fewer tokens on average.
Learning curves on ManiSkill2 tasks show CARD (red) consistently reaching high success rates faster or more reliably than baselines.
  • Iterative Gains: Ablation studies showed that while the first iteration provides a massive jump in performance, the second and third iterations are crucial for "polishing" the reward function to handle edge cases in more difficult tasks like Door Unlock.

Limitations and Future Work

Despite its success, the authors acknowledge a few hurdles:

  • Linear Scaling: Token consumption still grows linearly with the number of iterations. For extremely complex tasks requiring dozens of refinements, this could still become expensive.
  • Symbolic Dependency: CARD currently assumes the environment state (e.g., the exact 3D coordinates of a cube) is known.
  • Future Direction: The team aims to integrate Vision-Language Models (VLMs). This would allow the framework to "see" the agent's failures directly from video pixels, removing the need for pre-defined symbolic environment descriptions.

Summary updated

BibTeX
@article{sun2025large,
  author = {Shengjie Sun and Runze Liu and Jiafei Lyu and Jingwen Yang and Liangpeng Zhang and Xiu Li},
  title = {{A large language model-driven reward design framework via dynamic feedback for reinforcement learning}},
  journal = {Knowledge-Based Systems},
  year = {2025},
  doi = {10.1016/j.knosys.2025.114065},
}

Loading related content...

Figure