Introduction

Prioritisation and selective processing of information is imperative to survival (Gottlieb and Balan, 2010): when crossing a road, attending to oncoming traffic may well save your life. Different forms of attention selectively prioritise distinct aspects of sensory input (Moore and Zirnsak, 2017) such as spatial location (e.g. oncoming traffic) or colour (e.g. green traffic lights); these forms of attention also often co-occur. At the perceptual level, attention improves behavioural performance by increasing accuracy and decreasing reaction times (Giordano et al., 2009). At the neural level, attention enhances neuronal responses to external stimuli (Maunsell, 2015), and this is manifested as enhanced gain (Morgan et al., 1996), reduction in correlated activity (Cohen and Maunsell, 2009), increased local synchrony (Fries et al., 2001), and increased inter-area coherence (Buschman and Miller, 2007). Although attention has been widely studied in primates, there has been a recent surge in research on the neural correlates of attention in rodents (Speed and Haider, 2021). Intriguingly, the perceptual and neuronal correlates of attention seem to generalise across species (Buffalo et al., 2010, Wang and Krauzlis, 2018). However, it is unclear whether the changes in neuronal activity induced by spatial attention in rodents (Wang and Krauzlis, 2018) and primates (Buffalo et al., 2010) differ from those observed with non-selective changes in arousal (Lee et al., 2020, Miyashita and Feldman, 2013).

Rodent attentional research has commonly used paradigms initially designed for primates, including the Posner cueing paradigm for studying spatial attention in the visual system. These protocols are at times difficult to train (e.g. Wang and Krauzlis, 2018), requiring up to 7 months before mice achieve adequate performance (Hu and Dan, 2022). In part, this may reflect the ecological relevance of the cueing paradigm or the sensory modality that is employed. Mice are nocturnal animals (Jensen et al., 2013) that use their whiskers to encode their immediate surroundings rapidly and reliably (Diamond and Arabzadeh, 2013). In addition to being ecologically relevant, the whisker system is structurally well-characterised. An anatomically isomorphic pathway connects the mechanoreceptors at the base of each whisker to the somatosensory cortex (Welker and Woolsey, 1974, Feldmeyer et al., 2013, Diamond et al., 2008), which in turn encodes a tractable number of stimulus dimensions such as the speed (Arabzadeh et al., 2003) and direction (Kremer et al., 2011) of vibrations. The ecological relevance, structural elegance, and functional efficiency of the whisker system make it an ideal model within which to isolate the contributions of selective attention and arousal to perception and neural coding.

Here, we used a direct manipulation of reward contingencies, in a novel head-fixed whisker vibration detection task, to recruit spatial attention while concurrently recording neuronal activity (n=1461) from vS1 in behaving mice. By analysing hit rates and perceptual sensitivities of mice (n=11), we showed that reward contingencies elicit spatially selective evidence accumulation behaviour within their responses to single vibration stimuli, across their responses to tens of stimuli, and throughout each day of training. We also characterised the neuronal correlates of spatial attention in the vibrissal cortex at the individual unit and population level. We quantified attention-induced changes in baseline neuronal activity as well as modulations of early and late sensory-evoked responses. We also characterised how neuronal activity can be used to dissociate selective spatial attention from non-selective changes in arousal.

Results

Mouse behaviour exhibits the hallmarks of spatial attention

To investigate the neuronal correlates of spatial attention in the vibrissal system of mice, we developed a head-fixed behavioural paradigm. This paradigm involved the presentation of a pseudorandomised sequence of vibration stimuli (Fig.1a), each vibration delivered either to the left or right whisker pad. Mice were trained to lick a reward spout in response to the whisker vibration to receive a droplet of sucrose solution. Crucially, only responses to vibrations delivered on one whisker pad (the ‘rewarded side’, R+) were met with a droplet of sucrose solution (Fig.1a green panel). Responses to vibrations on the opposite whisker pad (the ‘unrewarded side’, R-) were not rewarded (Fig.1a red panel). The identity (left or right) of the rewarded stimulus was alternated across sessions.

Behavioural evidence of reward-contingent spatial attention.

a Head-fixed mice were subjected to a pseudorandom sequence of whisker vibrations (each either on the left or right). Each day, licks in response to vibrations on one side yielded a sucrose reward (Hit (R+), green). Responses to vibrations on the other side were unrewarded (Hit (R-), red). b Behavioural data from a typical mouse and day of training. The distribution of licks relative to stimulus onset (vertical lines) is displayed in raster format (top). Only the first licks following (& last licks preceding) stimulus onset are presented. Available trial-averaged lick rate (150-ms window; see Methods) is plotted below for the rewarded (R+, green) & unrewarded (R-, red) stimuli (shading: SE across trials). c Hit rates for rewarded (R+, green) & unrewarded (R-, red) stimuli are plotted against rewards collected for an example mouse (error bars: SE across all trials). d Identical to c, but averaged across mice (n = 11). e Pearson’s correlation coefficients between rewards collected & hit rates for rewarded (R+, green) & unrewarded (R-, red) stimuli. f Responses to rewarded (R+, green) & unrewarded (R-, red) stimuli, conditional on reward collection, are plotted against trials since reward (Lag) for an example mouse (shading: SE across days, n = 123). Horizontal lines indicate differences (p<0.05) between conditional & block-averaged hit rates (green & red) or between conditional hit rates (black, see Methods). g Mouse-averaged change in response probability (rewarded: R+, green, unrewarded: R-, red) conditional on reward collection (ΔP(Hit|R+)), relative to baseline (block-averaged rewarded & unrewarded hit rates) as a function of lag (shading: SE across mice, n = 11). Green and red horizontal lines denote p<0.05 (see Methods) for ΔP(Hit|R+)>0, while black lines denote p<0.05 for ΔP(HitR+|R+) ≠ ΔP(HitR-|R+). h Perceptual sensitivity (d’) for rewarded (R+, green) & unrewarded (R-, red) stimuli in an example mouse (n = 18 days, circles indicate means) on days in which the preferred stimulus was the rewarded stimulus. i Rewarded perceptual sensitivity (y axis, d’) plotted against unrewarded sensitivity (x axis, d’) across 11 mice on days in which the preferred stimulus was the rewarded stimulus. Dots indicate mean d’ (error bars: SE across sessions). The diagonal line indicates equivalence (diagonal). *: p<0.05 (see Methods).

The reward contingency manipulation was effective in recruiting spatial attention: although mice typically responded to both stimuli, they exhibited enhanced responses to the vibrations on the rewarded side (Fig.1b). Spatial attention was manifest in increased hit rates on the rewarded side. As illustrated in the example mouse, the differential hit rate became increasingly prominent with the number of rewards collected on the attended side (Fig.1c). The behavioural correlates of spatial attention generalised across mice and were quantified in the following ways; (i) mice exhibited significantly greater hit rates for the rewarded stimulus compared with the unrewarded stimulus (Fig.S1a, grand mean ± SE: ΔHR = 4.41 ± 1.01 %, p = 1.4e-3, paired t-test, n = 11 mice); (ii) mice exhibited statistically significant positive correlations between their hit rates on the rewarded side (rewarded hit rate) and the cumulative rewards collected (Fig.1d-e, mean ± SD: r = 0.66 ± 0.27, p = 9.98e-6, one sampled t-test, n = 11, Fig.S1c); (iii) in contrast, no significant correlation was found between cumulative rewards collected and hit rate on the unrewarded side (Fig.1d-e, mean ± SD: r = -0.11 ± 0.47, p = 0.44, one sampled t-test, n = 11); (iv) the correlations between cumulative rewards collected and rewarded hit rates were also significantly larger than those with unrewarded hit rates (Fig.1e, mean ± SD: Δr = 0.77 ± 0.53, p = 6.51e-4, paired t-test, n = 11).

To better understand the temporal dynamics of spatial attention in behaviour, we characterised how trial history impacted the way mice responded to stimuli. To this end, we calculated the conditional probabilities of responding given the collection of a reward on a single trial. The collection of a reward was associated with a spatially selective increase in hit rates for epochs on the order of four trials in duration (Fig.1f for the example mouse and Fig.1g for the average mouse,). Specifically, the collection of a reward was associated with a significantly greater subsequent increase in hit rate on the rewarded side than on the unrewarded side. In contrast, unrewarded responses did not herald an epoch of spatially selective responses (Fig.S1e). More broadly, hit rates fluctuated over the course of epochs on the order of 10-20 trials as a function of recent history (Fig.1g, Fig.S1d-e). The broad effect of reward-induced enhanced hit rates affected performance on both attended and unattended sides (Fig.1g). Importantly, however, attended hit rates were especially elevated immediately following the collection of a reward (Fig.1g), suggesting that rewards induced both a long-lasting bilateral tendency to respond as well as a transient, spatially selective enhanced sensitivity.

We next quantified spatial attention using the framework of signal detection theory (Green and Swets, 1966). Eleven of the twelve mice we exposed to the behavioural training protocol demonstrated significant perceptual sensitivity to the attended stimulus (p<0.05, Fig.S1f). Consistent with earlier results, perceptual sensitivity was significantly elevated with spatial attention and this was statistically significant both for the example mouse (Fig.1h, mean ± SD: d’R+− d’R- = 0.54 ±0.77, p = 8.1e-3, paired t-test, n = 18 sessions) and across mice (Fig.1i, grand mean ± SE: d’R+ − d’R- = 0.28 ± 0.06, p = 8.26e-4, paired t-test, n = 11 mice,). The side rewarded (left or right) did not significantly affect the degree of spatial attention observed in the average mouse (Fig.S1g, grand mean ± SE: Δd’Right – Δd’Left = 0.04 ± 0.12, p = 0.75, paired t-test, n = 11 mice). However, individual mice did tend to demonstrate a preference for one stimulus side over the other. Figures 1 h and 1 i show the attentional effects for mice at their strongest (when the preferred side of each mouse is R+). Analysed bilaterally, the same effects were present, but weaker (example mouse mean ± SE: d’R+ − d’R- = 0.33 ± 0.67, p = 5.3e-3, paired t-test, n = 36; average mouse grand mean ± SE: d’R+ − d’R- = 0.11 ± 0.03, p = 7.8e-3, paired t-test, n = 11 mice).

Neuronal responses to whisker vibrations are modulated by behavioural state

We recorded extracellular neuronal activity in the primary vibrissal somatosensory cortex (vS1) as mice performed the behavioural task (see Methods). Before quantifying the effects of spatial attention on neuronal activity, we first characterised how vS1 neurons responded to vibrations applied to the contralateral whiskers and how these responses were modulated by behavioural choice. Of the 3505 units recorded across 5 mice, 1461 exhibited statistically significant responses to the contralateral stimulus (“responsive units”, e.g. Fig.2a,b, see Methods). Neuronal responses were typically characterised by a pronounced increase in firing rate following the onset of whisker vibrations (e.g., Fig.2a,b). The onset of the first whisker deflection was usually associated with the greatest increase in firing rate (Fig.2a,b), but in many cases subsequent whisker deflections also elicited increases in firing rate (e.g., Fig.2b).

Decision-coding in the primary vibrissal cortex.

a Extracellular activity of an example unit. A stimulus trace sits atop a raster plot indicating action potential distribution around stimulus onset (vertical line; x axis: time in ms) over 58 stimulus presentations (trials). Beneath the raster plot is a trace showing trial-averaged firing rate in spikes/second (10-ms window, shading: SE across trials). b Trial-averaged activity of responsive units (n = 1461) is displayed: activity (colour, sp/s) is shown for each unit (y axis) against time since stimulus onset (x axis, ms). c The trial-averaged responses (y axis, spikes/s) of the average unit in hit (yellow) and miss (grey) trials (SE across units, n = 1461) over time since stimulus onset (x axis, 10-ms window). d The cumulative sum of the difference between hit and miss trial responses (Left y axis, spikes/second; black trace: unit- & trial-averaged responses, SE across units, n = 1461, 10-ms window; see panels e-f) is plotted over time since stimulus onset (x axis, ms). Overlaid is the cumulative proportion of reaction times (right y axis, % RTs; yellow, see Methods) having occurred at each time since stimulus onset (x axis, ms). The horizontal black line indicates all points at which Cum(Hits-Misses) ≠ 0 (p<0.05). e Evoked trial-averaged responses in hit (y axis, sp/s) & miss (x axis, sp/s) trials in an example recording (n = 189 units). Blue lines indicate equivalence between responses, as well as 0. f Mean evoked response in hit trials (y axis, normalised to range) is plotted against mean evoked response in miss trials (x axis, normalised to range) for each recording (n = 15). Error bars indicate SE across trials.

Neurons were modulated by choice probability (Sachidhanandam et al., 2013): i.e. they exhibited elevated responses in trials associated with behavioural responses (e.g. Fig.2c, Fig.S3a-c). However, as illustrated in Fig.2c-d, the relationship between neuronal activity and behaviour became apparent at later stages of response, around 100ms post stimulus onset. At 120 ms post stimulus onset, the cumulative difference between hit and miss trials was statistically significant (Fig.2d; p<0.05). The difference between hit and miss trials could not be attributed to the generation of the behavioural action (i.e. licking) as we only included neuronal activity prior to the first lick (see Methods). By this time following stimulus onset, licks had been detected in approximately 15% of hit trials. The effect of choice probability was evident at the neuronal level both within recording sessions (Fig.2e, unit mean ± SE: ΔResponse = 0.31 ± 0.06 spikes/s, p = 4.74e-7, paired t-test, n = 189 units) and also across sessions (Fig.S3d, unit median, [interquartile range]: ΔResponse = 1.46% of range, [-1.42%, 3.70%], p = 0.01, Wilcoxon ranked sum test, n=1461 units). It also generalised to the level of population responses across recordings (Fig.2f: population mean ± SE: ΔResponse = 3.42 ± 1.57% of range, p = 0.047, paired t-test, n = 15 recordings).

Consistent with prior research (Waiblinger et al., 2018) and behavioural data suggesting fluctuations in task engagement (e.g. Fig.1f,g, Fig.S1d-e), neuronal encoding of choice probability was heightened following a recent behavioural response (Fig.S3e, median unit, [interquartile range]: ((Hit − Miss)|Hit) = 2.3% of range, [-2.18%, 5.77%], ((Hit − Miss)|Miss) = 1.2% of range, [-2.56%, 4.99%], ((Hit − Miss)|Hit) − ((Hit − Miss)|Miss) = 0.87% of range, [-4.36%, 5.65%], p = 4.44e-4, Wilcoxon signed rank test, n = 1461 units). Curiously, this behavioural state-dependent modulation of choice probability coincided with a reduction in the neuronal responses associated with miss trials (Fig.S3f, median unit, [interquartile range]: (Miss|Hit) − (Miss|Miss) = -1.04% of range, [-4.07%, 1.55%], p = 1.02e-23, Wilcoxon signed rank test, n = 1461 units), without a significant change in hit trials (median unit, [interquartile range]: (Hit|Hit) − (Hit|Miss) = -0.14% of range, [-4.43%, 3.72%], p = 0.055, Wilcoxon signed rank test, n = 1461 units).

Behavioural response to a reversal in reward contingencies

In a second block of trials, we reversed the reward contingencies such that the initially rewarded stimulus became unrewarded (and vice versa, Fig.3a). This allowed us to behaviourally test the strength of the association created at the outset of the session and ensured that neurons would be recorded in both rewarded and unrewarded states. Consistent with the formation of a strong association in the first block, mice struggled to behaviourally differentiate the rewarded and unrewarded stimuli following the switch in reward contingencies (Fig.S2b,c). In block 2, mice responded with statistically equivalent hit rates to the rewarded and unrewarded stimuli (Fig.S2b, block 2 grand mean ± SE: ΔHR = -0.46 ± 0.74%, p = 0.54, paired t-test, n = 11 mice). Nevertheless, mice did adjust their behaviour to novel evidence. The correlations between hit rate and rewards collected for the previously rewarded and unrewarded stimuli reversed in block 2 (Fig.S2c-d, Rewarded mean ± SD: r = 0.69 ± 0.20, p = 5.25e-7, one sampled t-test, n = 11; Unrewarded mean ± SD: r = 0.12 ± 0.50, p = 0.44, one-sampled t-test, n = 11; Rewarded - Unrewarded mean ± SD: Δr = 0.57 ± 0.54, p = 6.3e-3, paired t-test, n = 11). However, mice generally responded less to both rewarded and unrewarded vibration stimuli in the second block. In the second block, hit rates were lower on both the previously rewarded (Fig.S1a, Fig.S2b, grand mean ± SE: ΔHR(B1R+− B2R-) = 14.11% ± 2.23%, p = 8.76e-5, paired t-test, n = 11 mice) and unrewarded sides (Fig.S1a, Fig.S2b, grand mean ± SE: ΔHR(B1R- − B2R+) = 10.16% ± 1.96%, p = 4.16e-4, paired t-test, n = 11 mice); although this reduction was significantly greater for the previously rewarded side (grand mean ± SE: ΔHR(B1R+ − B2R-) − ΔHR(B1R- − B2R+) = 3.95% ± 1.44%, p = 0.02, paired t-test, n = 11 mice). In parallel, fewer rewards were collected in the second block (Fig.S1b, Fig.S2f, Block 1 grand mean ± SE: Rewards = 10.85 ± 1.37; Block 2 grand mean ± SE: Rewards = 7.66 ± 1.21; Block 1 − Block 2, grand mean ± SE: ΔRewards = 3.19 ± 0.53, p = 1.33e-4, paired t-test, n = 11 mice).

Neuronal gain modulation associated with spatial attention.

a Schematic of the behavioural task with two blocks of trials. Reward contingencies (rewarded: R+; unrewarded: R-) are switched in the second block. b The spatial preference (Pref) of the average left stimulus trial (mean ± SE, n = 11 mice) is plotted (y axis) against rewards collected in the first (left) or second (right) block (x axis). Green trace (R+): data from days in which the left stimulus was rewarded. Red trace (R-): data from days in which the right stimulus was rewarded. c Grayscale colour map of contralateral (hit and miss) trial frequencies for different behavioural states (Perf and Pref, see Methods). Positive Pref values indicate a higher response rate to the contralateral side than the ipsilateral side (relative to the electrode), and vice versa. Perf values indicate average response rates. d A stimulus trace sits atop raster plots of peristimulus (vertical line; x axis: time in ms) action potential distributions in attended (yellow, n = 15) and unattended (grey, n = 10) hit trials (see Methods) for a typical unit. Traces below show attended (yellow) and unattended (grey) trial-averaged firing rates for hits (spikes/second, 10-ms windows, shading: SE across trials). e Evoked trial-averaged responses for hits in the attended (y axis) & unattended (x axis) states for all units (n = 1461) in spikes/second (blue lines: equivalent and absent responses). f Peristimulus hit trial- and unit-averaged, evoked firing rate traces (y axis, spikes/second; x axis, 10-ms windows) from 25% of units (n = 365 units, see Methods) in the attended (yellow) and unattended (grey) states (shading: SEM across units). g Trial- and unit-averaged evoked responses (y axis, spikes/second) plotted against their associated Pref (pink, bottom x axis) and Perf (blue, top x axis). Both dimensions were divided into four bins, with trials in each bin averaged together (SEM for x and y axes often smaller than the circular markers). h Hit trial- and unit-averaged evoked responses (z axis, colour, normalised to unit range) are plotted against their associated Pref (x axis) and Perf (y axis). Trial binning performed as in panel g.

Overall, mice did not exhibit statistically significant bilateral differences in perceptual sensitivity between the rewarded and unrewarded stimuli in block 2 (Fig.S2g, grand median, [interquartile range]: Δd’ = 0.02, [-0.09, 0.05], p = 0.70, Wilcoxon signed rank test, n = 11 mice). Curiously, mice only significantly reduced their perceptual sensitivity to the initially rewarded stimulus in block 2 (median, interquartile range: Δd’(B2R- − B1R+) = -0.26, [-0.30, -0.13], p = 2.93e-3, Wilcoxon signed rank test, n = 11 mice); they did not significantly change their perceptual sensitivity to the initially unrewarded stimulus (median, [interquartile range] : Δd’(B2R+ − B1R-) = - 0.07, [-0.19, 0.03] p = 0.17, Wilcoxon signed rank test, n = 11 mice). A detailed side-specific analysis of perceptual sensitivity (see Supplementary Materials) uncovered consistent findings after accounting for the stable spatial preferences of mice.

Distinct neural signatures for behavioural performance and spatial attention

We aimed to establish whether activity in vS1 differentiates between non-specific changes in behavioural state (i.e. fluctuations in overall performance, Lee et al., 2020) and spatially specific changes induced by attention (i.e. fluctuations in spatial preference). Overall behavioural state and degree of spatial attention are among the factors reflected in the observed differences between the two blocks. These factors are further complicated by fluctuation in the level of motivation (Waiblinger et al., 2018) and the presence of contradictory evidence in the second block. We therefore do not consider the classification of trials into block 1 and 2 to be a well-controlled symmetrical measure of spatial attention. Figure 3b clearly illustrates the asymmetry between the two blocks. Here, we indexed spatial attention with Pref, which captures the local preference of the mouse for one side over the other (Pref: the difference in hit rates between the left and right sides; see Eq.1). A spatial preference was established in block 1, and while this preference reversed in block 2, behaviour in the two blocks was asymmetrical.

To better capture the observed behaviour, we distinguished Pref from Perf; the latter quantifies the local non-specific performance of the mouse in vibrissal target detection (Perf: the average hit rate across the two sides; see Eq.2). The local nature of these indices (10-15 trials) is consistent with the observation that both behaviour (e.g. Fig.1g) and evoked neuronal activity (Fig.S3e,f) fluctuated on rapid timescales as a function of recent history. To characterise the effect of fluctuations in both overall performance and spatial preference on neuronal activity, we indexed all contralateral whisker vibrations according to their associated Perf and Pref, yielding a distribution of trials within a behavioural state space (Fig.3c). Note that at the extremes of behavioural performance (Perf), spatial preference (Pref) is necessarily close to 0. Nevertheless, as illustrated in Fig.3c, there were sufficient trials to dissociate different levels of performance from different levels of preference. Having classified each contralateral trial according to the local Perf and Pref indices, we examined the relationships between these behavioural metrics and the activity of the population of responsive units (n = 1461). The relationship between neuronal activity and spatial attention was quantified by comparing the responses of neurons on trials in which mice exhibited opposite attentive preferences of any magnitude. To this end, we divided trials into (contralaterally) attended (PrefC/L: Pref>0) and unattended (PrefI/L: Pref<0) groups.

The attended trials were associated with significantly greater evoked responses than the unattended trials (median unit, [interquartile range]: PrefC/LPrefI/L = 0.18 sp/s, [-0.42 sp/s, 0.88 sp/s], p = 6.5e-13, Wilcoxon signed rank test, n = 1461; mean unit ± SE: PrefC/L - PrefI/L = 1.04 ± 0.13% of range, p = 1.96e-15, paired t-test, n = 1461 units, pFDR = 1.05e-14, Fig.S4a-c,g,i). As the peristimulus activity of an example unit illustrates (Fig.3d), this remained the case even after restricting the analysis to hit trials and pre-lick activity (Fig.3e, median unit, [interquartile range]: ΔHits(PrefC/LPrefI/L) = 0.21 sp/s, [-0.77 sp/s, 1.41 sp/s], p = 5.55e-8, Wilcoxon signed rank test, n = 1461; Fig.S5a,g, median unit, interquartile range: ΔHits(PrefC/LPrefI/L) = 1.30% of range, [-3.47%, 7.01%], p = 4.31e-13, Wilcoxon signed rank test, n = 1461 units, pFDR = 1.72e- 12). Indeed, attentional modulation was significantly greater in hit trials (Fig.S5a,g) than in miss trials (Fig.S5b,h, median unit, interquartile range: ΔMisses(PrefC/L - PrefI/L) = 0.40% of range, [2.96%, 3.95%], p = 2.17e-3, Wilcoxon signed rank test, n = 1442 units, pFDR = 3.8e-3; ΔHits(PrefC/LPrefI/L) − ΔMisses(PrefC/LPrefI/L) = 1.21% of range, [-5.39%, 7.54%], p = 8.86e-5, Wilcoxon signed rank test, n = 1442 units, pFDR = 2.03e-4). In contrast, high (PerfHigh: Perf>0.5) and low (PerfLOW: Perf<0.5) performance trials were not associated with significantly different evoked responses (median unit, [interquartile range] = 0.03 sp/s, [-0.60 sp/s, 0.70 sp/s], p = 0.077, Wilcoxon signed rank test, n = 1461; median unit, [interquartile range]: PerfHighPerfLOW = 0.16% of range, [-3.19%, 2.80%], p = 0.56, Wilcoxon signed rank test, n = 1461 units, pFDR = 0.56, Fig.S4d-f,h,i).

Nevertheless, neuronal response modulations associated with attention were highly variable (Fig.S4c). The example unit in Figure 3d is in the 93rd percentile of units for raw modulation depth (ΔHits(attended − unattended) = 3.3 spikes/second; yellow line in Fig.3e), but only the 76th percentile of units for normalised modulation depth (ΔHits(attended − unattended) = 7.13% of unit range). The 365 units in the upper quartile for normalised modulation depth (Fig.3f) exhibited an average change in their evoked firing rates (between the attended and unattended states) of 2.5 spikes/second ± 0.08 spikes/second (mean ± standard error), representing a 12.34% ± 0.27% change in unit range (mean ± standard error). It is also worth highlighting that ~21% of responsive units (n = 308) were suppressed by the average vibrissal stimulus in the unattended state, while only 9.45% of responsive units (n = 138) were suppressed by the average vibrissal stimulus in the attended state.

Separating trials into quarters along both dimensions revealed that evoked activity was positively correlated with spatial preference (Fig.3g, r=0.97, p=0.03, Pearson’s correlation coefficient, pFDR = 0.04) and not with performance (Fig.3g, r=0.77, p=0.23, Pearson’s correlation coefficient, pFDR = 0.29). In other words, the more attentive mice were to the contralateral stimulus relative to the ipsilateral stimulus, the greater the evoked responses of the average unit on the average trial. The dissociation between spatial preference (Pref) and performance (Perf) was reinforced by a deeper analysis of the relationships between evoked neuronal activity and Perf (see Supplementary Materials). The positive correlation with spatial preference cannot be attributed to choice probability (Hit vs. Miss) for two reasons: (i) such a correlation would also be present with performance (higher performance indicates higher hit rate), and (ii) when we limited the analysis to hit trials, the positive correlation remained highly significant (Fig.3h, r=0.98, p=0.01, Pearson’s correlation coefficient, pFDR = 0.02). No significant correlation was observed between spatial preference and evoked responses in miss trials (r=-0.67, p=0.33, Pearson’s correlation coefficient, pFDR = 0.33). Thus, spatial attention increased the gain of neuronal responses in the absence of any differences in sensory input or motor output.

Behavioural and neuronal time-course of sPatial attention

The temporal profile of behavioural and neuronal responses can be as informative as their magnitude or frequency. For examPle, the Progressive (Fig.1c-e, Fig.3b) and raPid (Fig.1f,g) evidence-dependent differentiation of rewarded and unrewarded stimuli in block 1 are consistent with the literature on the nexus of selection history, reinforcement learning, and attention (e.g. Anderson and Britton, 2019, Golan and Lamy, 2023). Within an individual trial, the time-course of the elevated firing rate observed (Fig.2d) in the late-stage neuronal responses of hit trials is consistent with previous findings which suggested a causal role for such activity in perception (Sachidhanandam et al., 2013). Spatial attention has also been shown to elevate neuronal activity even before stimulus onset (Hayden and Gallant, 2005). On a behavioural level, attention is typically associated with faster reaction times ((e.g. Golan and Lamy, 2023), but see also (Giordano et al., 2009)). With such findings in mind, we characterised the temporal profile of spatial attention in our behavioural and neuronal data at the scale of an individual trial. The behavioural responses of the average mouse to vibrissal stimulation followed a characteristic profile (Fig.4a), with the first-lick frequency deviating from baseline at ~100 ms and reaching its peak at ~250 ms after stimulus onset. The perceptual sensitivities (d’) followed a similar time course (Fig.4b). However, the fastest behavioural responses were not those associated with the highest degree of spatial attention: the differences in perceptual sensitivity (Fig.4c), although present at short latencies (mean ± SE: Δd’250ms = 0.058 ± 0.017, p = 0.007, one-sampled t-test, n = 11 mice), became more prominent later (e.g. mean ± SE: Δd’750ms = 0.124 ± 0.028, p = 1.14e-3, one-sampled t-test, n = 11 mice).

Spatial attention is associated with slower reaction times.

a Baseline-subtracted first lick frequency (following the rewarded stimulus in block 1), averaged over sessions and mice (black, 25-ms bins, error bars: SE, n = 11 mice). b Mouse-averaged perceptual sensitivity (d’) to rewarded (green, R+) and unrewarded (red, R-) stimuli computed over time since stimulus onset (250 ms window, error bars: SE, n = 11 mice) in block 1 (all sessions for each mouse). Vertical black lines: bounds of mean interquartile range used for computing overall hit rates and perceptual sensitivity (Fig.1). c Difference between rewarded and unrewarded perceptual sensitivities (Δd’), y axes) using independent data points from panel b. Lick rates in panel a and perceptual sensitivities in panels b-c are computed from “available trials” (see Methods). d The distribution (y axis, Units) of changes in trial-averaged baseline firing rates (x axis, △sp/s, Attended − Unattended, n = 1461 units). e Hit trial- and unit-averaged, evoked firing rate traces (y axis, spikes/second) are shown for the attended (yellow) and unattended (grey) states (see Methods) against time since stimulus onset (x axis, milliseconds, 10 ms window). Error bars indicate standard error of the mean across units. f Hit trial- and unit-averaged difference between evoked neuronal response (y axis, △sp/s, error bars: SE across units) to the vibrissal stimulus in the attended and unattended states binned according to time since stimulus onset (x axis, time in seconds, first three data points are averages over 200 ms bins). Note that for panels d, e, and f, only hit trials are included and only neuronal activity prior to the first post-stimulus lick is included.

At the neuronal level, we observed elevated baseline firing rates during the attended state (Fig.4d; median [interquartile range] Δsp/s = 0.1486 [-0.1270, 0.5052] sp/s, p = 0.0064, Wilcoxon ranked sum test, n = 1461 units, pFDR = 0.01). The sensory evoked responses of the median unit were also elevated with spatial attention, with gain modulation being most evident at the later stages of evoked response. Intriguingly, attention-induced gain modulation was present even when we subtracted baseline activity from the post-stimulus responses and controlled for behavioural output by limiting the analysis to hit trials and pre-lick activity only (Fig.4e). Even the early (~200 ms post-stimulus onset) evoked responses revealed an increased firing rate to attended compared with unattended stimuli (see Fig.4f, median [interquartile range]: ΔResponse1≤ms≤200 = 0.25 [-1.05, 1.30] sp/s, p = 4.74e-4, Wilcoxon signed rank test, n = 1461 units, pFDR = 9.48e-4). The difference in firing rate increased in later-stage activity (Fig.4f, ~300 ms post-stimulus onset, median [interquartile range]: ΔResponse201≤ms≤400 = 0.58 [-0.72, 2.04] sp/s, p = 2.80e-27, Wilcoxon signed rank test, n = 1461 units, pFDR = 4.48e-26; ΔResponse201≤ms≤400 − ΔResponse1≤ms≤200 = 0.30 [-1.24, 2.11] sp/s, p = 1.29e-8, Wilcoxon signed rank test, n = 1461 units, pFDR = 3.45e-8) and remained high even ~500 ms post-stimulus (Fig.4f, median [interquartile range]: ΔResponse401≤ms≤600 = 0.32 [-1.11, 1.87] sp/s, p = 1.12e-8, Wilcoxon signed rank test, n = 1350, pFDR = 3.45e-8; ΔResponse401≤ms≤600 − ΔResponse1≤ms≤200 = 0.15 [-1.60, 1.98] sp/s, p = 2.37e-3, n = 1350 units, pFDR = 3.8e-3). Beyond 600 ms, there was no longer any statistically significant gain modulation (Fig.4f, median [interquartile range]: ΔResponse>600ms = 0 [-1.19, 1.30] sp/s, p = 0.19, n = 1461 units, pFDR = 0.20).

Discussion

To recruit spatial attention in mice in an ecologically relevant manner, we used a direct manipulation of reward contingencies, in a head-fixed whisker vibration detection task. Mice exhibited spatial attention by immediately and selectively increasing their responses to the rewarded side. Mice progressively differentiated between the two sides as they accumulated rewards during a block of trials. Spatial attention was characterised by greater hit rates and enhanced perceptual sensitivity. To differentiate between non-specific changes in behavioural state (i.e. fluctuations in overall performance) and spatially specific changes induced by attention, we indexed local behaviour along spatially specific preference (Pref) and nonspecific performance (Perf) dimensions. This allowed us to identify the signatures of spatial attention in the vS1 neurons, in particular the enhanced gain of evoked contralateral responses. Spatial attention-induced neuronal gain was present even after controlling for sensory input and behavioural output. In contrast, spatially non-specific changes in behavioural state were uncorrelated with neuronal responses before controlling for behavioural output (and negatively correlated with neuronal gain after controlling for behavioural output, see Supplementary Results, Fig.S5). Thus, our results provide strong evidence that neurons in vS1 dissociate between spatially non-specific changes in behavioural state and changes in behaviour associated with spatial attention.

What are the neuronal circuit mechanisms that could underlie the attention induced modulations observed here? There are many pathways by which such neuronal modulations might be implemented, including corticocortical (Buffalo et al., 2010, Herrington and Assad, 2010, Marshall et al., 2015, Zhang et al., 2014, Karnani et al., 2016, Marques et al., 2018, Hishida et al., 2019, Shen et al., 2022) and diverse subcortical feedback pathways (e.g. thalamus: Wimmer et al., 2015, Schmitt et al., 2017, Nakajima et al., 2019, claustrum: White and Mathur, 2018, White et al., 2018, superior colliculus: Lovejoy and Krauzlis, 2010, Zenon and Krauzlis, 2012, Bollimunta et al., 2018), alongside coordinated neuromodulation (for recent reviews, see Thiele and Bellgrove, 2018, Lockhofen and Mulert, 2021). The microcircuitry of attention is increasingly being revealed with the application of site-specific genetic recombination techniques (e.g. the Cre-LoxP system, Kim et al., 2018) in mice (for reviews, see Callaway, 2005, Huang and Zeng, 2013, Navabpour et al., 2020). Such techniques have enabled the discovery of a disinhibitory microcircuit mediated by vasoactive intestinal polypeptide- (VIP+) and somatostatin-expressing (SST+) interneurons (Zhang et al., 2014, Karnani et al., 2016, Shen et al., 2022) (see also (Manita et al., 2015, Xu et al., 2013, Zhang et al., 2016, Lee et al., 2013)). Indeed, long-range corticocortical feedback connections from the mouse anterior cingulate cortex (ACC, equivalent to primate FEF(Koike et al., 2016, Fillinger et al., 2017, White et al., 2018, Huda et al., 2020), but see also (Barthas and Kwan, 2017, Boyd-Meredith et al., 2022, Duan et al., 2015, Ebbesen et al., 2018, Erlich et al., 2011, Kopec et al., 2015, Trevino et al., 2022, Yartsev et al., 2018)) to VIP+ interneurons in visual cortex are a plausible source of attentional gain modulation observed therein. The same technologies have also been leveraged to map subcortical circuits implicated in attentional control (Schmitt et al., 2017, White et al., 2018, Nakajima et al., 2019). Further studies investigating the circuit mechanisms underpinning attention in the vibrissal system will be valuable because different sensory systems employ distinct circuits in similar algorithms (Shen et al., 2022, Ramamurthy et al., 2025). Consequently, a diversity of experimental paradigms is necessary to thoroughly map the neuronal implementation of attention.

Such work is likely to translate to an understanding of the circuit mechanisms of human attention. Although mice are not as closely related to humans as other primates, approximately 80% of our protein-coding genes have a one-to-one correspondence with orthologous genes in mice (Herrero et al., 2016) and our species’ share broadly conserved genetic regulatory networks (Breschi et al., 2017). Our brains do not appear to be an exception in this respect. At a macroscopic level they exhibit conserved expression patterns of orthologous genes across many (cortical and subcortical) structures (Chen et al., 2016, Strand et al., 2007). This conservation appears to extend to the cellular makeup of cortical areas (Bakken et al., 2021), subcellular (postsynaptic) proteomes (Bayes et al., 2012), and cell-type specific functional connectivity (Kim et al., 2023, Szegedi et al., 2020). Despite differences in topographic organisation and tuning for spatial and temporal frequencies, neurons in the mouse visual cortex exhibit fundamentally similar feature-selectivity to those of primates (Niell and Stryker, 2008, Van den Bergh et al., 2010, Niell and Scanziani, 2021). These observations are broadly consistent with the notion of a conserved cortical microcircuit, implementing canonical algorithms which generalise across sensory modalities and even species (Douglas et al., 1989, Douglas and Martin, 1994, Mountcastle, 1997, Rockland, 2010, Bastos et al., 2012, Ardid et al., 2015, Miller, 2016, Plebe, 2018, Keller and Mrsic-Flogel, 2018, Hwang et al., 2021, Miyashita, 2022, Banerjee et al., 2023, Luhmann, 2023). Thus, the development of ecologically relevant attention paradigms in mice would be a key step towards understanding the microcircuitry of attention in the more complex brain of primates.

The neuronal modulations we report must be interpreted in light of the causal link between neuronal activity and behaviour. The primary motor cortex is directly connected to vS1 (Rocco-Donovan et al., 2011, Miller-Hansen and Sherman, 2022) and as such, initiating a lick response may increase activity in vS1. Even more relevant for vS1 activity are the efferent signals related to whisker movement. Dominiak et al. (2019) reported that the behavioural and movementpreparation state of head-fixed mice, navigating a floating plus maze, are effectively indexed by asymmetries in the whiskers. Furthermore, O’Connor et al. (2010) reported that head-fixed mice asymmetrically manipulated their whiskers to maximise contact with a go-stimulus in the context of an object localisation task. Any whisker movement could result in feed-forward sensory vibrissal signals in addition to those evoked by the vibration stimulus itself. Overall, the control of whisking action which manifests in the system’s mode of operation (Diamond and Arabzadeh, 2013, Miyashita and Feldman, 2013), generative vs receptive, is expected to impact the feed-forward signals arriving in the vS1 cortex. However, key differences in experimental methodology should be considered before generalising across these studies. In the floating maze and object localisation paradigms (O’Connor et al., 2010, Dominiak et al., 2019), the mice are in control of sensory input to their whiskers and/or are required to move their whiskers. In contrast, whisker motion during detection tasks has consistently been found to be associated with reduced performance (Kyriakatos et al., 2017, Ollerenshaw et al., 2012, Vandevelde et al., 2023), suggesting that a “receptive” strategy of whisker immobilisation is more applicable to the current data. We cannot exclude the possibility that mice asymmetrically oriented their whiskers (as a function of Pref) to maximise contact with their preferred mesh. As such, it is possible that the neuronal modulations we observed with spatial attention reflect an overt form of attention rather than a covert one.

However, it would be premature to come to such a conclusion based on the results presented. After all, symmetrical whisker orientation correlated with variations in bilateral performance clearly does not explain the absence of neuronal modulation associated with variation in Perf. It is also worth noting that even in simple behavioural tasks, the precise spatiotemporal structure and meaning of neuronal activity reflecting sensorimotor transformations is a matter of ongoing research (Zareian et al., 2021, Zagha et al., 2022, Zareian et al., 2023, Esmaeili et al., 2021, Oryshchuk et al., 2024, Steinfeld et al., 2024). For example, choice has been decoded from neuronal activity distributed across the brain (Steinmetz et al., 2019, Esmaeili et al., 2021), including the primary vibrissal cortex (Oryshchuk et al., 2024), even after accounting for movement. Additionally, optogenetic perturbation studies have revealed that choice-related activity in the primary sensory cortex is causally involved in generating task-relevant behavioural decisions (Sachidhanandam et al., 2013, Zatka-Haas et al., 2021, Buetfering et al., 2022). Finkel et al. (2024) have also recently shown that choice-related neuronal activity in the primary somatosensory cortex disappears when mice switch from responding to tactile stimuli in the presence of visual distractors to responding to visual stimuli in the presence of tactile distractors. The choice-, and attention-related activity reported in the present paradigm should not be dismissed as simply afferent whisker input associated with orofacial movement or an efference copy originating in the motor cortex. Nevertheless, future research incorporating orofacial motion recordings will be necessary to examine the degree to which the attention induced modulations observed in our ecological prioritisation paradigm rely on overt or covert mechanisms, or a combination of the two.

In the current study, we combined elements of both continuous performance tasks (Sanchez-Roige et al., 2012, Terreros et al., 2016, Fizet et al., 2016, Jorratt et al., 2017, Lee et al., 2020, Abdolrahmani et al., 2021, Carli et al., 1983, Robbins, 2002, Demeter et al., 2008, Bangasser et al., 2017) and blocked trial designs (Wang and Krauzlis, 2018, McBride et al., 2019, Wang and Krauzlis, 2020, Speed et al., 2020, You and Mysore, 2020, Schnabel et al., 2021, Goldstein et al., 2022, Wang et al., 2022, Kanamori and Mrsic-Flogel, 2022, Poort et al., 2022, Morrill et al., 2022, Lee et al., 2016, Carlson et al., 2018) with the direct manipulation of reward contingencies, making our behavioural paradigm well-suited to studying the mechanisms of selection history. Concerning selection history, the reward sequence in each session was counterbalanced across days in an attempt to disincentivise mice from developing the stable side preferences observed in previous attention experiments with mice (You and Mysore, 2020, Kanamori and Mrsic-Flogel, 2022). Yet this counterbalancing introduced global structure in the experiment because the first side to be rewarded each day is the second side to be rewarded the day before. The advantage of counterbalancing over randomisation here is that the stability of the global structure introduced by counterbalancing makes it easier to interpret the resulting patterns in behaviour across mice. Indeed, two results suggest that the behaviour of the mice did not reflect learning of the global reward structure. First, the rewarded and unrewarded hit rates of the mice at the start of the average day were not markedly different. The progressive differentiation of the two stimuli as mice accumulated rewards during a block of trials suggests that their behaviour was driven by evidence accumulated within a day, and not by evidence accumulated the day before. Second, mice continued to have trouble adjusting to a reversal in reward contingencies even after extensive training. Although mice adapted to new evidence when reward contingencies were reversed, their behavioural responses were not symmetrical with respect to the first block (Fig.S2). In addition to fluctuations in overall behavioural state and degree of spatial attention, the observed differences between the two blocks reflect fluctuation in the level of motivation, the presence of contradictory evidence in the second block, and the relatively stable spatial preferences of the mice.

Over the past fifteen years attention research has increasingly focused on the nexus between attention, selection history, and valence (e.g. rewards and punishments, Serences, 2008, Della Libera and Chelazzi, 2009, Della Libera et al., 2011, van den Berg et al., 2014, Kim and Anderson, 2019, Kim and Anderson, 2023). This line of research has suggested that humans and other animals perform better in a range of tasks when they are incentivised with the promise of primary (e.g. water) or secondary (e.g. money) rewards (for a review, see Botvinick and Braver, 2015), and that operant conditioning has profound impacts on attentional capture in particular (for reviews, see Failing and Theeuwes, 2018, Anderson et al., 2021). Reward incentives have been shown to reduce saccadic response times and distraction (e.g. Milstein and Dorris, 2007), enhance target detection sensitivity in exogenous (Engelmann and Pessoa, 2007) and endogenous (Engelmann et al., 2009) spatial cueing tasks (see also Padmala and Pessoa, 2008, Small et al., 2005, Failing and Theeuwes, 2014), and speed responses in visual search (Sawaki et al., 2015, Reinhart et al., 2016, Schneider et al., 2018, Della Libera and Chelazzi, 2009). Furthermore, rewards have been shown to modulate the effects of inter-trial priming (Hickey et al., 2010, Hickey et al., 2014, Hickey et al., 2015, Hickey and van Zoest, 2013, Kristjansson et al., 2010) and statistical learning (Failing and Theeuwes, 2014, Anderson and Halpern, 2017). Yet these studies do not isolate the effects of reward learning on attention from those of voluntary goals. The strongest evidence for the role of operant conditioning on attentional control comes from studies probing the potential deleterious effects of rewards and punishments on task performance, a phenomenon which Anderson et al. (2011) named “value-driven attentional capture”, and which appears to be altered in various psychopathologies (Anderson, 2021). Specifically, value-driven attentional capture appears to be blunted in patients with depression (Anderson et al., 2014) and ADHD (Sali et al., 2018), and enhanced in patients with addictions (Anderson et al., 2013, Albertella et al., 2019b, Loganathan, 2021) and obsessive-compulsive behaviours (Albertella et al., 2019a). The asymmetrical behaviour of our mice following a reversal in stimulus-reward contingencies is likely to be partially attributable to value-driven attentional capture. Thus, investigating the microcircuitry and molecular mechanisms underlying the neuronal modulations we observed is likely to have high translational value for the study of human psychopathologies, including addictions.

Intriguingly, the fastest behavioural responses were not those associated with the highest degree of spatial attention (Fig.4b,c,f). At the behavioural level, mice exhibited more spatial attention in the form of perceptual sensitivity differences (Fig.4b,c) when they responded more slowly to vibration stimuli. Speed-accuracy trade-offs observed during spatial cueing tasks (Giordano et al., 2009), and evidence accumulation in sensory discrimination tasks (Abraham et al., 2004, Fassihi et al., 2020), represent useful frameworks within which to interpret these findings. In our task, when mice gave themselves more time to decide whether to respond to a whisker vibration, they were better at discriminating between the rewarded and unrewarded stimuli. This finding is reminiscent of evidence accumulation behaviour, in that both rodents and primates exhibit improved performance in difficult sensory tasks if they are given more time to accumulate relevant information (Abraham et al., 2004, Fassihi et al., 2020). In parallel, during difficult sensory tasks, neurons encoding relevant decision variables discriminate between stimulus conditions better if provided sensory information over a longer duration. In the current task, we observed elevated baseline neuronal firing rates in the attended state, consistent with previous research examining the effect of spatial attention in V4 of primates (Hayden and Gallant, 2005). We also observed attentional gain enhancement of neuronal responses even after controlling for baseline activity and behavioural responses. In a substantial subset of units (~25%, Fig.3f) this evoked gain modulation was immediate and sustained. However, in the median unit, the evoked gain enhancement we observed was more prominent in the later stages of neuronal responses, after 200 ms. This time-course parallels that observed in our earlier analysis of choice probability (Fig.2c,d). The correlation between late-stage neuronal activity and behaviour observed here is consistent with previous work on vS1 cortex. When mice were trained to detect individual deflections of a single whisker, Sachidhanandam et al. (2013) reported that early (<50 ms) reliable sensory responses were followed by secondary depolarisations 50-400 ms post-stimulus which were enhanced on hit trials. Furthermore, optogenetic inhibition of neurons in vS1 during this late stage of the neuronal response significantly reduced the probability of mice reporting the whisker stimulus by licking, suggesting a causal role for this activity in perception. The stimulus we delivered consisted of multiple whisker deflections, and as such the late-stage neuronal response previously associated with stimulus perception might be expected to persist beyond 400 ms. Here, by controlling for behavioural output and baseline activity, we were able to show that spatially selective responses require additional information processing above and beyond what is necessary for spatially non-selective vibrissal target detection and perception.

Materials & Methods

Mice

Subjects were twelve 5-6 week old male C57BL6/J mice. All procedures were approved by the Animal Care and Ethics Committee at the Australian National University. Mice were housed in independently ventilated and air filtered transparent plastic boxes in a climate controlled colony room on a 12/12 hour light/dark cycle. The first eight mice experienced a light cycle in which lights were switched off at 7 pm. The final four mice experienced a light cycle in which lights were switched on at 7 pm. Mice were water restricted to motivate them to perform the spatial attention task. Mice had abundant access to water for 2-3 hours after training sessions and were provided food ad-libitum. All mice gained weight at a normal rate throughout the duration of the experiment.

Surgical procedures

Mice underwent surgery for head-post implantation and (later) craniotomy. Animals were anaesthetised with isoflurane (~2% by volume in O2, 0.6 mL/min) and their eyes were covered with a layer of Viscotears liquid gel (Alcon, UK) and kept on a thermal blanket to maintain body temperature (Physitemp Instruments). Mice were administered a pre-operative intraperitoneal injection of atropine (0.04 mg/kg) with volume expansion (dextrose saline, 0.3 mL) to dry out mucous membranes and maintain hydration, respectively. The scalp and periosteum over the dorsal surface of the skull were removed. The position of the primary vibrissal cortex (S1) was marked using stereotaxic coordinates (relative to bregma: lateral 3mm; posterior 1.8mm) and vascular patterns. Custom-made head-posts were fixed to the skull above lambda using a layer of cyanoacrylate adhesive and secured to the skull using dental acrylic.

Following completion of surgical procedures for head-post implantation, mice were provided pain relief in the form of buprenorphine and then placed in their cages onto a warming blanket until recovery from anaesthetic. Mice were monitored daily for signs of distress until full recovery (7±1.5 days, mean ± standard error, range: 4-23 days). Further pain relief in the form of carprofen and lignocaine was administered as necessary. Upon full recovery from surgery, behavioural training commenced. Following behavioural training (68.2±19.3 days, mean ± standard error, range: 17-118 days, n=6 mice), mice underwent a second surgery prior to electrophysiological recordings.

As before, mice were anaesthetised with isoflurane (~2% by volume in O2, 0.6 mL/min). A circular craniotomy (2 mm in diameter) was drilled over the primary vibrissal cortex (S1) using the previously marked coordinates (centre relative to bregma: lateral 3-3.5mm; posterior 1.51.8mm). Throughout the surgery, drops of artificial cerebrospinal fluid were applied to the exposed area to maintain hydration and health of the cortex. Upon completion of the surgery, a biocompatible silicone adhesive sealant (Kwik-cast™) was applied to the craniotomy. Full recovery from this surgery was typically seen within 24 hours. Once mice had fully recovered, behavioural experiments in conjunction with electrophysiological recordings commenced.

Behavioural apparatus

Mice were trained to perform a spatial attention task while head-fixed. The behavioural apparatus was controlled by custom code written in Matlab (2016b, MathWorks) and interfaced through a data acquisition card (National Instruments, Austin, TX) at a sampling rate of 100 kHz. The vibration stimuli were presented to the whiskers via aluminium mesh (2x2cm) attached to a ceramic piezoelectric wafer (PiezoDrive, BA6020). The mesh was slanted parallel to the animal’s whisker pads (~2mm from the surface of the snout). Spacing on the mesh was arranged in a grid. Each opening was approximately 1x1mm, spaced approximately 200 μm apart. At 2mm from the surface of the snout, the diameter of the whiskers of a mouse is approximately 80 μm (Carvell and Simons, 2017). Most whiskers rested against the wire structure of the mesh, whether they entered through an opening or not.

Each vibration stimulus consisted of a train of discrete Gaussian pulsatile whisker deflections delivered at a frequency of 17 Hz for 2.04 ± 0.013 seconds (mean ± standard error, n=637 sessions, range: 1.7058-3 seconds). Each deflection lasted for 30 ms and was followed by a 28.82-28.83 ms pause; rounding each frequency period to the nearest 100th of a ms. Whiskers were deflected with an average amplitude of 100 ± 0.67 pm (mean ± standard error, n=12 mice).

A custom plastic “lick-port” was used to record licks and to deliver 6% sucrose reward droplets. The lick port itself consisted of a plastic housing supporting the alignment (via ~1mm apertures) of an infrared LED and phototransistor immediately in front of a lick spout. The lick port was attached to a metal micromanipulator to adjust the distance for each animal such that the spout was within reach of the tongue. The lick port functioned as an optical sensor, with the voltage output across the phototransistor being delivered to the data acquisition card and subjected to a software threshold to determine if a lick was present or absent. The sucrose solution (6%) was delivered via a gravity feed solenoid valve, with each reward being associated with a 20 ms opening of the valve.

Mice were placed in acrylic tubes (4 cm inner diameter) such that their heads extended out of the front and they could use their front paws to grip the tube edge. A surgically implanted, custom-made (standardised) head-post extending laterally from the midline of the mouse was locked into complementary grooves to immobilise the animal. Mice were thereby head-fixed in a natural crouching position with their whiskers free to move.

Behavioural training

From the first day of head-fixation, mice (aged 7-8 weeks) were exposed to a pseudorandomised sequence of vibration stimuli each delivered to the left or right whisker pad. A typical behavioural session consisted of 120-200 stimulus presentations, separated by a random inter-stimulus interval between 4 and 16 seconds in length. Each behavioural session was divided into two blocks, consisting of 60-100 trials. Each block consisted of equal numbers of stimuli delivered to each whisker pad. In 4 mice, 33% of trials in each block were “catch trials”, in which no stimulus was delivered. These catch trials were introduced to quantitatively test whether the mice were responding to the whisker stimuli by self-pacing. These “catch trial” mice also experienced a reversed light/dark cycle and were trained and tested in the dark. In each block of trials, only licks following whisker vibrations (within 1.25-3.25 seconds) delivered to one whisker pad resulted in the provision of a drop of sucrose to the mouse.

Stimuli delivered on this side were said to have been on the ‘rewarded side’. In contrast, stimuli delivered to the other whisker pad were said to have been on the ‘unrewarded side’. Licks following stimuli on the ‘unrewarded side’ did not result in the provision of a drop of sucrose. The rewarded stimulus side was switched in the second block of each session. The stimulus side to be rewarded first was also counterbalanced across days (96.2% ± 5.3%, mean ± standard deviation, n=12 mice) in order that mice would not simply learn to pay attention to one side.

Mice were occasionally given free rewards (without needing to lick) following the onset of a stimulus delivered to the rewarded side (mean ± standard deviation P(free) = 9.3% ± 6.1% of trials, n=12 mice). Delivery of free rewards was more common in early training to motivate licking (mean ± standard deviation P(free)1/2 = 14.15% ± 10.21% of trials, n=12 mice) and was reduced or eliminated in later training (mean ± standard deviation P(free)2/2 = 4.5% ± 4.3% of trials, n=12 mice). Free rewards were sometimes provided later in training to compensate mice for the stress associated with electrophysiological recordings (see Electrophysiological recordings). Free reward trials were excluded from all behavioural and electrophysiological analyses.

Mice experienced between 11 and 123 behavioural sessions. The average mouse experienced 53 behavioural sessions (53 ± 40, mean ± standard error). This equates to training for an average of 10-11 weeks (approximately 2.5 months), with the total range between 2 and 25 weeks (0.5-6.25 months). Note that this corresponds to total time spent collecting data, and not the minimum time required for mice to learn the task. The four mice trained and tested in the dark experienced more than 40 behavioural sessions (8 weeks, 2 months). Restricting the perceptual sensitivity analysis such that only the first half (51.50 ± 13.96, mean ± standard deviation, n=4 mice) or even third (34.25 ± 9.64 days, mean ± standard deviation, n=4 mice) of behavioural sessions were included for these mice did not alter the basic findings in relation to spatial attention (firing rates and perceptual sensitivities).

Behavioural analysis

All analysis was performed on MATLAB 2016b using custom-code.

Characteristic response distribution

Mice licked the reward spout with a mean baseline frequency of 1.58 ± 0.26 Hz (mean ± standard deviation, n=12 mice). Licking following the onset of a stimulus was distinguishable from licking prior to the stimulus onset (or in the absence of a stimulus) in two ways. First, the licking frequency of trained mice increased in response to the onset of the stimulus. In a subset of stimulus presentations, a lick detected following stimulus onset prompted the delivery of a drop of sucrose solution through the reward spout. This in turn resulted in a second increase in licking frequency as the mouse responded to the presence of the rewarding sucrose solution. To isolate licks produced in response to the stimulus from those produced in response to the reward, we restricted our behavioural analyses to the first lick after stimulus onset in each trial. We compared these licks with the first licks after a stimulus would have been delivered in catch trials, or the last licks before stimulus onset in stimulus trials (when there were no catch trials, n = 8 mice). Within-subject comparisons of pre-stimulus licking with catch trial licking did not show any significant difference between licking frequency in these two times (p>0.05 for all four mice, lick rate mouse mean ± SD: pre-stimulus=0.62±0.02, post-stimulus=0.59±0.04 Hz, n=4 mice).

Figure 1b shows the first licks following (and last licks preceding) stimulus onset in all trials except those in which free rewards were delivered. The lick rate traces in Fig.1b show mean and standard error of the mean across “available” trials. “Available trials” in the post-stimulus window were the trials in which a lick had not been registered at a prior time. Available trials and lick rates were computed symmetrically for pre- and post-stimulus windows as a function of absolute time relative to stimulus onset. This adjustment controls for the shape of the distribution of first and last licks relative to stimulus onset and more accurately measures the behavioural sensitivity of mice to the stimulus at each point in time. The baseline-subtracted lick rates shown in Fig.4a and the perceptual sensitivities shown in Fig.4b are also based on available trials.

Comparing the last licks before stimulus onset with the first licks after stimulus onset in this way revealed a characteristic stimulus response distribution (Fig.4a). Not all licks detected following the onset of a stimulus reflected genuine responses to the stimulus. For example, in a subset of trials, licks were detected immediately before and after stimulus onset. To encourage accuracy over speed, we also used longer behavioural response windows than the typical reaction time of a mouse. While this ensured that mice could take their time in responding to the stimuli, it also resulted in some rewards being delivered for late licks which did not reflect genuine responses to the stimulus. To adjust for these factors, we based our purely behavioural analyses on the mean interquartile range of rewarded licks across mice. Trials with licks occurring within 0.176 seconds of stimulus onset were excluded from all analyses. Analyses referring to rewards collected, and reward probability denote only rewards associated with responses within the characteristic window.

Signal detection theory

To quantify the perceptual sensitivity of the mice to the vibration stimuli, we employed signal detection theory (Green and Swets, 1966). We used the characteristic window ([0.176, 0.837] seconds, Fig.4a) to compute “hits”, “misses”, “false alarms”, and “correct rejections”. We computed trials with the first post-stimulus lick within this window as “hits”. Trials with first licks occurring more than 0.837 seconds after stimulus onset were computed as “misses”. Trials with first post-stimulus licks occurring less than 0.176 seconds after stimulus onset, and trials in which free rewards were delivered, were excluded from the analysis.

In the 8 animals without exposure to catch trials, we computed the last licks pre-stimulus (within the characteristic window: [-0.837, -0.176] seconds) as “false alarms”. Trials in which the last licks pre-stimulus occurred more than 0.837 seconds before stimulus onset were computed as “correct rejections”. Trials with the last licks pre-stimulus occurring less than 0.176 seconds before stimulus onset, and trials in which free rewards were delivered, were excluded from the analysis. In other words, perceptual sensitivity was computed symmetrically with respect to stimulus onset for these animals. In the 4 animals exposed to catch trials, the characteristic window after a stimulus would have been delivered was used to compute “false alarms” and “correct rejections” in catch trials. Perceptual sensitivity (d’) was calculated according to Equation 1:

Where Z is the inverse of the cumulative Gaussian distribution function. We computed perceptual sensitivity separately for the left and right stimuli in both the first and second blocks of each behavioural session, for each mouse. Of twelve mice exposed to the training protocol, 11 exhibited statistically significant perceptual sensitivity to the rewarded stimulus in block 1 (Fig.S1f). Note that all other behavioural analyses were only conducted on these 11 mice. The analysis of perceptual sensitivity over time (Fig.4b) was computed in the same way described above, except a shifting window of 250 ms was used instead of the mean interquartile range. Note that this is conceptually equivalent to computing perceptual sensitivity based on the available trials (see “Characteristic response distribution”) within each window.

Evidence accumulation

To assess the dependence of mouse behavioural performance on the accumulation of evidence in a session, we performed a bivariate linear regression analysis of behavioural hit rate on cumulative rewards collected (within a block: Fig.1c-e, Fig.S1c, and Fig.S2c-e). For this analysis, stimulus trials experienced by a mouse were associated with two numbers. The trials with first post-stimulus licks within the characteristic window ([0.176, 0.837] seconds, Fig.4a) were named “hits” and associated with 1s. The trials with first post-stimulus licks more than 0.837 seconds after stimulus onset were named “misses” and associated with 0s. Each hit and miss trial thus defined was assigned a second number (1 or 0) based on whether a reward had been delivered (1) to the mouse or not (0). Trials with first post-stimulus licks earlier than 0.176 seconds after stimulus onset, and free reward trials, were excluded from this analysis.

We computed the cumulative rewards collected from the latter of these two numbers, analysing each block of trials independently. In other words, we calculated cumulative rewards collected within each block. For each unique number of rewards collected (in block 1 or 2), we computed a hit rate across all stimulus trials experienced by each mouse; in the context of having collected that number of rewards. We computed hit rates separately for the rewarded and unrewarded stimuli, and for blocks 1 and 2. Pearson’s linear correlation coefficient (between hit rate and cumulative rewards collected) was then computed for each mouse, for the rewarded and unrewarded stimuli, and in blocks 1 and 2. The p-values were computed in this analysis using a Student’s t distribution for a transformation of the correlation.

Conditional response probability

Knowing that accumulating evidence (in the form of rewards) influenced the performance of the mice, we sought to ascertain the time-course of the effect of rewards. To do so, we computed the probabilities of various kinds of stimulus responses (hits: rewarded, unrewarded, or either) conditional on the occurrence of misses, or hits (either rewarded or unrewarded). Free reward trials, and trials with first post-stimulus licks occurring less than 0.176 seconds after stimulus onset, were excluded from this analysis. Trials with first post-stimulus licks occurring within the characteristic window ([0.176, 0.837] seconds) were considered “hits”. Trials with first poststimulus licks occurring more than 0.837 seconds after stimulus onset were considered “misses”.

Trials were aligned according to their “lag” (number of trials) relative to “misses”, “hits”, “unrewarded hits”, or “rewarded hits” (depending on the condition). For every mouse and behavioural session, a trial history matrix (initialised with NaNs) was constructed wherein each row represented a “miss”, “hit”, “unrewarded hit” or “rewarded hit”, and each column corresponded to the number of trials since that event (with the first column representing lag 0). Each element in the matrix was coded as a 1 if it was a “hit”, “rewarded hit” or “unrewarded hit” (depending on the condition), and as a 0 if it was a “miss”.

Averaging across rows (ignoring NaN values) yields a vector representing the probability of a “hit”, “rewarded hit”, or “unrewarded hit” conditional on the occurrence of a “miss”, a “hit”, an “unrewarded hit”, or a “rewarded hit” (depending on the condition). Conditional probability vectors created for each session were averaged for a single mouse (e.g., Fig.1f). Because hit rates can vary across mice, we divided the average conditional probability vector of each mouse by the hit rate appropriate to the analysis. For example, in Figure 1g the session- averaged rewarded conditional probability vector of each mouse was divided by the unconditional probability of responding to a rewarded stimulus for that mouse. Conversely, the session-averaged unrewarded conditional probability vector of each mouse was divided by the unconditional probability of responding to an unrewarded stimulus for that mouse. Thus, for each mouse, a ratio of the conditional probability to the baseline hit rate was computed for each lag on the average session. The resulting average conditional probability ratios of each mouse was then averaged across mice (e.g. Fig.1g, Fig.S1d,e).

Electrophysiological recordings

NeuroNexus recordings

After mice had been trained, craniotomies were performed (see ‘Surgical Procedures’) to enable extracellular recording of neuronal activity from vS1. For three mice, a single shank 32 channel array (NeuroNexus ©) was mounted to a metal pole attached to a perspex clamp and advanced using a micromanipulator (Sutter Instrument Co.) into the cortex. The array was arranged in a 1x32 Poly3 configuration with three columns of recording sites and 50 μm between rows and columns. Signals from 32 electrodes were simultaneously amplified and converted from analog to digital by a CerePlex Mini (M32) headstage before being saved to disk at a sampling rate of 30 kHz by a Cereplex Direct data acquisition device (Blackrock microsystems Inc., Utah).

Insertion of the electrode was approximately 1.5-1.8 mm posterior to the bregma and 3.0-3.5 mm lateral to the midline (Paxinos and Franklin, 2001). The dura was left intact and pierced by the electrode. The behavioural protocol and electrophysiological data collection were then initiated. Probes were advanced 1513±347 μm (mean ± SD, range [1000, 1927], n = 12 recordings) relative to the estimated surface of the cortex. Throughout electrophysiological recordings, drops of phosphate-buffered saline (PBS) were applied to the exposed area to maintain hydration and health of the cortex. An external reference wire was secured in place with the tip in the PBS-filled well of the craniotomy.

Channels were subdivided into groups exhibiting common noise, with each group being referenced to a nearby (internal) channel. Ten recordings were subdivided into six groups, one recording was subdivided into five groups and one recording was subdivided into eight groups (mean ± SD = 6.08±0.67 internal reference channels, n=12 recordings). The 30 kHz raw, continuous signals associated with each channel were filtered, thresholded and semi-automatically clustered with Wave-Clus (Quiroga et al., 2004). A fourth order Butterworth filter (300-3000 Hz) was applied to the continuous signal before spike detection using a negative threshold of three times the estimated standard deviation of the background noise (Donoho and Johnstone, 1994, Quiroga et al., 2004). A minimum refractory period of 1.5 ms separated all spikes detected. Mice were occasionally given free rewards (without needing to lick) following the onset of the stimulus (mean free reward rate 5% ± 1.57% of rewarded trials, n=15 recordings).

Neuropixel recordings

After mice had been trained, craniotomies were performed (see ‘Surgical Procedures’) to enable extracellular recording of neuronal activity from vS1. For three mice, a high-density (960 channels, 384 electrodes) Neuropixel probe (Jun et al., 2017) was inserted using a micromanipulator (www.newscale.com) into the right primary vibrissal cortex (1393 ± 71.56 um, n= 15 recordings). Neuronal activity was digitized at 30 kHz using SpikeGLX (www.github.com/billkarsh/SpikeGLX) and aligned to vibrissal stimulus onset using an analog copy of the stimulus signal which was simultaneously recorded on a synchronised National Instruments card. Recordings were spike sorted using Kilosort 3 (Pachitariu et al., 2016) and the results were manually curated using Phy (https://github.com/cortex-lab/phy). As previously described, insertion of the electrode was approximately 1.5-1.8 mm posterior to the bregma and 3.0-3.5 mm lateral to the midline (Paxinos and Franklin, 2001). After electrode insertion, a behavioural protocol and electrophysiological data collection would be initiated. Throughout electrophysiological recordings, drops of phosphate-buffered saline (PBS) were applied to the exposed area to maintain hydration and health of the cortex. Recordings were conducted with the mouse and stimulation apparatus mounted on an air table.

Electrophysiological analysis

Inclusion/exclusion criteria for recordings and trials

A total of 27 recordings, representing 3962 neurons, were collected from 6 mice. Of these, 15 recordings representing 3505 neurons and 5 mice were of sufficient quality to warrant data analysis. Some Neuropixel recordings were excluded from the analysis (n=12) because of poor quality. Recordings were excluded from analysis when they exhibited very low numbers of neurons (38.08 ± 33.45 units, mean ± standard deviation, n=12) & even fewer responsive neurons (1.42 ± 1.73 units, mean ± standard deviation, n=12). Of the remaining 3505 neurons, 1461 exhibited statistically significant responses to the contralateral stimulus (responsive units, see Methods). In the average recording, approximately 37.9% of neurons were responsive. However, the proportion of responsive units did vary widely (standard deviation: 29.5%), between a minimum of 7.3% and a maximum of 88%.

Identifying responsive neurons using AUROC analysis

Stimulus detectability was computed from distributions of spike counts occurring in a time interval before and after each stimulus onset. For each block of trials in each recording, the median first lick time of the mouse in that block of trials was used as the time interval for integrating neuronal activity. A criterion shifted in steps of one spike across the two distributions was used to determine the hit and false alarms of each unit, thus forming a receiver operating characteristic (ROC) curve. Detectability was expressed as the area under the ROC (AUROC) and significance testing was performed by trial-label shuffling (n=10000 shuffles) of the two distributions.

A unit was considered responsive to the stimulus if it exhibited an absolute deviation from an AUROC of 0.5 greater than 95% of shuffled AUROCs. The detectability of each neuron was computed three times: once for each block of trials and once for all trials pooled together. This was done for the sake of inclusivity, in case of any gain modulation associated with rewardcontingency. All analyses were conducted on all three groups of responsive units combined.

Neuronal activity in hit and miss trials

Stimulus trials were divided into two clearly different types. There were trials in which licks were detected following stimulus onset (hits), and trials in which licks were not detected following stimulus onset (misses). Because of the smaller number of trials available for analysis and the additional data provided by recordings of neuronal activity, we adjusted the criteria for classifying trials as “hits” and “misses” in our electrophysiological analyses to be more inclusive than our behavioural analysis. Nevertheless, trials in which licks were detected within 10 ms of stimulus onset were not considered hits (or misses) in our analyses. Likewise, trials in which free rewards were delivered were not considered hits (or misses) in our analyses.

With those exceptions, trials with first post-stimulus licks within the response window used for reward delivery (mean ± standard deviation: 2.05 ± 0.14 seconds, n=15 sessions, range: 1.9562.25 seconds) were classified as “hits”. Trials with first post-stimulus licks occurring after the response window used for reward delivery were classified as “misses”. For the creation of the raster plot and associated firing rate trace in Figure 2a, all neuronal activity within hit and miss trials was included.

The heat map created for Figure 2b showing firing rate traces for numerous units was computed in the same way, except neuronal activity was baseline-subtracted. For each neuron in each trial, we subtracted the average pre-stimulus response in that trial over a period equal to the response window (mean ± standard deviation: 2.05 ± 0.14 seconds, n=15 sessions, range: 1.956-2.25 seconds) from every 10 ms time bin before trial-averaging. The same baselinesubtraction algorithm was applied when computing heat maps for Figure S3 (panels a-b) and Figure S4 (panels a,b,d,e).

For all figures except Figure 2a-b, and for all analyses, post-stimulus activity in hit trials was not included beyond the first lick detection (post-stimulus onset) and activity in miss trials was not included beyond the median reaction time in the hit trials. The median reaction time was computed separately for each mouse in each recording and in each block of trials. We did this to limit the contribution of neuronal activity solely caused by orofacial movements during the collection of rewards (in hit trials) and to ensure that hit and miss trials did not differ systematically due to response adaptation.

For all analyses involving the calculation of trial-averaged evoked neuronal responses (Fig.2e,f, Fig.S3d-f, Fig.3d,e, Fig.S4g,h, Fig.S5a-f, Fig.4f) we computed baseline neuronal activity in each hit or miss trial as the firing rate in spikes/second over a pre-stimulus duration equal to the response window (mean ± standard deviation: 2.05 ± 0.14 seconds, n=15 sessions, range: 1.956-2.25 seconds). Summed neuronal activity within the baseline window was divided by its duration (in seconds). This yielded a pre-stimulus firing rate (in spikes/second) in each trial which could be subtracted from its corresponding post-stimulus firing rate to yield a trialaveraged evoked firing rate.

In a number of analyses, we normalised trial-averaged evoked responses of units or populations. To do this we subtracted the minimum evoked response of a unit or population from every evoked response of that same unit or population. Next, those differences were divided by the difference between minimum and maximum evoked responses for that unit or population. In other words, each evoked response of a unit or population was expressed as a proportion of the range of responses belonging to that unit or population. We did this to better compare changes in activity elicited by animal decisions, reward contingencies, and behavioural state across units with different ranges of activity. The normalisation algorithm we used is summarised in the Equation 2:

Where “N(response)” indicates the normalised response of a unit or population on a given trial, “response” indicates the evoked response of a unit or population on a given trial before normalisation, and “Responses” represents the vector of evoked responses of a unit or population across all trials included in the analysis.

Population activity

For the quantification of choice probability (e.g., Fig.2f), we complemented our analysis of individual units with an analysis of summed population activity. We classified hit and miss trials in the same manner as for individual units. For every trial in every recording, we then computed the evoked (baseline-subtracted) firing rate in the same manner used with individual units, except activity was summed across all responsive units in that recording.

Conditional choice probability

Having noticed that animal behaviour depended on recent trial outcomes, we hypothesised that neuronal behaviour would also be influenced by recent trial outcomes. To test this hypothesis, we sorted valid stimulus trials into hits and misses, and then sorted the subsequent contralateral stimulus trials into hits and misses. Thus, we were left with four groups of trials: contralateral hits given a recent hit (Hit|Hit), contralateral hits given a recent miss (Hit|Miss), contralateral misses given a recent hit (Miss|Hit) and contralateral misses given a recent miss (Miss|Miss).

We then computed the trial-averaged, baseline-subtracted responses of each unit in each of these four conditions. Having done so, we could compute the degree to which our responsive neurons encoded choice probability (Hit responses − Miss responses) given a recent hit and a recent miss. We could also investigate the extent to which a recent hit or miss was associated with a change in the coding of contralateral hit or miss trials, independently.

Perf vs. Pref vs. neuronal response

Knowing that behavioural state fluctuates on the order of 15 trials, we decided to sort our stimulus trials according to their local spatially non-specific behavioural state and degree of spatial attention. Specifically, every contralateral stimulus trial (hit or miss, see “neuronal activity in hit and miss trials”) was assigned a “performance” (Perf) and “spatial preference” (Pref) score based on the behaviour of the mouse within a surrounding window of trials. We used a 10-trial window for mice which were not exposed to catch trials and a 15-trial window for mice exposed to catch trials.

We did this to equate the number of stimulus trials on each spatial side in each window and for each mouse. In 15-trial windows, the trial used for the neuronal analysis was the 8th in the window. In 10-trial windows, the trial used for neuronal analysis was the 5th in the window. The lag of the neuronal trial relative to the onset of the behavioural analysis window (lags 0:9) and the magnitude of the attended (Pref>0) modulation observed were not significantly correlated (Pearson’s r = -0.16, p = 0.65, median (Attended − Unattended) = 1.07% of range, median p = 9.19e-8). The distribution of window types (according to left and right stimulus trial numbers), along with information about trial type distributions this behaviour space, can be found in Figure S6.

We computed performance by dividing the number of hits by the total number of stimulus trials. The total number of stimulus trials included trials in which free rewards were delivered (free rewards in each trial window: 0.08 ± 0.31, mean ± standard deviation, n = 1200 trials) and trials in which licks were detected within 10 ms of stimulus onset (10-ms lick trials in each window: 0.51 ± 0.88, mean ± standard deviation, n = 1200 trials). We defined spatial preference according to Equation 3:

Performance(L) is the number of hits on left stimulus trials divided by the total number of left stimulus trials. Performance(R) is the number of hits on right stimulus trials divided by the total number of right stimulus trials. The total numbers of left and right stimulus trials included trials in which free rewards were delivered and trials in which licks were detected within 10 ms of stimulus onset. For all experiments, the left stimulus corresponded to the stimulus contralateral to the recording electrode. As such, positive Pref scores indicate that the mouse responded to a higher proportion of contralateral stimulus trials than ipsilateral stimulus trials. To cross-validate this analysis, we computed behavioural state for each mouse across all trials in our behavioural dataset (Fig.3b). For this cross-validation, we restricted our analysis to trials in which the stimulus was delivered to the left whisker pad for consistency with the neuronal analysis.

Thus, we were able to sort trials into an attended state (Pref>0), and an unattended state (Pref<0). Likewise, we were able to sort trials into a “high performance” state (Perf>0.5) and a “low performance” state (Perf<0.5). Many decisions in the brain are made on the basis of a single observation, so what we gain from averaging across trials, the brain gains from averaging across neurons. In the interest of leveraging the advantage of having recorded from a large population of neurons we focused this analysis on the dynamics of our pseudo-population of neurons (n=1461).

We quantified the observed changes in activity by comparing trial-averaged evoked responses of units across states (e.g. Fig.S4g,h). We also examined state-decision interactions (e.g. Fig.S5a-f). For each comparison, we also provided the minimum number of trials available for each unit (Fig.S4i, Fig.S5g-i). To treat all responsive neurons equally, we normalised the evoked responses of each unit to its own range unless otherwise noted (Fig.3e, Fig.S4, Fig.S5, see Equation 3).

To better visualise the attentional effect, we identified the 25% of units exhibiting the largest difference between normalised, evoked, hit trial-averaged responses in the attended (y axis) & unattended (x axis) states. Having identified these units, we were able to compare their responses in the attended and unattended states, both as a group and individually (Fig.3d-f). To better visualise the landscape of neuronal responses as a function of Perf and Pref, we divided both performance [0:1] and preference [-1:1] into four bins, resulting in a 16 bin grid (Table 1).

Grid of Perf and Pref dimensions divided into quarters.

Both the spatially non-selective behavioural index Perf and the spatially selective index Pref have been divided into four bins. The table below summarises the associated intervals for each dimension in each bin. The highest values of Perf are located in the top row of the table. The highest values of Pref are located in the right-most column of the table.

Once trials had been sorted into these bins, their associated Perf, Pref, and evoked neuronal responses were averaged across trials for each unit, and then across units (Fig.3e). To determine whether the trial-averaged responses of the average unit exhibited significant correlations with Perf and Pref, we divided trials into the aforementioned bins purely on the basis of either Perf or Pref (Fig.3d). For Pref, these bins contained data from 946, 1461, 1461 and 1302 units, respectively (mean ± SE for these units: Trials1≤Pref<-0.5 = 3.82 ± 0.12, Trials-0.5≤Pref<0 = 30.12 ± 0.23, Trials0≤Pref<0.5 = 52.41 ± 0.18, Trials0.5≤pref≤1 = 3.55 ± 0.08). For Perf, the bins contained data from 1311, 1461, 1461 and 1461 units, respectively (mean ± SE for these units: Trials0≤Perf<0.25 = 32.00 ± 0.43, Trials0.25≤Perf<0.5 = 17.95 ± 0.20, Trials0.5≤Perf<0.75 = 24.78 ± 0.21, Trials0.75≤Perf≤1 = 16.72 ± 0.26). We computed Pearson’s linear correlation coefficient between neuronal responses (trial- and unit-averaged, evoked) and Perf or Pref. The p-values were computed in this analysis using a Student’s t distribution for a transformation of the correlation.

To visualise the time-course of neuronal responses between states (and across units), we first sorted hit trials into the “attended” (Pref>0) and “unattended” (Pref<0) states. We then computed the firing rate of each unit in each hit trial over time, in 10 ms bins. Note that only neuronal activity prior to the first post-stimulus lick was included in this analysis. To compare the baseline activity of each unit in attended and unattended states, we averaged across the 10 ms pre-stimulus time bins (over a period equal to the response window) and then across trials (Fig.4d). To compare stimulus-evoked responses of units between attended and unattended states, we subtracted the time-averaged baseline activity from each trial and then averaged the resulting firing rate traces over trials in each state (Fig.4e). For each unit, we then computed the difference in its trial-averaged responses across states (attended − unattended, Fig.4f). For a tractable analysis of how this difference evolved over time, we averaged the 10 ms bins falling into each of four periods (Period 1: 0<binss200; Period 2: 200≤binss400; Period 3: 400≤binss600; Period 4: bins>600).

Statistical tests

We applied a standardised approach when choosing which statistical test to conduct for any given comparison. We tested single samples (or the difference between paired samples) for normality by comparing them to the standard normal distribution using a (one-sample) Kolomogorov-Smirnov test. To do this, we centred and scaled samples by separately subtracting the mean or median from every value and then dividing by the standard deviation.

We then used the built-in function kstest from Matlab 2016b. When comparing two unpaired samples, we performed a test for normality on both samples. If we failed to reject the null hypothesis of normality (p≤0.05), we proceeded to use a (two-tailed) paired-samples or (twotailed) two-sample t-test as appropriate. If we compared two unpaired samples, we used parametric tests only if we failed to reject the null hypothesis of normality with respect to both samples in question. When using a paired samples t-test, the data was assumed to come from a normal distribution with unknown variance. When using a two-sampled (unpaired) t-test, both samples were assumed to have equal variance.

Upon rejection of the null hypothesis of normality (p<0.05), we tested single samples (or the difference between paired samples) for symmetry of the sample distribution around its median with a two-sided Wilcoxon signed rank test. To do so, we centred the sample distribution by subtracting the sample median from every value. We then used the built-in function signrank from Matlab 2016b. If we failed to reject the null hypothesis of symmetry around the sample median (p£0.05), we tested the hypothesis that the original sample had a median of 0 using a two-sided Wilcoxon signed rank test (signrank in Matlab 2016b). If we rejected the null hypothesis of symmetry around the sample median (p<0.05), we compared paired samples using a two-sided Wilcoxon ranked sum test (ranksum in Matlab 2016b). When comparing unpaired samples with a non-parametric test, we used two-sided Wilcoxon ranked sum tests.

Given the novelty of the analysis of spatial preference (Pref) and performance (Perf), a Benjamini Hochberg (1995) procedure was applied to control the false discovery rate (FDR) to each of two families of hypothesis tests: those associated with spatial preference (Pref), and those associated with performance (Perf). For each of these procedures, a desired false discovery rate of 0.05 was used. In accordance with this procedure, all adjusted p-values (reported in the text as PFDR) <0.05 are significant. Note that where the same hypothesis was tested using both raw and normalised data, only the hypothesis tests associated with normalised data were included in the control for multiple comparisons.

Data availability

The datasets generated and analysed to produce the results presented in the current study, along with associated codes, have been deposited at https://doi.org/10.17605/OSF.IO/ZHR63 and are publicly available.

Supplementary information

Stimulus detection and evidence accumulation.

a Mean response rates in stimulus+ (R+: rewarded; R+: unrewarded) and stimulus-conditions (black: pre-stimulus/catch; large circles: grand means, n = 11 mice). b Mean rewards collected (empty circle: grand median, n = 11 mice). c Inverse p-values for Pearson’s r between hit rate and rewards collected (n = 11 mice, log-scale; R+: rewarded; R-: unrewarded). Black line: p = 0.05. d Mouse-averaged change in bilateral hit probability conditional on hits (yellow) and misses (grey) relative to block-averaged hit rate (ΔP(HitB|Choice)) plotted against lag (trials, shading: SE, n = 11 mice). Horizontal lines: ΔP(HitB|Choice) ≠ 0 (yellow & blue, p<0.05) and ΔP(HitB|Hit) ≠ ΔP(HitB|Miss) (black, p<0.05). e Mouse-averaged change in response probability (R+: rewarded; R-: unrewarded) conditional on unrewarded response (ΔP(Hit|R-)), relative to baseline (block-averaged hit rates) plotted against lag (shading: SE, n = 11). Horizontal lines: p<0.05 for ΔP(Hit|R-) ≠ 0 (green and red), p<0.05 for ΔP(HitR+|R-) ≠ ΔP(HitR-|R-) (black). f Session-averaged perceptual sensitivities (left, green: d’) to the rewarded stimulus for 12 mice exposed to the behavioural paradigm beside associated inverse p-values (right, green, log-scale). Black line: p = 0.05. g Differential perceptual sensitivity (Δd’ = d’R+ − d’R-) when left (y axis) and right (x axis) stimuli are rewarded. Dots: mouse mean Δd’ (error bars: SE across sessions). Lines: equivalence (diagonal), 0 values (vertical, horizontal). Panels b-l: block 2 data. Green: rewarded. Red: unrewarded.

Behavioural responses to a reversal in reward contingencies.

a Behaviour from an example mouse and day. Top: Dots indicate the first licks post- (& last licks pre-) stimulus onset (vertical lines) is displayed in raster format (top). Available trial-averaged lick rate (see methods) is plotted below for the (un)rewarded stimuli (R+: rewarded; R-: unrewarded; x axis: time; 150-ms window; shading: SE across trials). b Mean response rates in stimulus+ (R+: rewarded; R-: unrewarded) and stimulus-conditions (pre-stimulus/catch: black; large circles: grand means, n = 11 mice). c Mouse-averaged hit rates for (un)rewarded stimuli (R+: rewarded; R-: unrewarded) plotted against the rewards collected (error bars: SE across mice, n = 11). d Pearson’s correlation coefficients between rewards collected & hit rates for (un)rewarded stimuli (R+: rewarded; R-: unrewarded). e Inverse p-values for Pearson’s r between hit rate and rewards collected (R+: rewarded; R-: unrewarded; n = 11 mice, log-scale). Black line: p = 0.05. f Mean rewards collected (empty circle: grand median, n = 11 mice). g Perceptual sensitivity to rewarded stimulus (y axis, d’) plotted against perceptual sensitivity to the unrewarded stimulus (x axis, d’). Dots: mouse means (error bars: SE across days). Diagonal line: d’R+ = d’R-. Green: rewarded. Red: unrewarded.

Side-specific perceptual sensitivity adjustments following a reversal in reward contingencies

On average, mice were equally perceptually sensitive to both stimuli on days in which their nonpreferred stimulus (left or right) was rewarded in block 1 (mean ± SE: d’B1R+ − d’B1R- = 0.02 ± 0.05, p = 0.61, paired t-test, n = 11 mice) and their preferred stimulus was rewarded in block 2 (mean ± SE: d’B2R+ − d’B2R- = 0.09 ± 0.06, p = 0.13, paired t-test, n = 11 mice). Given the stable spatial preferences mice exhibited, this equal perceptual sensitivity already reflects an effect of the reward manipulation on mouse attention. Furthermore, on these days mice significantly adjusted their perceptual sensitivities between the two blocks (mean ± SE: (d’B2R+ − d’B2R-) - (d’B1R- − d’B1R+) = 0.12 ± 0.05, p = 0.04, paired t-test, n = 11 mice). Specifically, mice reduced their sensitivity to their non-preferred (and initially rewarded) stimulus (mean ± SE: d’B2R- − d’B1R+ = − 0.24 ± 0.07, p = 5.0e-3, paired t-test, n = 11 mice), without changing their sensitivity to their preferred stimulus (mean ± SE: d’B2R+ − d’B1R- = -0.12 ± 0.07, p = 0.11, paired t-test, n = 11 mice).

In contrast, on days in which mice were rewarded for responding to their preferred stimulus in block 1, they remained more perceptually sensitive to this stimulus even after it was no longer rewarded in block 2 (mean ± SE: d’B2R+ − d’B2R- = -0.12 ± 0.05, p = 0.03, paired t-test, n = 11 mice). Yet again, mice significantly adjusted their perceptual sensitivities between blocks (mean ± SE: (d’B2R- − d’B2R+) − (d’B1R+ − d’B1R-) = -0.16 ± 0.05, p = 7.0e-3, paired t-test, n = 11 mice) by reducing their sensitivity to the stimulus that was initially rewarded (their preferred stimulus; mean ± SE: d’B2R- − d’B1R+ = -0.22 ± 0.05, p = 1.6e-3, paired t-test, n = 11 mice) without changing their sensitivity to the stimulus that was initially unrewarded (their non-preferred stimulus; mean ± SE: d’B2R+ − d’B1R- = -0.06 ± 0.05, p = 0.27, paired t-test, n = 11 mice). Thus, mice appeared to respond to the experiment by modulating (increasing and then decreasing) their perceptual sensitivity to the initially rewarded stimulus.

State-dependent choice coding in the primary vibrissal cortex.

a Activity of responsive units (n = 1461) averaged over hit trials (see Methods) is displayed in colour (sp/s, 10 ms window) for each unit (y axis) against time since stimulus onset (x axis, ms). b Activity of responsive units (n = 1461) averaged over miss trials (see Methods) is shown in colour (sp/s, 10 ms window) for each unit (y axis) against time since stimulus onset (x axis, ms). c The difference in trial-averaged activity of responsive units (n = 1461) between hit and miss trials (see Methods) is shown in colour (sp/s, 10 ms window) for each unit (y axis) against time since stimulus onset (x axis, ms). d Evoked trial-averaged responses in hit (y axis, normalised to range) & miss (x axis, normalised to range) trials for all responsive units (n = 1461 units). Blue line indicates equivalence between responses. e A histogram of unit differences (n=1461) in choice probability (Hit − Miss: H-M) between contexts (H-M given a recent hit: “(H-M)|H”; given a recent miss: “(H-M)|M”). f A histogram of unit differences in evoked miss trial-averaged evoked responses between contexts (misses given a recent hit: “M|H”; given a recent miss: “M|M”).

Spatial attention-dependent neuronal gain modulation.

a Trial-averaged (hit and miss) evoked activity of units (n = 1461) in the contralaterally attended state (Pref>0) is displayed in colour (sp/s, 10 ms bins) for each unit (y axis) against time since stimulus onset (x axis, ms). b Identical to a, except in the contralaterally unattended state (Pref<0). c The difference in trial-averaged activity between the contralaterally attended and unattended states (Pref>0 − Pref<0). d Trial-averaged (hit and miss) evoked activity of units (n=1461) in the highperformance state (Perf>0.5) is displayed in colour (sp/s, 10 ms window) for each unit (y axis) against time since stimulus onset (x axis, ms). e Identical to d, except in the low performance state (Perf<0.5). f The difference in trialaveraged activity of responsive units (n = 1461) between the high and low performance states (Perf>0.5 − Perf<0.5). g Trial-averaged evoked neuronal responses (normalised to range, see Methods) associated with the contralaterally attended state are plotted (y axis) against equivalent responses in the contralaterally unattended state (x axis) for each unit (n=1461). h Trial-averaged evoked neuronal responses (normalised to range, see Methods) associated with the high performance state are plotted (y axis) against equivalent responses in the low performance state (x axis) for each neuron (n=1461). i The distribution of the minimum numbers of trials contributing to the evoked responses of units across Pref (top) and Perf states (bottom).

Behavioural choice strengthens the dissociation between performance and preference

We found no significant correlation between overall (bilateral) performance and the trialaveraged evoked responses of the average unit (r = 0.77, p = 0.23, Pearson’s correlation coefficient, pFDR = 0.29). Controlling for animal choice revealed a significant negative correlation between performance and evoked responses in miss trials (r = -0.97, p = 0.03, Pearson’s correlation coefficient, pFDR = 4.83e-2), but not hit trials (r = -0.68, p = 0.32, Pearson’s correlation coefficient, pFDR = 0.36). The high (PerfHigh: Perf>0.5) and low (PerfLow: Perf<0.5) performance trials were not associated with significantly different evoked responses (median unit, interquartile range: PerfHigh - PerfLow = 0.16% of range, [-3.19%, 2.80%], p = 0.56, Wilcoxon signed rank test, n = 1461 units, pFDR = 0.56, Fig.S4d-f,h,i). In contrast, both high performance hit trials (HitsHigh) and high performance miss trials (MissesHigh) were associated with significantly lower evoked responses compared to the respective low performance trials (Fig.S5d,g; median unit, interquartile range: HitsHigh-HitsLow= -0.82% of range, [-6.12%, 3.93%], p = 2.75e-7, Wilcoxon signed rank test, n = 1461 units, pFDR = 1.24e-6; Fig.S5e,h, MissesHigh - MissesLow = -0.38% of range, [-5.21%, 3.57%], p = 1.6e-3, Wilcoxon signed rank test, n = 1339 units, pFDR = 3.6e-3).

At first glance this appears hard to reconcile with the lack of such an effect when hit and miss trials are pooled together. However this is actually a simple result of the encoding of choice probability (median unit, interquartile range: HitsHigh-MissesHigh = 1.07% of range, [-3.75%, 5.39%], p = 5.60e-5, Wilcoxon signed rank test, n=1370 units, pFDR = 1.68e-4; HitsLow-MissesLow = 1.19% of range, [-2.87%, 5.84%], p = 2.13e-13, Wilcoxon signed rank test, n = 1430 units, pFDR = 1.92e-12) and the frequencies of hit and miss trials associated with high and low performance. Each trial type (hits and misses) is associated with lower evoked responses in the high performance state than the low performance state (median unit, interquartile range: HitsHigh = 29.75% of range, [22.95%, 36.61%], HitsLow= 30.60% of range, [22.38%, 39.63%], MissesHigh = 27.99%% of range, [20.06%, 36.33%], MissesLow= 29.68% of range, [22.35%, 37.43%]), but hits are more common in the high performance state (median unit, interquartile range: trials(HitsHigh) = 25, [24, 31], median trials(HitsLow) = 10, [6, 12], n = 1461 units, trials(MissesHigh) = 6, [4, 7], trials(MissesLow) = 43, [32, 50], n = 1339 units) and are also associated with greater evoked responses than misses. Put differently, The median evoked response on a high performance hit trial is equal to the median evoked response on a low performance miss trial. As such, when hit and miss trials are combined, the reduction in evoked responses in the high performance state is washed out by the encoding of choice probability.

High and low performance trials were asssociated with statistically equivalent encoding of choice probability. In fact, neurons exhibited a borderline-significant reduction in their encoding of choice probability in high performance trials (median unit, interquartile range: (HitSHigh − MissesHigh) − (HitSLow − MissesLow) = -0.52% of range, [-7.76%, 6.21 %], p = 0.06, Wilcoxon signed rank test, n = 1339 units, pFDR = 0.09). In contrast, we observed greater encoding of choice probability in contralaterally attentive trials than ipsilaterally attentive trials (median unit, interquartile range: HitsC/L − MissesC/L = 1.45% of range, [-2.57%, 5.75%], p=3.86e-18, Wilcoxon signed rank test, n=1461 units, pFDR = 3.09e-17; HitsI/L − MissesI/L = 0.49% of range, [4.42%, 5.43%], p = 0.05, Wilcoxon signed rank test, n = 1442 units, pFDR = 0.06; (HitsC/L − MissesC/L) − (HitsI/L − MissesI/L) = 1.21% of range, [-5.39%, 7.54%], p = 8.86e-5, Wilcoxon signed rank test, n = 1442 units, pFDR = 2.03e-4).

The interaction of spatial attention, performance, and choice probability.

a Hit trial-averaged evoked neuronal responses (normalised to range, see Methods) associated with the contralaterally attended state are plotted (y axis) against equivalent responses in the contralaterally unattended state (x axis) for each neuron (n=1461). b Equivalent to a using miss trials (n=1442). c The difference between trial-averaged evoked neuronal responses in hit and miss trials associated with the contralaterally attended state are plotted (y axis) against equivalent responses in the contralaterally unattended state (x axis) for each unit (n=1442). d Hit trialaveraged evoked neuronal responses (normalised to range, see Methods) associated with the high-performance state are plotted (y axis) against equivalent responses in the low performance state (x axis) for each unit (n=1461). e Equivalent to d using miss trials (n=1339). f The difference between trial-averaged evoked neuronal responses in hit and miss trials associated with the high-performance state are plotted (y axis) against equivalent responses in low performance state (x axis) for each unit (n=1339). g The minimum number of hit trials associated with each unit across attention (top: Pref) or performance (bottom: Perf) state comparisons. h Identical to g, but for miss trials. i Identical to g and h, but for the hit-miss comparisons.

Additional information about classifying trials according to spatial preference and performance.

a A grayscale colour map of contralateral (hit) trial frequency as a function of Pref and Perf (see Methods). b A grayscale colour map of contralateral (miss) trial frequency as a function of Pref and Perf (see Methods). Positive spatial preference values indicate a higher response rate to the contralateral side than the ipsilateral side (relative to the electrode), and vice versa. Performance values indicate higher bilateral response rates. c A grayscale colour map of the frequency distribution of behaviour windows (surrounding hit and miss trials) according to their associated number of left (trial numbers (L), contralateral to electrode) and right (trial numbers (R), ipsilateral to electrode) stimulus trials. d A grayscale colour map of the frequency distribution of behaviour windows (surrounding only hit trials) according to their associated number of left (trial numbers (L), contralateral to electrode) and right (trial numbers (R), ipsilateral to electrode) stimulus trials. e A grayscale colour map of the frequency distribution of behaviour windows (surrounding only miss trials) according to their associated number of left (trial numbers (L), contralateral to electrode) and right (trial numbers (R), ipsilateral to electrode) stimulus trials. f A grayscale colour map of the average number of unclassifiable (licks within 10 ms of stimulus or free reward) trials associated with each behaviour window as a function of as a function of Pref and Perf (see Methods).

Acknowledgements

G.P.D. and T.S.E.G.S. were supported by the Australian Government Research Training Program. J.B.M. was supported by a National Health and Medical Research Council (NHMRC) Investigator Grant (GNT2010141). E.A. was supported by the Australian Research Council (ARC) Discovery Project Grants (DP170100908 and DP240103043). We thank Conrad Lee and Benjamin Mitchell for their helpful feedback.

Additional information

Author contributions

Conceptualisation, G.P.D., J.B.M., and E.A.; methodology, G.P.D., T.S.E.G.S., E.A.; software, G.P.D. and E.A.; validation, G.P.D. and T.S.E.G.S.; formal analysis, G.P.D and E.A.; investigation, G.P.D. and T.S.E.G.S.; resources, E.A.; data curation, G.P.D. and E.A.; writing − original draft, G.P.D.; writing − review and editing, E.A., J.B.M., and G.P.D.; visualisation, G.P.D. and E.A.; supervision, E.A. and J.B.M.; project administration, G.P.D. and E.A.; funding acquisition, G.P.D., T.S.E.G.S., E.A. and J.B.M.

Funding

Department of Education, Australian Government (AusGovEducation) (AGRTP)

  • Taylor Shivani Erin Grace Singh

  • Guthrie Phineas Dyce

DHAC | National Health and Medical Research Council (NHMRC) (GNT2010141)

  • Jason B Mattingley

Department of Education and Training | Australian Research Council (ARC) (DP170100908)

  • Ehsan Arabzadeh

Department of Education and Training | Australian Research Council (ARC) (DP240103043)

  • Ehsan Arabzadeh