arXiv:2610.33145cs.LGOct 2026

Manuscript Offprint

arXiv:2610.33145

Neural-DISCO: Source-Conditioned Counterfactual Editing of Neural Population Activity

Nico Policzer, James Ho, Joseph Soo, Xin Tang

Abstract

Understanding how neural activity encodes behavioral and sensory variables is a key challenge in systems neuroscience. This requires models that go beyond predicting activity from labels and instead support source-conditioned counterfactual editing: given a recorded source response, we should be able to edit one measured behavioral or stimulus label and predict how neural activity would change while preserving other observed labels and source-specific variability not explained by the labels. Here, we introduce Neural-DISCO, a disentangled representation learning framework for counterfactual modeling of neural activity. Neural-DISCO partitions the latent space into label-specific components, each associated with an observed behavioral or stimulus label, together with a residual latent that captures variability not supplied through observed labels. Across simulated and real neural recording datasets, we show that this structure enables selective editing of measured labels to generate counterfactual neural responses while preserving the remaining content of the original activity. Further, to gain insight into how behavioral and stimulus labels are encoded at single-neuron resolution, we pair this disentangled framework with feature attribution methods that identify which neurons are most important for each label. We find that disentanglement enhances the recovery of known functional cell roles in both synthetic and real data. Together, these results support Neural-DISCO as a framework for counterfactual modeling of neural activity and provide a practical interface for probing how neural populations encode behavior and sensory information. Code is available at https://github.com/TangLab-UBC/Neural-DISCO-neurips.

1 Introduction

Modern neural recording technologies record hundreds to thousands of neurons while animals move, make decisions, and receive structured sensory input. These data make it possible to relate neural population activity to simultaneously recorded behavioral and stimulus labels, a central goal in systems neuroscience [1–9]. Many questions, however, are not purely predictive. We often want to ask how a neural population response would change if a measured variable were altered—for example, if the animal occupied a different position, reached in another direction, or ran at a different speed—while keeping the remaining source-specific state as intact as possible.

We call this problem source-conditioned counterfactual editing, borrowing counterfactual terminology from causal inference while using it operationally rather than claiming causal identification from observational data alone [10]. Given a source response x and observed label values (y1,…,yK)(y_1, \ldots, y_K), the goal is to replace one label value yay_a by y^a\hat{y}_a and generate neural activity for the edited condition while

∗^{*}These authors contributed equally to this work.

†^{\dagger}Corresponding author: xin.tang@msl.ubc.ca.

40th Conference on Neural Information Processing Systems (NeurIPS 2026).

preserving the other observed label values y−ay_{-a}, and residual structure not captured by the labels. This differs from ordinary label-conditioned generation [11, 12]. A model of p(x′∣y^a,y−a)p(x' \mid \hat{y}_a, y_{-a}) can sample plausible activity consistent with the target labels, but unless it is conditioned on the source response, it generally marginalizes over internal state, spontaneous movement, and unmeasured task variables [3, 13, 14]. This source-conditioned counterfactual setting instead requires representations that retain residual content of the source sample. We note that only measured labels are editable; unmeasured variation may be preserved in the source residual but is neither identified nor directly editable.

We introduce Neural-DISCO, a DISentangled learning model for source-conditioned Counterfactual editing of neural population activity (Fig. 1). Each measured behavioral or stimulus label is encoded by its own embedding network into corresponding label-specific latents, while a separate residual encoder maps the source spike counts to a residual latent. A generator then decodes the concatenated latents into firing rates. To reduce observed-label leakage into the residual latent, we corrupt the residual with Gaussian noise during training and penalize its activation norm. This bottleneck biases the model to route observed factors through their designated label latents while preserving residual source-specific variability in the residual latent.

At test time, Neural-DISCO encodes a source response, replaces one label-specific latent with the embedding of a target value, keeps the residual and other label-specific latents fixed, and decodes the edited representation into firing rates. The same factorization also supports neuron-level interpretation. Because labels enter the generator through label-specific blocks, we compute integrated gradients to obtain label-specific attribution scores for each neuron [15].

We evaluate Neural-DISCO in three settings that probe complementary failure modes: a rat neural activity simulator with known functional cell classes and ground-truth edited rates; macaque reaching electrophysiology, where edited activity is evaluated by held-out behavioral decoding; and a mouse visual encoding Neuropixels dataset, where running-speed and grating stimulus orientation edits are evaluated jointly with stimulus preservation and independent unit-level tuning metrics. Across these settings, Neural-DISCO improves the balance between edit fidelity and residual preservation relative to classical Generalized Linear Model (GLM) baselines. Further, on traditional conditional-generation tasks Neural-DISCO performs competitively with strong neural encoding baselines.

a

Figure

b

Fig. 1: Neural-DISCO overview. (a) Neural-DISCO reconstructs source spike counts from supervised label latents and a bottlenecked residual latent. (b) Counterfactual editing replaces a selected label latent while holding the remaining label blocks and the source residual fixed. (c) The same block-structured generator supports label-specific neuron attribution.

Our contribution is a source-conditioned framework for neural activity editing and label-specific attribution. Neural-DISCO combines label-specific embeddings with a noisy residual bottleneck characterized by a capacity bound, and experiments on controlled simulation and two real neural recording datasets support selective editing, source preservation, and label-specific neuron attribution.

References (63)