Introduction
Sampling-based model predictive control replans at every control period. It proposes candidate control sequences over a short horizon, rolls them out in a simulator, keeps a better plan, applies its first control and starts again from the new state. Because it needs neither derivatives nor offline training, it can drive full-order, contact-rich models of legged and humanoid robots. The question this task asks is how to build such a planner when the robot, the simulator, the cost and a per-step budget of simulated rollouts are all fixed.
The field's answers differ mostly in how the sampling distribution is updated from the costs. Predictive Sampling keeps the best of a set of Gaussian perturbations of the current plan [1]. MPPI takes an exponentially weighted average of the samples [2]. The cross-entropy method refits a Gaussian to the elite samples [3], and CMA-ES adapts a full covariance [4]. More recent planners anneal the sampling covariance across iterations and along the horizon [5], shape it with the cost Hessian [6], adapt it by a natural gradient [7], mix globally diverse samples into a local update [8], or differentiate the rollouts to add a feedback law [9].
All of them also have to decide how one replan is warm-started from the previous one, and this is where we looked. A planner that replans every period shifts its plan by one step and has to append one new control at the end of the horizon. The appended control has almost no effect on the cost at the moment it is added, so the optimiser cannot tell a good one from a bad one. Its consequences appear only later, as it moves toward the front of the plan, and by then the sampler has to spend its budget repairing it. The question we ask is what that appended control should be.
Method
Our planner has two parts: a terminal prior that extends the plan at every replan, and an elite-averaging optimiser that refines the extended plan within the budget. We call the combination TPWS (terminal-prior warm starting).
The plan and its exact shift
We keep the plan as a dense sequence of controls at the rollout step , not as a set of spline knots. When a replan arrives at time , the plan is shifted by steps, so that the surviving part is carried over exactly, with no re-interpolation, and new controls are appended. The starter planner did the opposite: it kept knots, re-timed them to the current time and re-interpolated its mean at every replan.
The terminal prior
The appended controls come from a terminal controller chosen from the structure of the task, and the choice is made from the observation and the spec rather than from the task's name:
-
tracking, when the observation carries a reference : the new reference over the horizon, , plus the residual the plan held at its last step,
-
periodic, when the applied controls oscillate with a detected period : the control from one period earlier, , taken from the shifted plan when and from the history of applied controls otherwise;
-
regulation, otherwise: the task's nominal control , or, when the nominal control is all zeros and so carries no information, the last control of the plan.
def _extend(self, obs, t, s):
"""shift the plan by s steps and append s controls from the task's terminal prior."""
base = self.U[s:]
if "ref_qpos" in obs: # tracking
Rn = self._ref(obs, t, np.arange(self.h))
res = (self.U - self.R)[-1]
tail = Rn[self.h - s:] + res[None]
self.R = Rn
self.prior_active = True
elif self.period and len(self.hist) >= self.period: # periodic
P = self.period
rows = []
for j in range(self.h - s, self.h):
lag = j - P # prior control's time relative to now
rows.append(base[lag] if lag >= 0 else jnp.asarray(self.hist[lag]))
tail = jnp.stack(rows, 0)
# the reduced floor is used only once the current episode's own controls confirm the period
# (a period carried over from an earlier episode is not trusted during the start-up transient)
if not self.confirmed:
self.confirmed = self._confirmed(P)
self.prior_active = self.confirmed
else: # regulation
tail = jnp.tile((self.u_nom if self.reg == "nominal" else self.U[-1])[None], (s, 1))
self.prior_active = self.reg == "nominal"
self.U = jnp.clip(jnp.concatenate([base, tail], 0), self.lo, self.hi)The regulation branch decides between the nominal control and holding by a single test on the spec: the nominal is used if any of its entries exceeds in absolute value.
# regulation prior: the nominal control when the task provides one (an all-zero nominal carries no
# information -> hold the last control instead)
reg = cfg["reg"]
if reg == "auto":
reg = "nominal" if np.any(np.abs(np.asarray(spec["u_nominal"])) > 1e-6) else "hold"
self.reg = reg
self.sps = int(spec["sim_steps_per_replan"])
tq = jnp.arange(self.h) * self.dt
tk = jnp.linspace(0.0, (self.h - 1) * self.dt, self.K)
self.Phi = _interp_matrix(cfg["spline"], tq, tk) # [h, K]
self.key = jax.random.PRNGKey(int(spec.get("seed", 0)))
# sampling-scale floor: smin while the plan is extended by holding its last control, smin_prior while
# a structural prior extends it (the prior removes the exploration need of the tail; what remains is
# the smoothing that keeps plans robust to model mismatch -> task dependent)
sp = cfg["smin_prior"] if cfg["smin_prior"] is not None else cfg["smin"]
self.floor = jnp.full((self.K, 1), float(cfg["smin"]))
self.floor_prior = jnp.full((self.K, 1), float(sp))
self.prior_active = FalseDetecting the period
The period is found from the controls the planner has actually applied. Every 8 replans, when the observation carries no reference, we take the last (at most) 120 applied controls , subtract their mean, and compute a normalised autocorrelation with the usual correction for the shrinking overlap,
A lag is a candidate if , it is a local maximum, and somewhere at a shorter lag has dipped below ; the dip is what separates an oscillation from a slow drift. The strongest candidate is the period, and nothing is detected before 48 controls have been applied. The period persists across episodes: it is replaced when a new one is detected, and cleared only once 120 controls of an episode show none. A period, including one carried over from an earlier episode, earns the finer sampling floor only once the current episode's own controls confirm it: at least controls must have been applied and must hold on the last (at most) of them.
def _detect_period(self):
"""dominant period of the applied controls: the strongest autocorrelation local maximum that
is preceded by a clear dip (an oscillation, not a slow drift); 0 if none."""
Hh = np.asarray(self.hist[-120:])
if len(Hh) < int(self.cfg["pmin_hist"]):
return 0
Hh = Hh - Hh.mean(0)
den = np.sum(Hh * Hh) + 1e-12
Lmax = min(60, len(Hh) - 20)
r = np.array([np.sum(Hh[L:] * Hh[:-L]) / den * len(Hh) / (len(Hh) - L) for L in range(1, Lmax + 1)])
best, rbest = 0, -np.inf
for L in range(4, Lmax - 1):
rl = r[L - 1]
if rl >= float(self.cfg["r_min"]) and rl >= r[L - 2] and rl >= r[L] and \
np.min(r[: L - 1]) < rl - float(self.cfg["dip"]) and rl > rbest:
best, rbest = L, rl
return best
def _confirmed(self, P):
n = len(self.hist)
if n < 2 * P:
return False
H = np.asarray(self.hist[-min(n, 4 * P):])
H = H - H.mean(0)
r = np.sum(H[P:] * H[:-P]) / (np.sum(H * H) + 1e-12) * len(H) / (len(H) - P)
return bool(r >= float(self.cfg["r_min"]))The optimiser
Candidate sequences are knot-spline perturbations of the dense plan. With knots evenly spaced over the horizon and a cubic interpolation matrix (the splines are linear in the knots), sample is
so the current plan is always one of the candidates. Each sample's cost is the sum of its per-step costs and its terminal cost, with non-finite costs treated as infinite. The update averages the lowest-cost samples and refits the per-(knot, joint) scale to their perturbations, floored:
The scale persists from one replan to the next within an episode.
def _sample_impl(self, U, sig, key, n):
z = jax.random.normal(key, (n, self.K, self.nu)) * sig[None]
z = z.at[0].set(0.0) # the current plan is a candidate
Us = jnp.clip(U[None] + jnp.einsum("hk,nku->nhu", self.Phi, z), self.lo, self.hi)
return z, Us
def _iterate_impl(self, U, sig, z, Us, costs, floor):
J = jnp.sum(costs, axis=1)
J = jnp.where(jnp.isfinite(J), J, jnp.inf)
el = jnp.argsort(J)[: self.ne]
U_new = jnp.mean(Us[el], axis=0)
sig_new = jnp.maximum(jnp.std(z[el], axis=0), floor)
return U_new, sig_newThe floor is the part we think about differently. Its usual role is to keep enough exploration. Once a terminal prior extends the plan, the tail no longer needs large exploration, and what is left is a regulariser: a larger floor gives smoother, less sharply optimised plans that are more robust when the planner's model differs from the system it controls. The planner therefore uses two floors, while the plan is extended by holding (or by a period not yet confirmed in the current episode) and a finer while a structural prior is active, and the per-task table sets the second equal to the first except where the model was found to be exact.
Splitting the budget, and the opening transient
The number of samples per iteration is for a per-period budget and a default of four iterations. Each replan runs as many iterations as the remaining budget pays for, at most four, except for the first replan of an episode, which has no warm start and spends its larger budget on as many iterations as it affords. For tasks that open with a decisive transient, a per-task option spends that first budget on a few wide iterations instead, and two further options apply only to the opening replans of an episode: every sample is rolled out under domain-randomised models and its costs are averaged, with the sample count divided by , and the floor is raised to a larger smoothing level. The returned command is the first control of the plan, held over the control period.
R = int(self.cfg["dr_R"]) if self.step_i < int(self.cfg["dr_steps"]) else 1
n = self.n if R == 1 else max(self.n // R, self.ne + 2)
if self.first and int(self.cfg["first_wide"]) > 0: # first replan: fewer, wider iterations
n = max(int(sim.budget_left) // (self.h * int(self.cfg["first_wide"]) * R), n)
iters = max(int(sim.budget_left) // (n * self.h * R), 1)
if not self.first:
iters = min(iters, self.iters)
self.first = False
U, sig = self.U, self.sig
floor = self.floor_prior if self.prior_active else self.floor
if self.step_i < int(self.cfg["early_steps"]): # opening transient: more smoothing
floor = jnp.maximum(floor, float(self.cfg["early_smin"]))
for _ in range(iters):
self.key, k = jax.random.split(self.key)
z, Us = self._sample(U, sig, k, n)
try:
if R > 1:
c = np.asarray(sim.rollout(np.asarray(Us), randomize=R, seed=1234 + self.step_i))
costs = jnp.asarray(c.mean(axis=1))
else:
costs = jnp.asarray(sim.rollout(np.asarray(Us)))
except BudgetError:
break
U, sig = self._iterate(U, sig, z, Us, costs, floor)
self.U, self.sig = U, sig
u0 = np.asarray(U[0])
self.step_i += 1
self.hist.append(u0)
if len(self.hist) > 240:
self.hist = self.hist[-120:]
return np.tile(u0[None], (self.sps, 1))The horizon, knot count, initial scale, the two floors and the opening-transient options are set per task in a small table read from the spec's task field. The choice of terminal prior is not in that table: it follows from the observation and the spec.
Results
| Method | ① | ② | ③ | |
|---|---|---|---|---|
| Tracking error ↓ | Mean running cost ↓ | Mean running cost ↓ | Body tracking error ↓ | |
| Claude Opus 5.5 | 0.050 | 10.33 | 0.029 | |
| Predictive Sampling | 0.546 | 11.55 | 0.452 | 0.190 |
| MPPI | 0.171 | 10.48 | 0.265 | 0.133 |
| CEM | 0.074 | 10.44 | 0.168 | 0.069 |
| CMA-ES | 0.172 | 10.64 | 0.318 | 0.107 |
| DIAL-MPC | 0.067 | 10.50 | 0.239 | 0.049 |
| MPPI-CMA | 0.086 | 10.49 | 0.192 | 0.073 |
| Model Tensor Planning | 0.256 | 10.70 | 0.197 | 0.074 |
| CoVO-MPC | 0.299 | 10.49 | 0.316 | 0.173 |
| Feedback-MPPI | 0.190 | 10.76 | 0.343 | 0.182 |
- ① Unitree Go2 · torque-level trotting velocity tracking (DIAL-MPC)
- ② Unitree G1 · stand-up from a fall
- ③ Unitree G1 · LAFAN1 motion tracking
Our planner is lower than every published baseline on every setting. On Go2-walk it reaches a tracking error of 0.050. The strongest baseline there, the diffusion-style annealing planner [5], reaches 0.067; the cross-entropy method, the closest of the baselines to our optimiser, reaches 0.074, and Predictive Sampling, which the starter file implements, reaches 0.546. Our optimiser on its own is an elite-averaging update of the same family as the cross-entropy method, so the gap to that baseline reflects the warm start, the dense exact shift and the floors together, along with differences in configuration; our measurements, which are of the full planner only, cannot separate them.
On Go2-walk the weighted-average and covariance-adapting planners are further behind: MPPI reaches 0.171, CMA-ES 0.172 and MPPI-CMA 0.086.
On G1-standup our mean cost is 10.33. The best baseline there is the cross-entropy method at 10.44, ahead of MPPI (10.48) and the diffusion-style annealing planner (10.50). Every baseline except Predictive Sampling (11.55) lies in a narrow band on this setting, and our margin over the best of them is small in proportion to the cost itself.
On G1-mocap our body error is 0.029. The diffusion-style annealing planner is again the strongest baseline, at 0.049, followed by the cross-entropy method at 0.069; Predictive Sampling reaches 0.190.
How we got here
We began by measuring the strongest baseline rather than changing it. Instrumenting an elite-averaging planner on one development task, we recorded every replan's warm-start cost, final cost and best sample. Three observations shaped everything after. The prediction mismatch on the overlapping, carried-over part of the shifted plan was exactly zero, so the jump in cost from one replan's final plan to the next replan's warm start came entirely from the freshly appended control. The cost profile along the final plan rose steeply toward its end, so a large share of the total was the poorly optimised tail, and selection among samples was dominated by variation in that tail. And the averaged elite plan beat the single best sample in 92% of replans (warm start 0.472, final plan 0.323, best sample 0.357 in our development measurement), which told us that the averaging step, not the choice of a winner, was doing the work. The submission's comment puts the held tail control at about 15 times the cost of a converged step on that task; we state that as our own estimate.
Our first ideas were all on the side of the update, and none of them helped. Within the noise of our development runs, a dense plan with an exact shift, causal credit assignment, including the current mean as a sample, dropping the persistence of the scale and an MPPI-style weighted update all came out level with the elite baseline. A full covariance, mirrored sampling, multi-scale and low-frequency perturbations, a horizon-profiled floor, a covariance shaped in the spirit of the cost-Hessian methods and a self-adaptive global scale were tried and dropped. A diagonal Newton candidate fitted by regression on the samples was the best sample in only about 2% of iterations. Extrapolating the tail linearly instead of holding it was clearly worse.
Two further diagnostics pointed at the scale. Running the elite baseline with four times the budget improved the task's error metric on one task by about 20% in our development runs, so that task was limited by optimisation; on another task four times the budget did not help at all. And in steady state the sampling scale tuned for the transients was far too coarse to resolve the weak cost gradients near a good plan. We concluded that the scale had two jobs and that the tail had to be fixed first.
The periodic prior came next. A fixed period first, then the autocorrelation detector, made the tail continue the gait instead of freezing it. We then generated several candidate extensions (hold, nominal, one or two periods back) and chose among them with an extra lookahead rollout; this worked, but the choice itself spent part of each replan's budget. On the task with an informative nominal control we found that always appending the nominal lowered the running cost by about 24% in the opening phase and 37% in the late phase in our development comparison with the elite baseline; we attribute this to every plan then ending in the goal configuration. The final design replaces the lookahead selection with a fixed dispatch by task structure, which spends no budget on choosing. When the dispatch used a nominal of all zeros as a regulation target, we suspected that it hurt the task whose nominal is not a goal, and the regulation prior now falls back to holding when the nominal carries no information.
With the tail fixed, the floor became a regulariser, and we found that its right value depended on model mismatch. On the task where the planner's model matches the true system, lowering the floor under the prior helped monotonically in our runs; on a task simulated with a different integrator and contact model, a lower floor produced more failed episodes. Between two floors that both validated on the matched task, we chose a value in between rather than the more aggressive one. A still lower floor once let an episode fail during its start-up transient, because a period carried over from the previous episode switched on the fine floor before the gait was periodic. That is the origin of the per-episode confirmation. In later stress tests neither version failed, and the confirmed version was level with the unconfirmed one, so we kept it for the property it guarantees, that every episode starts the same way regardless of what preceded it, not for a measured gain.
For a task that opens with a decisive transient, plans that caught the transient under the planner's softer, coarser contact model were over-confident and failed on the true system. Averaging the sample costs over randomised models during the opening phase removed those failures in our development runs, a raised floor during the same phase removed most of them, and the submission's comment records that the two are complementary. On the task whose observation carries a reference, by contrast, the failures came from mismatch that the available randomisation cannot emulate, model averaging over whole episodes gave no gain there, and our development comparison of the tracking prior against the elite baseline was level in the mean.
Two late ideas were dropped. A gradient polish using the differentiable rollouts produced the lowest closed-loop cost of all our variants yet no lower error on the task's metric, which we read as a regime where better optimisation of the task cost no longer improves the metric. And our analysis of the remaining error on that task attributed much of it to behaviour that is optimal for the cost, which a planner should not try to undo.
Limitations
- No ablation. Our results are one number per setting, for the full planner. TPWS is a dispatch over three priors plus per-task options for the opening transient, and those numbers cannot show which of them carried each result, nor whether the others help where they apply.
- Per-task constants. The horizon, knot count, initial scale, both floors and the opening-transient options come from a table keyed by the task identity in the spec. The choice of prior is structural, but the planner as submitted is not one constant setting applied to every task, and the floors in particular were tuned on development episodes.
- Hand-set detector. The period detector's thresholds (an autocorrelation of 0.3, a dip of 0.3, at least 48 controls, a window of 120) are fixed by hand. A task with an irregular or slowly changing rhythm could be misdetected, and the confirmation latch only limits the damage to the floor, not to the extension itself.
- The command is a held control. The planner returns the first control held over one period. It uses neither the gradient interface, nor the time-varying feedback gains the interface allows, nor longer commitments that would buy budget for the next replan.
- Cost and metric part ways. In development, lower closed-loop cost stopped translating into lower error on the task's metric. Gains beyond ours on that kind of task may need a different cost rather than a better planner, which is outside what this task lets a planner change.
- The floor depends on model fidelity. We tie the floor to model mismatch, but we set it by measurement on each task rather than estimating the mismatch online, so the rule does not transfer automatically to a new robot or simulator.
References
- Taylor Howell, Nimrod Gileadi, Saran Tunyasuvunakool et al. (2022). Predictive Sampling: Real-time Behaviour Synthesis with MuJoCo.
- Grady Williams, Paul Drews, Brian Goldfain et al. (2017). Information Theoretic Model Predictive Control: Theory and Applications to Autonomous Driving.
- Reuven Rubinstein (1999). The Cross-Entropy Method for Combinatorial and Continuous Optimization. Methodology And Computing In Applied Probability.
- Nikolaus Hansen (2016). The CMA Evolution Strategy: A Tutorial.
- Haoru Xue, Chaoyi Pan, Zeji Yi et al. (2025). Full-Order Sampling-Based MPC for Torque-Level Locomotion Control via Diffusion-Style Annealing. ICRA.
- Zeji Yi, Chaoyi Pan, Guanqi He et al. (2024). CoVO-MPC: Theoretical Analysis of Sampling-based MPC and Optimal Covariance Design.
- Armand Jordana, Jianghan Zhang, Joseph Amigo et al. (2025). An Introduction to Zero-Order Optimization Techniques for Robotics.
- An T. Le, Khai Nguyen, Minh Nhat Vu et al. (2025). Model Tensor Planning. TMLR.
- Tommaso Belvedere, Michael Ziegltrum, Giulio Turrisi et al. (2025). Feedback-MPPI: Fast Sampling-Based MPC via Rollout Differentiation -- Adios low-level controllers.