Neural spiking for causal inference and learning — part 1/5

Cleaned-text code points [0, 15686). Bibliography omitted here; source.md includes it.

Loading metrics

Open Access

Peer-reviewed

Research Article

# Neural spiking for causal inference and learning

Benjamin James Lansdell , Roles Conceptualization, Formal analysis, Methodology, Software, Validation, Visualization, Writing – original draft, Writing – review & editing * E-mail: ben.lansdell@stjude.org address: Department of Developmental Neurobiology, St Jude Children’s Research Hospital, Memphis, Tennessee, United States of America Affiliation Department of Bioengineering, University of Pennsylvania, Philadelphia, Pennsylvania, United States of America https://orcid.org/0000-0003-1444-1950 ⨯

Konrad Paul Kording Roles Conceptualization, Formal analysis, Funding acquisition, Investigation, Supervision, Writing – original draft, Writing – review & editing Affiliations Department of Bioengineering, University of Pennsylvania, Philadelphia, Pennsylvania, United States of America, Department of Neuroscience, University of Pennsylvania, Philadelphia, Pennsylvania, United States of America ⨯

# Neural spiking for causal inference and learning

Benjamin James Lansdell,

Konrad Paul Kording

Version 2 Version 1 Uncorrected Proof

Published: April 4, 2023

https://doi.org/10.1371/journal.pcbi.1011005

Article

Authors

Metrics

Comments

Media Coverage

Reader Comments

Figures

## Figures

## Abstract

When a neuron is driven beyond its threshold, it spikes. The fact that it does not communicate its continuous membrane potential is usually seen as a computational liability. Here we show that this spiking mechanism allows neurons to produce an unbiased estimate of their causal influence, and a way of approximating gradient descent-based learning. Importantly, neither activity of upstream neurons, which act as confounders, nor downstream non-linearities bias the results. We show how spiking enables neurons to solve causal estimation problems and that local plasticity can approximate gradient descent using spike discontinuity learning.

## Author summary

Despite significant research, models of spiking neural networks still lag behind artificial neural networks in terms of performance in machine learning and modeling cognitive tasks. Given this, we may wonder, why do neurons spike? A key problem that must be solved in any neural network is the credit assignment problem. That is, how does a neuron know its effect on downstream computation and rewards, and thus how it should change its synaptic weights to improve? Artificial neural networks solve this problem with the back-propagation algorithm. We are still seeking to understand how biological neural networks effectively solve this problem. In this work we show that the discontinuous, all-or-none spiking response of a neuron can in fact be used to estimate a neuron’s causal effect on downstream processes. Inspired by methods from econometrics, we show that the thresholded response of a neuron can be used to get at that neuron’s unique contribution to a reward signal, separating it from other neurons whose activity it may be correlated with. This proposal provides insights into a novel function of spiking that we explore in simple networks and learning tasks.

Citation: Lansdell BJ, Kording KP (2023) Neural spiking for causal inference and learning. PLoS Comput Biol 19(4): e1011005. https://doi.org/10.1371/journal.pcbi.1011005

Editor: Ulrik R. Beierholm, Durham University, UNITED KINGDOM

Received: May 29, 2022; Accepted: March 7, 2023; Published: April 4, 2023

Copyright: © 2023 Lansdell, Kording. This is an open access article distributed under the terms of the Creative Commons Attribution License , which permits unrestricted use, distribution, and reproduction in any medium, provided the original author and source are credited.

Data Availability: All python code used to run simulations and generate figures is available at https://github.com/benlansdell/rdd .

Funding: KPK received NIH grant. "Quantifying causality for neuroscience" 1R01EB028162-01 https://braininitiative.nih.gov/funded-awards/quantifying-causality-neuroscience The funders had no role in study design, data collection and analysis, decision to publish, or preparation of the manuscript.

Competing interests: The authors state no competing interests.

## Introduction

Most nervous systems communicate and process information utilizing spiking. Yet machine learning mostly uses artificial neural networks with continuous activities. Computationally, despite a lot of recent progress [ 1 – 5 ], it remains challenging to create spiking neural networks that perform comparably to continuous artificial networks. Instead, spiking is generally seen as a disadvantage—it is difficult to propagate gradients through a discontinuity, and thus to train spiking networks. This disparity between biological neurons that spike and artificial neurons that are continuous raises the question, what are the computational benefits of spiking?

There are, of course, pragmatic reasons for spiking: spiking may be more energy efficient [ 6 , 7 ], spiking allows for reliable transmission over long distances [ 8 ], and spike timing codes may allow for more transmission bandwidth [ 9 ]. Yet, despite these ideas, we may still wonder if there are computational benefits of spikes that balance the apparent disparity in the learning abilities of spiking and artificial networks.

A key computational problem in both biological and artificial settings is the credit assignment problem [ 10 ]. When performance is sub-optimal, the brain needs to decide which activities or weights should be different. Credit assignment is fundamentally a causal estimation problem—which neurons are responsible for the bad performance, and not just correlated with bad performance? Solving such problems is difficult because of confounding: if a neuron of interest was active during bad performance it could be that it was responsible, or it could be that another neuron whose activity is correlated with the neuron of interest was responsible. In general, confounding happens if a variable affects both another variable of interest and the performance. Even when a fixed stimulus is presented repeatedly, neurons exhibit complicated correlation structures [ 11 – 15 ] which confounds a neuron’s estimate of its causal effect. This prompts us to ask how neurons can solve causal estimation problems.

The gold-standard approach to causal inference is randomized perturbation. If a neuron occasionally adds an extra spike (or removes one), it could readily estimate its causal effect by correlating the extra spikes with performance. Such perturbations come at a cost, since the noise can degrade performance. This class of learning methods has been extensively explored [ 16 – 22 ]. However, despite important special cases [ 17 , 19 , 23 ], in general it is not clear how a neuron may know its own noise level. Thus we may wonder if neurons estimate their causal effect without random perturbations.

How else could neurons estimate their causal effect? Over a short time window, a neuron either does or does not spike. Comparing the average reward when the neuron spikes versus does not spike gives a confounded estimate of the neuron’s effect. Because neurons are correlated, a given neuron spiking is associated with a different network state than that neuron not-spiking. And it is this difference in network state that may account for an observed difference in reward, not specifically the neuron’s activity. Simple correlations will give wrong causal estimates.

However, the key insight in this paper is that the story is different when comparing the average reward in times when the neuron barely spikes versus when it almost spikes. The difference in the state of the network in the barely spikes versus almost spikes case is negligible, the only difference is the fact that in one case the neuron spiked and in the other case the neuron did not. Any difference in observed reward can therefore only be attributed to the neuron’s activity. In this way the spiking discontinuity may allow neurons to estimate their causal effect.

Here we propose the spiking discontinuity is used by a neuron to efficiently estimate its causal effect. Once a neuron can estimate its causal effect, it can use this knowledge to calculate gradients and adjust its synaptic strengths. We show that this idea suggests learning rules that allows a network of neurons to learn to maximize reward, particularly in the presence of confounded inputs. We demonstrate the rule in simple models. The discontinuity-based method provides a novel and plausible account of how neurons learn their causal effect.

## Results

### Causal inference in neural networks

Though not previously recognized as such, the credit assignment problem is a causal inference problem: how can a neuron know its causal effect on an output and subsequent reward? This section shows how this idea can be made more precise.

Causal effects are formally defined in the context of a certain type of probabilistic graphical model—the causal Bayesian network—while a spiking neural network is a dynamical, stochastic process. Thus before we can understand how a neuron can use its spiking discontinuity to do causal inference we must first understand how a causal effect can be defined for a neural network. We present two results:

First, we lay out how a neural network can be described as a type of causal Bayesian network (CBN).

Second, assuming such a CBN, we relate the causal effect of a neuron on a reward function to a finite difference approximation of the gradient of reward with respect to neural activity.

Together these results show how causal inference relates to gradient-based learning, particularly in spiking neural networks.

#### Result I.

#### From dynamic neural networks to probabilistic graphical models.

We develop this idea in the context of a supervised learning setting. To formalize causal effects in this setting, we thus first have to think about how supervised learning might be performed by a spiking, dynamically integrating network of neurons (see, for example, the solution by Guergiuev et al 2016 [ 24 ]). That is, for simplicity, to avoid problems to do with temporal credit assignment, we consider a neural network that receives immediate feedback/reward on the quality of the computation, potentially provided by an internal critic (similar to the setup of [ 24 ]). Spiking neural networks generally operate dynamically where activities unfold over time, yet supervised learning in an artificial neural network typically has no explicit dynamics—the state of a neuron is only a function of its current inputs, not its previous inputs.

To accommodate these differences, we consider the following learning problem. Consider a population of N neurons. Let v i ( t ) denote the membrane potential of neuron i at time t , having leaky integrate-and-fire dynamics: for leak term g L , reset voltage v r and threshold θ . The network is assumed to have a feedforward structure. The neurons receive inputs from an input layer x ( t ), along with a noise process η j ( t ), weighted by synaptic weights w ij . The network is presented with this input stimulus for a fixed period of T seconds. Let the variable h i ( t ) denote the neuron’s spiking indicator function: h i ( t ) = ∑ δ ( t − t s ) if neuron i spikes at times t s . Post-synaptic current, s i ( t ), is generated according to the dynamics . On the basis of the output of the neurons, a reward signal r is generated, assumed to be a function of the filtered currents s ( t ): r ( t ) = r ( s ( t )). Here we assume that T is sufficiently long for the network to have received an input, produced an output, and for feedback to have been distributed to the system (e.g. in the form of dopamine signaling a reward prediction error [ 25 ]). Given this network, then, the learning problem is for each neuron to adjust its weights to maximize reward, using an estimate of its causal effect on reward.

As described in the introduction, to apply the spiking discontinuity method to estimate causal effects, we have to track how close a neuron is to spiking. Over the time period T , to distinguish between just-above-threshold inputs from well-above-threshold inputs, we also consider the input drive to the neuron: u i ( t ), which is the integrated input to the neuron, except without the reset mechanism. By tracking integrated inputs with a reset mechanism, then the value Z i = max 0≤ t ≤ T u i ( t ) tells us if neuron i received inputs that placed it well above threshold, or just above threshold.

To compute what the network’s output is for the given input over T seconds, we define a set of random variables, X , Z , H , S , R that aggregate the underlying dynamical (and spiking) variables, x ( t ), z ( t ), h ( t ), s ( t ) and r ( t ), respectively. Specifically, we define aggregating functionals f [⋅] to be summaries of the underlying dynamical variable activities. When the network dynamics are irregular [ 26 ], these aggregate variables will be approximately independent across subsequent windows of sufficient duration T . The dynamics given by the noisy LIF network generate an ergodic Markov process with a stationary distribution. That is, from a dynamical network, we have a set of random variables Φ that summarize the state of the network and can be considered I.I.D. draws from some distribution, which depends on the network’s weights and other parameters, Θ (e.g. noise magnitude and correlation): Φ ≔ ( X , Z , H , S , R ) ∼ ρ (⋅; Θ).

The functionals are required to only depend on one underlying dynamical variable. The spiking discontinuity approach requires that H is an indicator functional, simply indicating the occurrence of a spike or not within window T ; it could instead be defined directly in terms of Z . The random variable Z is required to have the form defined above, a maximum of the integrated drive. The choice of functionals is required to be such that, if there is a dependence between two underlying dynamical variables (e.g. h and x ), then there is also some statistical dependence between these variables in the aggregated variables. I.e. a trivial functional f R ( r ) = 0 would destroy any dependence between X and R . Given these considerations, for the subsequent analysis, the following choices are used: These choices were made since they showed better empirical performance than, e.g. taking the mean over T for S and R . Along with the parameters of the underlying dynamical neural network, these choices determine the form of the distribution ρ . The learning problem can now be framed as: how can parameters Θ be adjusted such that is maximized? Below we show how the causal effect of a neuron on reward can be defined and used to maximize this reward.

#### A causal Bayesian network of a neural network, and a neuron’s causal effect on reward.

What is the causal effect of a neuron on a reward signal? Given the distribution ρ over the random variables ( X , Z , H , S , R ), we can use the theory of causal Bayesian networks to formalize the causal effect of a neuron’s activity on reward [ 27 ].

Definition 1 . In a causal Bayesian network, the probability distribution ρ is factored according to a graph, [ 27 ]. The edges in the graph represent causal relationships between the nodes ; the graph is both directed and acyclic (a DAG). The standard definition of a causal Bayesian model imposes two constraints on the distribution ρ , relating to:

Conditional Independence: nodes are conditionally independent of their non-descendants given their parents, where Pa n represents the parents of node n .