## Abstract

Neuronal responses during behavior are diverse, ranging from highly reliable ‘classical’ responses to irregular ‘non-classically responsive’ firing. While a continuum of response properties is observed across neural systems, little is known about the synaptic origins and contributions of diverse responses to network function, perception, and behavior. To capture the heterogeneous responses measured from auditory cortex of rodents performing a frequency recognition task, we use a novel task-performing spiking recurrent neural network incorporating spike-timing-dependent plasticity. Reliable and irregular units contribute differentially to task performance via output and recurrent connections, respectively. Excitatory plasticity shifts the response distribution while inhibition constrains its diversity. Together both improve task performance with full network engagement. The same local patterns of synaptic inputs predict spiking response properties of network units and auditory cortical neurons from in vivo whole-cell recordings during behavior. Thus, diverse neural responses contribute to network function and emerge from synaptic plasticity rules.

### Similar content being viewed by others

## Introduction

Neuronal spiking patterns and responses to sensory input can be remarkably diverse, ranging from completely silent or firing a single action potential to prolonged burst firing or complex sequence generation^{1}. Various spiking patterns have been documented throughout brain regions in response to different sensory inputs, in relation to decision making, motor actions, or other task-related signals^{2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31}. The extent of spiking and receptive field heterogeneity is vast, with numerous types of neuronal responses found in many brain areas including visual cortex^{2,3,4,5}, auditory cortex^{6,7,8,9,10,11,12}, somatosensory cortex^{13}, parietal cortex^{4,14,15}, frontal cortex^{15,16,17,18,19}, hypothalamus^{20,21,22}, hippocampus^{23,24,25,26}, and the ventral tegmental area^{27,28} correlated with sensory, motor, choice, and other task-related signals^{2,4,11,14,15,16,29,30}. These neurons are often described as tuned, untuned, classically responsive, non-classically responsive, mixed selective, or category-free^{14,16,18,31}.

“Classically responsive neurons” (or “strongly rate-modulated neurons”) are those that have clear trial-averaged evoked activity relative to baseline in response to stimulus or other task-related events. “Non-classically responsive neurons” (or “weakly rate-modulated neurons”) are the remaining neurons that do not have these features and appear non-responsive. As shown previously^{16}, despite little to no rate modulation, non-classically responsive neurons encode substantial information about stimulus or choice behavioral variables in the relative timing of their spikes. Thus, it is important to determine whether these neurons contribute to the computations underlying task performance.

Recently, we showed that classically responsive neurons (e.g., pure tone frequency tuning in auditory cortex) and non-classically responsive neurons (i.e., nominally “non-responsive” neurons) both contained significant information about sensory stimuli and behavioral decisions. This finding suggests that non-classically responsive cells play important yet generally underappreciated roles in perception and behavior^{16}. This work is consistent with other recent findings demonstrating that neurons in rat primary visual and parietal cortex can encode sensory and non-sensory factors related to movement, reward history, and decision making^{4}. Similarly, a recent study on sequential memory in humans found that both strongly tuned and weakly tuned neurons recorded from the medial temporal lobe participated in theta-phase-locked encoding of sequence stimuli^{32}. A previous study on working memory in primate prefrontal cortex also revealed that non-selective neurons can contribute to optimal ensemble encoding^{19}, consistent with our own finding that mixed ensembles of classically and non-classically responsive cells improved encoding of task variables^{16}. Studies of deep neural networks trained to perform a visual recognition task showed that regularizing networks to increase the fraction of ‘non-selective’ units improved network performance relative to those with greater numbers of ‘selective’ units^{33}. These findings suggest that a diversity of neuronal response types (including neurons nominally thought to be non-responsive) may be a general property of neural networks, and that heterogeneity may be a key feature of the circuit dynamics important for network performance and behavior.

Here we now examine the synaptic basis for various types of spiking response profiles, and how synaptic plasticity learning rules were important for shaping synaptic inputs for spike output and network performance. We leveraged cell-attached, extracellular, and whole-cell recordings from behaving animals alongside recurrent network modeling to explore the synaptic origins and functional contribution of heterogeneous response profiles. Recent advancements using recurrent neural networks (RNN) with spiking units have shown that experimentally derived synaptic plasticity mechanisms can support stable neuronal assemblies^{34} and coordinate memory formation and retrieval^{35}. Related work has also shown that spiking RNNs can be trained to perform tasks using general-purpose methods similar to those employed in rate-based networks such as first-order reduced and controlled error (FORCE) training^{36,37} but these methods have only been employed as perturbation of networks with static synaptic weights. We combined FORCE training with a dynamic network to create a novel RNN with spiking units and multiple spike-timing-dependent plasticity (STDP) rules to solve a stimulus classification task similar to that of trained rats and mice. Our goal was to determine whether and how classically and non-classically responsive units contribute to task performance, how local synaptic structure (e.g. monosynaptic and disynaptic connections) constrains single-unit response profiles, and if the relationships observed for units in our network model could be applied to neurons in vivo during behavior.

## Results

### Diverse cortical responses measured during behavior in freely moving rats and head-fixed mice

We recorded from the rodent auditory cortex as animals performed a task requiring them to classify specific tone frequencies. We first trained rats to perform a go/no-go auditory frequency recognition task (Fig. 1a) requiring them to behaviorally respond with a nosepoke to a single target tone (4 kHz) for food reward and to withhold responses on non-target tones (0.5, 1, 2, 8, 16, 32 kHz). Rats learned this task within a few weeks of training performing with high d’ values (Fig. 1b; *d*’ = 2.8 ± 0.1, *p* = 6.1 × 10^{−5}, *N* = 15, two-sided Wilcoxon test). Perturbation experiments in rodents have revealed that the contribution of auditory cortex to perceptual decision making depends on details of the task design and difficulty^{38}; however, we and others have previously shown using muscimol inactivation studies that the auditory cortex is required for this task^{7,16,39}. (Although it is important to keep in mind that many loss of function experiments may be challenging to appropriately control for and interpret^{38}.) After rats reached behavioral criteria (percent correct: ≥70%, *d*’: ≥1.5), tetrodes were implanted in the right auditory cortex and we recorded from populations of single-units in non-head-fixed animals as they performed this go/no-go task (Fig. 1c). Single-unit responses were quite diverse across the population, spanning a range of response types from ‘classically responsive’ cells that were highly modulated relative to pre-trial baselines during the task to ‘non-classically responsive’ cells with relatively unmodulated firing rates throughout task performance including cue presentation and behavioral choice.

To capture the continuum of response types, we calculated a ‘firing rate modulation index’ comparing neural responses during the stimulus and choice periods to baseline values where either positive or negative changes in spike number increase the modulation index (in units of spikes per second). A low value of firing rate modulation index (near 0 spikes/s) corresponds to neurons that were unmodulated relative to baseline (‘non-classically responsive’) and larger values (≥2 spikes/s) correspond to neurons that were highly modulated (‘classically responsive’). The modulation was calculated from the firing rates during the stimulus and choice periods (‘stimulus/choice FR’) and baseline firing rate (‘baseline FR’) as

Many single-units recorded during behavior were non-classically responsive, with the remainder of cells having more ‘classical’ responses, e.g., to tone presentation (Fig. 1d, e; median firing rate modulation = 0.78 spikes/s, interquartile range = 0.47–1.50 spikes/s).

We observed a similar range of neuronal response profiles in cell-attached recordings from the auditory cortex of head-fixed mice trained on an analogous go/no-go auditory frequency recognition task (Fig. 1f). Mice were trained to respond to a single target tone (11.2 kHz) by licking for a water reward, and to withhold their response to a single non-target tone (5.6 kHz). Mice learned this task within a few weeks performing at high d’ values (Fig. 1g; *d*’ = 2.5 ± 0.1, *p* = 0.016, *N* = 7 mice, two-sided Wilcoxon test). After reaching behavioral criteria (percent correct ≥70% and *d*’: ≥1.5), animals were implanted with a cranial window that included a small hole for pipette access, and cell-attached recordings were made to measure spike firing during behavior (Fig. 1h). We found that neuronal responses in mice were also heterogeneous, including non-classically responsive cells with low firing rate modulation as well as classically responsive cells that were highly modulated during the task (Fig. 1i, j; median firing rate modulation = 2.26, interquartile range = 1.73–3.61 spikes/s). In both rats and mice, baseline firing rates for non-classically responsive neurons were comparable or lower than those of responsive neurons (Supplementary Fig. 1). Apparent differences in the response distribution between rats and mice may be attributable to species or task differences, but in both cases a wide range of response profiles were observed. These data then led us to wonder how local patterns of single-neuron excitatory and inhibitory inputs related to spike firing and behavioral performance (Fig. 1k).

### A spiking RNN model incorporating STDP rules captures in vivo cortical dynamics

To relate inputs and outputs over the response-type continuum, we developed a spiking RNN model trained to perform a similar go/no-go stimulus classification task as behaving animals (Fig. 2a–c; *d*’ = 4.6 ± 0.1, *p* = 0.0078, *N* = 8 networks, two-sided Wilcoxon test). All networks contained 1000 units (200 inhibitory, 800 excitatory); 200 excitatory units received inputs (input units) and the remaining 600 excitatory units projected onto the readout node (output units). The activity of this node is the dynamic signal which represents the response of our network to the incoming stimuli: ‘go’ is represented by an increase in node activity during the choice period, and ‘no-go’ is represented by node activity that remains at pre-trial baseline. All units were recurrently connected with a 5% random connection probability. The network was trained to perform the task via a version of FORCE designed for spiking networks^{36,37} (i.e., least-squares modification of the output weights with feedback) combined with STDP synaptic plasticity learning rules acting on the recurrent weights (Fig. 2a, Supplementary Fig. 2a–d). The network was trained to use a minimal amount of external stimulus input while being able to perform the task to mirror the behavioral errors seen during animal performance (Supplementary Fig. 2e).

Our model included biologically motivated and experimentally constrained excitatory and inhibitory synaptic STDP. Excitatory-to-excitatory synapses were modified by classic pairwise Hebbian homosynaptic plasticity^{40,41}, and inhibitory-to-excitatory synapses were modified by a homosynaptic rule which strengthens synapses when units fire synchronously regardless of order^{42,43,44,45}. Excitatory-to-excitatory and inhibitory-to-excitatory synapses were also adjusted by homeostatic mechanisms of heterosynaptic plasticity which prevented any one presynaptic connection from dominating (heterosynaptic balancing, β) or postsynaptic connection from dropping out (heterosynaptic enhancement, δ). These heterosynaptic changes occurred simultaneously with homosynaptic mechanisms and thus were qualitatively distinct from other types of homeostatic regulation of input weight distributions such as synaptic scaling.

While FORCE was originally designed to construct networks that can solve tasks without modification of the underlying recurrent synapses, in our network, STDP constrains FORCE to find solutions consistent with biological plasticity rules. FORCE and STDP can operate in parallel because each mechanism can be targeted to a different set of connections in the model: STDP modifies the recurrent synapses while FORCE modifies the connections to the readout node. In this way, STDP directly shaped the inherent recurrent dynamics of our network while FORCE determined how those dynamics were harnessed to perform the task. Since FORCE was originally designed to operate in networks with fixed recurrent weights and in our network these evolve, gross changes induced by STDP must be complete before FORCE can adapt to smaller synaptic changes. To ensure this, STDP was first activated without FORCE to allow for initial major synaptic restructuring to occur before FORCE training began and the two mechanisms continued in parallel (see Methods). The particular mechanisms and parameters chosen for STDP in this model were not optimized for the task a priori, and as such STDP should not have trivially improved performance. In general, we found that by using this procedure FORCE was compatible with STDP over a wide range of STDP parameters (Supplementary Fig. 2f–h). All networks without STDP active were trained with FORCE for the same number of trials as those with STDP.

We found that the spiking responses of individual network units spanned a wide range from non-classically to classically responsive similar to the in vivo data from both rats and mice (Fig. 2d, e; Fig. 1d, e, i, j). Specifically, spiking networks with STDP closely approximated the distribution of firing rate modulations observed experimentally in the rat auditory cortex in vivo while they were systematically lower than the modulation observed in mice (Fig. 2e, Supplementary Fig. 3a; for RNN vs. rat experimental data *p* = 0.27, two-sided Kolmogorov-Smirnov test, for RNN vs. mouse experimental data *p* = 1.46 × 10^{−7}, two-sided Kolmogorov–Smirnov test). Using a statistical threshold to identify non-classically responsive units as previously described^{16} (firing rate change from baseline <0.2 spikes/s during stimulus and choice periods, see Methods), we found the relative fractions of classically and non-classically responsive units were also comparable to experimental measurements (Supplementary Fig. 3b–d; ~40–50% non-classically responsive, 50-60% classically responsive). Using a single-trial, interspike interval (ISI)-based, Bayesian decoder we recently described^{16}, we found that task information was encoded in the activity of both classically and non-classically responsive RNN units (Fig. 2f).

To assess whether STDP altered response profile distributions, we compared the distribution of units before STDP was applied (pre-STDP) to those after (post-STDP). In pre-STDP networks, the recurrent weights were fixed during FORCE training whereas in post-STDP networks the recurrent weights evolved according to the STDP rules described above. Pre- and post-STDP networks were constructed in pairs with the same set of initial recurrent weights so that pre-STDP networks represent the behavior of the network with FORCE alone before STDP was active. The post-STDP response profile distribution differed substantially from pre-STDP networks, such that post-STDP networks exhibited more non-classically responsive units than pre-STDP networks (Fig. 2g; median post-STDP modulation = 1.52 spikes/s vs. pre-STDP modulation = 2.25 spikes/s, *p* = 1 × 10^{−323}, two-sided Mann–Whitney *U* test with Bonferroni correction). To understand how the synaptic changes induced by STDP resulted in this shift, we created two control networks with engineered weight matrices based on the full post-STDP weights. To determine whether the post-STDP response profile distribution resulted from a shift in mean weight strength, we first created networks with weights generated as in the pre-STDP condition but with mean values matched to those found post-STDP (Fig. 2g; ‘Mean-match’, weights drawn from a uniform distribution from 0 to 2x mean, median post-STDP modulation = 1.52 vs. mean-match modulation = 1.46, *p* = 6.2 × 10^{−6}, *N* = 8 networks; Supplementary Fig. 4a). Second, we created networks in which inhibitory-to-excitatory and excitatory-to-excitatory synaptic weights were shuffled at random to new pre- and postsynaptic target units to preserve the full weight distribution created by STDP but remove any synaptic correlations (Fig. 2g, ‘Shuffle’, median post-STDP modulation = 1.52 vs. shuffle modulation = 1.48, *p* = 0.0017, *N* = 8 networks, Supplementary Fig. 4a). Both control conditions were retrained with FORCE after weight matrices were altered. For both the ‘mean-match’ and ‘shuffle’ controls, the distributions of responses closely followed the post-STDP distribution; however, the proportion of inactive units (firing rate <1 spike/trial on average) significantly increased to ~5% of the full network (Fig. 2h; comparisons to post-STDP, *p* = 0.001, two-sided Mann–Whitney *U* test with Bonferroni correction). These results show that the overall synaptic weight changes induced by STDP could account for the increase in the fraction of non-classically responsive units. However, the synaptic correlations induced by STDP were required to facilitate full network engagement (i.e., no inactive units).

To determine how STDP shaped synaptic weight strengths and structure (i.e., network topology), we compared the synaptic weight strengths pre-STDP to post-STDP. Over the course of training, we found that STDP mechanisms made significant modifications to both the excitatory-to-excitatory and inhibitory-to-excitatory synaptic weight distributions and topologies. Median weights shifted relative to pre-STDP initial values for both types of synapses and the distributions of synaptic weights became skewed (Supplementary Fig. 4b), as has been observed in rat visual cortex^{46}. We asked if selective weight rescaling by STDP preserved the random structure of the initial pre-STDP network or created systematic patterns of synaptic connectivity (i.e., “small-world” network topology) as previously described in rat somatosensory cortex^{47,48}. We compared the topology of the synaptic weight matrix post- and pre-STDP and found that STDP generated a more clustered network structure consistent with both experimental observations^{48} and computational studies^{34,35} (Supplementary Fig. 4c).

Although our network was not explicitly designed to model multiple regions, we investigated whether our STDP rules induced synaptic structure between the input units (which receive the stimuli) and the output units (which determine the network response). We found that the STDP mechanisms in our model generate stimulus-specific correlations between excitatory and inhibitory inputs to output units consistent with feed-forward inhibition between thalamus and auditory cortex responsible for lateral refinement of sensory representations^{49} (Supplementary Fig. 4d). Future work exploring multi-region RNN architectures is required to determine whether these STDP rules are sufficient to reproduce more detailed aspects of the interaction between auditory cortex and upstream or downstream regions.

The modifications to the weight matrix made by STDP improved task performance (Fig. 2i; mean pre-SDTP *d*’ = 3.52 vs. post-STDP *d*’ = 4.49, *p* = 0.0014, *N* = 8 networks, two-sided Wilcoxon test with Bonferroni correction). This increase in performance was not observed in either the mean-matched or shuffled control conditions, demonstrating that the detailed connectivity structure of synaptic weights created by STDP were required to improve performance (Fig. 2i; mean pre-STDP *d*’ = 3.52 vs. mean-match *d*’ = 3.96, *p* = 0.04, and shuffle *d*’ = 3.67, *p* = 0.74, *N* = 8 networks in all groups, two-sided Wilcoxon test with Bonferroni correction). These results show that STDP shifts the weight matrix into a regime leading to improved task performance while maintaining a consistent level of network unit engagement.

### Classically and non-classically responsive RNN units differentially contribute to task performance

Given that STDP increased both the prevalence of non-classically responsive units as well as network task performance, we next explored how classically responsive and non-classically responsive units contributed directly to task performance. Given that excitatory output units contribute directly to the RNN output activity and recurrent dynamics, we focused our analysis on these units (*n* = 600 per network). We first evaluated the output connections to the readout node and recurrent weights between units to determine whether there were systematic differences between these response profiles. Both classically and non-classically responsive units spanned a similar range of values, however classically responsive units had larger weights onto the readout node than non-classically responsive units (Fig. 3a; *p* = 4.9 × 10^{−22}, *N* = 8 networks, *n* = 4800 connections, Levene’s test). This suggests that both classes contribute directly to task performance by driving the network output, but classically responsive units may affect performance specifically via their effect on the readout node. In contrast, non-classically responsive units had stronger recurrent projections than classically responsive units to both subpopulations (Fig. 3b; *p* < 2.0 × 10^{−5}, *N* = 8 networks, *n* = 4800 units, for all comparisons between NCR and CR, two-sided Hierarchical Bootstrapping Test). This result, coupled with the observation that non-classically responsive units generally had higher baseline and full-trial firing rates (Fig. 3c, median baseline NCR = 16.1 spikes/s vs. CR = 14.1 spikes/s, *p* < 2.0 × 10^{−5}; full-trial NCR = 16.1 spikes/s vs. CR = 14.3 spikes/s, *p* < 2.0 × 10^{−5}_{,} *N* = 8 networks, *n* = 4800 units, two-sided Hierarchical Bootstrapping Test) suggests non-classically responsive units may play a privileged role in generating task-related dynamics through their effect on recurrent network activity. Notably, in vivo average baseline firing rates for non-classically responsive neurons were lower than classically responsive neurons in both rats and mice (Supplementary Fig. 1) this difference may result from the fact that default network parameters prevented neurons with very low average firing rates from emerging.

To test this hypothesis, we transiently inactivated classically or non-classically responsive units during task performance. Inactivation of non-classically responsive units targeted the least modulated units in the network first while inactivation of classically responsive units targeted the most modulated units. During inactivation, we silenced output connections and replaced recurrent activity with average-firing-rate-matched Poisson noise to control for changes in the overall level of recurrent synaptic current. Completely inactivating either subpopulation impaired task performance suggesting that both subpopulations are important for network dynamics. Inactivating a relatively small number of highly non-classically responsive units (60 units, top 10% most non-classically responsive output units) had a significantly larger effect on performance than inactivating classically responsive units (Fig. 3d, Supplementary Fig. 5a; inactivating 10% most non-classically responsive Δ*d*’ = −1.58 vs. inactivating 10% most classically responsive Δ*d*’ = −0.92, *p* = 1.11 × 10^{−4}, *N* = 24 networks, two-sided Mann–Whitney *U* test with Benjamini–Hochberg correction). As the number of inactivated units increased, however, task performance continued to degrade and eventually the effects of inactivating 300 units (i.e., 50% of output units) from either subpopulation were comparable (Fig. 3d; inactivating 50% most non-classically responsive Δ*d*’ = −2.27 vs. inactivating 50% most classically responsive Δ*d*’ = −2.61, *p* = 0.042, *N* = 24 networks, two-sided Mann–Whitney *U* test with Benjamini–Hochberg correction).

The types of errors produced (‘false alarms’ on non-target trials and ‘misses’ on target trials) did not differ when inactivating either classically or non-classically responsive units (Supplementary Fig. 3c; false alarms vs. misses inactivating 50% most classically responsive, *p* = 0.26, inactivating 50% most non-classically responsive, *p* = 0.21, two-sided Mann–Whitney *U* test with Bonferroni correction). However, we observed a qualitative difference in the network dynamics that produced these errors depending on which subpopulation was inactivated. Inactivating classically responsive units led to greater response error in the readout node activity during the choice period (Supplementary Fig. 5b, d; root mean squared error during response period at 50% inactivation of most classically responsive = 0.48, 50% most non-classically responsive = 0.44, *p* = 1.1 × 10^{−6}, *N* = 24 networks, two-sided Mann–Whitney *U* test with Bonferroni correction). In contrast, inactivating non-classically responsive units caused a greater shift in readout node baseline activity (Supplementary Fig. 5b, e; mean shift in baseline activity at 50% inactivation of most classically responsive = −0.25 vs. 50% most non-classically responsive = 0.47, *p* = 2.9 × 10^{−7}, *N* = 24 networks, two-sided Mann-Whitney U test with Bonferroni correction). This suggests that while both response types are essential for proper network function, non-classically responsive units served to set boundaries which constrain overall network dynamics to the task-relevant subspace (i.e., readout node activity close to 0 except during ‘go’ responses) whereas classically responsive units affected dynamics within those boundaries.

We asked if these impairments resulted from silencing output connections or interfering with recurrent activity by either selectively inactivating output connections (shaped by FORCE) or recurrent connectivity (shaped by STDP). Inactivation of the output connections alone in either subpopulation impaired performance. Removing output connections from 10% of non-classically responsive output units led to a significant decrease in task performance (Fig. 3e; Supplementary Fig. 5f; removing output connections from 10% most non-classically responsive Δ*d*’ = −1.2 vs. 10% most classically responsive Δ*d*’ = −0.6, *p* = 0.011, *N* = 24 networks, two-sided Mann–Whitney *U* test with Benjamini–Hochberg correction). For greater than 20% inactivation, silencing output connections from classically responsive units resulted in a stronger decrease in performance (Fig. 3e; Supplementary Fig. 5f; *p* = 0.011, *N* = 24 networks, two-sided Mann–Whitney U test with Benjamini–Hochberg correction). This indicates that while classically responsive units contributed more to task performance via their output connections overall, a small fraction of highly non-classically responsive units were also critical for high levels of performance via their output projections. To impair the recurrent contribution of network units we replaced their recurrent activity with firing rate matched Poisson noise while leaving the activity directed towards the output node unperturbed. In contrast to silencing output connections, disabling the recurrent contributions of non-classically responsive units resulted in a larger impairment in performance than classically responsive units for all numbers of units inactivated (Fig. 3f; Supplementary Fig. 5g; disabling 10% most non-classically responsive output units Δ*d*’ = −0.7 vs. 10% most classically responsive units Δ*d*’ = −0.4, *p* = 0.036, *N* = 15 networks, two-sided Mann–Whitney *U* test with Benjamini–Hochberg correction; disabling 50% most non-classically responsive output units Δ*d*’ = −1.7 vs. 50% most classically responsive units Δ*d*’ = −1.5, *p* = 0.036, *N* = 15 networks, two-sided Mann–Whitney *U* test with Benjamini–Hochberg correction).

These inactivation experiments demonstrate that both classically and non-classically responsive units contribute significantly to task performance. Selective inactivation reveals that classically responsive units contribute more to task performance through their output projections while non-classically responsive units contribute primarily through their effect on recurrent activity. How do these recurrent perturbations affect the response profile distributions? Even though output weights remain fixed during inactivation, perturbing the recurrent activity of either classically or non-classically responsive units is sufficient to shift the response profiles of individual units and balance the relative output weights between classically and non-classically responsive populations to the readout node (Supplementary Fig. 5h). Unsurprisingly, recurrent inactivation of classically responsive neurons shifts the response profile distribution towards non-classical activity, as fewer classically responsive units are available to amplify the responses of other units in the network to stimulus or choice (Supplementary Fig. 5i, top). Remarkably, perturbing the recurrent activity of non-classically responsive units also shifts the response distribution away from classically responsive units indicating that the recurrent activity of non-classically responsive units collectively supports the activity of classically responsive units despite the smaller stimulus- and choice-related firing rate modulation exhibited in non-classically responsive units (Supplementary Fig. 5i, bottom). Recurrent inactivation randomizes the timing of single-unit spiking activity while maintaining the overall firing rate using a Poisson process. Because non-classically responsive units have a comparatively constant trial-averaged firing rate, this perturbation demonstrates that the spike-timing of these units enables the activity that drives the readout node in the unperturbed network.

### Effect of network parameters on ensemble diversity

Four of the main parameters in the network model are network size, fraction of inhibitory units, fraction of input units, and connection probability. We systematically varied each of those parameters (leaving other parameters fixed) to assess their effect on the distribution of classically responsive and non-classically responsive network unit response profiles in networks where STDP was active (post-STDP). Increasing network size while keeping the average number of connections per unit constant increased the proportion of classically responsive units (Supplementary Fig. 6a, left; *p* < 10^{−5} for 2000 units vs 1000 and 500, *N* = 4 networks, *n* = (1200, 2400, 4800) units per parameter size = (500, 1000, 2000), two-sided Mann–Whitney *U* test with Bonferroni correction) which was primarily a result of higher variability in the choice-related responses of network units (Supplementary Fig. 6a, middle, right; *p* < 10^{−5} all comparisons, *N* = 4 networks, *n* = (1200, 2400, 4800) units per parameter size = (500, 1000, 2000), Levene’s test with Bonferroni correction). Increasing the fraction of inhibitory units reduced the overall responsiveness (Supplementary Fig. 6b, left; *p* < 10^{−5} all comparisons, *N* = 4 networks, *n* = 2400 units per parameter, two-sided Mann–Whitney *U* test with Bonferroni correction) by decreasing the magnitude of both stimulus and choice-related activity (Supplementary Fig. 6b, middle, right; stimulus, *p* < 10^{−5} all comparisons, two-sided Mann–Whitney *U* test with Bonferroni correction; choice, *p* < 10^{−5} all comparisons, Levene’s test with Bonferroni correction). Increasing the fraction of input cells increased responsiveness (Supplementary Fig. 6c, left; *p* < 10^{−5}, *N* = 4 networks, *n* = 2400 units per parameter, all comparisons, two-sided Mann–Whitney *U* test with Bonferroni correction.) by increasing the stimulus response of the network (Supplementary Fig. 6c, middle, right; *p* < 10^{−5}, *N* = 8 networks, *n* = 4800 units per parameter, all comparisons, two-sided Mann–Whitney *U* test with Bonferroni correction). Finally, increasing the connection density of the network increased responsiveness (Supplementary Fig. 6d, left; *p* < 10^{−5}, *N* = 8 networks, *n* = 4800 units per parameter, all comparisons, two-sided Mann–Whitney *U* test with Bonferroni correction) despite the fact that connection weights were scaled down as connection probability increased. This increase was driven by an increase in stimulus-related activity (Supplementary Fig. 6d, middle, right; *p* < 10^{−5} all comparisons, *N* = 8 networks, *n* = 4800 units per parameter, two-sided Mann–Whitney *U* test with Bonferroni correction).

### Synaptic mechanisms shape response profile distributions and task performance

Our exploration of network parameters indicated that by changing connectivity statistics—perhaps simulating the effects of synaptic plasticity mechanisms—networks can adjust the relative fraction of classically responsive and non-classically responsive units. Therefore, we next examined the sensitivity of response profiles to the details of STDP in the model. To further understand how STDP improved task performance and determine the specific role of inhibitory and excitatory STDP mechanisms, we selectively included either only excitatory-to-excitatory or inhibitory-to-excitatory plasticity mechanisms during training and evaluated the effect on task performance and response profile distributions.

Selectively enabling either only inhibitory-to-excitatory or excitatory-to-excitatory plasticity boosted task performance relative to pre-STDP networks. However, including only inhibitory-to-excitatory plasticity produced performance gains comparable to the post-STDP condition where both rules were active (Fig. 3g; *N* = 8 networks per condition, increase in task performance relative to pre-STDP with only inhibitory-to-excitatory STDP, Δ*d*’ = 1.4 ± 0.1, *p* = 0.0014, increase in performance with only excitatory-to-excitatory STDP: Δ*d*’ = 0.6 ± 0.2, *p* = 0.011, increase in performance with both forms of STDP: Δ*d*’ = 1.1 ± 0.2, *p* = 0.0014, two-sided Wilcoxon test with Bonferroni correction). Plasticity in excitatory-to-excitatory and inhibitory-to-excitatory synapses were both sufficient to shift the response profile distribution towards non-classically responsive activity and create a distribution similar to that observed in the full post-STDP model (Fig. 3h; median shift in firing rate modulation relative to pre-STDP, Post-STDP: Δmodulation = −0.95 spikes/s, IE only: Δmodulation = −1.13 spikes/s, EE only: Δmodulation = −0.79 spikes/s, *p* < 10^{−5} for all comparisons, *N* = 8 networks, *n* = 4600 units per condition, two-sided Mann–Whitney *U* test with Bonferroni correction).

Notably, including inhibitory-to-excitatory plasticity alone produced a larger number of inactive units (Fig. 3i, ‘IE only’; firing rate <1 spike/trial on average). While inhibitory-to-excitatory synaptic plasticity was sufficient to improve performance to post-STDP levels, it decoupled a large fraction of network units in the process; however, in tandem with excitatory-to-excitatory plasticity performance gains can occur while all units remained engaged during task performance. Although the full network engagement maintained by excitatory plasticity was not necessary to improve performance on this task (Fig. 3g), maintenance of full network engagement effectively increases the size of the network which may have benefits in other tasks or contexts.

These plasticity mechanisms differed in how they shifted response profiles into a non-classically responsive regime. While both inhibitory-to-excitatory and excitatory-to-excitatory plasticity reduced firing rate modulation during the stimulus period (Supplementary Fig. 7a, left; median shift relative to pre-STDP, post-STDP: Δstimulus = −0.52 spikes/s, IE only: Δstimulus = −0.70 spikes/s, EE only: Δstimulus = −0.67 spikes/s, *p* < 10^{−5} for all comparisons to pre-STDP, *N* = 8 networks, *n* = 4600 units per condition, two-sided Mann–Whitney *U* test with Bonferroni correction), only excitatory-to-excitatory plasticity shifted choice modulation towards post-STDP values (Supplementary Fig. 7a, right; median shift relative to pre-STDP, post-STDP: Δchoice = −0.95 spikes/s, *p* < 10^{−5}, IE only: Δchoice = −0.07 spikes/s, *p* = 0.078, EE only: Δchoice = −0.97 spikes/s, *p* < 10^{−5}, *N* = 8 networks, *n* = 4600 units per condition, two-sided Mann–Whitney *U* test with Bonferroni correction). Furthermore, the range of both stimulus and choice-related modulation values decreased when inhibitory-to-excitatory mechanisms were included regardless of whether excitatory-to-excitatory mechanisms were present (Supplementary Fig. 7a; IE only vs. Pre-STDP and Post-STDP vs. EE only, *p* < 10^{−3}, *N* = 8 networks, *n* = 4600 units per condition, Levene’s test with Bonferroni correction). This suggests that excitatory-to-excitatory plasticity shifts response profiles toward non-classically responsive activity by shifting median responses closer to zero modulation while inhibitory-to-excitatory plasticity also constrains the range of modulation observed during each trial period.

We next sought to understand how the three forms of plasticity (homosynaptic STDP, heterosynaptic balancing β, and heterosynaptic enhancement δ) adjusted the population of unitary response profiles. To do this, we selectively increased or decreased the strength of each type of plasticity relative to default values for either excitatory-to-excitatory synapses or inhibitory-to-excitatory synapses. Altering the strength of excitatory STDP did not change the response profile distribution (Supplementary Fig. 7b, left); however, excitatory heterosynaptic mechanisms significantly modified response properties (Supplementary Fig. 7b, center, right). Strengthening excitatory heterosynaptic balancing (β) increased the firing rate modulation of network units (Supplementary Fig. 7b, center; *p* < 10^{−5}, *N* = 8 networks, *n* = 4600 units per condition, for 2x vs 0.5x strength, Kolmogorov–Smirnov test with Bonferroni correction), whereas strengthening heterosynaptic enhancement (δ) decreased modulation (Supplementary Fig. 7b, right; *p* < 10^{−5} for 2x to 0.5x strength, *N* = 8 networks, *n* = 4600 units per condition, Kolmogorov–Smirnov test Bonferroni correction). For inhibitory plasticity, heterosynaptic enhancement (δ) increased the modulation of network units in opposition to excitatory-to-excitatory heterosynaptic enhancement (Supplementary Fig. 7c, right; *p* < 10^{−5} for 2x vs 0.5x strength, *N* = 8 networks, *n* = 4600 units per condition, Kolmogorov–Smirnov test with Bonferroni correction). Similarly, inhibitory homosynaptic terms also increased the strength of classical responses (Supplementary Fig. 7c, left; *p* < 10^{−5} for 2x vs 0.5x strength, *N* = 8 networks, *n* = 4600 units per condition, Kolmogorov–Smirnov test with Bonferroni correction). Strengthening inhibitory heterosynaptic balancing, β, had the effect of expanding the dynamic range of response profiles without shifting the median, resulting in a greater diversity of response types (Supplementary Fig. 7c, center; *p* < 10^{−5} for 2x vs 0.5x strength, *N* = 8 networks, *n* = 4600 units per condition, Kolmogorov–Smirnov test with Bonferroni correction). These results suggest that while excitatory-to-excitatory homosynaptic plasticity has minimal effect on response types, each of the other synaptic mechanisms provide complementary constraints on the range and median of the response profile distribution.

### Specific local synaptic patterns predict response properties of diverse units

As STDP of excitation and inhibition shaped response profiles across the network, we next determined how individual classically and non-classically responsive units were embedded in the network by examining their synaptic input and output patterns. We analyzed the responses of the group of excitatory units which projected to the readout node since these neurons were not trivially stimulus responsive (via direct stimulus inputs) and displayed the greatest range of stimulus and choice modulation (‘output units’; Supplementary Fig. 3d, center).

Although the strengths of direct (i.e., monosynaptic) inputs onto a given unit should predominantly determine the response profiles of individual units, higher order correlations may also be relevant for determining single-unit responses. To assess the contributions of direct and higher-order synaptic connections (e.g., disynaptic, trisynaptic, etc.), we adapted a recent approach^{50} to systematically decompose the weight matrix into local patterns of connectivity or “motifs” (Fig. 4a), starting with small numbers of synaptic connections (lower-order motifs) and progressing to motifs with larger numbers of connections (higher-order motifs). These local patterns have been shown to predict a variety of network phenomena including cross-correlations and the dimensionality of network dynamics^{51}. Motifs with larger numbers of synaptic connections are only considered present in a network if they are unlikely to occur from random combinations of motifs with fewer connections. In previous work^{50,51}, only network-wide averages of these synaptic patterns were required, but here we derive motifs for each individual unit which sum to produce the full network-wide motif cumulants providing a neuron-by-neuron view of synaptic structure.

There are three main classes of synaptic patterns (Fig. 4a): ‘Chain motifs’ represent sequential synaptic connections. ‘Convergent motifs’ represent two neurons that project to a common downstream output neuron separated by one or many synapses. ‘Divergent motifs’ represent two neurons that share an upstream input unit separated by one or many synapses. The simplest motif is a ‘first-order chain motif’ which simply represents the average strength of synaptic inputs or outputs of a unit. To explain the responsiveness of excitatory output units we considered synaptic patterns shared with all four subpopulations in the network: ‘output units’ that project connections to the readout node, ‘target responsive input units’ that receive stimulus current on target trials, ‘non-target responsive input units’ that receive stimulus current on non-target trials, and ‘inhibitory units’ (Fig. 4b). For example, the first-order chain motif from the inhibitory subpopulation are simply the average inhibitory synaptic inputs to a unit; the “2nd order divergent motif” between a unit and the inhibitory subpopulation would indicate that it receives synaptic inputs from the same units as inhibitory units (beyond what can be explained by chance).

Classically and non-classically responsive units demonstrated distinct patterns of connectivity to the four subpopulations of the network (output units, target responsive input units, non-target responsive input units, and inhibitory units). Examination of the monosynaptic motifs (direct synaptic inputs and outputs to the four subpopulations) revealed that non-classically responsive units received weaker inputs than classically responsive units overall, particularly from inhibitory units and target responsive units (Fig. 4c, monosynaptic inputs, change in median normalized synaptic weights for non-classically vs. classically responsive units = −0.20, *p* < 10^{−5}, *N* = 24 networks, *n* = 14,400 units total, two-sided Mann–Whitney *U* test; Supplementary Fig. 8a, top, all comparisons of non-classically vs. classically responsive *p* < 10^{−5}, *N* = 24 networks, *n* = 14,400 units total, two-sided Mann–Whitney *U* test with Bonferroni correction). Despite receiving weaker inputs, non-classically responsive units had stronger recurrent synaptic outputs than classically responsive units to all other excitatory subpopulations (Fig. 4c, monosynaptic outputs, change in median synaptic input weight for non-classically vs. classically responsive units = 0.13, *p* < 10^{−5}, *N* = 24 networks, *n* = 14,400 units total, two-sided Mann–Whitney *U* test; Supplementary Fig. 8a, bottom; all comparisons of NCR vs. CR except inhibitory outputs, *p* < 10^{−4}, inhibitory outputs *p* > 0.7, two-sided Mann–Whitney *U* test with Bonferroni correction).

Only a limited number of disynaptic input motifs differed systematically from zero, indicating that most disynaptic connections have no additional structure beyond their monosynaptic motifs (Supplementary Fig. 8b). Interestingly, the disynaptic input motifs of non-classically responsive units are closer to zero indicating that their patterns of synaptic connectivity are more local than classically responsive units—spanning only a single synaptic connection (Fig. 4c, disynaptic inputs, change in median synaptic input weight for non-classically vs. classically responsive units = −0.36; Supplementary Fig. 8b, inputs *p* < 0.005 unless labeled n.s., two-sided Mann–Whitney *U* test with Bonferroni correction, outputs *p* < 0.04 unless labeled n.s., Levene’s test with Bonferroni correction). This suggests that non-classically responsive units receive less-correlated inputs from other units in the network and therefore perform a more diverse set of computations.

Can we predict which neurons will become classically or non-classically responsive based on their local synaptic structure? To answer this, we formulated a statistical model to predict the firing rate modulation of individual units based on its individual synaptic motifs. This statistical model uses the prevalence of synaptic motifs for individual units to predict the stimulus and choice modulation of these units via a multilinear regression. These predictions are then combined to make a prediction for the overall firing rate modulation (Fig. 4d). This model successfully predicted the firing rate modulation of individual output neurons across various network types with radically different response profiles (pre-STDP, IE only, EE only, post-STDP) demonstrating that the response profile of individual units can be explained by their local patterns of synaptic weights independent of the plasticity mechanisms shaping those weights (Supplementary Fig 8c; 30-fold cross-validated stimulus mean-squared error = 0.29 ± 0.15 spikes/s, *r* = 0.75 ± 0.06, choice mean-squared error = 0.63 ± 0.43 spikes/s, *r* = 0.87 ± 0.02). Examining the output units as a whole, this statistical synaptic motif model captures the observed shift towards non-classically responsive activity post-STDP demonstrating that local synaptic plasticity can account for global changes in the response profile distribution (Fig. 4e, Supplementary Fig. 8d).

We then dissected our statistical motif model to determine the contribution of each statistically significant monosynaptic and disynaptic motif to the firing rate modulation pre- and post-STDP (Fig. 4f; Supplementary Fig. 8e, f). We found that the shift in the response profile distribution is primarily accounted for by the effect of STDP on monosynaptic motifs. This finding is consistent with our observation that “mean-matched” and “shuffled” networks where higher-order synaptic structure has been removed have response profiles very similar to post-STDP networks where this higher-order structure is present (Fig. 2g). Interestingly, STDP lessens the systematic contribution of disynaptic motifs to the firing rate modulation of individual units (Fig. 2g, bottom, Supplementary Fig. 8f) indicating that one effect of STDP is to make response characteristics “hyper-local” in that they only result from direct, monosynaptic connections.

Which synaptic motifs are relevant for determining whether a neuron is classically or non-classically responsive? We next determined the contribution of each statistically significant monosynaptic and disynaptic motif to the firing rate modulation of classically responsive and non-classically responsive units. Monosynaptic motifs were primarily responsible for determining response profiles while disynaptic motifs played a smaller, non-systematic role (Fig. 4g, Supplementary Fig. 8g, h; all non-classically vs. classically responsive comparisons *p* < 10^{−5}, *N* = 8 networks, *n* = 4800 units total, two-sided Mann–Whitney *U* test with Bonferroni correction). 6 out of a possible 8 monosynaptic motifs and 6 out of a possible 16 disynaptic motifs were found to be relevant for predicting the modulation of individual units indicating that a specific set of local synaptic motifs are relevant for identifying the response properties of network units (Supplementary Fig. 8a, b, g–j; *p* < 0.01, two-sided Mann–Whitney *U* test with Bonferroni correction). Each of these identified motifs was relevant for the response properties of both classically responsive and non-classically responsive units. This indicated that both unit types were driven by the same types of connections. Moreover, these included connections to all subpopulations (output, target responsive input, non-target responsive input, and inhibitory) although higher-order, disynaptic connections to output and inhibitory units were of particular importance (Supplementary Fig. 8g, h; output, 3 of 4 possible disynaptic motifs, open red circles; inhibitory, 2 of 4 possible disynaptic motifs, open blue circles;). Decreases in monosynaptic inputs to non-classically responsive units and increases in their monosynaptic outputs (Fig. 4c, Supplementary Fig. 8a) all contributed to less modulated firing overall (Fig. 4g, Supplementary Fig. 8g). Moreover, the decrease in disynaptic correlations for non-classically responsive units (Fig. 4c, Supplementary Fig. 8b) resulted in a smaller disynaptic contribution to the response profiles of non-classically responsive units (Fig. 4g, Supplementary Fig. 8h).

Examining stimulus and choice-related firing rate modulation separately revealed that there were distinctions in how each subpopulation affects specific task-related responses (Supplementary Fig. 8g, h). Monosynaptic connections to inhibitory and output units play a significant role in both stimulus and choice-related responses, however connections to input units only contribute significantly to stimulus responses. Furthermore, disynaptic connections play a relatively larger role in choice-related responses than stimulus responses indicating that higher-order structure may be more important in transforming stimulus-related into choice-related activity. Thus, local synaptic structure predicted the response profile of individual units with direct monosynaptic connections having the largest effect. The response properties of classically and non-classically responsive units were driven by differences in how they connect to all network subpopulations rather than one in isolation (Fig. 4c, g, Supplementary Fig. 8a, b, g, h). Specifically, non-classically responsive units resulted from weakened input from all subpopulations and smaller disynaptic correlations rather than increased inhibition or weakened inputs from input units. Interestingly, non-classically responsive units had stronger recurrent connections to the rest of the network than classically responsive units. This difference is consistent with the greater impact on network performance resulting from inactivating recurrent connections of non-classically responsive units (Fig. 3f).

### Predicting single neuron response profiles recorded in vivo

Our model makes several predictions about the relationship between synaptic inputs and output spiking responses. Specifically, we hypothesized that neuronal response type (i.e., classically responsive or non-classically responsive) can be determined from average synaptic input strengths (Fig. 4c–f). We made in vivo whole-cell voltage-clamp recordings from neurons of the auditory cortex of mice during the go/no-go frequency recognition task (Fig. 5a; *n* = 12 neurons from *N* = 5 mice). We measured excitatory and inhibitory synaptic currents (E/IPSCs) during behavior, and for some cells (*n* = 4 neurons from *N* = 3 mice), we were able to record both the spiking activity in cell-attached mode prior to breaking into the cell to record postsynaptic currents (Fig. 5b, c, Supplementary Fig. 9a). For those cells where only synaptic currents were recorded, we used a straightforward integrate-and-fire model to simulate their spiking activity based on the experimentally measured currents over individual trials, including during inter-trial intervals (Supplementary Fig. 9b). The firing rate modulation of each neuron (and thus degree to which each neuron was classically responsive or non-classically responsive) was then calculated by comparing baseline spiking activity to activity during stimulus presentation. The parameters chosen for the integrate-and-fire simulation were based on those neurons where both synaptic input and spiking output data were available for the same neuron (Fig. 5b, c, right). This simulation accurately captured the firing rate modulation of cells where spiking data was available (Fig. 5d; Pearson’s *r* = 0.85) and reproduced a distribution of responses similar to those directly measured from cell-attached recordings (Fig. 5e; *p* = 0.41, two-sided Kolmogorov–Smirnov test). These results confirm that our simulations based on recorded input currents accurately reproduce the modulation of neurons where spiking outputs were not available.

Our spiking RNN also predicts that non-classically responsive units have weaker average inputs overall. We also observed this in the whole-cell recordings in vivo; non-classically responsive neurons had significantly weaker inhibitory and excitatory inputs than classically responsive cells (Fig. 5f, NCR vs CR, ΔExc = −72%, *p* = 0.002, ΔInh = −76%, *p* = 0.007, *n* = 12 neurons from *N* = 5 mice, two-sided Mann-Whitney U test). To evaluate whether the relationship between average synaptic inputs and spiking outputs observed in our model holds in vivo, we used parameters derived exclusively from our RNN to predict the firing rate modulation of individual neurons in vivo. These parameters were coefficients representing the relative contribution of average inhibitory and excitatory conductance to firing rate modulation during behavior and were combined with measured average synaptic conductances from cells in vivo to predict their modulation (Fig. 5g, left). The parameters were obtained from a simplified version of the same statistical model previously used to predict modulation of units in the RNN using their synaptic motifs (Fig. 4; see Methods). Comparing the modulation inferred directly from the trial-by-trial in vivo data with the one predicted by our model, we found the statistical model derived from the RNN predicts the firing modulation of individual neurons in vivo to a high degree of accuracy for neurons over a range of classically responsive and non-classically responsive firing rate modulations (Fig. 5g, right; mean-squared error = 2.2 spikes/s, Pearson’s *r* = 0.94, *n* = 12 neurons from *N* = 5 mice).

To test whether the RNN-derived predictions captured detailed aspects of the trial-by-trial dynamics, we compared these predictions to modified simulations which kept average conductance values fixed while rescaling trial-by-trial conductance dynamics relative to this baseline (peak conductance values were rescaled to be closer to the mean value by a factor of 2). This ensured that the RNN-based predictions would remain unchanged while simultaneously altering the trial-by-trial currents used for simulation. The modulations produced by these rescaled dynamics were systematically lower than the RNN-derived predictions indicating that the RNN-derived coefficients capture non-trivial features of the original trial-by-trial dynamics in vivo (Supplementary Fig. 9c, mean-squared error = 3.1 spikes/s, Pearson’s *r* = 0.85). Next, we checked whether the relationship between synaptic inputs and output modulation derived from our model was statistically meaningful by randomly shuffling the modulation values for RNN units and deriving coefficients that attempt to predict these random values from the synaptic structure. Using these shuffled RNN coefficients on the experimental data significantly reduced the accuracy of the predicted modulations, demonstrating that the success of our RNN-derived predictions was not due to chance (Supplementary Fig. 9d, mean-squared error = 4.9 spikes/s, Pearson’s *r* = 0.3).

Finally, to assess whether the inclusion of STDP in our model was necessary to predict the relationship between synaptic input and firing rate modulation, we derived parameters using only networks without STDP (Pre-STDP). If the input/output relationship observed did not depend on the synaptic structure induced by STDP, we would expect these networks to be equally predictive for neurons in vivo. While the predictions using Pre-STDP networks alone were correlated with the observed firingrate modulation they were systematically lower than the true value implying that STDP is required to correctly recapitulate the relationship between inputs and outputs observed in vivo (Supplementary Fig. 9e, mean-squared error = 3.1 spikes/s, Pearson’s *r* = 0.87). These findings indicate that our full RNN model including STDP successfully recapitulates the connection between synaptic structure and spiking response properties observed in vivo.

## Discussion

Our experimentally motivated spiking RNN model revealed that the diversity of neuronal response profiles is constrained by local synaptic structures and shaped by synaptic plasticity mechanisms. This model sits at the nexus between two recent trends in neural network modeling: First, recent work has successfully extended general-purpose learning algorithms (e.g., FORCE) designed for rate-based networks to networks with spiking units^{37,52,53,54}. Second, there has been renewed interest in using RNNs to understand the neuronal ensembles important for learning, memory storage, and task performance^{55,56} and the role of biologically motivated synaptic plasticity rules in forming these ensembles^{34,35,57}. Here, we have combined these approaches in a novel spiking RNN to investigate how they shape the synaptic organization underlying heterogeneous neuronal responses that drive task performance. This produced a ‘synaptic signature’ in terms of the monosynaptic/disynaptic connections to any given neuron, related to how that cell was wired into the network, which learning rules helped shape those connections, and the function of that cell for task performance.

Our model successfully captures several observations regarding sensory encoding in the auditory cortex. First, it accurately captures the distribution of response profiles observed in vivo. It qualitatively reproduces a wide range of response profiles spanning non-classically and classically responsive units and specifically captures the in vivo rat modulation distribution in detail (Fig. 2e). Moreover, we have demonstrated that STDP parameters are capable of altering both the median and range of the resulting neural response distribution suggesting that differences in STDP parameters may be responsible for differences in the experimentally observed response distributions between rats and mice (Supplementary Fig. 7b, c). Second, both classically and non-classically responsive units encode task information in their ISI distribution as has been observed experimentally^{16}. Critically, our model predicts the relationship between the synaptic input to a single unit embedded in a network performing a task and its observed task-related response properties. Moreover, it makes the key prediction that both classically and non-classically responsive units in the auditory cortex can contribute to task performance such that perturbation of either unit type should lead to classification impairments. Perturbation experiments in rodents have revealed that the contribution of the auditory cortex to perceptual decision making depends on details of the task design and difficulty^{38}. Muscimol inactivation studies suggest that auditory cortex is required for auditory stimulus classification tasks such as the one considered here^{7,16,39,58}. However, lesion and optogenetic inactivation studies show that the auditory cortex is not required for similar tasks^{38,59,60}. The difference between these types of loss of function experiments may still require appropriate controls for unambiguous interpretation^{38}. Our model incorporates essential biological features (spike timing, synaptic dynamics, and task performance) that, going forward, should enable us to quantify the cortical contributions (or lack thereof) to specific behaviors and tasks.

Notably, there are other important dimensions that might account for the biological basis of diverse response profiles such as dendritic geometry. It could be that non-classically responsive neurons have inputs organized differently than classically responsive neurons resulting in a differential somatic response via cable filtering^{61}. Intrinsic neuron properties may also change the dynamic behavior of single neurons. For example, integrator (class I) versus resonator (class II) neurons may respond to similar synaptic inputs with distinct spike patterns^{62,63}.

Previous work focused on rate-based networks where the network architecture is modified through backpropagation-through-time rather than biologically motivated plasticity rules. Instead, here we analyze the contribution of neural units and populations within a spiking network with biologically motivated plasticity rules such as STDP. We believe that our approach will help advance the new wave of ‘NeuroAI’, using RNN models to understand how the population dynamics of a single network can successfully perform multiple tasks^{55,56}.

Our model allows us to probe aspects of network function that would be challenging to address experimentally. In particular, perturbation of non-classically responsive units reveals that disrupting the spike times of units with limited firing rate modulation can nevertheless have a significant impact on task performance. (Fig. 3, Supplementary Fig. 5). Although inactivation does not reveal a categorical difference between the effect of perturbing non-classically and classically responsive units, it is remarkable that disrupting the timing of recurrent activity from non-classically responsive units has a greater impact on network performance than disruption of classically responsive activity (Fig. 3f). This finding highlights the importance of temporal coding (in addition to rate coding) for interpreting and explaining the network dynamics which drive behavior. Even small changes in network dynamics—e.g. adding, subtracting, or rearranging one or a few spikes via short-term plasticity or STDP—can have significant ramifications for the network activity driving behavior^{64,65,66,67,68}.

In principle and in practice, any neuron—or even every neuron—can contribute in some way to overall network dynamics and behavioral performance, regardless as to the degree of overt firing rate changes (i.e., classical responsiveness). Both classically and non-classically responsive units directly affected network task performance, and diverse neuronal responses throughout a population are likely essential for robustly supporting the dynamics required for sensorimotor transformations and adaptive behaviors. This diversity might also enable evidence accumulation, decision making, working memory^{15}, and learning in spiking RNNs^{69}, enabling neural processing and flexible computations over a range of spatiotemporal scales throughout the brain.

## Methods

### Electrophysiological recordings during behavior

All animal procedures were performed in accordance with National Institutes of Health standards and were conducted under a protocol approved by the New York University School of Medicine Institutional Animal Care and Use Committee. Animals were housed at room temperature (~22 °C) with a relative humidity of ~45% and a light-dark cycle of 12 h on/off (6:30 AM–6:30 PM light). All recordings were made in a dark, single-walled sound attenuating chamber that provided sound isolation and allowed for precise control over the acoustic environment. For single-unit recordings in freely moving rats, 5 adult male and 6 adult female Sprague-Dawley rats were trained to perform a go/no-go frequency recognition task as previously described^{16,58,70}. Animals were trained to respond via nosepoke to a target tone (4 kHz) for food reward and to withhold their response to nontarget tones (0.5,1, 2,8,16, 32 kHz). The response period was 2.5 sec and false alarms resulted in a 7 s timeout. All pure tones played were 100 ms duration, 3 ms cosine on/off ramps, at 70 dB sound pressure level (SPL). Behavioral events (stimulus delivery, food delivery, and nosepoke detection) were monitored and controlled with a custom-programmed microcontroller (Med Associates). All behavioral events were registered as TTL pulses. Speaker outputs were also recorded separately to ensure stimulus identity and timing alignment with outputs recorded via TTL. Nose pokes were detected by an infrared beam break. These behavioral events were then integrated with the neural recording signal using a signal processor (Blackrock Microsystems, Cerebrus Neural Signal Processor, 30 kS/s sampling rate). After animals reached behavioral criteria (percent correct: ≥70%, *d*’: ≥1.5), rats were anesthetized with ketamine (40 mg/kg) and dexmedetomidine (0.125 mg/kg) and implanted with tetrode microdrive arrays (Versadrive-8 Neuralynx) in right auditory cortex as previously described^{16}. Prior to implantation with a multielectrode array, primary auditory cortex (A1) was coarsely mapped by recording multiunit responses using a tungsten electrode. Tetrodes were advanced around 60 µm the day prior to recordings to a maximum of 2 mm from the pial surface and recordings were made from middle to deep cortical layers (putative cortical layers 3 to 6). Signals were filtered between 250 Hz and 5 kHz and digitized at 30 kHz. All above-threshold events with signal-to-noise ratios > 3:1 were stored for offline spike sorting. Single units were identified on each tetrode using OfflineSorter (Plexon Inc) by manually classifying spikes projected as points in 2D or 3D feature space. Clustering quality was evaluated using the Isolation Distance and L_{ratio} sorting quality metrics. The animals and units shown were previously described^{16}.

For cell-attached recordings in head-fixed mice, 4 adult male and 6 adult female C57Bl/6 mice were anesthetized with isoflurane (3% during induction, 2% during surgery), and a custom-designed stainless steel headpost was affixed to the skull with dental cement (Metabond). Following 7+ days of recovery and 7+ days of subsequent water restriction, mice were trained on a go/no-go frequency-recognition task^{7}. Animals were trained to respond to the target tone (11.2 kHz) by licking for water reward and to withhold responses to the non-target tone (5.6 kHz). Acoustic stimuli were 100 ms duration, 3 ms cosine on/off ramps, at 70 dB SPL. Animals had 2.5 s to respond and false alarms resulted in a 7 s timeout. Behavioral events (stimulus delivery, water delivery, and lick detection) were monitored and controlled by custom-written programs in MATLAB that interfaced with an RZ6 processor (Tucker-Davis Technologies). All behavioral events were registered as TTL pulses. Speaker outputs were also recorded separately to ensure stimulus identity and timing alignment with outputs recorded via TTL. After animals reached behavioral criteria (percent correct: ≥70%, and d’: ≥1.5), mice were anesthetized with isoflurane and a 3 mm diameter glass cranial window with a small 200 µm hole to allow for pipette access was implanted over auditory cortex (1.75 mm anterior to the lambdoid suture). After recovery, in vivo cell-attached or whole-cell recordings were obtained from neurons located 300–900 µm below the pial surface during behavior as previously described^{7}. We ensured that the recordings were made from primary auditory cortex (A1) based on the tonotopic gradient and short-latency tone onset responses. Recordings were made in a sound-attenuation chamber (Eckel) using a Multiclamp 700B amplifier (Molecular Devices). For voltage-clamp experiments, whole-cell pipettes (5–7 MΩ) contained (in mM): 130 Cs-methanesulfonate, 4 TEA-Cl, 4 MgATP, 10 phosphocreatine, 10 HEPES, 1 QX-314, 0.5 EGTA, 2 CsCl, pH 7.2, *R*_{i} = 257 ± 92 MΩ (s.d.), *R*_{s} = 67 ± 59 MΩ (s.d.). Data were filtered at 2 kHz, digitized at 20 kHz, and analyzed with Clampfit 10 (Molecular Devices). For classically responsive neurons, *R*_{i} = 278 ± 112 MΩ (s.d.), *R*_{s} = 69 ± 76 MΩ (s.d.) and for non-classically responsive neurons, *R*_{i} = 234 ± 84 MΩ (s.d.), *R*_{s} = 64 ± 54 MΩ (s.d.). Cells were held at −70 mV to measure EPSCs and above 0 mV for IPSCs.

### Characterization of response profiles using a continuous measure

To comprehensively characterize spiking responses, we used a continuous measure of responsiveness which generalizes the binary classification (classically vs. non-classically responsive) we used previously^{16}. Our continuous measure of responsiveness quantified the degree to which a cell exhibited firing rate changes during both the stimulus and choice periods. For the experimental data, we calculated the trial-averaged change in firing rate for each neuron during stimulus presentation relative to intertrial baseline, \({R}_{{st}}\), using a 150 ms window from stimulus onset to 50 ms post-stimulus to capture offset responses. The trial-averaged change in firing rate prior to behavioral choice, \({R}_{{ch}}\), was calculated using a window spanning the 500 ms prior to behavioral response on ‘go’ trials and 500 ms prior to the average behavioral response on ‘no-go’ trials. For spiking RNN units, stimulus modulation was calculated using the 100 ms stimulus period and choice modulation was calculated using the 100 ms choice period.

Our overall measure of firing rate modulation, *R*, combined these two terms in quadrature so that both stimulus- and choice-related firing rate changes must be small for a unit to be characterized as having a low firing rate modulation (i.e., have a more non-classically responsive response profile),

This measure captures the detailed firing rate modulation of individual units during both the stimulus and response periods. It provides information about the degree to which a unit is classically responsive such that values close to 0 are only possible when a unit is non-classically responsive (e.g., a unit with firing rate modulation of 0.1 spikes/s would be classified as a non-classically responsive unit whereas we would consider 5 spikes/s as highly classically responsive).

### Discrete characterization of classically and non-classically responsive units

Statistical identification of classically and non-classically responsive units followed our previous methods^{16}. We used two positive statistical tests for non-classical responses to establish lack of responses during either the stimulus and/or response periods. The test compared the number of spikes during each of these windows to inter-trial baseline. Given that spike counts are discrete, bounded, and non-normal, we used subsampled bootstrapping to evaluate whether the mean change in spikes during tone presentation or the response period was sufficiently close to zero (in our case, 0.2 spikes). We subsampled 90% of the spike count changes from baseline, calculated the mean of these values, and repeated this process 5000 times to construct a distribution of means. If 95% of the subsampled mean values were between −0.2 and 0.2, we considered the cell sensory non-classically responsive (*p* < 0.05). This is a conservative, rigorous method for identifying a cell or unit as being ‘non-classically responsive’^{16}.

### Spiking recurrent neural network model

To study the origin and functional contributions of diverse neural response profiles, we simulated a spiking neural network of 1,000 sparsely connected (5% connection probability) leaky integrate-and-fire units (800 excitatory, 200 inhibitory) with current-based synaptic input. All parameters listed in Supplementary Table 1. The temporal evolution of the membrane voltage \({V}_{i}\) of unit *i* is

where *τ*_{m} = 20 ms is the membrane time constant, *V*_{r} = −65 mV is the resting membrane potential, *I*_{Ei}*(t)* and *I*_{Ei}*(t)* are the recurrent EPSCs and IPSCs to unit *i*, respectively, and \({I}_{0}\) is the leak current. Upon reaching a threshold value of *V*_{th} = −55 mV the unit emits an action potential and its membrane voltage is reset to *V*_{r}.

EPSCs and IPSCs decay exponentially with time constants of *τ*_{E} = 20 ms and *τ*_{I} = 20 ms respectively such that if neuron *j* synapses onto neuron *i* with synaptic weights *W*_{ij} and fires action potentials at times {*t*_{jk}} the excitatory and inhibitory currents are

Where Θ is the Heaviside step function. Non-zero values of the weight matrix *W*_{ij} were initialized to a uniform distribution between 0 and a maximum value. The initial mean value was set differently for each connection type in our network (excitatory-to-excitatory, inhibitory-to-excitatory, excitatory-to-inhibitory, inhibitory-to-inhibitory) to ensure initial chaotic dynamics amenable to FORCE training (see below ‘Task and FORCE training’). Initial output weights scaled by the square root of the average number of incoming connections from each subpopulation (excitatory or inhibitory):

Excitatory-to-inhibitory and inhibitory-to-inhibitory weights remained fixed throughout the simulation. In contrast, excitatory-to-excitatory and inhibitory-to-excitatory weights were modified by a form of spike timing plasticity (see below ‘Synaptic plasticity mechanisms’).

### Task and FORCE training

The network was trained on a go/no-go stimulus classification task similar to that used experimentally for rats and mice^{16,58,70}. During a 100 ms stimulus period, the network was stimulated with one of seven possible inputs (corresponding to frequencies of 0.5, 1, 2, 4, 8, 16, 32 kHz), and trained to produce an output during the subsequent 100 ms response period if the input was the 4 kHz target tone, while remaining at baseline for all other non-target tones. In between each 200 ms trial were inter-trial intervals randomly chosen from a uniform distribution between 100 and 400 ms.

A subset of excitatory units were designated as input units (*N*_{in} = 200) that received additional current during the stimulus period. Our stimuli were represented using a place code. For each stimulus *s* a fixed subset of units *G*_{s} received an additional fixed current *I*_{in} while all other input units received no additional current:

The input current magnitude, *I*_{in}, was minimized while ensuring that the network could still perform the task. The remaining excitatory units were output units (*N*_{out} = 600) which projected an additional set of weights, *w*, to a readout node whose activity, *z*_{out}*(t)*, represents the response of the network. The activity of the readout node is a weighted sum of the activity of all output units smoothed by an exponential kernel with time constant *τ*_{out} = 100 ms. If output unit *i* fires action potentials at times{*t*_{ik}}, its smoothed output is

and the readout node activity is calculated as:

The network was trained to produce a burst in readout node activity when the target stimulus was presented (*s* = *T*) and remain at baseline for all other stimuli (*s* ≠ *T*) using a version of FORCE training adapted to spiking recurrent neural networks^{36,37}. Specifically, *z*_{out}*(t)* was trained to approximate:

FORCE training requires that network output units receive feedback from the readout node in the form of an additional current. If *I*_{FB i}*(t)* is the feedback current to readout node *i* then

where *Q* is the network-wide feedback strength, *η*_{i} is the fixed feedback weight onto output unit *i* chosen from a uniform distribution between −1 and 1.

During FORCE training, the network iteratively modified the output weights \({w}_{i}\) to reduce the error between the network output and the desired output function: *e(t)* = *f*_{out}*(t) – z*_{out}*(t)*. Updates to the output weights were made at random times with an average interval of *T*_{FORCE} = 4 ms. Using bold font to denote vectors and matrices, the learning rule for a given updated interval of *Δt* is:

where *P(t)* is the network estimate for the inverse of the correlation matrix and is updated according to

Initial weights, *w(0)*, were chosen from normally distributed gaussian values with a standard deviation of *k*_{0} = 0.1 / *N*_{out} and P(0) = *I* where *I* is the identity matrix and *λ* is a model parameter which acts as a regularizer such that:

In our network, *λ* = 1. Once training was complete output weight *w* remained fixed.

After output weights stabilized and networks reached asymptotic performance (i.e., after 2000 to 5000 trials), all weights were fixed and additional trials were run to evaluate network performance. Network performance was calculated by examining the integrated output activity during the response period (100 to 200 ms):

An optimal threshold was calculated to distinguish the integrated output on target versus non-target trials by regressing the trial type (target vs. non-target) against the integrated output activity, *R*, using logistic regression. Integrated outputs above/below this threshold were considered go/no-go responses. All d’ were calculated using these response designations.

### Synaptic plasticity mechanisms

FORCE training modified the output weight vector *w* while the recurrent weight matrix was modified by homo- and heterosynaptic forms of STDP. All recurrent inputs to excitatory cells were plastic and we used distinct homosynaptic mechanisms for excitatory-to-excitatory synapses and inhibitory-to-excitatory synapses. Inputs to inhibitory units remained fixed throughout training and testing.

#### Homosynaptic excitatory-to-excitatory plasticity

In our model, homosynaptic excitatory-to-excitatory plasticity follows a standard Hebbian model^{40,71} in that when a presynaptic cell fired before a post synaptic cell, long-term potentiation (LTP) occurred and when a postsynaptic cell fired before a presynaptic cell, long-term depression (LTD) occurred. The rule can be expressed as

Where *z*_{+j}*(t)* and *z*_{-j}*(t)* are each increased by 1 each time neuron *j* fires an action potential and exponentially decay with a time constant of *τ*_{+} = *τ*_{−} = 20 ms and *A* = 0.001 and *B* = 0.00105 represent the strength of LTP and LTD respectively.

#### Homosynaptic inhibitory-to-excitatory plasticity

Inhibitory-to-excitatory homosynaptic plasticity was based on experimental^{42} and theoretical^{43} work demonstrating that synapses between inhibitory and excitatory auditory cortical cells undergo LTP when spike timing is synchronous regardless of order and undergo LTD when firing is asynchronous,

where *η*_{I} = 0.001 is the overall strength of inhibitory-to-excitatory plasticity, *α* represents the strength of LTD (see “Training Protocol” for more information). *z*_{I j}*(t)* increases by 1 each time neuron *j* fires an action potential and exponentially decays with a time constant of *τ*_{I} = 5 ms. This time constant was set to match the crossover time scale of LTP to LTD observed experimentally^{42}.

#### Heterosynaptic inhibitory-to-excitatory and excitatory-to-excitatory plasticity

Given the instability of pairwise Hebbian excitatory plasticity^{34,72}, we included two forms of heterosynaptic plasticity on excitatory-to-excitatory and inhibitory-to-excitatory synapses based on previous spiking RNN studies^{35} which would (1) systematically weaken all presynaptic weights to prevent any one presynaptic connection from dominating (heterosynaptic balancing)

and (2) systematically strengthen postsynaptic weights to prevent a weakened synapse from dropping out entirely (heterosynaptic enhancement)

### Training protocol

In general, networks were trained until output weights, recurrent weights, and network behavior stabilized (2000–5000 trials). In addition to the dynamic mechanisms listed above the network-wide bias current, *I*_{0}, was tuned so that inhibitory firing was on average *r*_{I} ≈ 20 spikes/s across the population. This was accomplished via a learning rule which adjusted the bias current after each trial by

where *η*_{r} = 0.005 is the bias current learning rate and *R*_{I} is the average firing rate of all inhibitory cells.

Given these three plasticity mechanisms (STDP, FORCE, and bias current adjustment) training proceeded in a staged manner to ensure learning for each mechanism occurred in a regime where major initial changes induced by other mechanisms had subsided and subsequent plasticity could be regarded as quasi-stable. (1) Initially only bias current adjustment was active in order to set inhibitory rates to their desired firing rate prior to activating activity dependent plasticity mechanisms (STDP). (2) After 40 trials, all STDP mechanisms were activated, and bias currents were permitted to keep adjusting to maintain inhibitory rates near their target value. During this period, inhibitory plasticity adjusted excitatory firing rates towards a target value set, *r*_{E} = 10 spikes/s. This value is determined via the strength of inhibitory-to-excitatory LTD (Eq. 15) by the equation^{43}

(3) After an additional 60 trials (trial 100), FORCE training was activated once inhibitory and excitatory rates had reached their target values. STDP and bias current adjustment was maintained. (4) After an additional 100 trials (trial 200), bias current adjustment ceased and STDP and FORCE training remained active simultaneously for the remainder of the training session. The observed boost in performance occurred when STDP and FORCE were simultaneously active for at least ~1000 trials (Supplementary Fig. 2d) indicating that the two mechanisms can interact productively.

### Simulation details and code

All simulations were carried out via an event-based simulator which integrated all dynamical variables between spiking events. All simulations were all conducted in Julia 1.7.2 with standard packages and custom written code to run simulations^{73} (see GitHub repository at https://github.com/albannalab/InsanallyAlbanna-NatComm-2024/). See Brette et al. for a description of the method and comparison with other methods^{74} and Engelken for implementation details^{75}. Effectively, the main loop of the simulator runs as follows (all quantities beginning with a capital letter below represent arrays calculated across the network:

WHILE t_current <t_trial: # Determining input currents I_in = Input current I_force = FORCE feedback current I_new = I_background + I_old + I_in + I_force + PSPs # Integrating to next spike time Time_to_next_spike = INTEGRATE_MEMBRANE_EQUATIONS(I_new, I_old) delta_t = min(Time_to_next_spike) spiking_idx = argmin(Time_to_next_spike) t_current += delta_t # Updating PSPs, output, recurrent weights, and output weights Network_activity[spiking_idx] += t_current PSPs = UPDATE_PSP(PSPs, Network_activity) z_out = CALCULATE_READOUT_ACTIVITY(Network_activity)

W = STDP(W, spiking_idx, Network_activity)

W_out = FORCE(W_out, Network_activity)

### Single-trial, ISI-based Bayesian decoding

We applied a single-trial Bayesian ISI-based trial-by-trial decoding algorithm previously described^{16}. In brief, using a training set composed of 90% of the data recorded trials the probability density function for observing an ISI on target/nontarget trials (or go/no-go trials) was inferred (p(target), p(non-target), p(go), and p(no-go)) via kernel density estimation with the bandwidth set by cross-validated maximum likelihood estimation. These probability density functions were used to infer the probability of a stimulus and choice from the observed ISIs, {ISI}, on a new trial taken from the remaining 10% of test trials via Bayes rule (assuming statistical independence between the ISIs observed)

### Small-world path length analysis

To calculate the shortest path length shown in Supplementary Fig. 4c, we reduced our synaptic connection matrix *W* by setting a weight threshold, culling connections whose weights fall below said threshold and using the remaining weights to define the adjacency matrix. To calculate the mean shortest path lengths of the network, we performed a breadth-first search from each neuron along its outgoing connections modified to also calculate the shortest path from a neuron to itself (either a self-edge or a cycle in the network). The mean of all distances across all starting neurons is taken as the mean shortest path length for a given culling thresholds.

We compared these results against the same calculation performed on Watts-Strogatz small-world graphs which contain a mixture of regular local structure and random global structure. Previous work has suggested that cortical neural networks display connection statistics (such as mean path length) more consistent with a small-world network rather than one with purely random global connections^{46,48}. Watts-Strogatz small-world networks vary parametrically from entirely local structure to entirely global structure via a parameter *β* spanning from 0 (completely regular ring-lattice) to 1 (completely random connections between vertices). Note that this parameter is unrelated to the heterosynaptic balancing parameter *β*. To compare the culled adjacency matrix from our model to a Watt-Strogatz small-world network, we match the number of edges in the Watts-Strogatz graphs to the number of connections in the culled networks and generate the small-world network by first generating a bidirectional regular ring lattice with the same number of unidirectional edges as the adjacency matrix derived from our network and assign each unidirectional edge to a random endpoint with chance *β*.

### Inactivation experiments

Because recurrent and output connections play qualitatively different roles in network dynamics we used separate procedures to inactivate each type of connection. Full inactivation of a unit employed output and recurrent inactivation procedures simultaneously. To inactivate the output contributions of a neuron, its output weight was held at zero so that its activity made no contribution to the activity of the readout node. To inactivate a neuron’s recurrent contributions, the neuron was not silenced but rather its effect on postsynaptic neurons was replaced by a Poisson process that fired with a fixed rate equivalent to that of the neuron that was being replaced. Using this approach, we could be certain that the deficits observed were not caused by an overall decrease in network synaptic current (the original unit and Poisson unit fired at the same average rate) but could instead be attributed to the removal of all spike timing information present in the unit’s firing pattern.

Inactivation targeting classical/non-classical subpopulations proceeded by characterizing the firing rate modulation (see “Characterization of response profiles using a continuous measure”) and inactivating in order from most to least classically/non-classically responsive unit. For example, inactivating 10% of output units during the experiment targeting the non-classically responsive subpopulation would correspond to inactivating the top 10^{th} percentile of non-classically responsive units. Variability during the choice period was evaluated by calculating the root mean squared error between the readout node activity and correct output function on each trial.

### Synaptic motif cumulant calculations

Synaptic motif cumulants represent the extent to which a pattern of synaptic connections (e.g., a disynaptic chain) between two subpopulations (in our case, input target units, input nontarget units, output units, or inhibitory units) are present relative to chance combinations of motifs with fewer synaptic connections^{50,51}. Recent work has used calculated average motif cumulants across the network, but here we extend this work by examining motif cumulants for each network unit on an individual basis to examine how these synaptic patterns relate to the response profiles of individual units.

A synaptic motif is defined as the average product of synaptic weights present in a specified pattern of connections. For example, the n-chain motif, \({\mu }_{n}^{{ch}}\), is the average product of synaptic weights in a n-synapse chain of unidirectional connections from one unit to another and is calculated using the expression

Where *W* is the synaptic weight matrix, *N* is the number of network units, and 〈⋅〉 denotes the average over all matrix elements. The two other motifs shown to be significant for network dynamics are the (m,n)-diverging and (m,n)-converging motifs, \({\mu }_{m,n}^{{di}}\) and \({\mu }_{m,n}^{{co}}\), which describe when two chains (of length *m* and *n*) diverge from the same unit or converge onto the same unit. For 2^{nd} order motifs (disynaptic) these are the only other two possible motifs beyond chain motifs and are calculated

To decompose these motifs into motif cumulants we introduce

and define the n-chain, (m,n)-diverging, and (m,n)-converging motif cumulants as

The motifs can then be decomposed in terms of the motif cumulants as

where \(C\left(n\right)\) represents all possible sets \(\{{n}_{1},\ldots,{n}_{t}\}\) of non-zero integers such that \({\sum }_{i=1}^{t}{n}_{i}=n\) excluding the set containing only one element \(\{n\}.\) The sum represents all possible ways of constructing the motif from lower order cumulants so we can interpret the final term on the right hand side as the contribution that cannot be attributed to lower order terms.

The equations above can be generalized if the network is composed of *N* units divided into *k* subpopulations. We specify each subpopulation \({P}_{q}\) of size \({N}_{q}\) (in our case, target input units, non-target-input units, output units, and inhibitory units) using \({u}_{q}\), a column vector of length 1 with equal entries for the components corresponding to members of the subpopulation and 0 for all other components. In other words, for subpopulation *i* and unit *j* the components of vector \({u}_{q}\) are

We then specify the \(N\times k\) matrix, *U*, as the concatenation of these subpopulation vectors,

which in component notation is simply \({U}_{{jq}}={u}_{{qj}}\). Similarly, we define \(\widetilde{U}\) via

We now define a matrix of subpopulation motifs corresponding to the average product of synaptic weights present in specified pattern of connections where the first and last units of the motif are in subpopulation *r* and *q* respectively,

Where \({\langle \cdot \rangle }_{{qr}}\) denotes the average over initial subpopulation *r* and final subpopulation *q*. In matrix form we write the motifs as *k* × *k* matrices

As expected, these subpopulation motifs can be used to calculate the total motifs using a weighted average. For example, the n-chain motif is calculated from the subpopulation motifs

As in the single population case, these subpopulation motifs can be broken down into a series of subpopulation motif cumulants. To calculate the subpopulation motif cumulants we follow the same process as the single population case. Defining

The *k* × *k* matrix of average n-chain cumulants between each subpopulation is then calculated as

and (m,n)-divergent and (m,n)-convergent motif cumulants are calculated

We extend this previous work by using these expressions to calculate subpopulation motif cumulants for each individual network unit. Since the initial and final \(\widetilde{U}\) terms serve to average over the initial and final subpopulation respectively, we define the average subpopulation motif cumulants into each unit (a *N* × *k* matrix) or out of each unit (a \(k\times N\) matrix) by removing the \({\widetilde{U}}^{T}\) or \(\widetilde{U}\) term. Denoting these individual motif cumulant matrices \(\hat{\cdot }\), we then have

where \({\hat{\kappa }}_{n}^{{ch}}\) represents the n-chain subpopulation motif cumulants terminating in the unit of interest and \({\hat{\kappa }}_{n}^{{chR}}\) represents n-chain subpopulation motif cumulants originating in the unit of interest. (m,n)-divergent and (m,n)-convergent motifs are symmetric so we only require one expression for each \(N\times k\) matrix.

### Statistical synaptic motif model for output unit modulation

Cells which project to the output unit receive direct feedback projections, *η*, from the output unit, therefore we first examined the relationship between the stimulus- or choice-related firing rate modulation and the magnitude of feedback received. The output unit’s activity differs systematically on “go” vs. “no-go” trials, implying that this relationship should be particularly strong for choice-related activity. This prediction is also supported by theoretical work examining the connection between connectivity and dynamics in similar networks^{76}. By fitting the models

we observed linear correlations between stimulus and choice-related responses and the strength of the feedback connections, η, both for networks including and excluding STDP with choice-related activity being the most strongly correlated (\({r}_{{stimulus}}^{2} \, \approx \, 0.4 , {r}_{{choice}}^{2} \, \approx \, 0.8\)). However, the precise relationship between output feedback and single output unit modulation varies from condition to condition (pre-STDP, post-STDP, EE only, IE only) and network to network demonstrating that this relationship is modulated by changes to the recurrent connectivity. In other words, the coefficients for this model (slope and y-intercept) were not universal and varied across and within conditions. In other words, feedback magnitude can predict which units will become the most stimulus or choice modulated within a network, but the factors that determine the precise relationship between the feedback strength and a unit’s response profile are unexplained.

Our goal then was to explain the observed relationship between firing rate modulation and feedback strength using only the prevalence of individual subpopulation motif cumulants in a universal model which applies across conditions. Such a model provides a detailed understanding of the synaptic features relevant for generating a particular response profile as it accounts for the variability using coefficients tied to each synaptic motif cumulant that apply across conditions. To accomplish this we included these motifs as linear regressors in place of the unknown coefficients from the previous model (Eq. 37). Summarizing the individual subpopulation motif cumulants of order \({n}_{s}\) (i.e., 1 is monosynaptic, 2 is disynaptic, etc.) from subpopulation *q* (target input units, nontarget input units, output units, inhibitory units) as

We can then write a model for the stimulus and choice modulation including all subpopulations *q* and cumulants up to order \({n}_{s}\) as

Note that in this model each synaptic motif cumulant receives two coefficients: one for the interaction with the output feedback and one for feedback independent effect. All coefficients are universal in that they are fit across network conditions meaning that they quantify the contribution of each motif to stimulus and choice modulation under all observed network conditions. This model was fit using the Python statsmodels package with LASSO regularization to remove regressors with small coefficients. All calculations were done with \({n}_{s}=2\) (monosynaptic and disyanptic motif cumulants) because higher-order models showed marginal improvement as measured by the AIC criterion. Once statistically significant coefficients were identified (p < 0.01 Bonferroni-correction for number of motif cumulants included), we refit the model with only significant motif cumulants.

To calculate the overall contribution of a particular motif *κ* to either stimulus or choice modulation for a unit, \({R}_{{st}/{ch}}\), from Eq. 39 let \({\beta }_{\kappa }^{\eta }\) be the *η* interaction coefficient for cumulant *κ* and \({\beta }_{\kappa }\) be the independent coefficient and define the contribution from each cumulant as

such that

Given the definition of overall firing rate modulation, *R*, as \({R}^{2}={R}_{{st}}^{2}+{R}_{{ch}}^{2}\) we can decompose it into a linear combination of motif cumulant related terms

where the contribution of any given cumulant to the overall modulation squared is defined as

### Spiking simulations using measured synaptic inputs

For two units, cell-attached spikes were first recorded and then after breaking into the cell, EPSCs and IPSCs were also measured for the same neuron. For all other units, spiking activity was simulated trial-by-trial using the measured excitatory and inhibitory post-synaptic currents (E/IPSCs) via an integrate-and-fire point neuron simulation based on previously described methods^{7}. The simulation relies on conductance-based dynamics

where *V* is the membrane voltage, \({V}_{r}\) is the resting membrane potential, and \({\tau }_{m}={R}_{m}{C}_{m}\) is the membrane time constant. \({V}_{E/I}\) and \({g}_{E/I}\left(t\right)\) are the excitatory/inhibitory reversal potentials and time based conductances, respectively. Spiking threshold was set to \({V}_{{th}}=-40\,{{{{{\rm{mV}}}}}}\) and simulated neurons were constrained with a refractory period of \(5\,{{{{{\rm{ms}}}}}}\).

Model parameters for individual neurons were derived using a voltage pulse of \(\varDelta V=\,10\,{{{{{\rm{mV}}}}}}\), the membrane capacitance (*C*), input resistance (\({R}_{i}\)), and series resistance (\({R}_{s}\)) were calculated from the current, \(I\left(t\right)\) via

where \(I\left(0\right)\) is the initial current on pulse onset, \(I\left(\infty \right)\) is the asymptotic current, and *τ* is the measured exponential decay constant for \(I\left(t\right)\).

PSC time courses in individual trials were fit to a standardized parametric form incorporating the maximum current (\({I}_{\max }\)), the time of max current (\({t}_{\max }\)), the rise time to half max (\({t}_{{rise}}\)), and the fall time to half max (\({t}_{{fall}}\))

where \({t}_{0}={t}_{{rise}}\left(\frac{{t}_{{fall}}}{{t}_{{rise}}+1}\right)\) is an offset requires so that \(I\left({t}_{\max }\right)={I}_{\max }.\) PSCs were then converted to the conductances, \({g}_{E/I}\left(t\right)\) used in the simulation by calculating the synaptic currents \({I}_{{syn}}\left(t\right)=I\left(t\right)\frac{{R}_{{in}}+{R}_{s}}{{R}_{s}}\) and converting to conductance using the holding potential, \({V}_{h}\), \(g\left(t\right)=\frac{{I}_{{syn}}\left(t\right)}{{V}_{h}-{V}_{r}}\). The conductance terms used in the simulation also incorporated noise set to 10% of the average conductance values.

To generate spiking activity for an individual trial, one EPSC and one IPSC measured during stimulus presentation were randomly selected and used to calculate conductance dynamics for simulation. The process was repeated for am EPSC and IPSC taken in the 200 ms prior to stimulus onset to determine baseline activity. This process was repeated 2000 trials and the firing rate modulation during the stimulus period was calculated as the average difference between stimulus-evoked and baseline firing rate.

### Predicting in vivo firing rate modulation using motifs from spiking RNN

To validate our spiking RNN model, we applied the statistical synaptic motif model to predict the response profiles of cortical neurons recorded from behaving animals using only measured average synaptic inputs. Because the statistical model was trained on a diversity of network structures and response profile distributions, the coefficients of our model are applicable even in cases where the overall firing statistics differ from that of the full post-STDP network.

To apply our statistical motif model to predict the stimulus-related firing rate modulation of in vivo neurons, we first fit a simplified version of our statistical model that only included monosynaptic inputs from two subpopulations (inhibition and excitation) using data from RNNs under all STDP conditions. This model predicts the stimulus modulation of an individual RNN unit from its average excitatory and inhibitory synaptic inputs. We then used this model to predict the stimulus modulation of a cell in vivo by dividing the average excitatory/inhibitory conductance values by the average number of inputs from each cell type in our model (30 for excitation and 10 for inhibition) as a proxy for that cell’s average monosynaptic excitatory and inhibitory inputs. These values were then fed to our statistical model to predict the firing rate modulation.

To ensure that these predictions were non-trivial we ran two controls. The ‘rescaled conductance’ control preserved the average conductance values for each cell but re-ran simulations using trial-by-trial peak conductance that had beet rescaled relative to the mean conductance value for that cell (trial-by-trial peaks were brought closer to the mean by a factor of 2). This control preserved the RNN-derived predictions while altering the dynamics which produced the simulated results. The ‘shuffled RNN control’ randomly shuffled all unit’s modulation values in our RNN before fitting the synaptic motif model to generate the coefficients predicted by chance. These coefficients were then used in place of the true coefficients to determine if the RNN-derived predictions could be explained by chance.

### Reporting summary

Further information on research design is available in the Nature Portfolio Reporting Summary linked to this article.

## Data availability

Source data are provided with this paper. Additional data that support the findings of this study are available from the corresponding authors upon request. Source data are provided with this paper.

## Code availability

Source code is available on Github^{73} (https://github.com/albannalab/InsanallyAlbanna-NatComm-2024).

## References

Gerstner, W., Kistler, W. M., Naud, R. & Paninski, L.

*Neuronal Dynamics: From Single Neurons to Networks and Models of Cognition*. (Cambridge University Press, 2014). https://doi.org/10.1017/CBO9781107447615.Musall, S., Kaufman, M. T., Juavinett, A. L., Gluf, S. & Churchland, A. K. Single-trial neural dynamics are dominated by richly varied movements.

*Nat. Neurosci.***22**, 1677–1686 (2019).Goard, M. J., Pho, G. N., Woodson, J. & Sur, M. Distinct roles of visual, parietal, and frontal motor cortices in memory-guided sensorimotor decisions.

*eLife***5**, e13764 (2016).Osako, Y. et al. Contribution of non-sensory neurons in visual cortical areas to visually guided decisions in the rat.

*Curr. Biol.***31**, 2757–2769.e6 (2021).Guitchounts, G., Masís, J., Wolff, S. B. E. & Cox, D. Encoding of 3D head orienting movements in the primary visual cortex.

*Neuron***108**, 512–525.e4 (2020).Rodgers, C. C. & DeWeese, M. R. Neural correlates of task switching in prefrontal cortex and primary auditory cortex in a novel stimulus selection task for rodents.

*Neuron***82**, 1157–1170 (2014).Kuchibhotla, K. V. et al. Parallel processing by cortical inhibition enables context-dependent behavior.

*Nat. Neurosci.***20**, 62–71 (2017).Francis, N. A. et al. Small networks encode decision-making in primary auditory cortex.

*Neuron***97**, 885–897.e6 (2018).Insanally, M. N., Köver, H., Kim, H. & Bao, S. Feature-dependent sensitive periods in the development of complex sound representation.

*J. Neurosci.***29**, 5456–5462 (2009).Otazu, G. H., Tai, L.-H., Yang, Y. & Zador, A. M. Engaging in an auditory task suppresses responses in auditory cortex.

*Nat. Neurosci.***12**, 646–654 (2009).Schneider, D. M., Nelson, A. & Mooney, R. A synaptic and circuit basis for corollary discharge in the auditory cortex.

*Nature***513**, 189–194 (2014).Schneider, D. M., Sundararajan, J. & Mooney, R. A cortical filter that learns to suppress the acoustic consequences of movement.

*Nature***561**, 391–395 (2018).Rodgers, C. C. et al. Sensorimotor strategies and neuronal representations for shape discrimination.

*Neuron***109**, 2308–2325.e10 (2021).Raposo, D., Kaufman, M. T. & Churchland, A. K. A category-free neural population supports evolving demands during decision-making.

*Nat. Neurosci.***17**, 1784–1792 (2014).Scott, B. B. et al. Fronto-parietal cortical circuits encode accumulated evidence with a diversity of timescales.

*Neuron***95**, 385–398.e5 (2017).Insanally, M. N. et al. Spike-timing-dependent ensemble encoding by non-classically responsive cortical neurons.

*eLife***8**, e42409 (2019).Mante, V., Sussillo, D., Shenoy, K. V. & Newsome, W. T. Context-dependent computation by recurrent dynamics in prefrontal cortex.

*Nature***503**, 78–84 (2013).Rigotti, M. et al. The importance of mixed selectivity in complex cognitive tasks.

*Nature***497**, 585–590 (2013).Leavitt, M. L., Pieper, F., Sachs, A. J. & Martinez-Trujillo, J. C. Correlated variability modifies working memory fidelity in primate prefrontal neuronal ensembles.

*Proc. Natl Acad. Sci.***114**, E2494–E2503 (2017).Carcea, I. et al. Oxytocin neurons enable social transmission of maternal behaviour.

*Nature***596**, 553–557 (2021).Kohl, J. et al. Functional circuit architecture underlying parental behaviour.

*Nature***556**, 326–331 (2018).Karigo, T. et al. Distinct hypothalamic control of same- and opposite-sex mounting behaviour in mice.

*Nature***589**, 258–263 (2021).Meshulam, L., Gauthier, J. L., Brody, C. D., Tank, D. W. & Bialek, W. Collective behavior of place and non-place neurons in the hippocampal network.

*Neuron***96**, 1178–1191.e4 (2017).Gauthier, J. L. & Tank, D. W. A dedicated population for reward coding in the hippocampus.

*Neuron***99**, 179–193.e7 (2018).Fenton, A. A. & Muller, R. U. Place cell discharge is extremely variable during individual passes of the rat through the firing field.

*Proc. Natl Acad. Sci.***95**, 3182–3187 (1998).Liberti, W. A., Schmid, T. A., Forli, A., Snyder, M. & Yartsev, M. M. A stable hippocampal code in freely flying bats.

*Nature***604**, 98–103 (2022).Engelhard, B. et al. Specialized coding of sensory, motor and cognitive variables in VTA dopamine neurons.

*Nature***570**, 509–513 (2019).Choi, J. Y. et al. A comparison of dopaminergic and cholinergic populations reveals unique contributions of VTA dopamine neurons to short-term memory.

*Cell Rep.***33**, 108492 (2020).Guo, L., Weems, J. T., Walker, W. I., Levichev, A. & Jaramillo, S. Choice-selective neurons in the auditory cortex and in its striatal target encode reward expectation.

*J. Neurosci.***39**, 3687–3697 (2019).Jaramillo, S. & Zador, A. M. The auditory cortex mediates the perceptual effects of acoustic temporal expectation.

*Nat. Neurosci.***14**, 246–251 (2010).Parthasarathy, A. et al. Mixed selectivity morphs population codes in prefrontal cortex.

*Nat. Neurosci.***20**, 1770–1779 (2017).Reddy, L. et al. Theta-phase dependent neuronal coding during sequence learning in human single neurons.

*Nat. Commun.***12**, 4839 (2021).Leavitt, M. L. & Morcos, A. Selectivity considered harmful: evaluating the causal impact of class selectivity in DNNs. Preprint at https://arxiv.org/abs/2003.01262 (2020).

Litwin-Kumar, A. & Doiron, B. Formation and maintenance of neuronal assemblies through synaptic plasticity.

*Nat. Commun.***5**, 5319 (2014).Zenke, F., Agnes, E. J. & Gerstner, W. Diverse synaptic plasticity mechanisms orchestrated to form and retrieve memories in spiking neural networks.

*Nat. Commun.***6**, 6922 (2015).Sussillo, D. & Abbott, L. F. Generating coherent patterns of activity from chaotic neural networks.

*Neuron***63**, 544–557 (2009).Nicola, W. & Clopath, C. Supervised learning in spiking neural networks with FORCE training.

*Nat. Commun.***8**, 2208 (2017).Slonina, Z. A., Poole, K. C. & Bizley, J. K. What can we learn from inactivation studies? Lessons from auditory cortex.

*Trends Neurosci.***45**, 64–77 (2022).Talwar, S. K., Musial, P. G. & Gerstein, G. L. Role of mammalian auditory cortex in the perception of elementary sound properties.

*J. Neurophysiol.***85**, 2350–2358 (2001).Bi, G. Q. & Poo, M. M. Synaptic modifications in cultured hippocampal neurons: dependence on spike timing, synaptic strength, and postsynaptic cell type.

*J. Neurosci.***18**, 10464–10472 (1998).Song, S., Miller, K. D. & Abbott, L. F. Competitive Hebbian learning through spike-timing-dependent synaptic plasticity.

*Nat. Neurosci.***3**, 919–926 (2000).D’amour, J. A. & Froemke, R. C. Inhibitory and excitatory spike-timing-dependent plasticity in the auditory cortex.

*Neuron***86**, 514–528 (2015).Vogels, T. P., Sprekeler, H., Zenke, F., Clopath, C. & Gerstner, W. Inhibitory plasticity balances excitation and inhibition in sensory pathways and memory networks.

*Science***334**, 1569–1573 (2011).Field, R. E. et al. Heterosynaptic plasticity determines the set point for cortical excitatory-inhibitory balance.

*Neuron***106**, 842–854.e4 (2020).Mongillo, G., Rumpel, S. & Loewenstein, Y. Inhibitory connectivity defines the realm of excitatory plasticity.

*Nat. Neurosci.***21**, 1463–1470 (2018).Song, S., Sjöström, P. J., Reigl, M., Nelson, S. & Chklovskii, D. B. Highly nonrandom features of synaptic connectivity in local cortical circuits.

*PLOS Biol.***3**, e68 (2005).Watts, D. J. & Strogatz, S. H. Collective dynamics of ‘small-world’ networks.

*Nature***393**, 440–442 (1998).Perin, R., Berger, T. K. & Markram, H. A synaptic organizing principle for cortical neuronal groups.

*Proc. Natl Acad. Sci.***108**, 5419–5424 (2011).Li, L. et al. A feedforward inhibitory circuit mediates lateral refinement of sensory representation in upper layer 2/3 of mouse primary auditory cortex.

*J. Neurosci.***34**, 13670–13683 (2014).Hu, Y., Trousdale, J., Josić, K. & Shea-Brown, E. Motif statistics and spike correlations in neuronal networks.

*J. Stat. Mech. Theory Exp.***2013**, P03012 (2013).Recanatesi, S., Ocker, G. K., Buice, M. A. & Shea-Brown, E. Dimensionality in recurrent spiking networks: global trends in activity and local origins in connectivity.

*PLoS Comput. Biol.***15**, e1006446 (2019).Lee, J. H., Delbruck, T. & Pfeiffer, M. Training deep spiking neural networks using backpropagation.

*Front. Neurosci.***10**, 508 (2016).Lillicrap, T. P., Cownden, D., Tweed, D. B. & Akerman, C. J. Random synaptic feedback weights support error backpropagation for deep learning.

*Nat. Commun.***7**, 13276 (2016).Perez-Nieves, N. & Goodman, D. F. M. Sparse spiking gradient descent. Preprint at https://arxiv.org/abs/2105.08810 (2021).

Dubreuil, A., Valente, A., Beiran, M., Mastrogiuseppe, F. & Ostojic, S. Complementary roles of dimensionality and population structure in neural computations.

*bioRxiv*https://doi.org/10.1101/2020.07.03.185942 (2020).Yang, G. R., Cole, M. W. & Rajan, K. How to study the neural mechanisms of multiple tasks.

*Curr. Opin. Behav. Sci.***29**, 134–143 (2019).Rajan, K., Harvey, C. D. & Tank, D. W. Recurrent network models of sequence generation and memory.

*Neuron***90**, 128–142 (2016).Carcea, I., Insanally, M. N. & Froemke, R. C. Dynamics of auditory cortical activity during behavioural engagement and auditory perception.

*Nat. Commun.***8**, 14412 (2017).Dalmay, T. et al. A critical role for neocortical processing of threat memory.

*Neuron***104**, 1180–1194.e7 (2019).Ceballo, S., Piwkowska, Z., Bourg, J., Daret, A. & Bathellier, B. Targeted cortical manipulation of auditory perception.

*Neuron***104**, 1168–1179.e5 (2019).Chen, X., Leischner, U., Rochefort, N. L., Nelken, I. & Konnerth, A. Functional mapping of single spines in cortical neurons in vivo.

*Nature***475**, 501–505 (2011).Izhikevich, E. M.

*Dynamical Systems in Neuroscience: The Geometry of Excitability and Bursting*. (MIT Press, 2007).Prescott, S. A., Ratté, S., De Koninck, Y. & Sejnowski, T. J. Pyramidal neurons switch from integrators in vitro to resonators under in vivo-like conditions.

*J. Neurophysiol.***100**, 3030–3042 (2008).Feldman, D. E. The spike timing dependence of plasticity.

*Neuron***75**, 556–571 (2012).Froemke, R. C. & Dan, Y. Spike-timing-dependent synaptic modification induced by natural spike trains.

*Nature***416**, 433–438 (2002).Yang, Y., DeWeese, M. R., Otazu, G. H. & Zador, A. M. Millisecond-scale differences in neural activity in auditory cortex can drive decisions.

*Nat. Neurosci.***11**, 1262–1263 (2008).Ferster, D. & Spruston, N. Cracking the neuronal code.

*Science***270**, 756–757 (1995).Theunissen, F. & Miller, J. P. Temporal encoding in nervous systems: a rigorous definition.

*J. Comput. Neurosci.***2**, 149–162 (1995).Perez-Nieves, N., Leung, V. C. H., Dragotti, P. L. & Goodman, D. F. M. Neural heterogeneity promotes robust learning.

*Nat. Commun.***12**, 5791 (2021).Froemke, R. C. et al. Long-term modification of cortical synapses improves sensory perception.

*Nat. Neurosci.***16**, 79–88 (2013).Song, S. & Abbott, L. F. Cortical development and remapping through spike timing-dependent plasticity.

*Neuron***32**, 339–350 (2001).Akil, A. E., Rosenbaum, R. & Josić, K. Balanced networks under spike-time dependent plasticity.

*PLOS Comput. Biol.***17**, e1008958 (2021).Insanally, M. N. et al. Contributions of cortical neuron firing patterns, synaptic connectivity, and plasticity to task performance. https://doi.org/10.5281/zenodo.11221989 (2024).

Brette, R. et al. Simulation of networks of spiking neurons: a review of tools and strategies.

*J. Comput. Neurosci.***23**, 349–398 (2007).Engelken, R.

*Chaotic Neural Circuit Dynamics*(Theoretical and Computational Neuroscience of the Georg-August University School of Science, 2017).Mastrogiuseppe, F. & Ostojic, S. Linking connectivity, dynamics, and computations in low-rank recurrent neural networks.

*Neuron***99**, 609–623.e29 (2018).

## Acknowledgements

The authors thank Larry Abbott, Tim Vogels, and David Sussillo for comments and discussions, Silvana Valtcheva for technical guidance with the whole-cell recordings, and Madeline Albanese for assisting with mouse behavioral training. This work was funded by the National Institutes of Health (grant number R00-DC015543 to M.N.I., R01-DC012557 to R.C.F., P01-NS074972 to R.C.F., and U19-NS107616 to R.C.F.), and a NARSAD Young Investigators Award to M.N.I. Shari E. Ross created artwork in Figs. 1f, 1k, 5a.

## Author information

### Authors and Affiliations

### Contributions

M.N.I., K.K., S.F., O.L., and T.G. collected the data. B.F.A. designed the model, M.N.I, B.F.A., and J.T. performed all model simulations, K.R. and B.D. verified the model. M.N.I., B.F.A., and R.C.F. designed the study. M.N.I., B.F.A., and R.C.F. wrote the paper.

### Corresponding authors

## Ethics declarations

### Competing interests

The authors declare no competing interests.

## Peer review

### Peer review information

*Nature Communications* thanks the anonymous reviewer(s) for their contribution to the peer review of this work. A peer review file is available.

## Additional information

**Publisher’s note** Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

## Supplementary information

## Source data

## Rights and permissions

**Open Access** This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if changes were made. The images or other third party material in this article are included in the article’s Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article’s Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http://creativecommons.org/licenses/by/4.0/.

## About this article

### Cite this article

Insanally, M.N., Albanna, B.F., Toth, J. *et al.* Contributions of cortical neuron firing patterns, synaptic connectivity, and plasticity to task performance.
*Nat Commun* **15**, 6023 (2024). https://doi.org/10.1038/s41467-024-49895-6

Received:

Accepted:

Published:

DOI: https://doi.org/10.1038/s41467-024-49895-6