Flipping the Coins: Training Physical Simulators through Hard Switches
Tianrun Gao, Ruiqi Feng, Haomin Wen, Tailin Wu, Liangqiong Qu, Xiaomeng Huang, Ruiqi Shu
Abstract
Hybrid simulators embed learnable components such as neural networks in physical solvers and train them on reference trajectories. Many scientific solvers feature hard switches, such as a tripping power line, an igniting grid cell, or depolarizing brain tissue, where the loss exhibits discrete jumps across switch flips, leaving standard automatic differentiation to capture only its smooth part. Existing training paradigms face a fundamentally challenging trade-off, as gradient-based relaxations smooth the switches and introduce bias across jumps, whereas derivative-free methods treat the solver as a black box and discard path gradients of the continuous dynamics. Here we introduce EventFlip, which flips a near-threshold switch from a stored state, replays the original solver, and measures the loss difference between the two runs, in effect a finite difference across the switch. By perturbing every threshold with small Gaussian noise, we cast each switch as a stochastic binary decision and derive an unbiased gradient estimator that combines the continuous path gradient with a jump term constructed from these counterfactual rollouts. EventFlip-Rand optimizes this noise-averaged objective, whereas EventFlip-Hard operates on the deterministic hard-switch simulator used at deployment and provably targets the complete discontinuous loss. Under an identical forward evaluation budget, we benchmark EventFlip against twelve baselines across a power-grid cascade, a detonation wave, and cortical spreading depolarization, achieving the lowest error on every task and reducing the strongest baseline's error by factors of 1.5, 1.4, and 1.4, respectively.
Create a lesson
Metadata
- Comments
- 47 pages (13 main + appendix), 4 figures, 15 tables
Related papers
Train-Only-Constrained LM for Synthetic Clinical Trajectories: Leak-Safe Calibration and Auditable Dynamics
Shared title terminologycs.LGYaser Kord, Moritz Hess
Cell-Type-Specific Expression Is Hard to Predict from Bulk, but It Is Still Useful
Shared title terminologycs.LGGadi Naveh, Amit Miller, Gal Keinan
AlignPre: Skill-Aligned Post-Training for Latent-Free Generative Precipitation Nowcasting
Shared title terminologycs.LGDemin Yu, Kenghong Lin, Xutao Li
Assessing the Physical Interpretability of AlphaEarth Foundation Embeddings Through Multi-Sensor Satellite Time-Series Benchmarking for Agricultural Mapping
Shared title terminologycs.LGEl Houcine El Moussaoui, Chouaib El Hachimi, Saïd Khabba et al.
MolGPAO: Molecular Generative Pre-trained Autoregressive Octree with Speculative Decoding and Sub-Millisecond Seam Healing for 3D Molecules
Shared title terminologycs.LGShangqian Chen, Guojiang Zhao, Zheng Cheng et al.
LEGOSpec: A Composable and Efficient Framework for Speculative Draft Design and Training
Shared title terminologycs.LGHanzhen Wang, Jiaming Xu, Guohao Dai