Introduction
Sampling-based model predictive control (MPC) replans at every control step by asking a simulator to roll out candidate control sequences from the current state and keeping what costs least. It needs no gradients and no model simplification, which is why it is used for contact-rich locomotion and whole-body control, where the dynamics switch discontinuously as feet and hands make and break contact. Its weakness is the other side of the same coin: all of its intelligence lives in how it spends a fixed budget of simulated rollouts per control step.
In this task the robot, simulator, cost and budget are fixed; only the planner is ours. The question is how to parameterise, sample, update, warm-start and execute candidate controls so that the closed loop tracks its target best under a fixed per-step rollout budget. The starter is Predictive Sampling [1]: Gaussian perturbations of a knot spline, the current mean kept as one candidate, the cheapest candidate becoming the next mean, one iteration per replan.
The field offers several answers to the update question. MPPI weights all samples by an exponential of their cost [2]; the cross-entropy method refits a Gaussian to the elite fraction [3]; CMA-ES adapts a full covariance [4]; CoVO-MPC designs the sampling covariance from a theoretical analysis [5]; DIAL-MPC anneals the sampling noise in the manner of a diffusion schedule [6]; Model Tensor Planning adds globally diverse candidate paths [7]; MPPI-CMA combines path-integral weighting with covariance adaptation [8]; and Feedback-MPPI differentiates its rollouts to return feedback gains alongside the plan [9]. All of them are baselines here.
Three things make the problem harder than choosing an update rule. First, the budget is not the same at every replan: the first replan of an episode is given more, and committing to several control periods buys a proportionally larger budget for the next replan, so a planner sized once from the nominal budget leaves rollouts unused. Second, averaging across samples is dangerous when contact makes the cost landscape multi-modal: the mean of two good plans that touch the ground at different times can be a bad plan. Third, the noise in closed-loop outcomes is large relative to the differences between methods, so it is easy to adopt a change that is only run-to-run variation.
Method
Our planner, which we call BAER (budget-adaptive elite refit), is an iterated cross-entropy sampler with a handful of deliberate departures from the textbook version. We describe the search, then what is executed.
Parameterisation and sampling
A candidate is a cubic spline through knots spread over a horizon of planning steps, evaluated densely to give the control sequence that is rolled out. The sampling distribution is a diagonal Gaussian with a mean and a separate standard deviation for every knot and every actuator. In each iteration we draw candidates:
that is, antithetic pairs for the main share of the batch, plus an exploration share of drawn around at the initial, widest scale rather than the current, possibly collapsed one. The first candidate is always itself, as in Predictive Sampling, and in the first iteration of each replan eight further slots are taken by the elites carried over from the previous replan, shifted in time.
def _sample_impl(self, st):
key, k1, k2 = jax.random.split(st["key"], 3)
n_main = self.n - self.n_explore
half = n_main // 2
e = jax.random.normal(k1, (half, self.K, self.nu))
eps = jnp.concatenate([e, -e], axis=0)
if eps.shape[0] < n_main:
extra = jax.random.normal(k2, (n_main - eps.shape[0], self.K, self.nu))
eps = jnp.concatenate([eps, extra], axis=0)
key, k2 = jax.random.split(key)
knots = st["mean"][None] + st["sigma"][None] * eps
if self.n_explore > 0:
ex = st["mean"][None] + self.sigma0 * jax.random.normal(k2, (self.n_explore, self.K, self.nu))
knots = jnp.concatenate([knots, ex], axis=0)
knots = knots.at[0].set(st["mean"])
return knots, dict(st, key=key)Rank-weighted elite refit
Candidates are ranked by their summed cost, with non-finite costs mapped to a very large value so that a diverging rollout ranks last instead of poisoning the update. The best form the elite set, with in the default configuration. Instead of averaging the elites uniformly, as the cross-entropy method does, we weight them by rank only,
which makes the update invariant to the scale and offset of the cost, so the same constants serve very different cost functions. The mean is the weighted elite average, and the spread is the weighted elite variance with the Bessel correction for weighted samples,
after which the new spread is optionally damped toward the old one and clipped to a band,
with in some configurations and in the default. The floor keeps the search alive; the ceiling keeps one bad iteration from blowing it up. The update also keeps track of the single best candidate evaluated so far in the replan and its cost.
def _update_impl(self, st, knots, costs, best, best_cost):
c = jnp.sum(costs, axis=1)
c = jnp.where(jnp.isfinite(c), c, 1e30)
idx = jnp.argsort(c)[: self.ne]
ek = knots[idx]
w = self.w_rank
mean = jnp.sum(w[:, None, None] * ek, axis=0)
var = jnp.sum(w[:, None, None] * (ek - mean[None]) ** 2, axis=0)
bessel = 1.0 / jnp.maximum(1.0 - jnp.sum(w ** 2), 1e-6)
sig_e = jnp.sqrt(var * bessel)
a = self.sig_smooth
sigma = jnp.clip(jnp.sqrt((1.0 - a) * sig_e ** 2 + a * st["sigma"] ** 2), self.smin, self.sigma0)
i0 = jnp.argmin(c)
better = c[i0] < best_cost
best = jnp.where(better, knots[i0], best)
best_cost = jnp.minimum(best_cost, c[i0])
return dict(st, mean=mean, sigma=sigma, elites=ek[:8]), best, best_cost, c[0]Spending the budget that is actually there
The number of candidates per iteration is fixed once, from the nominal per-period budget , after reserving what the final evaluations need:
where is the configured number of iterations (6 by default) and is a reserve of one rollout for evaluating the refit mean, plus the cost of the gradient polish and the feedback prediction described below when they are enabled. At every replan, however, the number of iterations is recomputed from the simulator's remaining budget,
so a larger budget, whether on the first replan of an episode or after a multi-period commitment, is spent on more iterations of the same batch size rather than discarded. The starter sizes its batch from the nominal budget and runs a fixed number of iterations, leaving the rest unused. Keeping the batch shape fixed also keeps the shapes of the compiled sampling and update functions fixed.
The warm start re-times the previous mean, best plan and elites onto the new knot times, sets the last knot to a tail value (the nominal control, or the reference's last knot when a reference is given), and partially resets the spread toward its initial value through the geometric mean .
When the observation carries a reference trajectory of joint positions, we read the reference at the actual knot times rather than taking its first frames, as the starter does, and express the warm-started mean as a shrunk deviation from it,
so the search is re-anchored to the reference at every replan without discarding what the previous replan learned.
def plan(self, obs, sim):
t = float(obs["time"])
rk = self._ref_knots(obs)
tail = rk[-1] if rk is not None else self.nominal
st = self._shift(self.state, t, tail)
if rk is not None:
st = dict(st, mean=rk + self.ref_pull * (st["mean"] - rk))
tq = jnp.linspace(st["tk"][0], st["tk"][-1], self.h)
left = int(getattr(sim, "budget_left", self.B_spec * (5 if self.first else 1)))
iters = int(min(max((left - self.reserve) // (self.h * self.n), 1), 32))
self.first = False
best = st["best"]
best_cost = jnp.float32(1e30)
for it in range(iters):
knots, st = self._sample(st)
if it == 0:
knots = knots.at[1:9].set(st["elites"])
knots = jnp.clip(knots, self.lo, self.hi)
U = self._dense(tq, st["tk"], knots)
costs = jnp.asarray(sim.rollout(np.asarray(U)))
st, best, best_cost, _ = self._update(st, knots, costs, best, best_cost)Elitist selection of the executed plan
After the last iteration the refit mean has never itself been rolled out; it is an average, and under contact an average of good plans need not be good. We therefore spend one reserved rollout on it and execute whichever is cheaper, the mean or the best candidate seen in any iteration of this replan:
On a tie the mean is kept. The winner also becomes the next replan's mean, so the next warm start is built from a plan whose cost has actually been measured.
# elitist final selection, then optional gradient polish of the winner
win, win_c = st["mean"], None
try:
Um = self._dense(tq, st["tk"], st["mean"][None])
cm = float(jnp.sum(jnp.asarray(sim.rollout(np.asarray(Um)))))
if float(best_cost) < cm:
win, win_c = best, float(best_cost)
else:
win_c = cm
except Exception:
win, win_c = best, float(best_cost)
if self.grad_rounds > 0 and win_c is not None and np.isfinite(win_c):
win, win_c = self._polish(st, tq, sim, win, win_c)
st = dict(st, mean=win)
st = dict(st, best=st["mean"])Gradient polish
In the configuration with the smallest noise scale (the one with the
grad_rounds=3 entry), the winner is refined with the simulator's exact rollout gradient. The
gradient with respect to the dense controls, , is mapped to the knots
through the spline's Jacobian, , normalised by its root-mean-square, and used for a
line search over four step lengths,
All four candidates and the current plan are rolled out forward, and the cheapest replaces the current plan only if it lowers the cost; otherwise, or if any call fails, polishing stops. Up to three rounds are run. Every polished plan is therefore a measured improvement, never a step taken on the gradient's word alone.
def _gradstep_impl(self, knots1, gu1, base_len):
gk = jnp.einsum("hk,hu->ku", self.Jac, gu1)
gk = jnp.nan_to_num(gk, nan=0.0, posinf=0.0, neginf=0.0)
rms = jnp.sqrt(jnp.mean(gk ** 2)) + 1e-12
direction = gk / rms * base_len
steps = jnp.asarray(self.grad_steps)
cands = knots1[None] - steps[:, None, None] * direction[None]
return jnp.clip(cands, self.lo, self.hi)
def _polish(self, st, tq, sim, knots1, cost1):
best_k, best_c = knots1, float(cost1)
for _ in range(self.grad_rounds):
try:
U = self._dense(tq, st["tk"], best_k[None])
_, gu, _ = sim.rollout_grad(np.asarray(U))
except Exception:
break
cands = self._gradstep(best_k, jnp.asarray(gu)[0], jnp.float32(self.smin))
cand_all = jnp.concatenate([best_k[None], cands], axis=0)
try:
Uc = self._dense(tq, st["tk"], cand_all)
cc = np.asarray(sim.rollout(np.asarray(Uc))).sum(axis=1)
except Exception:
break
i = int(np.argmin(cc))
if float(cc[i]) < best_c - 1e-12:
best_c, best_k = float(cc[i]), cand_all[i]
else:
break
return best_k, best_cExecution with feedback
By default one control period of the planned spline is returned. In the configurations with
fb_a > 0, the planner instead commits to two control periods, which buys a doubled budget for the
next replan, and returns the plan with a time-varying linear feedback term,
. The reference states come from
one short rollout of the chosen plan, interpolated linearly to the simulator's step; the gain is
diagonal in joint space, a proportional term on each actuated joint's position and a damping
term on its velocity. If the state rollout fails, the plan is returned without feedback.
L = self.hold * self.sps
tq_sim = jnp.arange(L) * self.sim_dt + t
u_ff = np.asarray(self._dense(tq_sim, st["tk"], st["mean"][None])[0])
if self.fb_a > 0:
try:
Uh = self._dense(tq, st["tk"], st["mean"][None])
_, xs = sim.rollout(np.asarray(Uh[:, : self.n_pred]), states=True)
xs = np.asarray(xs[0], np.float64)
tau = np.arange(L) * self.sim_dt / self.dt
jj = np.minimum(np.floor(tau + 1e-9).astype(int), self.n_pred)
ff = (tau - jj)[:, None]
x_ref = xs[jj] + ff * (xs[np.minimum(jj + 1, self.n_pred)] - xs[jj])
nx = xs.shape[1]
nq = int(self.spec["nq"])
K = np.zeros((L, self.nu, nx))
for i in range(self.nu):
if 7 + i < nq:
K[:, i, 7 + i] = -self.fb_a
if nq + 6 + i < nx:
K[:, i, nq + 6 + i] = -self.fb_b
return u_ff, K, x_ref
except Exception:
return u_ff
return u_ffPer-setting constants
The horizon, number of knots, noise band and the switches for damping, polish and feedback are read from a table keyed on the setting's name, which is how the starter is organised too. There are three presets in effect: a short horizon with more knots ( or , or , , , no damping, polish or feedback); a long, coarse one (, , , , damping , feedback); and a fine one with small noise (, , , , damping, polish and feedback). The algorithm is the same in all three; only these constants differ.
Results
| Method | ① | ② | ③ | |
|---|---|---|---|---|
| Tracking error ↓ | Mean running cost ↓ | Mean running cost ↓ | Body tracking error ↓ | |
| Muse Wonder Full | 0.055 | 10.29 | 0.019 | |
| 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
BAER is ahead of every published baseline on all three settings. On Go2-walk its tracking error is 0.055 against 0.067 for the strongest baseline, DIAL-MPC [6], and 0.546 for the starter, Predictive Sampling. On G1-mocap the margin is the largest: a body error of 0.019 against 0.049 for DIAL-MPC [6], less than half of the best baseline's error, and roughly a tenth of the starter's 0.190.
On G1-standup BAER reaches a running cost of 10.29 against 10.44 for Cross-entropy method [3], and 11.55 for the starter. The baselines on this setting are tightly bunched, from 10.44 to 10.76 apart from the starter, so the margin, while in our favour, is small in absolute terms and we do not read more into it than the ordering.
The ordering of the baselines is consistent with what motivated our design. The cross-entropy method and DIAL-MPC, both iterated, are the two strongest baselines on Go2-walk and G1-mocap, and the cross-entropy method is the strongest on G1-standup, where the field is bunched. BAER keeps the cross-entropy method's elite refit and adds the budget-adaptive iteration count, elitist selection and, where enabled, reference anchoring, polish and feedback.
How we got here
We began by benchmarking every reference method in a closed-loop harness of our own that charged the real per-step budget. On those short development runs three of the iterated methods, the cross-entropy method, DIAL-MPC and MPPI-CMA, were ahead of the single-iteration ones (clearly so on two of the three development settings), and Predictive Sampling was among the weakest everywhere. Our first planner therefore combined an iterated elite refit with the pieces the baselines lacked: full use of the larger first-replan budget, reference knots read at the true knot times, and the elitist choice between the refit mean and the best sample. From then on we mostly changed one factor at a time.
- More iterations, with the batch shrunk to pay for them, helped. In our development ablation over two, four, six and eight iterations, six and eight were best on one setting, a second was nearly flat from four on, and a third was slightly worse than with four; we set the default to six, and later made the count follow the budget left at each replan.
- An annealed, MPPI-style update was worse. Inspired by DIAL-MPC's fixed annealing schedule and per-knot noise ramp, we tried softmax weights over all standardised costs with a noise scale annealed geometrically from to within each replan and ramped across the knots. It was worse than the elite refit on all three development settings (for example 0.095 against 0.0666 on one of them), so the elite refit stayed. A later per-knot noise ramp on its own was also worse.
- Gradient polish only paid off where the noise is small. Applied everywhere, it gave no clear gain; restricted to the fine preset, our development runs showed it improving two settings by about 7% and 2% and leaving a third unchanged, so it is enabled only there.
- Horizon and knots are not universal. Our ablations showed one family of settings preferring more knots and a shorter horizon (, was the best of the variants we tried), while another was sample-starved: a longer horizon raised its development cost from 10.23 to 11.91, because every extra planning step comes out of the number of samples.
- Domain-randomised rollouts hurt. Selecting plans by their cost under two randomised models made both settings we tried it on worse in development, and we dropped it. Restart and diversity hardening against an occasional poor branch on one setting was also dropped: its mean cost over repeated development runs was 10.378 against 10.318 without it, and the poor branch persisted.
- Feedback with a two-period commitment helped one setting and did not hurt two others. It gave our best development result on one setting (0.01499 against 0.01597). Since committing two periods also doubles the next replan's budget and hence the number of iterations, that gain cannot be separated from the extra iterations.
- Damping the variance refit helped on two families and hurt on the third. Mixing the new spread half and half with the old one reduced the worst of six repeated development runs on one setting from 10.59 to 10.36 and lowered their mean from 10.318 to 10.279, and improved one setting of another family on both repeats, but made one setting of a third family worse on both repeats (0.075 and 0.080 against 0.064 and 0.057); the other settings, run once or twice, were mixed. It is therefore enabled per preset.
- The elitist selection is load-bearing. Removing it raised one setting's development cost from 10.234 to 10.392.
- Several other changes did not survive. A wider elite fraction (0.12) first looked better, but an identical-code rerun moved by as much as the apparent gain, so we kept 0.06. Turning the antithetic pairs off was neutral, a larger exploration share (0.15) was worse or neutral, and a sharper (0.15) rank temperature was worse than 0.25 on all three development settings, a softer one (0.4) on two of them. Discounting was mixed, and boosting the terminal cost was worse on both settings we tried it on.
Two of these lessons were about the measurements themselves. A rerun of identical code moved one setting by about 20% in our development runs, and we put the noise at about 7% and 1% on two others, so we repeated the close comparisons; we had already moved to longer runs after an earlier seed comparison showed large variation on one setting. And the carry-over of the previous replan's elites, which is part of the final planner, never showed a gain beyond that noise in our development runs; we kept it, but we cannot claim it helps.
Limitations
- The constants are per setting. The horizon, knots, noise band and the polish, damping and feedback switches are looked up by setting name, and they were tuned on our development runs of those same settings. The algorithm is shared, but a new robot or task would need its preset chosen, and we did not test how sensitive the results are to choosing the wrong one.
- Several components are not separately justified. The elite carry-over showed no measurable gain; the feedback gain's benefit is confounded with the doubled iteration count that the two-period commitment buys; and the feedback gains and are hand-set, diagonal and identical across joints, not derived from the dynamics as Feedback-MPPI derives its gains [9].
- The margin on G1-standup is small. BAER's running cost there, 10.29, is below every baseline's, but the baselines themselves span a narrow range, and in our development runs the same setting showed an occasional poor outcome in one run out of several that restart hardening did not remove.
- Development noise limits what our ablations can say. Run-to-run variation of up to about 20% on one setting in our development runs means that several of the "neutral" verdicts above could hide real effects of a few percent in either direction.
- The covariance is diagonal. BAER adapts a separate spread per knot and actuator but no correlations between them, which CMA-ES and CoVO-MPC exploit [4, 5]; that BAER beats them here says that budget use and plan selection mattered more on these settings, not that correlations are useless.
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.
- Zeji Yi, Chaoyi Pan, Guanqi He et al. (2024). CoVO-MPC: Theoretical Analysis of Sampling-based MPC and Optimal Covariance Design.
- Haoru Xue, Chaoyi Pan, Zeji Yi et al. (2025). Full-Order Sampling-Based MPC for Torque-Level Locomotion Control via Diffusion-Style Annealing. ICRA.
- An T. Le, Khai Nguyen, Minh Nhat Vu et al. (2025). Model Tensor Planning. TMLR.
- Armand Jordana, Jianghan Zhang, Joseph Amigo et al. (2025). An Introduction to Zero-Order Optimization Techniques for Robotics.
- Tommaso Belvedere, Michael Ziegltrum, Giulio Turrisi et al. (2025). Feedback-MPPI: Fast Sampling-Based MPC via Rollout Differentiation -- Adios low-level controllers.