TL;DR
Model-based reinforcement learning (MBRL) often struggles because models try to predict every detail of the environment, even irrelevant ones. This paper introduces VaGraM (Value-Gradient weighted Model loss), a novel loss function that uses value function gradients to tell the model exactly which parts of the dynamics "matter" for the task. This leads to significantly higher robustness when model capacity is limited or the environment is full of distractions.
The Objective Mismatch in MBRL
In MBRL, we train an agent by letting it "dream" or plan using a learned model of the world. Ideally, this is more sample-efficient than learning from scratch. However, there is a fundamental "objective mismatch": most models are trained using Maximum Likelihood Estimation (MLE) to predict the next state as accurately as possible.
The problem is that not all state dimensions are equally important. If a robot is trying to walk, it needs to know where its legs are, but it doesn't need to perfectly predict the flickering of a background light. Standard MLE treats both errors the same. Previous attempts at "value-aware" learning (like VAML) tried to fix this but were often unstable in practice because they evaluated the value function in regions the agent had never visited, leading to "garbage-in, garbage-out" optimization.
Introducing VaGraM
The authors propose VaGraM, which shifts the focus from predicting the exact state to predicting the parts of the state that impact the expected return. Instead of trying to match the value of a predicted state directly, VaGraM uses a Taylor expansion to approximate the error.
Key technical steps include:
- Gradient Weighting: VaGraM uses the gradient of the current empirical value function ($\nabla_s V$) as a measure of sensitivity. If the gradient is high in a certain direction, a small prediction error there will drastically change the expected reward.
- Taylor Approximation: By expanding the value function around the true next state, the model is only evaluated on data it has actually seen, solving the stability issues of previous methods.
- Diagonal Scaling: To prevent the model from finding "lazy" solutions (predicting a state that is far away but happens to have the same value), a Cauchy-Schwartz upper bound is applied. This results in a mean-squared error loss where each dimension is weighted by the square of its corresponding value gradient.
Essentially, VaGraM tells the model: "You can be wrong about the state, as long as you are right about the parts that change the value."
Key Insights and Stability
- The "Where it Counts" Principle: A model doesn't need to be perfect; it just needs to be accurate in the directions that affect the agent's performance.
- Stability through Gradients: Using the gradient at the observed state is much more stable than using the value at a predicted state. This prevents the optimizer from chasing "phantom" high-value regions in an untrained value function.
- Robustness to Model Size: VaGraM allows agents to succeed even with very small neural networks. While MLE models fail when they don't have enough "memory" to store the whole world's dynamics, VaGraM-trained models prioritize the important bits.
- Ignoring Distractions: In environments with irrelevant features, VaGraM naturally ignores them because the value gradient with respect to those features is zero.
Experimental Results
The researchers evaluated VaGraM on several standard and modified benchmarks, including the Pendulum task and the MuJoCo continuous control suite (Ant, Hopper, Walker2d, HalfCheetah).
- Reduced Capacity: On the Hopper task, when the model size was reduced to just 2 layers, the standard MLE baseline (MBPO) failed completely. VaGraM, however, maintained near-peak performance.
- Distraction Resistance: In a custom "Hopper with 15 distracting dimensions" test, the MLE model's performance tanked as it wasted its capacity on noise. VaGraM achieved significantly higher returns, proving it could filter out the "junk" data.
- Benchmark Performance: On standard MuJoCo tasks, VaGraM performed on par with or better than state-of-the-art MBPO, showing that value-awareness doesn't come at the cost of general performance.
Limitations and Future Work
- Deterministic Assumption: The current derivation of VaGraM assumes a deterministic model is sufficient. While this worked well for the tested environments, it might struggle in highly stochastic worlds where capturing the full probability distribution is necessary.
- Value Function Dependency: VaGraM is only as good as the current estimate of the value function. In the very early stages of learning, when the value function is random, the weighting might be unhelpful.
- Future Directions: The authors suggest scaling this to image-based RL, where "distracting pixels" are a major hurdle, and extending the math to handle partially observable environments (POMDPs).
Summary updated