Differentiable Simulation of Hard Contacts with Soft Gradients for Learning and Control
Anselm Paulus, A. Ren\'e Geist, Pierre Schumacher, V\'it Musil, Simon Rappenecker, Georg Martius

TL;DR
This paper introduces DiffMJX, a novel differentiable simulation method for hard contacts that improves gradient accuracy for learning and control in robotics by combining adaptive integration and contact-from-distance techniques.
Contribution
It proposes DiffMJX, integrating adaptive time stepping and contact-from-distance with penalty-based simulation to enhance gradient computation for hard contacts.
Findings
DiffMJX significantly improves gradient accuracy in contact-rich simulations.
The method reduces the sim-to-real gap caused by stiff contact modeling.
Contacts from distance enable informative pre-contact gradients without sacrificing realism.
Abstract
Contact forces introduce discontinuities into robot dynamics that severely limit the use of simulators for gradient-based optimization. Penalty-based simulators such as MuJoCo, soften contact resolution to enable gradient computation. However, realistically simulating hard contacts requires stiff solver settings, which leads to incorrect simulator gradients when using automatic differentiation. Contrarily, using non-stiff settings strongly increases the sim-to-real gap. We analyze penalty-based simulators to pinpoint why gradients degrade under hard contacts. Building on these insights, we propose DiffMJX, which couples adaptive time integration with penalty-based simulation to substantially improve gradient accuracy. A second challenge is that contact gradients vanish when bodies separate. To address this, we introduce contacts from distance (CFD) which combines penalty-based…
Peer Reviews
Decision·ICLR 2026 Poster
- The work addresses very relevant problems in simulators for robotics, and especially for using differentiable simulation to improve training. - There is a lot of engineering effort under the hood for both the simulator integration and the robot experiments. - The technical details in the paper are well presented and easy to follow.
- The variable step size on demand (i.e., during collisions) is a very poorly scaling option. It works well in the very specific cases of dropped objects or a single robot in contact with a ball that the authors present. However, in most applications of RL with multiple (1000s) parallel environments, the number of contacts would cause the simulator to continuously operate at a minimal step size, thereby bogging it down indefinitely. - The contacts from a distance approach introduced by the auth
- The paper addresses a real and unsolved bottleneck—gradient instability under hard contacts. - The integration with MuJoCo-XLA makes the method directly applicable to a widely used robotics stack. - The numerical experiments (bouncing-ball, simple manipulator) clearly illustrate gradient discontinuities and the partial improvement achieved by DiffMJX.
**1.Relation to prior “force-from-distance” work.** The proposed “Contacts From Distance (CFD)” estimator appears conceptually related to earlier “force-from-distance” smoothing used in quasi-dynamic contact models, such as Pang et al. (Global Planning for Contact-Rich Manipulation via Local Smoothing of Quasi-Dynamic Contact Models, arXiv:2206.10787). That paper also introduces continuous, distance-based contact forces that activate before penetration to improve numerical stability. However, i
1. The problem is interesting with potentially high, practical impacts on accelerated differentiable learning and control, as hard contacts are involved in almost all control problems. 2. The proposal of adaptive time stepping is well-motivated and novel in the context of accelerated learning and control. Experiments sufficiently show that it helps improve gradient estimate accuracy under hard contacts while maintaining the simulator's computational efficiency. Although CFD is simple, it is well
1. Limited theoretical analysis of several claims. For example, while empirical results show that adaptive integration improves gradient accuracy, it lacks rigorous theoretical analysis of when and why this approach guarantees correct gradients. The authors can provide theoretical bounds on gradient error as a function of integration tolerance, or at minimum, a more rigorous analysis of when adaptive integration helps. 2. Many explanations remain at the high level of intuition instead of formal
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsDiamond and Carbon-based Materials Research · Advanced machining processes and optimization · Tribology and Wear Analysis
