Inverse Modeling of Neural Recordings via Differentiable Biophysical Simulation

Frithjof Gressmann, Ngoc Hau Pham, Lawrence RauchwergerNeurIPS 2026

TL;DR

Recording from the brain using modern multi-electrode probes is like listening to a crowded cocktail party from outside the walls—you get rich electrical echoes, but you don't know who is saying what or where they are standing. Instead of relying on black-box machine learning to guess hidden patterns, this paper builds a fully differentiable physics simulator of neurons and surrounding brain tissue, running it in reverse via gradient descent. By anchoring the math to observed spike times, the method simultaneously pinpoints where individual neurons are in 3D space and reconstructs the invisible input currents driving them.

What Problem Does This Paper Address?

High-density multi-electrode arrays (MEAs), like Neuropixels probes, measure the faint extracellular voltage fields generated by nearby neurons. While machine learning excels at compressing these recordings into abstract, black-box latent vectors to predict behavior, neural engineering requires physically meaningful quantities—actual currents and 3D coordinates that an interface can target or manipulate.

With recent advances in differentiable programming, you might think we could just wire up classical Hodgkin-Huxley membrane equations, simulate the extracellular field, compare the output to real recordings, and use backpropagation to find the input currents. Unfortunately, neurons make terrible optimization landscapes. Below their firing threshold, small input changes barely register on extracellular electrodes, leaving gradients completely flat. Near the threshold, a tiny nudge shifts a spike by a millisecond or deletes it entirely, causing violent jumps in loss dominated by waveform misalignment. Furthermore, tissue physics creates a classic scale ambiguity: a neuron close to the probe receiving a weak input looks remarkably similar to a distant neuron receiving a massive input.

Methods

The authors construct an end-to-end differentiable forward pipeline in JAX that couples reduced biophysical neuron models (via ODE solvers) to a resistive-capacitive volume conductor. This conductor models both the $1/r$ spatial decay of electrical fields and the distance-dependent temporal blurring caused by brain tissue. Rather than training a neural network encoder, they treat each neuron’s 1 kHz input current $I_n(t)$, 3D position $r_n$, and amplitude $A_n$ as free parameters optimized directly per recording.

To tame the hostile loss landscape, they introduce two core innovations:

  1. Amplitude Reparameterization: They factor each neuron's signal into a normalized 3D spatial profile (anchored to the electrode channel where that neuron spikes loudest) and a single explicit scalar $A_n$. Moving a neuron in space only redistributes its footprint across channels without tangling up overall drive magnitude.
  2. A Three-Part Anchored Loss: Standard preprocessing ("spike sorting") already identifies when neurons fire. The authors use these spike times as millisecond-scale anchors via three loss terms: a scale-invariant trace loss ($\mathcal{L}_{\text{cont}}$) masked tightly around spikes so gradients flow backward through the membrane ODE; a closed-form template anchor ($\mathcal{L}_{\text{spike}}$) that shapes $A_n$ and $r_n$ without running the ODE; and a drive anchor ($\mathcal{L}_{\text{drive}}$) placing canonical current pulses at spike times to ensure physiological depolarization.
Figure 1: Joint effect of the three loss terms on a one-neuron toy system with an alpha-pulse latent input (peak amplitude, onset relative to a known spike at t = 0). Loss landscape (colorbar log10 L) for the three cumulative subsets of Eq. 2 where Adam paths (blue) start from the same subthreshold init (◦) toward the truth (⋆). Recovered drive I(t) and membrane voltage V (t) at the end of each path. Bare Lcont leaves Adam on a flat subthreshold plateau (no spike), adding Lspike recovers the amplitude but not the onset, add adding Ldrive yields a smooth basin and recovers both.

Datasets

  • Synthetic LIVN Network Recordings: Simulated excitatory-inhibitory networks of two-compartment motoneurons coupled via thousands of noisy conductance synapses, used to test multi-unit interference against exact ground-truth positions.
  • Paired Patch-Clamp / Neuropixels (SPE-1): Naturalistic in vivo mouse recordings featuring simultaneous extracellular Neuropixels arrays and ground-truth single-cell patch pipettes. They evaluate 3D localization on the Zhao et al. (2026) benchmark (11 juxtacellularly patched cells) and perform a held-out modality voltage check on cell c5 (a whole-cell current-clamp recording).

Key Insights and Ideas

  • Differentiable $\neq$ Well-Conditioned: Simply translating physics equations into an autodiff framework isn't enough; excitable dynamics actively fight gradient descent until scale degeneracies and threshold cliffs are explicitly engineered away.
  • Spike Sorting as Continuous Supervision: Usually viewed as a lossy step that throws away raw voltage traces, discrete spike times act here as crucial temporal anchors. Gradients radiating backward from a spike through the membrane integrator successfully shape the continuous subthreshold current that caused it.
  • Marginalizing Physics Shrinks the ML Burden: By baking known membrane dynamics and tissue blurring into the forward pass, optimization isn't wasted re-learning Ohm's law—forcing the learned latents onto named physical quantities.

Key Results

  • Synthetic Multi-Unit Localization: On synthetic recordings, single neurons are localized within $19.5 \pm 4.9\ \mu\text{m}$ mean absolute error (MAE), and pairs sharing a primary electrode reach $28.3 \pm 4.8\ \mu\text{m}$ (100% within $50\ \mu\text{m}$). At 4 simultaneous units per electrode, overlapping templates push error to $57.8 \pm 12.9\ \mu\text{m}$.
  • In Vivo Localization: On the SPE-1 benchmark, the end-to-end fit achieves a capped-median localization error of $39.7\ \mu\text{m}$ (72.7% accuracy within $50\ \mu\text{m}$), modestly outperforming purpose-built geometric baselines like Center of Mass ($42.8\ \mu\text{m}$) and Grid Convolution ($44.2\ \mu\text{m}$).
Table 2: SPE-1 localization on the Zhao 11. We report the published aggregate of Zhao et al. [38]: capped-median template error (cap 500 µm) over 5 seeds × 11 cells = 55 per-cell errors for each baseline, and the fraction of those errors within 50 µm of the patch ground truth. Our method has no sorter-seed dependence, so we instead aggregate 3 random initializations of the inverse fit per cell (33 errors) with the same capped-median rule.
  • Cross-Modality Voltage Check: Fitting only the extracellular trace of cell c5 recovers intracellular action potential timing and bursts, though inter-spike voltage drifts significantly (subthreshold correlation $r_{\text{sub}} \approx 0.05–0.18$, MAE $>21\ \text{mV}$).
Figure 2: Somatic voltage check on SPE-1 cell c5. Predicted Vsoma(t) from our inverse fit (optimized only against the simultaneous extracellular Neuropixels trace) overlaid on the whole-cell current- clamp patch trace, affinely calibrated to mV. The patch voltage is never used as a target or in any loss term during fitting, so agreement is a cross-modality generalization of the mechanistic prior rather than a held-out-sample comparison. Jointly learned position converged to 199µm.

Limitations and Future Work

  • Unconstrained Subthreshold Regimes: Because all three loss terms focus around spike times, the inferred current between spikes is largely unconstrained, overfitting to background noise and causing intracellular voltage drift. Adding smoothness regularizers or resting-membrane priors is an immediate next step.
  • Compute Cost vs. Amortization: Optimizing latents from scratch ("train-at-test") takes roughly one GPU hour per cell for a 300-second recording. Replacing free current parameters with a neural encoder would amortize inference for real-time applications.
  • Simplified Biophysics: Single- and two-compartment models omit complex dendritic morphologies, burst adaptation, and background local field potentials (LFPs), leaving room to fold richer multi-compartment physics into the pipeline.

Summary updated

Abstract

Inferring the latent processes that generate observable neural activity is a central challenge in neuroscience, with direct implications for brain-machine interfaces and neural engineering. Existing inverse approaches typically summarize the recording into low-dimensional features or learn black-box latents that lack a direct biophysical interpretation. A promising alternative is to fit a differentiable biophysical simulator end-to-end against the full extracellular signal, using direct and scalable gradient optimization. In practice, however, recovering a per-neuron input via backpropagation through neuronal dynamics is difficult because the loss landscape is nearly flat in the subthreshold regime and jumps sharply at spike threshold, leaving gradient descent without a useful signal. We observe that per-neuron spike times, routinely available from spike sorting, expose discrete millisecond-scale anchors at which the loss does carry information. Gradients from these anchors flow back in time through the differentiable simulator and shape the subthreshold drive that produced each spike. Building on this, we present a fully differentiable pipeline coupling biophysical membrane dynamics to a volume conductor model of the multi-electrode array. For each neuron in a recorded population, the method jointly recovers a time-varying latent input current and a probe-relative position consistent with both the extracellular trace and the observed spike times. No explicit likelihood or posterior estimation is required, and every fitted latent corresponds to a named biophysical quantity. On paired patch-clamp / Neuropixels SPE-1 data, the model localizes the patched neuron to within $40 \mu m$ on average across cells, while reproducing observed spatio-temporal activity patterns under realistic noise. These results position scalable differentiable biophysical simulation as a practical route to mechanistic, gradient-based analysis of high-density neural recordings.
BibTeX
@inproceedings{gressmann2026inverse,
  author = {Frithjof Gressmann and Ngoc Hau Pham and Lawrence Rauchwerger},
  title = {{Inverse Modeling of Neural Recordings via Differentiable Biophysical Simulation}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=KFA1usL2kP},
}
Figure