Gain Leakage: Separating Slow Brain-State Gain from Flow Fields in Neural Population Models

Radio cosmologists face a problem that neuroscientists face too without naming it. A faint signal, the cosmological hydrogen line, sits under a foreground that is ten thousand times brighter. That foreground is smooth, so in principle it could be removed. In practice the telescope's sensitivity pattern changes with frequency. This property is called instrumental chromaticity, and it turns the smooth foreground into fake fine-grained structure. Fitting a smooth curve and subtracting it then fails. Neural population recordings have the same structure. Slow, large brain-state fluctuations in gain (arousal, attention, anesthesia state) scale every neuron's response. Because they act multiplicatively on fast, stimulus-locked activity, they smear slow power into fast frequencies. A nonlinear dynamics model that treats this as an additive drift can absorb the leaked power into its inferred flow field, the vector field that says where the population state moves next. It can then report attractors or rotations that are partly artifacts of the gain.

This note proposes a latent dynamical model that fits the flow field jointly with an explicit multiplicative population gain. The model is paired with a "leakage map" diagnostic, adapted from the Fourier wedge of radio astronomy, that measures how much gain-driven power contaminates each frequency band. The central claim is testable. When gain fluctuations are present, flow-field models without a multiplicative gain term will recover distorted dynamics: fixed points that move or vanish depending on brain state. Modeling the gain as a multiplicative factor at the readout, analogous to the instrument response, removes the distortion without losing held-out predictive accuracy.

What the analogy actually buys

In 21-cm work, a source's image is multiplied by a frequency-dependent beam. That product spreads smooth foreground power into high line-of-sight frequencies in proportion to the source's spatial scale. The result is the wedge-shaped contaminated region and a clean "window" outside it. Wide-field MWA analysis showed that even a 1% error in modeling beam sidelobes lets smooth foreground power corrupt the spectrum (THE IMPORTANCE OF WIDE-FIELD FOREGROUND REMOVAL FOR 21 cm COSMOLOGY). That finding is why polynomial subtraction fails there. The field's answer is to fit the beam and the foreground together in one Bayesian model, as in A general Bayesian framework for foreground modelling and chromaticity correction for global 21 cm experiments and its time-dependent extension (Use of time dependent data in Bayesian global 21-cm foreground and signal modelling), rather than to clean the data first.

The neural analog is concrete. The Continuous Modulated Poisson model (Continuous partitioning of neuronal variability) writes a neuron's instantaneous rate as $\lambda(t) = f(s,t)\,g(t)$, where $f(s,t)$ is a stimulus drive and $g(t)$ is a slow stochastic gain with a heavy-tailed Exponentiated Power Law covariance. Because the rate is a product, its power spectrum is the convolution of the two spectra. Every frequency component of the drive acquires sidebands whose width is set by the gain's bandwidth. If we plot residual power against drive frequency and observed frequency, gain leakage occupies a band around the diagonal. This is the neural "wedge": its width is predicted by the gain timescale, and the region outside it is a clean window.

The analogy holds for this multiplicative structure. It does not hold for electrode volume conduction. The research file offers no probe-physics data, and I do not pursue that thread. Chromaticity serves here as the methodological lens. Neural variability supplies the mechanism. Nonlinear dynamics is the application regime where the artifact does harm.

Core Claim and Model

The model is a latent stochastic differential equation in the style of FINDR. A low-dimensional state $x(t)$ evolves under a learned drift, meaning the deterministic part of the motion, which is the flow field. Rates are read out as

$$\lambda_n(t) = b_n(t) + g(t)^{\alpha_n}\,\phi\!\left(c_n^\top x(t)\right),$$

where $n$ indexes neurons, $\phi$ is a softplus nonlinearity, $c_n$ is the neuron's readout weight vector, and $b_n(t)$ is an additive baseline. The gain $g(t)$ is a single shared positive process with a Gaussian-process prior on $\log g$ using an EPL kernel. The exponent $\alpha_n$ sets each neuron's gain sensitivity, which is allowed to vary because CMP found that strongly tuned neurons carry weaker gain.

The gain multiplies the dynamics-driven part of the rate and not the whole log-rate. This is what separates the model from simply adding one more latent dimension under an exponential link, and it follows the additive-plus-multiplicative structure that Characterizing the nonlinear structure of shared variability in cortical neuron populations using latent variable models found sufficient in anesthetized V1. The gain is deliberately barred from entering the drift, so it cannot rescale the flow field. Inference uses FINDR's sequential variational autoencoder from Brody-Lab/findr, with a sparse variational Gaussian process posterior over $\log g$.

Prior work and how this differs

The work that supplies the method is Flow-field inference from neural data using deep recurrent networks. FINDR fits a gated-MLP drift with additive task-irrelevant baseline drift, recovers two attractors in rat frontal cortex, and reports cross-validation geometric consistency of $|r| \approx 0.94$. It has no multiplicative gain, and we test whether its additive drift term is enough.

Three papers motivate the proposal. CMP establishes that gain is multiplicative, continuous, and heavy-tailed, and that it grows in size and timescale up the visual hierarchy, but it fits neurons one at a time and contains no dynamics. The shared-variability study (art_e8c2f091) shows that affine gain-plus-offset structure suffices in anesthetized V1 but not in awake PFC. That finding partly constrains us: awake gain may not be one-dimensional, and the study used static binned latents with no flow field. Amplification of Trial-to-Trial Response Variability by Neurons in Visual Cortex and State-dependence of sensory-evoked responses in neocortex show that small state changes pass through a spike nonlinearity and produce large count variability. That is exactly the route by which gain could pose as dynamics.

Two expressive models, LFADS (Inferring single-trial neural population dynamics using sequential auto-encoders) and LDNS (Latent Diffusion for Neural Spiking Data), can absorb gain into inferred inputs or latents. They predict well but do not give the explicit phase portrait we need. They are competitors on prediction, not on interpretability.

The one existing bridge between the chromaticity literature and machine learning is the U-Net wedge infilling of Machine-learning recovery of foreground wedge-removed 21-cm light cones. It addresses a different problem, deterministic spatial reconstruction, and we do not build on it.

Research Program

The first stage is synthetic, because only ground truth can show that a flow field is wrong. We simulate populations of 50 to 200 neurons. Each population has a known two-dimensional drift: a two-attractor decision system matched to FINDR's setting, and a rotational system matched to motor cortex. On top of the drift we add a shared EPL gain whose amplitude and timescale we sweep, along with additive baseline drift, with Poisson spiking. We then derive the leakage map analytically from the product structure and check it empirically.

The second stage fits each model to real data and asks whether the inferred flow field is state-invariant. We split trials by inferred gain (high versus low tercile), refit, and compare fixed-point locations, Jacobian eigenvalues, and the alignment of flow vectors after FINDR's SVD alignment. A model that has absorbed gain into dynamics will show attractors that move with state. A model that has correctly separated the gain should show the same phase portrait in both halves.

The third stage tests a prediction that follows from CMP. Across the NLB datasets, the leakage-band width inferred from data should track the fitted gain timescale. The cost of omitting gain, measured as flow-field disagreement between state splits, should be largest where the gain variance is largest.

Baselines

The naive reference point is Gaussian-smoothed rates and linear GPFA. On MC_Maze, Neural Latents Benchmark '21 reports 0.187 bits per spike for GPFA in co-smoothing, which is prediction of held-out neurons from held-in ones. That benchmark reports 0.346 bits per spike for AutoLFADS on the same dataset, and AutoLFADS is the strongest predictive baseline with a reported number. Our model is not expected to beat 0.346. It counts as successful on prediction if it lands within run-to-run variance of AutoLFADS, while winning on flow-field recovery, where AutoLFADS offers no phase portrait to compare.

The strongest competitor on the actual question is unmodified FINDR. It is the only method in the file that outputs an interpretable flow field with an explicit drift-nuisance term, and it achieves $|r| \approx 0.94$ cross-validation consistency on rat frontal cortex. We run it from the released code with the same latent dimension, the same data splits, and the same hyperparameter search budget, set as an equal number of trials per model. On synthetic data, beating it means lower error against the true drift and correctly located fixed points across the gain sweep. On real data, it means higher flow-field agreement between gain-split refits, without losing co-smoothing performance.

The ablation that isolates the key ingredient keeps our full model but makes the gain additive in log-rate, which is equivalent to adding a shared latent under an exponential link. If this ablation matches the full model, the multiplicative placement is not doing the work, and the claim fails. A second ablation replaces the EPL kernel with a squared-exponential kernel, to test whether heavy-tailed timescales matter.

Why not just…?

Why not just rely on FINDR's existing baseline drift term? Under a log link, an additive drift can mimic a gain that scales the whole rate. It cannot mimic a gain that scales only the stimulus- or dynamics-driven deviation, which is the structure the shared-variability study found in V1. The synthetic sweep answers this directly. If FINDR recovers the true drift as gain amplitude grows, the proposal is unnecessary, and we will report that.

Why not just normalize each trial by its population firing rate before fitting? This is the neural version of polynomial foreground subtraction. It assumes the gain is constant within a trial, which CMP shows it is not, since gain has continuous within-trial structure. It also divides out the additive offset along with the gain. The leakage map will show whether normalized residuals still carry sideband power. We expect them to, for the same reason smooth subtraction fails under a 1% beam error in the MWA work.

Why not just add more latent dimensions or use LFADS with inferred inputs? This is a real threat on prediction. A high-capacity model can soak up gain and may score as well or better in bits per spike. The cost is that gain becomes mixed into the latents or inputs, and the phase portrait loses meaning. The gain-split consistency test measures exactly this mixing. If extra dimensions produce state-invariant fixed points, we concede the point.

Why not just fit GAM first and then run FINDR on the residual? Two-stage cleaning breaks for the reason joint Bayesian fitting replaced it in global 21-cm work: the first stage cannot distinguish gain from slow dynamics and will remove some real slow dynamics. We include this two-stage pipeline as an additional baseline, using the same budget.

Proposed Experiments and Decisive Checks

The synthetic check is decisive. Across a grid of gain amplitude and timescale, we measure the mean-squared error between inferred and true drift on the visited region of state space, the fixed-point location error, and the error in stability classification. The proposal succeeds if FINDR's error grows with gain amplitude while the full model's error stays flat, and if the log-additive ablation tracks FINDR instead of the full model.

On NLB, we use MC_Maze (Large/Medium/Small), DMFC_RSG, Area2_Bump, and MC_RTT. We report co-smoothing bits per spike, behavioral decoding $R^2$, and PSTH match through the benchmark, together with gain-split flow-field agreement. DMFC_RSG and MC_RTT are the likeliest places for cognitive and state-dependent gain. Because NLB found that co-smoothing and decoding diverge, an explicit gain variable may help explain that gap: decoding should improve when gain is removed from the latents.

If the rat decision data are available with the FINDR release, we test whether its two attractors survive gain modeling. If they move between gain splits under FINDR but not under our model, the result shows that a published phase portrait carries state contamination. If they are stable under both, the result is useful as a negative finding.

The final check is falsifiable. The width of the leakage band in the residual spectrum should match the inferred gain timescale. A mismatch would mean the multiplicative account is wrong.