Introduction
In many reinforcement learning (RL) applications, agents receive feedback only at the end of an episode. This "episodic and sparse" reward structure creates a significant challenge known as credit assignment: determining which specific actions throughout a long sequence contributed to the final outcome. Traditional reward redistribution methods often struggle with environmental noise, the scalar nature of rewards, and a lack of semantic understanding of the task.
The LaRe Framework
To address these challenges, we introduce LaRe (Latent Reward), a framework that leverages the semantic reasoning capabilities of Large Language Models (LLMs) to generate multi-dimensional, interpretable latent rewards. Unlike methods that use LLMs as agents, LaRe uses them to bridge the gap between linguistic task descriptions and symbolic RL requirements.
The framework operates in three distinct stages:
- Environment Prompting: The LLM is provided with standardized task descriptions and state-space definitions.
- Latent Reward Self-Verification: The LLM generates Python code for an encoding function ($\phi$) that extracts latent rewards—such as "stability" or "height"—from raw states. To ensure reliability, LaRe employs self-prompting and pre-verification against random states to eliminate code errors and hallucinations.
- Contribution Allocation: These latent rewards serve as an information bottleneck. A neural network decoder then decomposes the final episodic return into step-wise proxy rewards, which are used to train the RL policy.
Experimental Evaluation
We evaluated LaRe across a diverse set of benchmarks, including MuJoCo Locomotion tasks (e.g., Walker2d-v4, HumanoidStandup-v4), Multi-Agent Particle Environments (MPE) with up to 30 agents, and the StarCraft Multi-Agent Challenge (SMAC).
Key Results and Insights
LaRe demonstrates superior performance compared to state-of-the-art return decomposition methods like RUDDER and RRD.
Superior Credit Assignment
By forcing rewards to be multi-dimensional, LaRe allows agents to learn why they succeed. In the HumanoidStandup task, the LLM-generated rewards focused on nuanced metrics like "torso stability," leading to more robust policies that even outperformed those trained with manually designed "ground truth" dense rewards. This suggests that LLMs can design internal reward structures that are more effective than human-engineered ones.
Scalability and Reliability
In multi-agent settings, LaRe maintained high performance where traditional attention-based methods faltered. Furthermore, the self-verification mechanism proved highly effective, raising the execution success rate of LLM-generated code from as low as 0% to a perfect 100%.
Theoretical Efficiency
Mathematically, LaRe reduces reward-irrelevant redundancy, leading to tighter concentration bounds. This theoretical advantage translates to faster learning, as the agent is less distracted by irrelevant state data.
Conclusion
LaRe represents a significant step in using LLMs to enhance RL through structured, semantic credit assignment. By using executable code as a bridge, the framework translates human-like reasoning into mathematical signals that accelerate agent training and improve policy robustness.
Summary updated