Source-linked AI summary
Ostrich: Taking Large Strides Through Stiff Contact in Differentiable Dynamics
Aleš Kučera, Karel Zimmermann
TL;DR
Differentiable simulators face trade-offs in accuracy, gradient reliability, and cost for stiff, persistent contact. Ostrich combines GPU hard-contact simulation with implicit gradients and a reused Schur complement. It matches MuJoCo’s sim-to-real accuracy at a 50× larger timestep and reports stronger control-synthesis success and faster optimization iterations than the differentiable baselines.
Problem
Under stiff, persistent contact, differentiable simulators trade simulation accuracy, gradient reliability, and per-iteration cost; tape-based methods require small steps, while surrogates lose contact geometry.
Source: §I · p. 1, B. Gradient Reliability through Contact · p. 2Method
Ostrich uses a GPU-accelerated rigid-body simulator with hard contacts and Coulomb friction solved by non-smooth Newton iteration, then differentiates the converged residual with an implicit adjoint.
Source: §I · p. 1Results
Ostrich holds MuJoCo’s sim-to-real accuracy at a 50× larger timestep, succeeds on 100% of control-synthesis trials versus 16% for MJX and 8% for Semi-Implicit, and runs a warm iteration 211× faster than MJX.
Source: A. Sim-to-Real Accuracy and Timestep… · p. 5, B. How Reliable and Fast Are the… · p. 6Takeaways & Limitations
Ostrich combines hard-contact fidelity, reliable gradients, and scalable optimization in the tested trajectory and parallel-world tasks.
Source: §V · p. 7All real-robot evidence comes from a single wheeled platform, and gradient flow through contact birth or death remains open.
Source: §V · p. 8
Abstract
from arXiv · showhide
Three properties determine whether a differentiable simulator can drive gradient-based optimization through contact: simulation accuracy, gradient reliability, and per-iteration cost. Tape-based engines such as MJX and Newton Semi-Implicit require timesteps small enough to keep contacts numerically tractable, and their backpropagation memory grows linearly with the number of timesteps T. Surrogate models bound memory by approximating contact away, but the resulting gradients lose the geometry the optimization depends on. We present Ostrich, a GPU-accelerated rigid-body simulator that resolves hard contacts and friction with non-smooth Newton iteration at large timesteps (h ~ 0.1 s), and differentiates the converged residual via the implicit function theorem, reusing the forward Schur complement to compute the adjoint at O(1) memory per timestep. On real-robot trajectories over a pallet obstacle, Ostrich holds MuJoCo's sim-to-real accuracy up to a 50x larger timestep. Its gradients converge from random initializations where MJX descends slowly and Newton Semi-Implicit stalls; a warm iteration runs 211x faster than MJX's and 4.7x faster than Semi-Implicit's. On the same scene Ostrich differentiates 8,192 parallel worlds on a single 24 GB GPU, sustaining 29x checkpointed MJX's optimization throughput; without checkpointing both baselines exhaust memory at far fewer worlds. We close with a gradient-based trajectory optimization demonstration over triangle-mesh terrain across a 10 s horizon, a setting where prior engines either restrict to primitive geometry or face the convergence and memory limits shown above.
I. INTRODUCTION
Stiff, persistent contact exposes trade-offs in accuracy, gradient reliability, and cost for differentiable simulators. Ostrich combines hard-contact GPU simulation with implicit gradients and scales to mesh collisions and parallel worlds.
I. INTRODUCTION
- Ostrich resolves hard contacts and Coulomb friction with non-smooth Newton iteration, then differentiates the converged residual using an implicit adjoint.The adjoint reuses the forward Schur complement, giving O(1) gradient memory per timestep.Source: §I · p. 1
II. RELATED WORK
- Prior hard-contact implicit-differentiation engines remain CPU-bound or restricted to primitive collision geometries, while Ostrich scales to arbitrary triangle meshes and thousands of GPU worlds.Ostrich also adds joint control constraints, best-iterate backtracking, and robust friction projection to the formulation of Macklin et al..Source: §I · p. 1
A. Simulation Accuracy under Stiff Contact
- Soft-contact engines need small timesteps to keep contact numerically tractable, and reducing stiffness widens the sim-to-real gap.Adaptive-timestep methods reduce accepted steps without removing the dependence between contact stiffness and step size.Source: A. Simulation Accuracy under Stiff… · p. 2
B. Gradient Reliability through Contact
- Gradients through stiff or non-smooth contact can be biased, noisy, or wrong-signed; surrogate dynamics also omit terrain geometry, non-holonomic traction, or localized slip.Short-horizon truncation drops exact long-horizon gradients, while randomized smoothing trades non-smoothness for bias.Source: B. Gradient Reliability through Contact · p. 2
C. Per-Iteration Cost: Memory and Throughput
Tape-based differentiation stores per-step computations and inner solver iterations, while existing implicit-differentiation engines have CPU, geometry, or scaling limits. Ostrich reuses its forward solve for GPU-parallel adjoints and discretizes motion with backward Euler.
C. Per-Iteration Cost: Memory and Throughput
- Reverse-mode AD tapes grow with trajectory length and per-step solver work, whereas implicit differentiation uses O(1) memory per timestep regardless of solver iterations.Prior implicit methods described here remain CPU-bound or limited in geometry or GPU-world scale.Source: C. Per-Iteration Cost: Memory and… · p. 2
III. THEORY
- Ostrich’s adjoint reuses the forward solve’s matrix-free Schur operator and preconditioner under hard NCP contact, so gradients run at the forward solve’s parallel efficiency.The simulator extends the non-smooth Newton formulation with implicit control constraints, friction-projection robustness, and best-iterate backtracking.Source: §III · p. 2
A. Discrete Equations of Motion
- Backward Euler updates positions using the next velocity, while evaluating the constraint Jacobian implicitly at the next position preserves stable handling of stiff contacts and motors.The kinematic map is evaluated at the previous position so the KKT system remains linear in next-step velocity and multipliers.Source: A. Discrete Equations of Motion · p. 2
B. Constraint Formulation
The formulation encodes physical interactions as residual equations and solves contacts, friction, and control constraints together. Its friction safeguards preserve admissibility across Newton iterates, while implicit servo constraints remain well posed at positive timesteps and gains.
Constraint formulation
- Physical interactions are encoded as residual equations in next-step position, velocity, and constraint multipliers.The formulation includes bilateral joint constraints with diagonal compliance and uses the Fischer-Burmeister function for non-penetration complementarity.Source: B. Constraint Formulation · pp. 2–3
Friction constraints
- Friction weight W interpolates between sticking and sliding; freezing it within a Newton iteration makes the step inexact without softening contact, and the fixed point satisfies exact Coulomb-cone KKT conditions.Clamping the impulse keeps it within the cone, while W ≥ 0 keeps friction dissipative.Source: B. Constraint Formulation · p. 3
Control constraints
- Implicit servo constraints formulate position and velocity targets as constraint rows rather than explicit PD torques, which can become unstable when h^2 kp exceeds system inertia.The servo constraint is solved jointly with contacts and friction and is well posed for any positive timestep and gains.Source: B. Constraint Formulation · p. 3
C. Newton Solver
Ostrich solves the coupled residual system with an inexact non-smooth Newton method. It reduces the system using the kinematic relation and Schur complement, then uses best-iterate backtracking to handle overshooting at large timesteps.
C. Newton Solver
- The solver stacks kinematic, dynamics, and constraint residuals into a nonlinear system over the next state, controls, and physical parameters.Constraint residuals include bilateral joints, normal contacts, friction, and control.Source: C. Newton Solver · p. 3
- Using the linear kinematic residual to eliminate position reduces the Newton system to velocity and multipliers; a Schur complement then eliminates velocity.The reduced system is solved with matrix-free Preconditioned Conjugate Residual, followed by velocity back-substitution.Source: C. Newton Solver · p. 3
- At large timesteps, fixed-budget best-iterate backtracking returns the eligible iterate with the smallest residual instead of using a line search.On mesh terrain, the final iterate overshoots an earlier lower-residual iterate by up to three orders of magnitude on a third of steps.Source: C. Newton Solver · pp. 3–4
D. Adjoint Backward Pass
Ostrich computes reverse-mode gradients by differentiating the converged residual with the Implicit Function Theorem, rather than differentiating through solver iterations. Reusing the forward Schur-complement solve keeps the adjoint memory constant per timestep, and finite-difference tests validate its gradients across contact and non-contact settings.
Adjoint formulation
- The Implicit Function Theorem turns the residual-defined state transition into an adjoint computation that propagates gradients to the previous state, controls, and parameters in one reverse sweep.Rather than differentiating through solver iterations, the method solves for an adjoint and obtains the required input gradients through vector-Jacobian products.Source: D. Adjoint Backward Pass · p. 4
Reuse of the forward solver
- Eliminating the velocity adjoint with the Schur complement reduces the adjoint solve to the forward solver’s operator evaluated at its converged iterate.After solving for the contact adjoint, the velocity adjoint is recovered by back-substitution.Source: D. Adjoint Backward Pass · p. 4
Adjoint formulation
- The backward pass reuses the forward solve’s operator and preconditioner, requiring one PCR solve and O(1) memory per timestep regardless of forward iteration count.A residual evaluation at the converged state and one vector-Jacobian sweep provide the previous-pose pull-back, including rigid-transform dependence of contact points and normals.Source: D. Adjoint Backward Pass · p. 4
Validation
- Centered finite differences show maximum relative errors of 0.02% on an impulsive contact-boundary test, ≤0.4% across tested wheel DOFs, and ≤1.6% on cart-pole losses through 50 steps.The largest relative deviations occur on DOFs with the smallest gradients; the checks run in continuous integration.Source: D. Adjoint Backward Pass · p. 4
IV. EXPERIMENTS
The experiments assess simulation accuracy, gradient reliability, and computational cost on a real three-wheeled robot traversing a pallet. Ostrich is compared with MJX and Newton Semi-Implicit, with implementation and prior-engine limitations framing the evaluation.
IV. EXPERIMENTS
- The experiments evaluate simulation accuracy, gradient reliability, and per-iteration cost on a custom three-wheeled robot using data from 14 pallet traversals.The surveyed engines did not produce clean gradients through stiff box contact, with failure modes linked to their contact-solver families.Source: §IV · p. 4
- The pallet figure depicts a representative held-out trajectory, base elevation, and combined position-and-yaw error averaged across ten held-out runs.All three engines reproduce the measured climb on the representative run.Source: Figure 2 · p. 5
- Ostrich is benchmarked against MJX and Newton Semi-Implicit, the two surveyed differentiable baselines that run the scene; other engines are excluded for gradient, hardware, or geometry limitations.Genesis produced near-zero rigid-body gradients on this scene, Dojo is CPU-only and dormant, and TinyDiffSim supports only primitive geometry.Source: §IV · p. 5
- Ostrich runs in NVIDIA Warp GPU kernels, while Newton handles model building and collision detection; experiments use one RTX 3090 with 24 GB memory.Source: §IV · p. 5
A. Sim-to-Real Accuracy and Timestep Range on a Pallet Obstacle
On held-out pallet traversals, all three engines reproduce the climb, while Ostrich has the lowest reported combined error. Ostrich maintains that accuracy floor at timesteps up to 50 times larger than MuJoCo’s, whereas Semi-Implicit is limited by penalty-spring stability.
a) Setup
- The evaluation uses 14 pallet traversals spanning speeds of 0.12–2.05 m/s, with four training runs and ten held-out runs.Wheel-command scale is calibrated on the flat pre-obstacle cruise, disjoint from the scored climb.Source: A. Sim-to-Real Accuracy and Timestep… · p. 5
c) Held-out accuracy
- 0.208 m combined error for Ostrich compares with 0.268 m for Semi-Implicit and 0.315 m for MuJoCo on held-out runs; all three reproduce the measured pallet climb.The shared error floor concentrates on turn-heavy runs, consistent with variation in per-run turn efficiency that a constant-friction model cannot represent.Source: A. Sim-to-Real Accuracy and Timestep… · p. 5
d) Timestep range
- Ostrich holds its accuracy floor up to h = 0.1 s, while MuJoCo leaves its floor at 2 ms, a 50× smaller timestep.The hard-contact solve introduces no contact timescale of its own; integration error sets Ostrich’s timestep edge.Source: A. Sim-to-Real Accuracy and Timestep… · p. 5
- Semi-Implicit is capped 200× below Ostrich by its penalty springs’ explicit-integration stability limit and diverges beyond 0.5 ms.Its held-out evaluation used 0.25 ms, within that limit.Source: A. Sim-to-Real Accuracy and Timestep… · p. 5
B. How Reliable and Fast Are the Gradients?
The section tests gradient-based control synthesis through contact and compares optimization reliability and cost across Ostrich, MJX, and Semi-Implicit. The task starts from perturbed poses and optimizes wheel commands to reach and stop at a target.
Setup
- The task optimizes a 30-parameter, K=10-knot wheel-velocity spline over a 6 s horizon, driving the robot through a box obstacle to a random target pose.Each engine runs 50 Adam iterations from randomly perturbed initial poses, with per-engine timesteps of 100 ms, 2 ms, and 0.5 ms for Ostrich, MJX, and Semi-Implicit, respectively.Source: B. How Reliable and Fast Are the… · p. 6
Reliability
- Ostrich succeeds on 100% of 25 trials (median final position error 0.065 m), versus MJX’s 16% and Semi-Implicit’s 8%.Success requires final position error below 0.2 m and terminal speed below 0.3 m/s.Source: B. How Reliable and Fast Are the… · p. 6
- Ostrich reaches median loss 0.042 in ∼28 s of warm iterations (29 s end to end); MJX reaches 0.28 after ∼1.6 h, while Semi-Implicit stalls at 0.59.The plotted median running-best loss spans 25 trials; its wall-clock axis excludes one-time setup.Source: Figure 4 · p. 6
Wall-clock cost
- A warm Ostrich iteration takes 0.55 s, 211× faster than MJX (116 s) and 4.7× faster than Semi-Implicit (2.6 s).Setup costs are separate; neither baseline reaches a comparable loss in the reported 50-iteration run.Source: B. How Reliable and Fast Are the… · p. 6
Zeroth-order comparison
- Evolution strategies use about 1,800 rollouts per solved problem against 50 forward-adjoint pairs, a 35× sample-count gap.At 300 parameters, ES needs twice the rollouts and 1.5× the budget, reaching 4× the matched-budget loss before catching up at 5× the budget.Source: B. How Reliable and Fast Are the… · p. 6
C. Does It Scale?
This section measures end-to-end optimization throughput and peak GPU memory as the number of parallel box-traversal worlds increases, including checkpointed configurations.
Memory scaling
- Plain BPTT exhausts the 24 GB card for MJX at 8 worlds; its 3,000 taped steps and inner contact iterations contribute to memory pressure.Semi-Implicit tapes 12,000 steps over the 6 s horizon, while Ostrich uses 60 steps and does not tape inner iterations.Source: C. Does It Scale? · p. 7, Figure 5 · p. 7
Throughput across regimes
- At 8,192 worlds, Ostrich peaks at 348 world-iterations/s versus checkpointed MJX’s 12 at 4,096 worlds (29×); Semi-Implicit reaches 23 at 512 worlds.The measurements use an RTX 3090 with 24 GB; Semi-Implicit runs out of memory at 1,024 worlds.Source: C. Does It Scale? · p. 7, Figure 5 · p. 7
- Checkpointed Ostrich sustains 171–173 world-iterations/s up to 32,768 worlds while using 21.7 GB.Checkpointing adds one forward re-execution per step; MJX starts paying this recomputation cost at 8 worlds and Ostrich at 16,384.Source: C. Does It Scale? · p. 7, Figure 5 · p. 7
- At one world, Ostrich runs at 0.53 s per optimization iteration, versus 126 s for checkpointed MJX and 4.4 s for Semi-Implicit.Computational cost remains O(T) for all methods; the reported gains come from timestep size and batch throughput.Source: C. Does It Scale? · p. 7
D. Beyond Primitives: Terrain Traversal
The section demonstrates gradient-based trajectory optimization directly on triangle-mesh terrain, including many simultaneous mesh-wheel contact candidates. It reports results across random terrains and describes a truncated adjoint used for the 10 s horizon.
Setup
- The terrain is a 24 × 24 m sum-of-sinusoids heightmap, with ∼12,500 mesh faces and hundreds of simultaneous contact candidates per step.The optimization spans 10 s with T=125 steps at h=80 ms, using a K=10-knot target spline.Source: D. Beyond Primitives: Terrain Traversal · p. 7
Results
- The O(1)-memory backward pass is evaluated on 50 random instances; the reported per-seed result is the best RMSE achieved over optimization.The figure plots RMSE median and IQR across 50 random terrains over 100 iterations.Source: D. Beyond Primitives: Terrain Traversal · p. 7, Figure 6 · p. 7
Setup
- The full position pull-back amplified contact sensitivity by ∼1.13× per step and gave no usable descent, so the terrain adjoint truncates it and holds contact geometry fixed within each step.The stated adjoint norm growth is for the 10 s horizon.Source: D. Beyond Primitives: Terrain Traversal · p. 7
Results
- The median per-seed best RMSE is 0.143 m; 45/50 seeds are below 0.5 m and 35/50 below 0.2 m.Median per-iteration time is 1,045 ms (∼8 ms/step).Source: D. Beyond Primitives: Terrain Traversal · p. 7, Figure 6 · p. 7
V. CONCLUSION
Ostrich combines hard-contact simulation with implicit gradients and demonstrates accurate, scalable gradient-based optimization across long horizons and mesh-resolved contact. Its scope remains bounded by unresolved contact-birth/death gradients and evidence from a single wheeled platform.
- Ostrich preserves MuJoCo’s sim-to-real accuracy at up to 50× larger timesteps and achieves 100% random-target success versus 16% for MJX and 8% for Semi-Implicit.Source: §V · p. 7
- It differentiates 8,192 parallel worlds on one 24 GB GPU, versus 4,096 for checkpointed MJX and 512 for Semi-Implicit.Source: §V · p. 7
- The demonstration extends gradient-based optimization to mesh-resolved contact over long horizons and thousands of parallel worlds.Source: §V · p. 8
- Real-robot evidence comes from a single wheeled platform; contact-birth/death gradients remain open, although the adjoint’s active set can evolve between steps.On long chaotic horizons, the position pull-back is truncated.Source: §V · p. 8
- The architecture targets differentiable MPC on real hardware, population-scale policy learning, and physical-parameter identification.Source: §V · p. 8