Machine-learned force fields are increasingly valuable proprietary assets. These are neural networks that predict the forces on atoms so that a simulation can step a molecule forward in time. A pharmaceutical client may want to run one on confidential molecules hosted by an untrusted cloud provider, with neither side revealing its secret. Homomorphic encryption makes this possible. It lets a server compute on encrypted numbers, and the client decrypts the result. The most practical variant for real-valued networks, approximate homomorphic encryption (Bootstrapping for Approximate Homomorphic Encryption), returns answers that carry small random errors. The server may also deliberately add noise to its outputs so that clients cannot reverse-engineer the model. In a molecular simulation, a random error on every force is not harmless. It behaves like the random kicks of a thermostat, the device simulations use to hold temperature fixed. Like a thermostat, it heats the system and corrupts the time-dependent behavior that motivates running dynamics at all, such as diffusion rates and vibrational spectra.
This note proposes to stop treating that noise as a nuisance and use it as the thermostat. The variance of the encryption and model-protection noise is known in advance from the cryptographic parameters. We can therefore add exactly the matching friction the fluctuation-dissipation theorem requires, and nothing more. The result is a constant-temperature simulation whose total dynamical distortion is set by the cryptographic precision, rather than by the cryptographic noise plus a separately tuned thermostat layered on top. This yields an explicit exchange rate between encryption cost (bits of precision, circuit depth, latency) and physical fidelity (suppression of diffusion, broadening of spectra). That exchange rate is the quantity a practitioner needs and nobody has measured.
Core Claim
Each encrypted force evaluation returns $F + \delta$. Here $\delta$ is a fresh, approximately white error with per-component standard deviation $\sigma_F$, coming from ciphertext rounding and any deliberate output noise. Integrated with time step $\Delta t$, this is the discretized random force of a Langevin thermostat whose friction is fixed by matching the noise variance to $2 m \gamma k_B T / \Delta t$:
$$ \gamma_{\text{crypt}} = \frac{\sigma_F^2 \, \Delta t}{2\, m\, k_B T}, $$
where $m$ is the atomic mass, $k_B T$ the target thermal energy, and $\gamma_{\text{crypt}}$ the friction that exactly balances the injected heat. Without that friction the noise heats each degree of freedom at a steady rate of roughly $\sigma_F^2 \Delta t / 2m$ per unit time. With it, the simulation is exactly a Langevin simulation at friction $\gamma_{\text{crypt}}$.
Rounding error falls by half with each additional bit of encrypted precision $p$, so $\sigma_F \propto 2^{-p}$. The induced friction then falls by a factor of four per bit, which is the source of the exchange rate. Our claims are threefold. Matched-friction compensation achieves the minimum dynamical distortion compatible with a given noise level. Generic thermostats tuned by hand sit above that minimum. The precision-versus-fidelity curve predicted by the equation above can be verified on liquid water and alanine dipeptide.
The equation only covers random error. Encrypted networks also suffer systematic error when non-polynomial activations are replaced by polynomial approximations after training. If forces are computed from the approximated network directly rather than as its exact gradient, they acquire a curl. A curl means a non-conservative component, which pumps in energy that no friction can correctly remove. The dark side of the forces shows that such curl heats bulk water at about 7,000 billion degrees per second. It also shows that thermostats are a "false cure" for this: they keep the temperature finite only by destroying the dynamics.
The second half of the proposal removes the systematic error by construction. We train a force field whose energy is natively a low-degree polynomial in encrypted inputs, in the spirit of PolyNeXt, which replaces activations with Hadamard (elementwise) products of linear projections. We then compute forces as the exact symbolic gradient of that polynomial. The gradient of a degree-$d$ polynomial has degree $d-1$, so conservative forces need no more multiplicative depth than the energy itself. Multiplicative depth is the number of sequential encrypted multiplications, which governs noise growth and the need for expensive "bootstrapping" refreshes. They need more multiplications, but not more depth. This contradicts the assumption, stated as Gap 2 in our source survey, that conservative forces must double the encrypted circuit depth. If it holds, direct force prediction loses its main reason to exist under encryption.
Relation to Prior Work
The only work in our survey joining Langevin dynamics and homomorphic encryption is Secure and Differentially Private Bayesian Learning on Distributed Data. It runs preconditioned stochastic-gradient Langevin sampling over parameters of linear and survival models. It aggregates encrypted gradients with shallow circuits that avoid bootstrapping, and reuses the Langevin noise as a differential-privacy guarantee. That paper supplies two methods we reuse: per-round client decryption to avoid bootstrapping, and the idea that injected noise can do double duty. It goes in the opposite direction, though. It turns sampling noise into privacy noise for a static posterior, where dynamics have no physical meaning. We turn privacy and encryption noise into thermostat noise for physical trajectories, where dynamical distortion is the central concern.
The thermostat literature supplies the distortion mechanisms we must control. Which Thermostat/Barostat Algorithm Should We Choose documents how local stochastic friction suppresses diffusion and erases long-time tails. Isothermal-isobaric molecular dynamics using stochastic velocity rescaling gives a global alternative that perturbs individual trajectories less. Fine tuning classical and quantum molecular dynamics using a generalized Langevin equation and Langevin Equation with Colored Noise show that frequency-dependent friction can target specific vibrational bands. None of these considers noise whose variance is dictated by an external, known source. That is what makes a matched, minimal friction possible.
On the machine-learning side, Forces are not Enough constrains the design. Low static error does not guarantee stable simulations, and geometric inductive biases matter. Our polynomial potential must therefore be judged on trajectory stability and observables, not only on force error. FlashMD motivates the latency concern but is not used here. Its energy-rescaling filter and thermostats would add their own distortion on top of ours.
The private-inference line motivates the noise-tolerance premise. Circa shows classifiers tolerate up to 10% activation faults for under 1% accuracy loss. SAFENet shows selective polynomial replacement cuts latency. Both, however, assume a single inference whose errors do not compound. In iterated dynamics, per-step errors accumulate into heat. That is exactly why classification-tuned tolerances do not transfer, and why we need an explicit dissipation model.
Research Program
The protocol keeps the client in the loop, following the shallow-circuit logic of Gil et al. The client owns its coordinates in plaintext. It computes neighbor lists and displacement vectors locally, pads them to a fixed maximum neighbor count so the server learns nothing from their size, and encrypts them. The server evaluates the polynomial potential and its symbolic gradient homomorphically. It can optionally add Gaussian output noise of known variance to protect its weights, and it returns encrypted forces. The client decrypts and takes one integration step, including the matched friction. No ciphertext survives across steps, so no bootstrapping is needed inside the trajectory loop. The noise per call is fresh and close to independent between calls, which is the assumption behind the core equation. We will test that assumption directly. Using only squared distances and unnormalized polynomial angular features avoids square roots and normalizations, which would otherwise need approximation. Forces obtained as gradients of a rotation-invariant energy are automatically rotation-equivariant.
The work has four parts. First, we build and train the polynomial-native potential on MD17 molecules, a small periodic liquid-water box, and alanine dipeptide. We compare its force accuracy and plaintext trajectory stability against a conventional activation-based equivariant model of matched size. Second, we characterize the encrypted noise empirically: its variance, its correlation across atoms and across successive calls, and its dependence on precision bits and circuit depth. We fit a calibrated noise model from real encrypted evaluations. Third, we run long trajectories in a plaintext emulator that injects the calibrated noise, which is affordable where full encrypted runs are not. In these runs we measure the precision-to-fidelity curve and compare compensation schemes. Fourth, we run genuinely encrypted trajectory segments, short but many and batched across independent replicas through slot packing. Batching amortizes cost across replicas, since a single trajectory cannot be parallelized this way. These runs confirm that the emulator's predictions hold.
If the encrypted noise turns out to be correlated across atoms, white Langevin compensation becomes approximate. In that case we fit a colored-noise friction kernel in the style of the generalized Langevin equation to the measured noise spectrum. This is an extension we would only pursue if the data require it.
Baselines
The reference point is a plaintext constant-energy simulation using the same polynomial potential. It defines the "true" dynamics of the model, and every encrypted variant is scored by its deviation from it. The naive encrypted baseline runs the same constant-energy integrator on decrypted encrypted forces with no correction. We expect steady heating, and we will report its measured heating rate against the predicted $\sigma_F^2 \Delta t / 2m$.
The strongest conventional competitor is encrypted forces combined with an off-the-shelf thermostat. We run two versions. One is a local Langevin thermostat at a commonly used coupling, as surveyed in Which Thermostat/Barostat Algorithm Should We Choose. The other is global stochastic velocity rescaling (Bussi et al.) at weak coupling. Global rescaling is the most serious threat, because it is known to perturb transport weakly. For fairness, each thermostat's coupling constant gets the same tuning budget, a grid search of equal size scored on temperature stability. The comparison uses identical noise realizations, time steps, system sizes, and trajectory lengths. Matched friction counts as beating them if two conditions hold together. It must reproduce the plaintext water diffusion coefficient and the vibrational spectrum's peak positions and widths with smaller deviation than either tuned thermostat. It must also hold the target temperature within the same tolerance, at every precision level tested. No reported result was found on Lacuna for diffusion-coefficient error of thermostatted water relative to unthermostatted dynamics, so we will establish these numbers ourselves.
A second competitor follows the cheap route suggested by the depth argument against conservative forces. It is a direct-force polynomial network, together with whatever thermostat keeps it stable. The dark side of the forces reports non-conservative models as roughly 2x faster with about 30% higher force errors. It also reports a multiple-time-stepping hybrid that handles 7 of 8 steps non-conservatively and recovers 80-90% of the speedup. We include that hybrid as a baseline, run under encryption with the same precision. Our conservative design beats it if three conditions hold. Its encrypted depth must be no greater. Its per-step latency must lie within the hybrid's speedup margin. Its diffusion error must be lower.
Two ablations isolate the key ingredients. In the first, the matched friction is deliberately mis-set to half and twice the predicted $\gamma_{\text{crypt}}$. If the noise model is right, distortion should be minimized near the predicted value and the temperature should drift on either side. In the second, the polynomial-native potential is replaced with the conventional activation-based model whose activations are approximated by polynomials after training. This separates the systematic, curl-producing error from the random error that friction can absorb.
Why not just…?
Why not just use enough precision that the noise is negligible? This is a genuine threat. At high enough precision, $\gamma_{\text{crypt}}$ may be so small that the uncorrected constant-energy run drifts imperceptibly over affordable trajectory lengths. The precision sweep in the experiments answers it directly. If negligible distortion arrives at a precision whose latency and ciphertext size are close to the minimum the circuit already requires, the compensation scheme is unnecessary. The contribution then shrinks to the measured exchange rate and the polynomial potential, and we will say so. The case where compensation matters is deliberate model-protection noise. That noise exists precisely to be non-negligible, and higher precision does nothing to shrink it.
Why not just use a standard thermostat and tune it? A tuned thermostat must remove the same injected heat, and it does so with a coupling chosen by trial rather than derived. A local Langevin thermostat set above $\gamma_{\text{crypt}}$ adds friction the noise did not require, suppressing diffusion further, as Which Thermostat/Barostat Algorithm Should We Choose documents. Global rescaling is different and might genuinely match or beat matched local friction for diffusion. The local noise is already present either way, and global dissipation spares individual momenta. The comparison against weak-coupling velocity rescaling is designed to settle this. If rescaling wins, the practical recommendation becomes "calibrated noise plus global rescaling," and the exchange-rate law still holds.
Why not just predict forces directly and skip the encrypted gradient? The case for doing so rests on the assumption that gradients double encrypted depth. For a natively polynomial energy the gradient has lower degree, so the depth argument largely disappears. Meanwhile the physics argument against direct forces is strong: curl-driven heating that thermostats cannot repair without destroying dynamics (The dark side of the forces). Our depth and latency measurements of both designs at equal precision will show whether any real cost advantage remains.
Why not just run locally or in a hardware enclave? Local execution requires the model owner to ship its weights, which the private-inference setting excludes (SAFENet). Hardware enclaves trust the hardware vendor and are exposed to side channels that lattice cryptography does not depend on (Security Guidelines for Implementing Homomorphic Encryption). The honest weakness is cost. Gil et al. needed about 34 minutes for 500 iterations of an encrypted logistic regression across two sites. We therefore target short, replica-batched trajectories and screening-scale runs, not million-step production simulations.
Proposed Experiments
The decisive check is the precision sweep on liquid water. For each setting of encrypted precision, and separately for each level of deliberate output noise, we measure the noise variance. From it we predict $\gamma_{\text{crypt}}$ and compare the predicted diffusion suppression and spectral broadening against those observed under matched friction. We report the results as a curve of distortion versus encrypted per-step latency and ciphertext size. The core claim fails if the predicted friction does not minimize distortion. It also fails if matched friction does not outperform the tuned local Langevin baseline at moderate noise.
The second check is whether the noise is white. We measure autocorrelation of the force error across successive calls and atoms. If significant correlation appears, we test whether a fitted colored-noise kernel restores the agreement.
On alanine dipeptide, we compare transition rates between conformational basins and the free-energy surface against the plaintext reference. Rates are sensitive to friction, while the free-energy surface should be preserved by any correct canonical sampler. Their divergence therefore isolates dynamical from thermodynamic error.
On MD17 and water, we report force error, simulation stability over fixed lengths, and radial distribution functions for the polynomial-native potential against the activation-based model. This tests whether the polynomial constraint costs the stability that Forces are not Enough shows static error cannot predict. Finally, we run real encrypted segments of a few hundred steps on the smallest systems. These confirm that the emulator's noise model reproduces measured heating and diffusion within statistical error, and they report wall-clock time per step and per replica.
References
- Bootstrapping for Approximate Homomorphic Encryption
- The dark side of the forces: assessing non-conservative force models for atomistic machine learning
- Activation-Free Backbones for Image Recognition: Polynomial Alternatives within MetaFormer-Style Vision Models
- Secure and Differentially Private Bayesian Learning on Distributed Data
- Which Thermostat/Barostat Algorithm Should We Choose for Our Molecular Dynamics Simulation?
- Isothermal-isobaric molecular dynamics using stochastic velocity rescaling
- Fine tuning classical and quantum molecular dynamics using a generalized Langevin equation
- Langevin Equation with Colored Noise for Constant-Temperature Molecular Dynamics Simulations
- Forces are not Enough: Benchmark and Critical Evaluation for Machine Learning Force Fields with Molecular Simulations
- FlashMD: long-stride, universal prediction of molecular dynamics
- Circa: Stochastic ReLUs for Private Deep Learning
- SAFENet: A Secure, Accurate and Fast Neural Network Inference
- Security Guidelines for Implementing Homomorphic Encryption