Researchers often record the same piece of cortex across many sessions, animals and laboratories, using electrodes that sample voltage at evenly spaced depths through the cortical layers. From those voltages they compute where synaptic current enters and leaves neurons at each depth, a quantity called current source density (CSD). Comparing CSD across recordings is unreliable for two reasons. Every probe sits at a slightly different depth, in a column with slightly different layer thicknesses. Every contact also has a slightly different gain, and that gain changes over time as scar tissue forms. CSD takes the second spatial derivative of the voltage, so small channel-to-channel distortions become large fake current sinks and sources. The single-cell genomics community has spent a decade learning to remove such "batch effects", the systematic non-biological differences between runs. Laminar electrophysiology has no equivalent method: labs align profiles by eye, or shift them so that one landmark sink lines up.
We propose a batch correction method for laminar recordings in which the nuisance is described physically rather than learned generically. Each session's voltage is modeled as a shared CSD pattern plus a regularized session-specific deviation. That pattern is distorted by three things: a smooth, monotone warp of depth, which absorbs insertion offset and layer thickness; a per-contact gain; and a low-dimensional tissue conductivity profile. All three distortions are fit without behavioral labels. The idea that makes this work is that volume conduction, the smearing of currents through tissue that CSD exists to undo, guarantees that the true voltage is spatially smooth along the probe. Jagged structure that stays fixed over time therefore belongs to the contacts and not to the brain. This physical constraint is what lets per-channel distortion be told apart from real laminar differences.
Core Claim
Cross-session and cross-animal variation in laminar CSD is dominated by a few physically structured, time-invariant distortions. Most of them act on the voltage before differentiation, so they should be corrected in voltage space under a forward model, not on the CSD map or on a generic embedding. We claim that this correction can be estimated from unlabeled activity. The constraints are that the potential is smooth in depth, that nuisance parameters stay fixed while biological activity varies over time, and that a proximal penalty keeps every session close to a shared template without forcing it onto that template. We also claim the correction will beat the field's working practices: per-channel standardization, alignment to a landmark sink, and transferring spike-based motion estimates to the low-frequency band. It should beat them both at recovering known ground-truth CSD and at preserving real between-session biological differences.
Relation to Prior Work
The closest neural work treats recording days as domains, but only for spike counts. SABLE trains a sequential autoencoder with a gradient reversal layer so that its latent space forgets the session while still predicting hand position. It reaches $R^2 = 0.91$ on a held-out day, but it needs about 12 training sessions and continuous behavior. CAPTIVATE trains on a single day augmented with synthetic perturbations such as dropping, jittering and permuting neurons. Its decoding falls from $R^2 = 0.84$ to $0.68$ over eight days, and its random channel permutations ignore the fixed one-dimensional geometry of a laminar shank. The Multi-task-Masking transformer generalizes across 48 mice in the International Brain Laboratory repeated-site dataset at 0.8–1.0 bits per spike, but it works on sorted units with no depth coordinate. These papers motivate the problem: cross-session variability matters and can be learned around. We differ in three ways. We work on the continuous low-frequency field, we use no behavior, and we replace a learned invariance with an explicit physical nuisance model that can be inspected.
Two papers supply technique or constraints. Boussard et al. triangulate each spike's three-dimensional position and register spike density maps over time to cancel mechanical drift. We borrow the idea of registering one recording to another, but their point-source model does not apply to distributed fields, and it cannot represent changes in gain or conductivity. Zhang, He, et al. show that sorting errors degrade decoding and that modeling the continuous spatial density of spike features avoids this. That result supports staying in a sorting-free, continuous representation.
From batch correction we take the regularization design. scBatchProx learns batch-specific affine adapters on frozen embeddings, with a proximal penalty that keeps each batch near a global structure. Its ablation, in which removing the penalty collapsed biological clusters, is the main reason we include a proximal term on the session deviation. BERMUDA aligns only clusters that are similar across batches, which preserves populations present in just some batches. Its authors note that it struggles with continuous gradients, and cortical depth is a continuous gradient. Our monotone depth warp is the continuous counterpart of its matching step.
Urdaneta et al. constrain the design. Over 40 weeks, stimulation thresholds rose 134% in layer 1 but only 42% in layer 5, with glial scarring peaking near 300 µm. Electrode degradation therefore depends on depth, so a single global scale factor cannot be right, and the gain model must vary by contact. hybridLFPy supplies the biophysical simulator for ground truth. It couples a spiking network to multicompartment neurons to produce laminar voltages and CSD under idealized conditions, so it lacks exactly the artifacts we will inject.
Model
For session $s$ and contact $k$ at nominal depth $z_k$, we model the recorded low-frequency voltage as
$$V_{s}(z_k,t) = g_{s,k}\,\big[\Phi_{\sigma_s} (\bar C + \Delta_s)\big](w_s(z_k),t) + \epsilon_{s,k}(t).$$
Here $\bar C(z,t)$ is a shared CSD template, defined per stimulus condition or as a set of spontaneous-event templates. $\Delta_s$ is the session's biological deviation. $\Phi_{\sigma}$ maps CSD to voltage by solving $\partial_z(\sigma(z)\,\partial_z V) = -C$ with a conductivity profile $\sigma(z)$ built from a few smooth basis functions. $w_s$ is a monotone warp from probe depth to template depth. $g_{s,k}$ is a time-invariant contact gain, and $\epsilon$ is noise.
We fit the model by minimizing the voltage reconstruction error plus three penalties. The first is a proximal penalty $\lambda\|\Delta_s\|^2$ in the spirit of scBatchProx. The second is a smoothness prior on $\log g_{s,\cdot}$, made weak so that isolated bad contacts can deviate. The third is a curvature penalty on $w_s$.
Identifiability rests on two facts. Because $g$ and $w$ do not change over time, multiplying the voltage across many time points and conditions separates them from $\Delta_s$, which does vary. Because $\Phi$ smooths in depth, any non-smooth structure that persists across time is attributed to $g$. Conductivity is the weakly identified piece. We restrict it to two or three basis functions and test in simulation whether estimating it helps at all. If it does not, we drop it rather than claim it.
Research Program
The first deliverable is a ground-truth benchmark, which closes the gap left by idealized forward models. We will run hybridLFPy's cortical column simulation under several spontaneous and evoked states. We will then inject parameterized artifacts into the simulated voltages: depth offsets of up to a few hundred micrometers; layer-thickness scaling of ±20%; per-contact gains whose spread grows with depth-dependent "scar" profiles shaped after the Urdaneta pattern of superficial-heavy degradation; dead contacts; and conductivity gradients. We will also plant true biological differences between sessions, for example a stronger supragranular sink in a subset of sessions. This lets us score both under-correction and over-correction.
The second deliverable is the estimator above. It will be written so that it can register a new session to a fixed template in seconds, without refitting the template.
The third deliverable is an application to real multi-animal laminar data. The main target is the International Brain Laboratory repeated-site recordings used by Zhang et al., whose identical stereotaxic targets across many mice and labs make lab and animal identity natural batch labels. This assumes the low-frequency band of those Neuropixels recordings can be accessed, which the file does not confirm. The IBL 2024 release offers a larger, more heterogeneous test. The laminar datasets of Chandrasekaran et al. (macaque premotor cortex, 16-contact probes) and Dai et al. (cat V1, nine animals) are secondary targets, subject to data access. They provide published laminar effects, a 15.5 ms superficial lead and a rise in direction selectivity from 0.26 to 0.46. Those effects come from spikes and site responses, so we will test whether CSD-derived analogs become more consistent across animals after correction.
Baselines
The naive reference is the field's default: compute finite-difference CSD per session on nominal channel depths and pool across sessions with no alignment. Every metric is reported relative to this.
The second baseline is per-channel standardization, which z-scores or scales each contact's voltage to unit variance before computing CSD. It is the cheapest correction a reviewer would suggest. It removes gain differences, but it also flattens the true depth gradient in voltage amplitude. Beating it means lower ground-truth CSD error in simulation and lower lab-identity decodability on real data at equal or better retention of stimulus information.
The third baseline is landmark alignment: shift each session so that its earliest stimulus-evoked sink, or a spontaneous-event signature where there is no stimulus, lines up with the template, then average. This is the strongest working practice in laminar labs and the most direct competitor for the depth-warp component.
The fourth baseline transfers spike-based motion estimates. Depth displacement is estimated from spikes with Boussard et al. and the resulting shift is applied to the low-frequency channels. This tests whether existing registration already explains the variation.
The fifth baseline applies scBatchProx directly. Its FiLM adapters with the proximal penalty act on CSD profiles flattened into vectors and projected to a low-dimensional embedding. It is the strongest published batch integrator in the file, and it is lightweight enough to run under the same compute budget.
No reported result was found on Lacuna for any CSD alignment method on these datasets. The closest reported cross-animal numbers, 0.8–1.0 bits per spike for Multi-task-Masking on IBL repeated-site spikes and $R^2 = 0.91$ for SABLE on held-out M1 days, measure different signals and serve only as context, not as targets.
All methods receive the same sessions and the same held-out split by animal and lab. Hyperparameters for every method are tuned on simulation splits and a held-out set of real sessions with an equal search budget. Ablations remove one ingredient at a time: the per-contact gain, the warp (offset only versus full warp), the conductivity term, and the proximal penalty. A further ablation replaces the gain model with heavier spatial smoothing before differentiation. That ablation isolates whether the explicit artifact model adds anything beyond blurring.
Why not just…?
Why not just z-score each channel? Standardization assumes the true signal has equal variance at every depth, which is false. Field amplitude varies systematically through the layers, so equalizing variance writes an artificial curvature into the voltage profile, and the second derivative turns that curvature into fake sinks. It also uses one rule everywhere, while the Urdaneta measurements show degradation that differs severalfold between layers 1 and 5. The planted-difference simulations will show directly whether standardization erases real between-session amplitude differences. If it matches our method on real data, we will report that.
Why not just align everyone to the layer 4 sink? This is the serious threat for depth offset, and we take it seriously. A single landmark fixes one point. It cannot correct differences in layer thickness, which stretch the profile, and it cannot correct contact gain, which creates jagged artifacts anywhere on the shank. It also needs a clean evoked sink, which spontaneous or premotor recordings may lack. If landmark alignment plus mild smoothing performs as well as the full model in simulation across the injected artifact range, the contribution reduces to the benchmark plus the gain model. We will then narrow the claim to that.
Why not just reuse spike-based drift registration? Boussard et al. handle within-session mechanical drift well, and where spikes are plentiful their displacement estimate is a better source for the offset than anything we fit. We will feed it in as an initialization of the warp. It does not model differences in thickness or gain between animals. Most of all, it does not model changes in tissue properties, which the glial-scarring results show are real. The fourth baseline measures how much cross-animal variance remains after spike registration. If almost none remains, our method is unnecessary for that dataset.
Why not just smooth the CSD more heavily? Spatial smoothing before differentiation suppresses the jagged gain artifacts and is essentially free. The cost is resolution: sink boundaries blur. The smoothing ablation will plot sink-boundary localization error against artifact amplitude for both approaches. Our method should dominate this tradeoff only when contact gains are heterogeneous, and if it does not, smoothing wins.
Why not just apply a genomics integrator to CSD vectors? These tools treat features as unordered and correct them independently of physics. BERMUDA additionally needs discrete clusters, which a continuous depth profile does not provide. The scBatchProx baseline tests this alternative directly. We expect it to reduce batch decodability but to produce depth-incoherent corrections, which we will detect as non-monotone sink displacement in simulation.
Decisive Checks
The first check is on the simulated benchmark. Across the injected artifact grid, the method must recover ground-truth CSD with lower error, and sink-boundary positions with lower error in micrometers, than the landmark and smoothing baselines. It must also preserve the planted supragranular difference at its true magnitude. A method that removes batch effects by erasing that difference fails this check regardless of its other scores.
The second check is on the IBL repeated-site data. Corrected profiles should make lab and animal identity harder to decode with a cross-validated linear classifier. At the same time they should keep or improve decoding of stimulus contrast and side from evoked CSD, and improve split-half reliability of laminar profiles across held-out animals.
The third check, if the laminar datasets are available, asks whether CSD-derived laminar contrasts become more consistent across animals after correction. One example is the timing of supragranular versus infragranular sinks around the decision in premotor cortex, compared with the reported spike-based lead.
Finally, the estimated gains are a falsifiable by-product. If they are physical, their spread should grow with time since implantation and be largest superficially, following the pattern Urdaneta et al. measured. Gains that show no such structure would suggest the model is fitting noise.
References
- Robust alignment of cross-session recordings of neural population activity by behaviour via unsupervised domain adaptation
- Capturing cross-session neural population variability through self-supervised identification of consistent neuron ensembles
- Towards a "Universal Translator" for Neural Dynamics at Single-Cell, Single-Spike Resolution
- Three-dimensional spike localization and improved motion correction for Neuropixels recordings
- Bypassing spike sorting: Density-based decoding using spike localization from dense multielectrode probes
- Federated-inspired Single-cell Batch Integration in Latent Space
- BERMUDA: a novel deep transfer learning method for single-cell RNA sequencing batch correction reveals hidden high-resolution cellular subtypes
- The Long-Term Stability of Intracortical Microstimulation and the Foreign Body Response Are Layer Dependent
- Hybrid scheme for modeling local field potentials from point-neuron networks
- Brain-wide representations of prior information in mouse decision-making
- Laminar differences in decision-related neural activity in dorsal premotor cortex
- Cortical direction selectivity increases from the input to the output layers of visual cortex