Adaptive look-back windows when noise grows with the signal

Any system that tracks a changing quantity from noisy samples has to decide how far back to look. A long memory averages away noise, but if the world has changed, old samples pull the estimate the wrong way. Recent algorithms choose this look-back window automatically. They keep enlarging the window until the newest samples disagree with the older ones by more than noise could explain. Every one of them, though, assumes the noise has a fixed size. Neurons violate that assumption. A spike threshold turns small, constant membrane fluctuations into output variability that grows with the firing rate. In one cat visual cortex cell, membrane-potential variance grew less than fourfold across stimuli while firing-rate variance grew nearly a hundredfold (Amplification of Trial-to-Trial Response Variability by Neurons in Visual Cortex). A window selector that reads spike counts with a fixed noise level will mistake high-rate fluctuations for change and cut its memory short. At low rates it will miss real change.

The proposal is to give the window selector an explicit noise law that is learned online, $\mathrm{Var} = A\mu + B$, where $\mu$ is the current mean, $A$ is the multiplicative gain and $B$ is the additive floor. The two parts are tracked on two timescales. The mean is followed on a fast adaptive window. The noise law is pooled across all the rate levels the stream visits and followed on a slower adaptive window of its own. Because the predicted variance comes from the mean rather than from the spread inside the current window, drift inside that window cannot inflate the noise estimate and hide itself. Any excess of observed spread over the law's prediction then becomes a second signal that the world has changed. The two-timescale design mirrors what barrel cortex appears to do. There, stimuli are filtered on millisecond scales while stimulus variance is integrated with a time constant of $280 \pm 180$ ms (Shifts in Coding Properties and Maintenance of Information Transmission during Adaptation in Barrel Cortex).

Core Claim

The claim is that a window selector which takes its noise level from a slowly learned law tying variance to the mean will track drifting, rate-dependent count streams with lower error than three alternatives: fixed-noise selectors, selectors that use the spread inside each window, and selectors applied after a variance-stabilizing transform. The gain should be largest where the noise law is not pure Poisson. One such case is the affine and saturating regimes that recurrent circuits produce (Circuit-motivated generalized affine models characterize stimulus-dependent visual cortical shared variability). Another is the regime where drift and rate changes happen together.

Concretely, at time $t$ the method compares each candidate window length $j$ with every shorter length $k$. It keeps $j$ only if the two mean estimates $\hat\mu_j$ and $\hat\mu_k$ agree within the noise the law predicts:

$$ |\hat\mu_j - \hat\mu_k| \le c\sqrt{\log(t/\delta)}\left(\sqrt{\frac{\hat A\hat\mu_j + \hat B}{j}} + \sqrt{\frac{\hat A\hat\mu_k + \hat B}{k}}\right). $$

Here $\delta$ is the allowed failure probability, $c$ is a constant, and $\hat A, \hat B$ are the current estimates of the noise law. A window is also rejected if the spread inside it, divided by the law's predicted variance, exceeds a chi-square-type bound. That ratio test catches drift that shifts the mean within the window without moving its average. The noise-law estimates $\hat A, \hat B$ are themselves refit on an adaptive window. That window is tested for stability in the same "keep expanding until a shorter window disagrees" manner. Its samples are residuals pooled across many mean levels, so the slow window gets many effective samples even when the fast window is short.

Relation to Prior Work

Four adaptive-window methods supply the basic machinery, and all four assume noise of fixed size.

We reuse their expand-until-contradicted logic. We replace the fixed noise scale with a learned, mean-dependent one, which none of them consider.

The noise-transformation literature motivates the form of the law and constrains which forms are plausible. The rectified power-law analysis (Amplification of Trial-to-Trial Response Variability by Neurons in Visual Cortex) explains why variance tracks the mean near threshold. The generalized affine model (Circuit-motivated generalized affine models characterize stimulus-dependent visual cortical shared variability) shows that the coefficients $A, B$ change with contrast and that saturation pushes networks back toward additive noise. That second finding has two consequences. A fixed Poisson assumption is wrong, and the noise law must be allowed to drift, slowly. That paper's analysis is entirely stationary. We put its law inside a tracker that does not assume stationarity.

The barrel cortex study shows that a biological system separates fast signal integration from slower variance integration (Shifts in Coding Properties and Maintenance of Information Transmission during Adaptation in Barrel Cortex). It offers no algorithm and uses externally imposed variance blocks, not noise generated by the neuron's own threshold. We provide the algorithm and test whether its slow window lands near the measured time constant.

Two further papers matter in specific ways. HetSyn (HetSyn: Versatile Timescale Integration in Spiking Neural Networks via Heterogeneous Synapses) learns fixed, heterogeneous synaptic time constants offline. It is a static alternative to online adaptation and is relevant only as a spiking-network implementation target in later work. The slope-versus-peak results of Tuning Curves, Neuronal Variability, and Sensory Coding predict that shrinking the window, which raises effective noise, should move the most informative stimulus from the tuning-curve flank toward its peak. We treat that as a secondary, testable consequence, not the core claim.

Research Program

The work has three parts.

First, theory. We extend the Lepski-type oracle inequality to noise satisfying $\mathrm{Var}(x_s) \le A\mu_s + B$, with $A, B$ themselves drifting slowly. The target result is that cumulative error scales with the local variance $A\mu + B$ along the path, not with the worst-case $\sigma^2_{\max}$. The cost of estimating $(A, B)$ should enter only as a lower-order term controlled by how slowly the law moves relative to the mean.

Second, the algorithm. We implement the two-timescale selector with geometric candidate windows so the per-step cost is logarithmic rather than linear. That addresses the $O(t)$ history scan flagged for FITNESS.

Third, evaluation. The method is tested on synthetic neural streams with known ground truth, on real count data, and on neural recordings. The details are below.

Baselines

Fixed windows and exponential leaks (naive reference). A fixed window or an exponential leak with its time constant tuned in hindsight on the test stream. This is generous to the baseline: it shows what an oracle-tuned, non-adaptive method achieves. Beating it means lower tracking error without hindsight tuning.

Fixed-noise adaptive selectors. SAWS and the doubling-discrepancy learner, each run twice: once with a noise scale set to the worst case and once with the average. Both use the same candidate window grid and the same $\delta$. These isolate the cost of ignoring rate dependence. Beating them means fewer false drift alarms at high rate and shorter detection lag at low rate.

Empirical-Bernstein Lepski (strongest conceptual competitor). The same selector, with each window's variance estimated from its own samples. It is heteroscedasticity-aware without any structural law, so it is the method most likely to make ours redundant. It gets identical tuning budgets for $c$ and $\delta$. Beating it requires a significant reduction in mean-squared tracking error and detection lag on streams with within-window drift.

Anscombe transform plus fixed-noise Lepski. The square-root (Anscombe) transform is applied to the counts, then a standard selector is run. The final mean is back-transformed with bias correction, so it is not penalized for the known $\mathbb{E}[\sqrt{X}] \neq \sqrt{\mathbb{E}[X]}$ bias.

Ablations. Four ablations isolate the key ingredients:

  • an oracle version with the true $(A, B)$, which bounds the cost of learning the law;
  • a version with $(A, B)$ refit on the fast window, which tests whether separating the timescales matters;
  • a version without the variance-excess test;
  • a version with a pure Poisson law ($B = 0$, $A = 1$).

FITNESS on Kitsune. On the Kitsune botnet stream, the strongest reported number is FITNESS at an average precision of 0.96 (FITNESS). We use its context-selection step with our threshold swapped in. For SAWS on Victoria electricity and NYC emergency-department data, and for the rolling-window tournament on Dubai housing, there is no reported numeric result on Lacuna, only qualitative superiority over fixed windows. We will rerun those methods ourselves under identical protocols.

Why not just…?

Why not just tune a fixed window or leak? Every adaptive-window paper in the file reports that fixed windows lose under variable drift: SAWS on electricity and staffing data, the rolling-window tournament on Dubai housing, and FITNESS on synthetic regret curves. The hindsight-tuned baseline will show how large that gap is in our streams. Rate-dependent noise should widen it, because the best fixed window differs between high-rate and low-rate periods.

Why not just assume a conservative noise bound? With roughly hundredfold variance growth across rates (Amplification), a worst-case bound inflates the low-rate threshold by about an order of magnitude in standard deviation. That should blind the detector to small shifts. An average bound should do the reverse and fire on high-rate fluctuations. The fixed-noise baselines measure both failure modes directly.

Why not just estimate the variance inside each window (empirical Bernstein)? This is the real threat. Our argument against it is mechanistic. A window that straddles a change has inflated spread, so the threshold loosens exactly when it should tighten, and the drift hides itself. A law fit across many rate levels on a slower window does not inherit that inflation. The argument could fail if drift is mostly abrupt and windows rarely straddle changes. Synthetic streams with gradual versus abrupt drift will show where any advantage lives. If empirical Bernstein matches us everywhere, we will report that the structured noise law is unnecessary. The theory and the timescale analysis of neural data would then stand on their own.

Why not just apply a variance-stabilizing transform? The square-root transform equalizes variance only under a pure Poisson law. Affine noise with $B > 0$ and saturating noise stay unequal after the transform (Circuit-motivated generalized affine models). Comparing results on Poisson streams with results on affine and saturating streams will show whether the transform's failure matters in practice. We expect it to tie with our method on Poisson streams.

Proposed Experiments

Synthetic neural streams. These come from a rectified power-law neuron, $R = k[V - V_{\text{thresh}}]^n$, driven by a membrane mean that drifts, with Gaussian membrane noise. A second variant passes the output through an excitatory-inhibitory rate network whose contrast steps change $A$ and $B$. Metrics are mean-squared tracking error, detection lag after a change, the false-alarm rate during stationary high-rate periods, and estimation error for $(A, B)$. The decisive test is a stream with gradual drift during high-rate periods. There, empirical Bernstein should loosen its threshold while our method should not.

Real count streams. These are the NYC emergency-department vomiting-visit counts and the Victoria electricity demand used by SAWS, plus the Kitsune stream. The comparisons are the baselines above under matched grids and budgets.

Neural data. We use the rat barrel cortex variance-switch recordings and the macaque V1/V2 contrast recordings, if accessible. The first check is whether the learned slow-window time constant after a variance switch falls within the reported $280 \pm 180$ ms. The second is whether the fitted $(A, B)$ trajectories reproduce the contrast dependence reported for V1/V2.

Secondary check. Shrinking the selected window should shift the decoder's most informative stimulus toward the tuning-curve peak, as Tuning Curves, Neuronal Variability, and Sensory Coding predicts for higher noise.

What would refute the claim. The claim fails if empirical-Bernstein Lepski matches us on gradual-drift affine streams, or if the oracle-$(A, B)$ ablation shows that learning the law costs more than it saves.