Some neural network controllers use sine activations instead of ReLUs, and they are increasingly trained by differentiable simulation: a physics engine written so that gradients flow from a task loss, such as "the robot moved at the wrong speed," back through hundreds of simulated time steps into the controller's weights. Two findings sit uneasily together. Sine-activated controllers trained this way learn soft-robot locomotion much faster than reinforcement learning (Complex Locomotion Skill Learning via Differentiable Physics). Separately, sine-feature networks trained with ordinary reinforcement learning drift toward high-frequency internal representations. That drift makes them collapse when observations are noisy, unless weight decay holds the frequency down (Frequency and Generalisation of Periodic Activation Functions in Reinforcement Learning). No one has checked whether the drift also happens when gradients come from a simulator, or what it does there.
We argue the interaction is not incidental. In differentiable simulation, the controller's sensitivity to its input state is multiplied into the gradient at every time step. A sine layer's sensitivity grows with its frequency. If the frequency drifts upward, the controller should therefore produce three problems together: exploding gradients over long horizons, chaotic closed-loop behavior, and brittleness to sensor noise. The proposal measures this coupling directly. It then tests a remedy: a penalty on the sensitivity of the whole closed loop (simulator plus controller), estimated cheaply along rollouts, that limits frequency only where it destabilizes the dynamics. The remedy is compared against weight decay, per-layer Lipschitz limits, and the simplest alternative, which puts periodic features only on a clock input.
Core Claim
Write the simulator step as $s_{t+1} = f(s_t, u_t)$, where $s_t$ is the physical state and $u_t = \pi_\theta(s_t)$ is the controller's action. The gradient of a loss at step $T$ with respect to an earlier state passes through the product of closed-loop Jacobians:
$$J_t = \frac{\partial f}{\partial s_t} + \frac{\partial f}{\partial u_t}\,\frac{\partial \pi_\theta}{\partial s_t}.$$
For a sine layer $\sin(\omega W s)$, the controller sensitivity $\partial \pi_\theta / \partial s$ scales with $\omega \lVert W \rVert$. Upward frequency drift therefore enters the gradient product directly and raises its growth rate. The same quantity makes the deployed policy amplify observation noise. Our first claim is empirical and falsifiable. Under analytic gradients, periodic controllers drift in frequency, and the drift tracks the growth of $\log \sigma_{\max}(J_t)$, the log of the largest stretching factor of the closed-loop Jacobian. The opposite outcome would also be informative. If the simulator damps the drift, for example because contact and dissipation shrink $\partial f / \partial s$, then the noise brittleness reported for model-free reinforcement learning would be an artifact of zeroth-order training.
Our second claim concerns the remedy. A hinge penalty on closed-loop stretching,
$$\mathcal{L} = \mathcal{L}_{\text{task}} + \lambda\,\mathbb{E}_t\big[\max(0,\ \log\hat\sigma(J_t) - \log\rho)\big],$$
should keep the speed advantage of sine controllers while removing their noise collapse. Here $\hat\sigma(J_t)$ is estimated with two or three power-iteration steps using Jacobian-vector products the simulator already supports, $\rho$ is a target stretching factor slightly above 1, and $\lambda$ is a weight. The penalty differs from weight decay and from per-layer spectral normalization because it accounts for the physics. Where the plant is strongly dissipative, the controller may stay high-frequency; where the plant is near-unstable, the controller is held back.
Research Program
The first phase is a measurement study. We train sine-activated controllers with analytic policy gradients in two settings. The first is the soft-robot locomotion agents built on DiffTaichi: Differentiable Programming for Physical Simulation, following the protocol of Complex Locomotion Skill Learning via Differentiable Physics. The second is the rope and liquid tasks of DaxBench: Benchmarking Deformable Object Manipulation with Differentiable Physics. Throughout training we log three things. The first is the effective first-layer frequency, measured the same way as the scale $\beta$ in the reinforcement-learning frequency study so the two are comparable. The second is a finite-time estimate of the closed-loop Lyapunov exponent along rollouts, which measures how fast nearby trajectories separate. The third is gradient norm as a function of horizon length. We vary the initial frequency so we can see whether all runs converge to the same scale, as the "high-frequency magnet" result reports for model-free training.
A critical confound in the existing evidence motivates the second phase. The locomotion controllers of Complex Locomotion Skill Learning via Differentiable Physics receive an external periodic clock signal alongside the state. Their advantage may therefore come entirely from periodic processing of time, while sine processing of state contributes only the fragility. We split the controller into two parallel branches, in the spirit of FAN: Fourier Analysis Networks, which uses parallel sine and standard-activation branches in one layer. One branch is periodic and takes the clock; the other is periodic or smooth and takes the state. We ablate each branch separately, and we also run with the clock removed.
The third phase adds the closed-loop penalty and evaluates every variant under test-time Gaussian observation noise at several levels. Following Frequency and Generalisation of Periodic Activation Functions in Reinforcement Learning, we add the noise only at deployment.
Baselines
The naive reference is a tanh or ReLU controller trained with the same analytic gradients, horizon, and optimizer. It tells us whether periodicity helps at all on these tasks. Periodic Signal Recovery with Regularized Sine Neural Networks argues that piecewise-linear networks cannot extrapolate cycles. Locomotion controllers act on state rather than time, however, so this argument may not transfer, and the naive baseline could be competitive.
The strongest existing method is the sine-activated controller with external clock and sliding-window temporal loss from Complex Locomotion Skill Learning via Differentiable Physics. That paper reports convergence "orders of magnitude faster" than PPO, but no reported numeric result was found on Lacuna for its locomotion tasks. We will therefore reproduce it ourselves.
On DaxBench Whip-Rope, the high-frequency dynamic-control task, analytic policy gradients reach a reward of 0.83 against 0.25 for PPO (DaxBench). We use 0.83 as the noise-free bar. The file does not state the architecture behind that number, so we rerun it with our settings.
Weight-decay frequency anchoring, the fix proposed by Frequency and Generalisation of Periodic Activation Functions in Reinforcement Learning, is the most direct competitor to our penalty. A per-layer spectrally normalized sine controller isolates the key ingredient of our method: whether accounting for the physics term $\partial f / \partial s$ matters, or whether bounding the controller alone is enough. Gradient clipping with truncated horizons is the standard engineering answer to exploding gradients and is included as well.
All methods share the same simulator, horizon, number of environment steps, and seeds. Each regularizer (λ, weight-decay coefficient, Lipschitz bound, clipping norm) gets the same sweep budget of eight values, chosen on noise-free validation reward. Beating the field means two things. Noise-free reward must stay within seed noise of the best baseline. Reward must also degrade significantly less at medium and high observation noise than under weight decay, across at least two task families.
Why not just…?
Why not just use weight decay, which already fixes the drift? It is the real threat. It works in model-free reinforcement learning (Frequency and Generalisation of Periodic Activation Functions in Reinforcement Learning), but it shrinks all weights uniformly, regardless of where the dynamics are unstable. On a task that needs sharp, fast control, such as Whip-Rope, uniform shrinkage should cost reward. The matched-budget comparison settles this. If weight decay matches our penalty on both noise-free reward and noise robustness, we will report that the physics-aware penalty is unnecessary, and the measurement study stands alone as the contribution.
Why not just put Fourier features on the clock and use a smooth network on the state? This could plausibly match everything, because it keeps rhythm generation and removes high-frequency sensitivity to state. We treat it as a first-class arm of the branch ablation rather than a straw man. If it wins, the result is still a clear and useful finding: periodic structure belongs on time, not on state, in differentiable-simulation control. The no-clock condition is where the two diverge. There, any rhythm must come from state feedback, and a smooth state branch may fail to form gait cycles.
Why not just clip gradients or shorten the horizon? Clipping limits the training signal but does nothing about the deployed policy's sensitivity to noise. The learned controller remains high-frequency. Short horizons also hurt tasks whose reward depends on long-range timing. The gradient-norm and noise curves will show both effects separately.
Decisive Checks
The central check is a correlation across all runs and frequency initializations. If learned frequency predicts the closed-loop Lyapunov estimate, and that estimate in turn predicts reward loss under noise, the mechanism holds. If frequency does not drift under analytic gradients, the simulator is acting as a stabilizer, and the noise-brittleness concern largely does not apply to differentiable-simulation training.
A second check isolates the physics term. We transfer each controller to a version of the simulator with stronger damping. If our penalty's advantage over policy-only spectral normalization shrinks as damping increases, that supports the claim that accounting for $\partial f / \partial s$ is what matters.
The final check removes the clock. In the no-clock locomotion condition, we measure whether any variant learns stable gait cycles. This also tests directly the open question left by Complex Locomotion Skill Learning via Differentiable Physics: whether the external clock is needed at all.
References
- Complex Locomotion Skill Learning via Differentiable Physics
- Frequency and Generalisation of Periodic Activation Functions in Reinforcement Learning
- DiffTaichi: Differentiable Programming for Physical Simulation
- DaxBench: Benchmarking Deformable Object Manipulation with Differentiable Physics
- FAN: Fourier Analysis Networks
- Periodic Signal Recovery with Regularized Sine Neural Networks