Quick Facts
- Category: Science & Space
- Published: 2026-05-11 00:07:06
- How Scientists Discovered the Juan de Fuca Plate Is Tearing Apart Under the Pacific Northwest
- 5 Critical Lessons from Braintrust's API Key Breach
- MSPs Face Urgent Call to Overhaul Backup and Security Strategies, Experts Warn
- Astronaut Captures Stunning Milky Way and Airglow from ISS
- How to Evaluate Rivian’s Q1 2026 Financial Report and R2 Production Milestones
Introduction
Planning over long horizons with learned world models is notoriously difficult. The optimization landscape becomes ill-conditioned, high-dimensional latent spaces introduce local minima, and gradients through vision models are brittle. GRASP (Gradient-based planning with virtual states, stochastic iterates, and reshaped gradients) is a new method that addresses these challenges. This guide walks you through the key steps to implement GRASP for your own world model-based planning system.

What You Need
- A pre-trained world model – ideally one that predicts future latent states or observations (e.g., a recurrent neural network or transformer-based dynamics model).
- A differentiable cost function that measures how close a predicted trajectory is to a desired outcome (e.g., goal-reaching or reward-based).
- A gradient-based optimizer – Adam or SGD with momentum works well.
- Sufficient compute (GPU recommended) because GRASP involves optimizing over multiple virtual states in parallel.
- Basic knowledge of PyTorch or similar deep learning framework.
Step-by-Step Implementation
Step 1: Formulate the Planning Problem
Define the horizon length H – the number of future time steps you want to plan over. For long horizons (e.g., H > 50), traditional gradient-based planning fails, but GRASP excels. Create a cost function J(s_{1:H}, a_{1:H}) that penalizes deviations from a target. The world model provides the predicted states s_t given actions a_t and initial context. The goal is to minimize J over the action sequence.
Step 2: Lift the Trajectory into Virtual States
Key innovation: Instead of optimizing over a single long trajectory, lift the problem into an augmented space where each time step has its own independent state variable. More precisely, introduce virtual states v_t for each time step t=1..H. The optimization now searches over (v_1, ..., v_H, a_1, ..., a_H). The world model is used only as a penalty: you enforce that v_{t+1} ~= model(v_t, a_t) via a soft constraint. Because each v_t is independent, you can compute gradients for all time steps simultaneously – this parallelizes the optimization and avoids the sequential backpropagation through time that makes long-horizon planning slow and unstable.
Step 3: Add Stochasticity to the State Iterates
During optimization, inject controlled noise directly into the virtual states. This is inspired by Langevin dynamics. After each gradient step, add Gaussian noise to each v_t. The noise level (sigma) decays over iterations. This stochasticity helps the planner escape poor local minima and explore diverse trajectories. In practice, you can set sigma proportional to the gradient magnitude – small adjustments work well.
Step 4: Reshape Gradients to Avoid Brittle State-Input Gradients
Traditional gradient-based planning backpropagates through the entire world model, including high-dimensional visual encoders. These gradients are often ill-conditioned (vanishing/exploding) and require careful tuning. GRASP reshapes the gradient flow by splitting the gradient into two parts: one from the cost function to the virtual states (direct), and another from the virtual states to the actions through only a simplified version of the model (e.g., skip connections or a lower-rank approximation). This prevents noise from the vision model from corrupting action updates. Practically, implement a custom backward pass that stops gradients through the visual encoder and uses an auxiliary differentiable mapping.

Putting It All Together
Your implementation loop should look like this:
- Initialize virtual states
v_1, ..., v_H(e.g., from random noise or a prior trajectory). - For each optimization iteration:
a. Compute costJ(v, a)and gradients with reshaped backprop.
b. Updatevandausing your optimizer (e.g., Adam).
c. Add noise tov(Step 3).
d. Enforce consistency: projectvback toward the world model's predictions softly (optional). - After convergence, extract the action sequence
a_1..a_Has your plan.
Tips for Success
- Noise scheduling matters: Start with a high noise level for exploration, then anneal to zero for fine convergence. A linear or exponential decay works well.
- Use multiple restarts: Run several optimizations from different initial virtual states and pick the plan with the lowest cost.
- Monitor virtual state consistency: If the soft constraint drifts too far from the world model, consider a hard reinitialization every few steps.
- Scale to high-dimensional observations: Work in a compressed latent space (e.g., from a VAE) rather than raw pixels. GRASP’s gradient reshaping is especially beneficial here.
- Leverage parallel computing: Because each virtual state is independent, you can batch the evaluation of the cost and model for all time steps together—making GRASP efficient on GPUs.
By following these steps, you can turn any learned world model into a practical long-horizon planner. GRASP’s innovations – lifted trajectories, stochastic iterates, and gradient reshaping – together tame the failure modes that previously limited gradient-based planning. Start with Step 1 and build up from there.