primary areas of the sensory neocortex are thought to faithfully represent the identity of stimuli in the external environment . yet
as animals learn the association between a sensory stimulus and its behavioral relevance , or improve their perceptual capabilities with training , stimulus representations in sensory cortical areas can change ( schoups et  al .
, 2001 ; yang and maunsell , 2004 ; rutkowski and weinberger , 2005 ; blake et  al . , 2006 ; li et  al . , 2008
, 2012 ; goltstein et  al . , 2013 ; yan et  al . ,
such changes may lead to enhanced and more distinct representations of task - relevant stimuli , and therefore improve the salience of information relayed to downstream areas .
the nature and effect sizes of learning - related changes to neural representations vary strongly between different studies , potentially depending on modality , sensory cortical area , and the behavioral task ( schoups et  al . , 2001 ; yang and maunsell , 2004 ; rutkowski and weinberger , 2005 ;
the repeated association between a stimulus and reward can lead to lasting , task - independent changes in cortical representations of that stimulus ( schoups et  al .
, 2001 ; rutkowski and weinberger , 2005 ; goltstein et  al . , 2013 ) . alternatively , the expression of learning - related changes to sensory responses can also depend on the animals being engaged in the task ( li et  al .
2006 ) , consistent with observations that even in primary sensory cortex neuronal responses can be influenced by non - sensory , task - dependent signals reflecting the animal s attentive state , expectations , or behavior ( see , for example , ress and heeger , 2003 ; shuler and bear , 2006 ; li et  al . , 2008 ; niell and stryker , 2010 ; keller et  al . , 2012 ; david et  al . ,
2012 ; stnior et  al . , 2013 ; nienborg and cumming , 2014 ) .
therefore , the strategies by which learning can modify cortical sensory processing are diverse but remain poorly understood .
specifically , how do individual neurons change their response properties as stimuli acquire behavioral relevance ? to what extent
do these changes persist when the animals are not engaged in the task ? how do learning - induced response changes relate to the appearance of non - sensory , task - dependent signals ?
do these non - sensory signals act globally , or do they target specific neuronal subsets encoding behaviorally relevant sensory features ? to address these questions , it is crucial to track the activity of the same cells over the course of learning .
, 2012 ; chen et  al . , 2013 ) in mouse v1 while the animals learned to perform a visual discrimination task in virtual reality .
we observed a robust and progressive population - wide increase in neural selectivity in cortical layer 2/3 ( l2/3 ) during learning 
an effect related to greater day - to - day stability of single cell response preferences as well as to an increase in the number of cells selective for task - relevant stimuli .
task acquisition additionally led to the appearance of both anticipatory and behavioral choice - related signals in a specific subpopulation of neurons whose firing predicted the reward .
therefore , learning the relationship between visual cues and their behavioral relevance leads to concerted changes in the representation of both sensory and non - sensory task - related information in a primary sensory cortical area .
mice can perform complex visually guided behaviors , but they often require weeks of training to achieve high performance levels when head restrained ( andermann et  al . , 2010 ; glickfeld et  al . , 2013 ;
virtual reality environments offer an advantage for training head - fixed animals because they allow active engagement with the sensory world , for example , when the animal s locomotion on a treadmill is directly coupled to optic flow changes in the visual scene ( hlscher et  al . , 2005 ; dombeck et  al . , 2007 ) .
we hypothesized that this type of active visuomotor engagement approximates ethological situations when mice encounter behaviorally relevant stimuli during navigation , exploration , or foraging .
indeed , we found that this enabled rapid visually guided learning ( see below ) .
we trained head - fixed mice to discriminate two grating patterns of different orientations in a virtual reality environment in which the animals running controlled their position in a corridor ( figures 1a and 1b ; see also movie s1 available online ) .
after running through a virtual approach corridor ( walls with black / white circles ) from random starting points , mice were abruptly presented with a corridor containing either vertical or angled ( 40 relative to vertical ) gratings on both walls .
mice were rewarded for licking in response to the vertical grating corridor with a drop of soya milk delivered through a reward spout ( hit trial ; reward was given if a lick was detected in a region a short distance into the grating corridor , referred to as the reward zone ) .
no punishment was given for licking in response to the non - rewarded , angled grating corridor ( false - alarm trial ) .
most mice progressed rapidly from indiscriminate licking ( example lick raster plots in figure  1c , top ) to licking only within the grating corridors in response to both gratings ( figure  1c , middle ) , and finally to nearly exclusive licking in response to the rewarded , vertical grating ( figure  1c , bottom ) and withholding licking in the non - rewarded angled grating corridor ( correct rejection trials ) . mice typically slowed down while licking in the rewarded grating corridor and learned to accelerate upon seeing the non - rewarded grating ( figure  1c , right panels ) .
we quantified task performance by calculating the behavioral d - prime for each training session , which is a measure of the difference in the proportions of hit and false - alarm trials ( figure  1d ; see experimental procedures ) .
mice usually learnt the task within 36  days ( figure  1d ) and eventually reached high behavioral accuracies ( behavioral d - prime in last session 3.2   0.7 , corresponding to 89%   8% correct responses , mean   sd ; see figure  s1 ) .
we tested whether v1 activity was required for visual discrimination in this task by optogenetically silencing v1 in both hemispheres of fully trained animals in a random subset of trials .
we silenced the cortex during grating corridor presentation by photostimulation of parvalbumin - positive inhibitory interneurons expressing channelrhodopsin-2 in transgenic mice ( boyden et  al .
visual discrimination performance decreased progressively when increasing the intensity of blue light directed to v1 in transgenic mice , ( figure  1e ; friedman test ,   = 32.44 , p  < 10 ) , but not in wild - type control mice ( figure  1e ; friedman test ,   = 5.76 , p  = 0.22 ) .
the same transgenic mice were additionally trained in an analogous odor discrimination task in the same virtual corridor ( see experimental procedures ) , which they continued to perform normally even when illuminating v1 with high light intensities ( figure  1e ; friedman test ,
  = 0.20 , p  = 0.98 ) , demonstrating that only visual processing was affected by this optogenetic manipulation . having established the necessity of v1 for this visual discrimination task ( see also glickfeld et  al . , 2013 ) , we examined how the activity of neuronal populations in v1 changed during learning . for this purpose
2013 ) in v1 using aav vectors , and chronically recorded calcium signals ( 32  hz frame rate ) in l2/3 using two - photon microscopy ( denk et  al . , 1990 ) while the animals performed the task ( figures 2a and 2b ; on average 199 trials per session , range 31342 trials ) .
we imaged the same populations of neurons ( 75   27 cells per mouse ; mean   sd ) either in each training session over the entire time course of learning ( five mice , figure  1d ) , before and after learning ( three mice ) , or only after learning ( three mice ) .
neurons exhibited diverse response profiles during the task ( figures 2a , 2b , and s2 ) .
while some neurons responded to features in the approach corridor ( figure  2a , cell 1 ; figure  s7 ) , many cells responded to both the vertical and angled grating corridors , and their responses were often stronger to one grating than the other ( figures 2b and s2 ) .
in other neurons , the calcium signal decreased during grating presentation ( figure  2b , cell 8 ; figure  s2 ) . despite variability in response amplitudes and in the degree of response selectivity from session to session ( see below and figures 2e2 g ) , the majority of neurons maintained their response profiles over time ( figures 2b , s3a , and s3b ) . to quantify how the preference and selectivity of individual neurons for the two grating corridors changed during learning , we derived an index of neuronal selectivity for each neuron in each training session ( defined as the difference between the average responses to vertical and angled gratings in a time window 01  s after grating onset , normalized by the pooled standard deviation of responses across trials ) . by binning sessions with similar behavioral performance ( figure  2c )
, we observed a gradual broadening of the distribution of neuronal selectivity over learning , resulting in both more positive values ( higher preference for the rewarded , vertical grating ) and more negative values ( higher preference for the non - rewarded , angled grating ) .
consequently , the fraction of selective neurons rose significantly over learning ( figure  2d ) , including an increase in the percentage of cells preferring the non - rewarded grating corridor ( 12% to 19% , p  = 0.02 , bootstrap test ) , and a larger increase in the percentage of cells preferring the rewarded grating corridor ( 12% to 32% , p  < 10 , figure  2d ; see figure  s4 for individual mice ) . restricting the analysis only to neurons with a significant response increase after grating corridor onset ( p  < 0.01 , wilcoxon signed - rank test ) yielded similar results ( figure  s5 ) .
the increase in neuronal selectivity was caused by an increase in reliability of responses ( mean standard deviation of responses within 01  s window from grating onset , pre learning  = 0.088 , post learning  = 0.063 , p  = 0.001 , bootstrap test , 27 sessions before and 52 after learning ) , as well as an increased difference in response amplitude to the two gratings with learning ( mean absolute response difference ; pre learning  = 0.017 , post learning  = 0.024 , p  = 0.016 , bootstrap test ) .
however , there was no consistent strategy by which individual neurons changed their response amplitudes to the two gratings ( figure  s3c ) .
we next determined whether the increase in selectivity for grating stimuli was restricted to neurons with specific response properties .
neurons preferentially responding to either grating before learning were no more likely to increase their selectivity during learning than non - selective neurons ( r  = 0.06 , p  = 0.20 ; figure  s3e ) .
moreover , individual cells showed relatively large variability in how they changed their selectivity over learning ( figures s3d and s3f ) .
the increase in selectivity , therefore , involved diverse modes of response change distributed over many neurons across the l2/3 population in v1 .
neuronal responses can show considerable variability from one day to the next ( huber et  al .
, 2012 ; peters et  al . , 2014 ; ziv et  al . , 2013 ) .
we quantified day - to - day fluctuations of stimulus preferences of individual cells and how they changed during learning ( figures 2e2 g ) .
we computed the likelihood of neurons maintaining their grating selectivity from one day to the next ( persistence of response preference , figure  2f ) within different stages of learning : before animals showed improvements in their behavioral performance ( pre learning ) , during learning , and after the behavioral performance had stabilized ( post learning ; see experimental procedures ) . while neurons were relatively more likely to lose their selectivity from one day to the next before learning , it was rare for neurons to completely switch from preferring one grating to the other ( on average 3% before learning ) . over learning ,
the persistence of selective responses increased , and cells preferring either the rewarded or the non - rewarded stimulus became more stable in their stimulus preference ( figure  2f ; rewarded - grating - preferring cells , pre  = 49% to post  = 70% , p  < 10 ; non - rewarded - grating - preferring cells , pre  = 17% to post  = 55% , p  < 10 , bootstrap tests ) .
we additionally determined the probability of non - selective neurons becoming selective from one day to the next ( figure  2 g ) .
as learning progressed , non - selective neurons became more likely to acquire a preference for the rewarded , vertical grating , but not for the non - rewarded , angled grating ( figure  2 g , rewarded - stimulus - preferring cells , p  < 10 ; non - rewarded - stimulus - preferring cells , p  = 0.29 , bootstrap tests ) .
therefore , the increasing preference for task - relevant stimuli in l2/3 of v1 during learning was a result of a stabilization of response selectivity to both gratings as well as an increased conversion of unselective neurons into those more selective for the rewarded grating .
we next determined how these learning - related changes in single - neuron selectivity influenced the ability of neuronal populations to discriminate the grating stimuli . as a composite measure of selectivity in a population with both positive and negative selectivity indices
, we computed the root - mean - square of grating selectivity of all neurons imaged simultaneously ( population selectivity ) over the time course of stimulus presentation ( 200  ms sliding window ; see experimental procedures ) for different training sessions , grouped by behavioral performance ( figure  3a ) .
neuronal population selectivity increased progressively with improving behavioral performance ( pre learning  = 0.26 , post learning  = 0.46 , p  < 10 , bootstrap test , comparison within 01  s window post grating onset ) , and rose sharply after grating onset only in well - trained mice .
additionally , we trained a linear decoder to predict which stimulus the mouse had encountered in each trial ( vertical versus angled grating corridor ) from calcium responses of all cells imaged simultaneously ( see experimental procedures ) .
the ability of the decoder to classify trials correctly increased strongly with improved behavioral performance during learning , such that classification accuracy exceeded 90% in expert mice ( figure  3b ) .
therefore , as mice got better at discriminating the two gratings , population - level representations of these task - relevant stimuli became increasingly distinguishable .
in individual animals , neuronal population selectivity closely tracked the session - by - session changes in behavioral performance ( figure 
s6 ) ; there was a high positive correlation between the average population selectivity ( 01  s post grating onset ) and the behavioral d - prime for individual sessions ( figure  3c ; r  = 0.64 , p  < 10 , n  = 78 sessions ) .
these results suggest that the increased selectivity of v1 neurons during training is a specific effect of learning the discrimination task .
indeed , neither response amplitude nor response selectivity for stimulus features in the approach corridor increased during learning ( p  = 0.38 , pre- versus post learning , wilcoxon signed - rank test ) , even though those features did evoke reliable responses in subsets of cells ( figure  s7 ) . therefore , learning - related changes in v1 activity were specific to task - relevant grating stimuli and were not a consequence of repeated exposure to the same visual environment over multiple sessions ( frenkel et  al . , 2006 ) .
to what extent did these learning - related changes in v1 representations depend on the animals being engaged in the task ? to address this question , we trained expert mice to switch between blocks of the visual discrimination task and an analogous olfactory discrimination task .
mice learned to lick to obtain a reward in response to one of two different odors while running through the virtual corridor where they occasionally encountered the grating stimuli used in the visual discrimination task ( see experimental procedures ) .
mice learned to switch rapidly between the two tasks within the same session , such that they successfully discriminated the grating stimuli in the visual task but ignored the same grating stimuli ( while successfully discriminating odors ) during the intervening olfactory blocks ( figure  4a ; see experimental procedures , movie s1 , and figures s8a  s8f ) .
although the average response amplitudes to the grating stimuli did not change in the olfactory blocks ( figure  s9 ; p > 0.32 ) , most neurons became less selective ( figure  4b ) , as the fractions of neurons preferring both the rewarded and non - rewarded stimuli decreased ( figure  4c ; all p values  < 10 , bootstrap test ) .
consequently , population selectivity for the same grating stimuli decreased significantly in the olfactory blocks compared to the visual blocks ( figure  4d , p  = 0.014 , bootstrap test ) , but remained above the pre learning level ( p  = 10 ) .
moreover , when the same visual stimuli were played back to fully trained but anesthetized mice , the selectivity of v1 populations was further reduced compared to the olfactory blocks ( p  = 0.002 ) but still higher than before learning ( figure  4d , p  = 0.04 ) .
these results indicate that there may be two causes underlying the learning - related increase in stimulus selectivity in v1 : a more lasting , task - independent change in the visual circuits , and a task - dependent modulation that depended on the animals being engaged in visual discrimination .
the fact that the selectivity of most neurons increased during visual discrimination ( figure  4b ) suggests that the task - dependent signals mediating these effects have a widespread influence on neuronal populations in v1 .
several possible causes may underlie the task - dependent changes of stimulus selectivity in v1 during learning .
responses to task - relevant stimuli could be specifically modified to give rise to more distinguishable representations at the population level , thus allowing for easier perceptual discrimination .
in addition , changes in v1 activity could also reflect signals associated with the behavioral outcome of the task , including signals related to the animals motor behavior , which are known to modulate the activity of v1 neurons ( niell and stryker , 2010 ; keller et  al .
, 2012 ; saleem et  al . , 2013 ) . neither the average running speed nor running speed variability at grating onset changed systematically over the course of training ( median speed  = 45.3  cm / s before , 43.4  cm / s after learning , p  = 0.46 ; median sd  = 12.2  cm / s before , 13.9  cm / s after learning , p  = 0.84 , wilcoxon signed - rank test )
. however , the running profile after the animals had identified the grating did change with training : mice slowed down in response to the rewarded grating and increasingly accelerated when detecting the non - rewarded grating during learning ( see figures 1c and s10 for more examples from different mice ) . to determine whether these changes in running behavior or an associated change in optic flow speed could explain the learning - related increase of stimulus discriminability in v1 , we carried out several independent controls .
first , we trained a separate set of animals in a modified version of the task in which expert mice encountered grating corridors whose optic flow was uncoupled from running speed for 1  s and exactly matched to pre learning optic flow speed profiles ( figures s11a and s11b ; see supplemental experimental procedures ) . in separate experiments ,
gratings were presented at a fixed speed profile during the visual and olfactory discrimination task ( figures s11c 
note that in these tasks , gratings were always preceded by a gray corridor to ensure also that the visual input preceding the task - relevant stimuli was uniform across conditions .
thus , when the speed profiles of task - relevant visual stimuli were identical in all conditions , we again found that v1 neurons increased their grating selectivity over the course of learning , as well as when the animals engaged in the visual compared to the olfactory discrimination task ( figures s11b , and s11f and s11 g , respectively ) .
second , we tested if locomotion - related response modulation in v1 influenced the learning - related changes in neuronal selectivity .
we did not observe any speed - related differences in neuronal population selectivity computed from trials with matched running speed profiles in all conditions ( figures 5a and 5b ) .
specifically , v1 neurons showed increased selectivity after learning independent of running speed ( figure  5a ; population selectivity within 00.5  s from grating onset , pre- versus post  learning , slow : p  = 0.02 ; fast : p  = 0.01 , bootstrap test ) .
moreover , while some neurons showed a correlation between their calcium signal and running speed , as expected from previous studies ( niell and stryker , 2010 ; keller et  al . , 2012 ; saleem et  al . , 2013
) , there was no positive relationship between how strongly cells were modulated by running and/or optic flow speed and their change in grating selectivity over learning ( figures s12a and s12d ; see experimental procedures ) .
indeed , the exclusion of neurons whose responses were modulated by running did not alter the increase in v1 population selectivity over learning ( figures s12b and s12c , and s12e and s12f ) .
third , while there was some modulation of v1 activity by signals related to the animals licking , excluding neurons modulated by licking did not change the learning effect ( figures s12g  s12l ) .
fourth , we found that any signals related to eye position , eye movements , and pupil size could not account for the increased neuronal selectivity after learning ( see supplemental information and figures s13a  s13f ) .
furthermore , we conducted similar analyses to control for any differences in motor behavior during the visual and olfactory discrimination task ( figures s8g  s8j and s13g  s13j ) , and found that variations in locomotion , licking , eye movements , or pupil size could not explain the task - dependent improvements of neuronal selectivity in v1 .
finally , we trained the linear decoder introduced above on either the population activity of v1 neurons or the running speed of the mouse to predict trial type ( vertical versus angled grating corridor ; see experimental procedures ; figure  5c ) .
due to the systematic divergence of running speed after mice had entered the grating corridors ( see above ) , the ability of the decoder to classify trials correctly based on running speed strongly improved over learning . however , the decoder trained on v1 activity allowed for earlier classification of the stimulus than the decoder trained on running speed ( figure  5c , top behavioral d - prime bin v1 activity versus running speed at 150  ms , p  < 10 , bootstrap test ) .
indeed , even the short - latency v1 activity before running speed divergence ( typical divergence > 220  ms after stimulus onset ) allowed for a significant improvement in grating classification during learning ( bottom versus top behavioral d - prime bin at 220  ms , p  = 0.001 , bootstrap test ) .
importantly , in post learning sessions ( behavioral d - prime > 2 ) , during which mice showed a delayed divergence in their running speeds in response to the rewarded and non - rewarded gratings ( running divergence > 400  ms after grating onset ) , neuronal activity allowed for an equally early and accurate classification of the grating stimuli compared to sessions with matched behavioral d - prime but with earlier running speed divergence ( neuronal decoding performance early versus late running divergence : p > 0.1 for all time bins 0  0.5  s from grating onset ; figure  5d ) . therefore ,
learning led to improvements in the ability of v1 populations to discriminate task - relevant stimuli before the animal acted on its decision either to slow down and lick for reward , or to speed up and suppress licking .
taken together , the increase of neuronal selectivity in v1 with training can not be explained by the modulation of v1 activity by any of the measured motor parameters ( running , licking , eye movements , pupil dilation ) nor by any differences in optic flow before and after learning .
the information related to the animal s own action is not the only non - sensory signal that can influence v1 activity .
other task - related signals relaying information about the attentional state , expectations , or behavioral choice have also been observed in visual cortical areas ( moran and desimone , 1985 ; britten et  al . , 1996 ; shuler and bear , 2006 ;
, 2013 ; nienborg and cumming , 2014 ) . to identify such signals in v1 activity , we compared responses to the non - rewarded , angled grating during correct rejection trials ( cr , mouse withheld licking and accelerated ) and false - alarm trials ( fa , mouse incorrectly licked and slowed down ) . because the visual stimulus identity during cr and fa trials was the same but the behavior of the animal was different ( i.e. , stopping and licking versus running
; see also figure  6a ) , we could identify neurons whose responses were not behaviorally modulated ( no significant response difference between cr and fa trials despite a strong difference in behavior ; figure  6b ) and those that were ( significantly different responses between cr and fa trials ; figure  6b ) .
when we excluded all behaviorally modulated cells from the analysis , we still found that the proportion of neurons selective for the rewarded and non - rewarded gratings significantly increased over learning ( figure  6c ; all p values  < 0.04 , bootstrap test ) , similar to the effects for the entire population ( figure  2d ) .
these results again demonstrate that the improvement in v1 selectivity for both task - relevant stimuli after learning is not caused by signals related to the change in the animals behavior during learning , associated changes in optic flow speed , or task - related signals such as reward expectation .
importantly , however , visually evoked activity of many cells was modulated by the behavioral response ( up to 40% of selective neurons ; figure  6b ) .
this difference was apparent at the population level because a decoder trained on predicting the behavioral choice in response to the non - rewarded grating ( cr versus fa trials ) from neuronal activity of all cells performed above chance and improved with learning ( figure  6d ; highest versus lowest behavioral d - prime , p  = 0.01 , bootstrap test ) .
interestingly , on average , neurons preferentially responding to the rewarded grating showed significantly different responses between cr and fa trials , while neurons preferring the non - rewarded grating did not ( figure  6e ; rewarded - stimulus - preferring cells , p  < 10 , n  = 336 ; non - rewarded - stimulus - preferring cells , p  = 0.31 , n  = 194 , wilcoxon rank - sum test ) .
therefore , signals related to the behavioral outcome developed over learning and mainly influenced a specific subgroup of neurons preferring the rewarded stimulus .
analysis of neuronal activity just before the onset of the grating corridors revealed another task - dependent signal that developed during training , presumably related to the animals anticipation . while mice started each new trial at a different , random position in the approach corridor ,
the abrupt onset of the grating corridors was always preceded by the same pattern of black and white circles on the corridor walls ( see figure  s7a ) .
some neurons increased their activity just before grating onset with learning ( figure  7a ) , suggesting that they had developed anticipatory signals ( jaramillo and zador , 2011 ; totah et  al .
, 2013 ) , which might reflect the animals ability to eventually predict and anticipate the time point of appearance ( but not the identity ) of the grating corridors from the preceding corridor wall pattern .
importantly , only the neurons preferring the rewarded stimulus , and not the neurons preferring the non - rewarded stimulus , developed this pre - stimulus activity increase during learning ( figures 7b and 7c , pre- versus post learning , rewarded - stimulus - preferring cells : p  = 0.001 ; non - rewarded - stimulus - preferring cells : p  = 0.14 , bootstrap test ) .
the existence of these specific , putative anticipation signals was supported by a significant decrease in pre - stimulus activity during anesthesia after learning only in cells preferring the rewarded grating ( figure  7c , rewarded - stimulus - preferring cells : p  < 10 ; non - rewarded - stimulus - preferring cells : p  = 0.06 , trend in the opposite direction , bootstrap test ) . taken together , non - sensory signals , both before and after appearance of the task - relevant stimuli , seem to influence primarily a specific ensemble of cells that preferentially responded to the stimulus that predicts the reward .
we show that learning leads to concerted changes in how l2/3 neurons in v1 process visual and non - visual signals related to the behavioral task . by tracking individual neurons during learning , we observed a net recruitment and stabilization of neurons selective for task - relevant stimuli , resulting in improved stimulus discriminability at the population level , which closely correlated with the behavioral performance of the animals .
these learning - induced enhancements of stimulus representation in v1 diminished substantially when animals did not engage in the visual discrimination task , suggesting that putative top - down signals contribute to increased population - level discriminability . in parallel , we observed the emergence of additional task - dependent signals in a specific subpopulation of cells  neurons preferentially responding to the rewarded stimulus developed anticipatory responses prior to the appearance of task - relevant stimuli and additional activity related to the animal s behavioral choice after stimulus onset .
we developed a visually guided task in which head - fixed mice learned to discriminate two grating patterns in a virtual reality environment in which the animals running controlled their position in a corridor ( hlscher et  al .
most mice learned to perform this task with high behavioral accuracy within 1  week ( behavioral d - prime > 3 , corresponding to accuracy levels of > 90% ) .
we speculate that task acquisition was facilitated by the fact that mice had active control over their visual environment ( locomotion coupled to visual feedback ) , resulting in a more naturalistic visual experience ( gibson , 1979 ) that seemed to promote engagement in the task .
we showed that task performance was dependent on visual cortex activity and , importantly , that responses of v1 neurons to task - relevant stimuli became progressively more distinguishable , leading to more selective task - relevant information in v1 circuits .
the closed - loop nature of behavioral tasks in virtual reality makes it necessary to separate sensory and motor influences on neuronal responses .
specifically , it was important to control for the changes in running speed and the resultant changes in  the optic flow speed over the course of training in relation to  the observed changes in v1 activity .
the learning - related increase in neuronal selectivity did not decrease ( 1 ) when comparing responses only in running speed - matched conditions before and after learning , ( 2 ) when comparing responses to identical optic flow before and after learning , ( 3 ) when excluding neurons from the analysis whose responses were modulated by  running and visual flow speed , and ( 4 ) when only including neurons with similar responses to the same grating in fa and cr trials even though the animals behavior ( running speed and licking ) and the optic flow differed .
moreover , learning - induced increase in v1 selectivity did not diminish when controlling for licking , eye position , eye movements , and pupil size .
therefore , the improvement in v1 stimulus discriminability during training could not be accounted for by any changes in the animals motor behavior we could measure or by associated changes in visual input . finally , even though somatic gcamp6 signals the occurrence of spiking with a slight delay ( time to peak for one action potential >
2013 ) , we found improved discriminability  of task - relevant stimuli in v1 within approximately 200  ms after stimulus onset , which preceded the animal s behavioral response and changes in locomotion .
this suggests that learning may increase the salience of information relayed to downstream areas to better inform behavioral decisions .
importantly , these results are comparable with those of a recent study of learning - related changes in v1 of macaque monkeys using multiunit recordings ( yan et  al . , 2014 ) , suggesting that learning exerts similar effects on a primary sensory cortex in rodents and primates . tracking the activity of the same identified cells throughout
learning allowed us to investigate which changes in single cells underlie population - wide improvements in stimulus selectivity .
previous studies in visual cortex have shown differences in orientation tuning at or close to task - relevant grating orientations in  animals trained in visually guided tasks compared to control conditions ( schoups et  al .
, 2001 ; yang and maunsell , 2004 ; goltstein et  al . , 2013 ) .
these results suggest that increases in population selectivity might have been mainly due to an increase in response selectivity of neurons that already had shown some orientation tuning before learning .
however , we did not find that learning - related changes are especially pronounced in or even restricted to neurons with particular visual response properties .
specifically , neurons already selectively responding to one of the two task - relevant grating stimuli before learning were not more likely to increase their selectivity than non - selective neurons during learning .
one change in single cell responses that led to increased stimulus discriminability at the population level was a learning - induced decrease in day - to - day fluctuations of selectivity for task - relevant stimuli in individual neurons , akin to response stabilization observed in the motor cortex ( huber et  al .
neurons preferring either the rewarded or  the non - rewarded stimulus became more likely to maintain their response selectivity across consecutive training sessions .  in parallel , we found an increased recruitment of previously non - selective neurons to become selective for the rewarded grating stimulus during training , which may explain the larger proportion of neurons selective for this stimulus in expert mice .
we successfully trained mice to switch between a visual and an olfactory discrimination task several times within the same training session .
mice ignored the grating stimuli during the olfactory discrimination task , and this allowed us to test whether the learning - related enhancement in task - relevant visual stimulus processing was hardwired or task - dependent .
population - level discriminability for grating stimuli was reduced but not decreased to pre learning levels when expert animals were not engaged in the visual discrimination task .
therefore , learning led to both task - independent and task - dependent enhancements in the processing of relevant stimuli in v1 .
task - independent changes likely reflect more persistent alterations to visual circuits , akin to those previously observed outside the task or under anesthesia in visual cortex after learning ( schoups et  al . , 2001 ; yang and maunsell , 2004 ; goltstein et  al . ,
the existence of task - dependent changes , however , suggests that non - sensory signals directly contribute to the enhanced processing of behaviorally relevant stimuli ( li et  al .
such modulatory signals , which depend on the animals behavioral context , could be relayed by excitatory projections of cortical or subcortical origin ( krauzlis et  al . , 2013 ; mcalonan et  al . , 2008 ; zhang et  al . , 2014 ) , or may additionally involve cholinergic input from the basal forebrain ( pinto et  al . , 2013 ) .
importantly , we found that these signals seem to increase the selectivity of most neurons encoding both the rewarded and non - rewarded stimuli when animals actively engaged in visual discrimination . coinciding with the changes in the representations of task - relevant stimuli
, we observed the appearance of two additional types of task - dependent signals during learning .
first , neurons  preferring the rewarded stimulus developed anticipatory responses prior to the appearance of task - relevant stimuli ( jaramillo and zador , 2011 ; totah et  al . , 2013 ) .
these signals are unlikely to be visually evoked , as they are not visible in neurons preferring the vertical grating before learning or under anesthesia .
instead , they likely arise through the learned association between a specific corridor position and the appearance of a grating stimulus , suggesting that processing in v1 is influenced by stimulus expectation , perhaps to prime activity in those neurons whose firing best predicts a reward .
these anticipatory signals may thus reflect reward expectation ( the rewarded stimulus will appear with 50% likelihood ) .
for example , they could be the neural signature of a type of  wishful thinking  by the animals 
stimulus expectation that preferentially evokes the cortical representation of the rewarded and therefore preferred stimulus . over the course of training
, some neurons also increasingly exhibited enhanced responses during error trials in which the animals incorrectly sought reward in response to angled gratings , suggesting their activity might be related to the animal s behavioral choice ( britten et  al .
, 1996 ; ress and heeger , 2003 ; nienborg and cumming , 2014 ) , or reward expectation as previously observed in v1 ( shuler and bear , 2006 ; stnior et  al . ,
importantly , both the anticipatory and the behavioral choice - related signals emerged predominantly in neurons responding preferentially to the rewarded stimulus .
we hypothesize that these signals may arise by strengthening of inputs from areas encoding reward expectation ( e.g. , orbitofrontal cortex ; tremblay and schultz , 1999 ) .
activity - dependent hebbian mechanisms would permit this strengthening to occur specifically on v1 neurons preferring the rewarded stimulus , because these are consistently active before and during the time of reward delivery .
with learning , as the animals increasingly develop an expectation of reward ( i.e. , just before and during the task - relevant stimulus appearance ) , neurons preferring the rewarded stimulus in v1 would be preferentially activated by projections conveying these putative top - down signals .
this mechanism may act in concert with cholinergic signaling that has been proposed to explain reward timing - related plasticity in v1 ( chubykin et  al .
the appearance of non - sensory signals in neuronal ensembles preferring the stimulus associated with a reward contrasts with the modulation of sensory stimulus responses when mice were engaged in the visual discrimination task , which acted more generally by increasing the selectivity of neurons encoding both the rewarded and the non - rewarded stimuli .
identifying the sources of these diverse task - dependent signals is an important next step for clarifying their role in shaping early sensory processing .
the sophisticated genetic tools available in mice will help elucidate the role of the many cortical and subcortical areas providing input to v1 during learned behaviors , as well as specific inhibitory cell types or different neuromodulator systems in the emergence and expression of learning - related changes . in summary ,
as a mouse learns the behavioral significance of  a visual stimulus , the responses of l2/3 neurons in v1 become more selective for task - relevant stimuli , leading to enhanced stimulus discriminability at the population level . in
parallel , multiple task - dependent signals emerge during learning and differentially influence the firing of neurons within the v1 circuit .
this demonstrates the remarkable flexibility by which a primary sensory cortex can tailor its processing to the requirements of a task and to the behavioral relevance of sensory stimuli .
all experimental procedures were carried out in accordance with the institutional animal welfare guidelines and licensed by the uk home office and the swiss cantonal veterinary office . a virus expressing gcamp6f or gcamp6 m ( aav2/1-hsyn - gcamp6-wpre ; chen et  al . , 2013 ) was injected in the primary visual cortex ( v1 ) in the right hemisphere of c57bl/6j mice ( p49p57 ) .
we imaged gcamp6-labeled neurons in layer 2/3 in 93 training sessions and 12 recording sessions under isoflurane anesthesia in 11 mice with a custom - built resonant scanning two - photon microscope with a frame rate of 32  hz .
a reward delivery spout was positioned near the snout of the mouse , and licks were detected using a piezo disc sensor .
mice were then trained in a visual discrimination task in which the running speed on the cylinder was detected with an optical mouse and used to control the speed at which mice moved through a virtual environment presented on two screens in front of them .
a trial started when the mouse was positioned at a random starting point in an approach corridor with walls showing black and white circles on a gray background .
when the mouse reached a specific point in the corridor , it was randomly teleported to one of two grating corridors with either a vertical or an angled grating on the walls . in the vertical grating corridor ,
the mouse was rewarded with a drop of soya milk , for licking the spout after it had entered a  reward zone ,  a short distance into the grating corridor .
a subset of mice was trained to switch between blocks of an olfactory and visual discrimination task . in olfactory blocks
, mice performed an analogous olfactory go - no go discrimination task in which they were rewarded for licking in response to one of two odors . during this task ,
mice were also presented with the vertical and angled grating corridor at different positions in the approach corridor .
. on switching to the visual block , mice started licking selectively to the rewarded grating as before .
see supplemental experimental procedures for further details about the visual stimulus , behavioral tasks , and training .
bilateral silencing of v1 was carried out in four transgenic mice ( three males , one female ) expressing channelrhodopsin-2 in parvalbumin - expressing interneurons ( hippenmeyer et  al . , 2005 ; madisen et  al . ,
2012 ) . additionally , three male wild - type c57bl/6j mice underwent identical surgical and experimental procedures .
intrinsic imaging was used to determine the extent of v1 , and all regions excluding v1 were covered with black paint . in expert mice
( > 90% performance levels ) , v1 was silenced by illuminating both cranial windows with 470  nm light at one of four intensities shortly before and during the grating corridor . in 30% of trials
the same mice were also trained on an olfactory discrimination task as described above ( but without grating stimuli ) .
image stacks were corrected for motion , and regions of interest ( rois ) were selected for each cell in each session .
raw fluorescence time series f(t ) were obtained for each cell by averaging across pixels within each roi .
baseline fluorescence f0(t ) was computed by smoothing f(t ) ( causal moving average of 0.75 s ) and determining for each time point the minimum value in the preceding 60  s time window . the change in fluorescence relative to baseline , f / f ,
was computed by taking the difference between f and f0 , and dividing by f0 . to analyze responses to the vertical and angled grating corridors ,
a wilcoxon rank - sum test was used to determine if responses  the average f / f in a time window of 1  s after grating onset  in the two conditions were significantly different ( p  < 0.05 ) , and the sign of the difference determined the response preference .
the persistence of stimulus preference ( figure  2f ) was defined as the probability that a cell that significantly preferred one of the two gratings on one day also preferred the same grating on the next day .
recruitment of non - selective cells ( figure  2 g ) was defined as the probability that a cell with no stimulus preference on one day became selective to one of the two gratings on the next day .
we computed these measures for three stages of learning , based on the behavioral d - prime ( bdp ) of two consecutive sessions : before learning ( bdp of both sessions  < 1 , and bdp  < 0.5 , nsession  = 14 ) , during learning ( bdp of first session  < 2 , bdp second session > 0.5 , and bdp > 0.5 , nsession  = 14 ) , and after learning ( both bdp > 2 and absolute change in bdp  < 0.5 , nsession  = 19 ) .
varying the criteria to define different stages of learning led to similar results ( data not shown ) . to quantify
the selectivity of neural responses we computed a response selectivity index ( si ) for individual cells from the difference between the mean response in the first second after grating onset to the vertical and angled grating corridor , divided by the pooled standard deviation of the responsessi=(rvra)/spva , wherespva=i=1k=2(ni1)si2/i=1k(ni1 ) , and ni is the number of trials in condition i for k conditions .
therefore , positive values indicate a preference for the vertical grating corridor and negative values a preference for the angled grating corridor
. please note that in the manuscript text the term selectivity substitutes for si . to obtain a combined measure of grating discriminability for simultaneously imaged populations of neurons ,
population selectivity was computed by taking the average of the squared selectivity index across cells and taking the square root:(incellsi2)/ncell .
a bootstrap test ( efron , 1979 ) was used to test for significant differences between conditions that contained both dependent and independent data points . to test whether changes in the proportion of cells preferring the vertical or angled grating , or without preference across two conditions ( typically before and after learning ) , were significant , we first computed for each session the proportions of cells in each category .
next , we randomly picked the same number of sessions ( the minimum across conditions ) from both conditions , and repeated this 10,000 times .
we then computed in both conditions the average cell proportion across sessions , and we also computed the proportion after randomly assigning sessions to one of the two conditions .
the p value was given by the number of bootstraps in which the proportion change in the actual data was greater than the proportion change with randomly assigned condition labels .
similarly , bootstrapping was also used to assign significance to the differences in population selectivity , decoding performance , and pre - stimulus activity increase , by comparing the difference in the original data to the difference with randomly assigned condition labels . to control for the effect of running speed and optic flow on neural responses and selectivity across learning ,
grating responses were compared specifically in trials that were matched for running speed across sessions and stimulus conditions ( figures 5a and 5b ) .
first , the average running speed was determined in sliding 200  ms time windows from 0.5 to  + 0.5  s around the onset of the grating corridor ( 50  ms step size ) . then responses in each time window of each trial
were assigned to one of three groups , depending on running speed ( three bins divided equally from the 2.5% percentile to the 97.5% percentile of the average running speed , across all sessions ) .
data for each time window were only included if it contained at least ten trials of both grating conditions . in the highest speed bin ,
not enough matched data were available across learning , thus restricting the analyses to the lowest speed bin ( referred to as  slow  ) and the intermediate speed bin (  fast  ) . to quantify the accuracy with which two conditions ( either trials with vertical and angled grating corridors ( figures 3b , 5c , and 5d ) or fa and cr trials ( figure 
6d ) could be classified at time t relative to grating onset , a cumulative decoder was employed . from training data ( 30 trials of both conditions ) ,
the decoder constructed for each neuron n a model of the response using as parameters the mean response to the vertical ( nv ( t ) ) and angled grating corridor ( na ( t ) ) and the variance of the noise n to maximize the observed log - likelihood of the data under a gaussian noise model . on test trials ( the remaining trials that were not used as training data ) , the log - likelihood at time t that trial k belongs to condition c ( where c was for instance the vertical ( v ) or angled grating corridor ( a ) condition ) is proportional tolc(t)=nncell0tstart(dn , k(ttstart)nv(ttstart))2/(2n2 ) , where d indicates deconvolved f / f ( see supplemental experimental procedures ) .
if lv > la , the trial was assigned to the vertical condition , otherwise to the angled grating condition . to obtain at each time point t the cumulative likelihood lc , the summation only included time points starting from tstart , which was the time of the grating onset , up until time t. note that without the temporal accumulation of log - likelihood , the decoder would be equivalent to a linear discriminant analysis . to determine the time point at which there was a detectable divergence of running speed between vertical and angled grating trials
, we performed a wilcoxon rank - sum test on the average speed in nonoverlapping , consecutive 50  ms windows .
the time of divergence was defined as the center of the first window with p  < 0.01 followed by p  < 0.01 in at least four consecutive windows . for figure  5d , we defined post learning sessions with delayed divergence as sessions with behavioral d - prime > 2 and time of running speed divergence greater than 400  ms ( n  = 8 sessions in n  = 7 mice , average d - prime 2.59 ) .
we paired each of these sessions to a unique session with the smallest difference in behavioral d - prime , but with time of divergence  < 400  ms ( n  = 8 sessions in n  = 6 mice , average d - prime 2.61 ) . to analyze responses during fa and cr trials , only sessions with at least 15 fa trials were included in the analysis ( figure  6 ) .
these were predominantly sessions at intermediate learning stages , as most expert mice made very few mistakes by the end of training ( see figure  s1 ) .
behaviorally modulated cells were defined as cells with significantly different activity for fa and cr trials in the first second after grating corridor onset ( p  < 0.05 , wilcoxon rank - sum tests ) . to obtain average responses for cells preferring the vertical or the angled grating corridor ( figure  6e ) , neurons were classified as vertical ( or angled ) preferring if they significantly preferred the vertical ( or the angled ) grating corridor in at least one session and never switched preference , and responses of such cells were averaged across the sessions in which they showed a significant preference .
the relative response increase before grating onset ( figure  7c ) was calculated for each cell as the difference in the average f / f signal between two time windows , 0.25  s to 0  s and 1  s to 0.75 s , divided by the average f / f signal in the 1 to 0.75  s window , where t  = 0  s is time of grating onset . to compare pre - stimulus responses before and after learning ,
responses were averaged on the first day of training and the first day post learning ( behavioral d - prime > 2 ) for each cell .
neurons were classified as vertical ( or angled ) preferring if they significantly preferred the vertical ( or the angled ) grating corridor ( p  < 0.05 , wilcoxon rank - sum test ) .
 summarywe determined how learning modifies neural representations in primary visual cortex ( v1 ) during acquisition of a visually guided behavioral task . 
 we imaged the activity of the same layer 2/3 neuronal populations as mice learned to discriminate two visual patterns while running through a virtual corridor , where one pattern was rewarded . 
 improvements in behavioral performance were closely associated with increasingly distinguishable population - level representations of task - relevant stimuli , as a result of stabilization of existing and recruitment of new neurons selective for  these stimuli . 
 these effects correlated with the appearance of multiple task - dependent signals during learning : those that increased neuronal selectivity  across the population when expert animals engaged in the task , and those reflecting anticipation or behavioral choices specifically in neuronal subsets preferring the rewarded stimulus . therefore , learning engages diverse mechanisms that modify sensory and non - sensory representations in v1 to adjust its processing to task requirements and the behavioral relevance of visual stimuli . 
Introduction
Results
Discussion
Experimental Procedures
Author Contributions