Computational Properties of the Visual Microcircuit

The neocortex is organized around layered microcircuits consisting of a variety of excitatory and inhibitory neuronal types which perform rate-and oscillation based computations. Using modeling, we show that both superficial and deep layers of the primary mouse visual cortex implement two ultrasensitive and bistable switches built on mutual inhibitory connectivity motives between SST, PV and VIP cells. The switches toggle pyramidal neurons between high and low firing rate states that are synchronized across layers through translaminar connectivity. Moreover, inhibited and disinhibited states are characterized by low- and high frequency oscillations, respectively, with layer-specific differences in frequency and power which show asymmetric changes during state transitions. These findings are consistent with a number of experimental observations and embed firing rate together with oscillatory changes within a switch interpretation of the microcircuit.


Introduction
The neocortex is a recurrent network of morphologically diverse inhibitory interneurons and excitatory pyramidal neurons (PYR) [1][2][3][4] . The majority of interneurons can be assigned to biochemically defined classes, such as parvalbumin (PV), somatostatin (SST), and vasoactive intestinal polypeptide (VIP) positive cells 5 . These neurons are distributed across layers and connected according to an intricate circuit diagram with intra-and interlaminar connections [6][7][8][9][10] . The discovery of regularities within the connectivity pattern of excitatory and inhibitory neurons prompted researchers to propose the existence of canonical microcircuits 11,12 , which implement elementary computations that are repeated across the brain 13 .
To identify such computations, research has focused on a better description of the functional role of individual neuron types by selective optogenetic activation and silencing of specific cell types 5,[14][15][16] . These studies have not only highlighted an essential role of inhibitory neurons to balance excitation, but also recognized disinhibitory subcircuits which release pyramidal neurons from strong inhibition 15,[17][18][19][20][21] .
Moreover, neuronal oscillations in different frequency bands have been attributed to the activity of different interneuron types [22][23][24] . While the function of simplified circuits with multiple interneuron types, attributed to the superficial cortical layer, have been investigated theoretically [25][26][27][28][29] , the dynamics of more complex networks comprising multiple layers with translaminar connectivity remain unexplored. Moreover, it is unclear how firing rate descriptions of microcircuit function relate to oscillatory behavior of cortical networks, which can differ across cortical layers [30][31][32] . This is crucial to interpret meso-and macroscopic signals from LFP, EEG or MEG recordings in light of circuit function, where access to firing rate information is not possible.
To address these questions, we take a computational approach and isolate the role of different neurons in rate-and oscillation based functioning of the layered microcircuit of the primary mouse visual cortex, for which the most comprehensive connectivity diagram to date is available 7 . Modeling permitted to go beyond of what is possible with available experimental tools and we not only characterized the effect of selective activation/suppression of different neuron types, but also perturbed specific connections and test their impact on microcircuit dynamics and response properties.
We found that the superficial and deep layers in the visual microcircuit can operate in two different states, each with different excitation-inhibition balance: Inhibition dominated state controlled by SST neurons and a disinhibited state governed by PV neurons. By perturbing connections of different types of interneuron we confirmed that disparities in recurrent connections within these inhibitory cell classes play a crucial role for the different EI-balance in the two states. Two mutual inhibitory motifs that include SST, PV and VIP cells serve as ultrasensitive or bistable switches with different sensitivity, which can toggle the microcircuit between the two states. Such a state change in one layer can propagate through translaminar connections to the other layer.
Notably, we also found that in the inhibited regime beta-band oscillations were more prevalent especially in the deep layer, whereas in the disinhibited state gamma oscillations emerged predominately in the superficial layer, similar to experimental observations 30,32 We also provide a mechanistic explanation to other empirical findings such as asymmetric changes in oscillation power and frequency during state transitions as seen with the presentation of visual stimuli with increasing size 24,33 . Thus, our results provide a comprehensive description of state-dependent effects of different inhibitory interneuron types with testable predictions and relate rate and oscillation -based accounts of microcircuit functioning.

Results
In this study, we investigate the computational properties of a detailed microcircuit of the mouse visual cortex 34 (Fig. 1a). This network consists of two different layers (superficial and deep), representing L2/3 and L5 of the primary visual cortex and each containing four different cell types that are connected within and between layers: excitatory pyramidal cells (PYR), and three different classes of inhibitory cells (PV, SST and VIP). The connectivity was corrected for the different prevalence of each cell type 34 and scaled with a global parameter (G) to approximate effective coupling changes. The variable G could be related to the overall cell count in the microcircuit 35,36 ( Fig.1b). The population dynamics of each neuron type was given by a firing rate model (see Methods). This microcircuit model also displayed noisy oscillations, which allowed us to study both firing rate and oscillatory behavior as measured by variations in power and frequency of the local field potential (LFP), approximated by the rate of the pyramidal cell populations. We first examined spontaneous interactions across all neurons and then drove specific neuron classes, simulating input from remote cortical and subcortical sources.

Spontaneous activity
First, we systematically scaled the microcircuit connectivity by G, and measured the steady-state firing rates of all neurons without any external input. A sharp increase in pyramidal, PV and VIP cell activity with G was followed by a rapid decrease of mean rates in both layers (Fig. 1c). SST neuron also behaved similar to PV and VIP cells but both rise and decay in their activity was much slower. The average firing rates of pyramidal and SST neurons was higher in the deeper layer, in accordance with experimental results in mice 37,38 . Power spectral analysis of the LFP showed a clear peak, whose frequency and power varied with the coupling parameter in a layer specific manner (Figs. 1d-e). Generally, frequencies first increased within the high gamma range from ~60 Hz (for small G) to ~110 Hz (for G = 100) across both layers (Fig. 1f). For G > 100, the dominant LFP frequency steadily decreased to a low gamma (~40 Hz, superficial layer) or low beta range (~15Hz, deep layer) for G = 500. Interestingly, the frequency consistently remained higher in deep layers, consistent with recent experimental findings in mouse V1 31 . Moreover, high gamma frequencies (G < 250) were stronger in superficial layers, whereas the power of slower oscillations (G > 250 was higher in deep layers (Fig. 1g), again in congruence with experimental studies 32,39-41 . showing the scaling of a connection by a coupling parameter G. c) Mean spontaneous rate for all cell types in superficial and deep layers as a function of the coupling parameter G d-e) Example power spectra of LFP in superficial and deep layers for two different values of G. f-g) Frequency and power of oscillatory peaks in LFP spectra as a function of G for both layers.

Origin of different firing rate and oscillation in deep and superficial layers
Next, we investigated the anatomical origin of firing rate and oscillation differences across layers by modifying specific connections. We targeted three connections, which show pronounced asymmetry across layers: PYR sup PYR deep connection, translaminar projections of SST cells, and recurrent inhibition among PV neurons (PV-PV connections) (Fig. 2a, Supplementary Table 4). The removal of the PYR sup PYR deep connection strongly reduced the firing rate differences across the layers (Fig. 2b).
Removal of the translaminar SST connection which only projects from deep to superficial layer had a smaller impact on the firing rate difference. Moreover, the disinhibitory PV-PV connections are considerably stronger in deep layers (Supplementary Table 4). When we changed the PV-PV connections such that their strength was the same in the deep and superficial layers, the firing rate difference between the two layers was also reduced. Modifying all three connections simultaneously almost completely abolished rate inequality between layers. Likewise, differences in oscillation power in different frequency bands across layers were suppressed (Figs. 2c-d, compare with Figs. 1d-e). Thus, our model suggests that stronger excitation and disinhibition in the deep layer together with more inhibition in the superficial later underlie the experimentally observed firing rate and oscillation power differences between deep and superficial layers. Knocking out PV cells was accompanied by a slow oscillation (~30 Hz) in both layers with a frequency that remained approximately stable with G. By contrast, when SST cells were removed the network oscillated at high frequency (~110 Hz) across all tested values of G (Fig. 2f, top, Supplementary Fig. 2a, left). Note that this increase in the oscillation frequency was not due to disinhibition from SST silencing, because PYR firing rate decreased in both knock-out cases with G ( Supplementary Fig. 1), while the frequency remained high. In accordance with the hypothesis, for small values of G when PV rate is high, the oscillation frequency in the intact network approached the frequency seen in the SST knock-out case. As G was increased and SST activity surpassed PV firing rates, the oscillation frequency decreased and converged to values seen in the PV knock-out scenario. Importantly, oscillatory power was overall higher in the PV knock-out case with low frequency and lower in the SST silenced network with faster oscillations across all tested values of G (Fig. 2f, bottom, Supplementary Fig. 2a, right). In contrast to PV and SSP cells, VIP cell silencing only slightly increased the oscillation frequency, but did not influence the relative decrease in frequency as a function of G. However, when we manipulated frequency and power in the knock-out networks, we found that they changed symmetrically. In both PV and SST silenced circuits, driving PYR cells or the remaining inhibitory cell jointly increased or decreased power and frequency in superficial and deep layer, except for the deep layer after SST silencing (Figs. 2g-j, Supplementary Fig. 2b-c). Thus, the relative dominance of PV and SST cell activity is an important factor that determines the oscillation frequency and power, which are inversely related in the full model, but positively correlated in the partly silenced network.

Two different states and state switching dynamics of the microcircuit
Thus far, we changed the relative prevalence of given interneuron types by scaling the connectivity matrix or silencing individual cell types or connections. Visual inspection of the microcircuit revealed two prominent mutual inhibition motifs. SST cells exhibit reciprocal inhibitory connections with PV cells and also VIP cells in each layer, which brings these cell pairs in competition with each other (Fig. 1a). We hypothesized that driving one inhibitory cell type will functionally silence competing cells and toggle the circuit between different inhibitory states, which may differ in terms of PYR firing rate and their oscillation profile. To verify this hypothesis, we first tested whether input to VIP or PV cells can suppress SST activity. To this end we enhanced the SST activity by injecting additional input to SST cells in both layers (I ext = 5Hz). Next, we stimulated either VIP or PV cells in both layers simultaneously, mimicking feedforward input from layer 4 to PV cells or feedback input from upstream areas to VIP cells, which may target superficial and deep layers simultaneously 32,42   PYR and SST cell response to increasing (up branch, in blue/green) and decreasing input (down branch, in black) to VIP cells for an exemplary value of g and both layers. Note that g is higher than in a). The network displays hysteresis in each layer (shaded region h). d) Same as in c) for simultaneous input to PV cells in both layers. Fig. 3a), we found two main effects. First, VIP connections to SST cells suppressed SST rates, whereas PYR and PV cells increased their firing across both layers, because they were released from SST inhibition, in particular for higher G values ( Fig.3a and Supplementary Fig. 3a).

When VIP cells were driven (Supplementary
However, as VIP input increased, PYR and PV cells were gradually suppressed again in the superficial layer, while their firing rate was only slightly affected in the deep layer. This was caused by the inhibitory connection from VIP to PYR cells in the superficial layer and indeed its removal resulted in a response similar to the deep layer two layers ( Fig. 1a, Supplementary Fig. 4).
Second, as G increased, the responses of SST cells became more switch like with sigmoidal curves in both layers, a hallmark of an ultrasensitive switch in many biological systems 43 (Fig. 3a). A similar sigmoidal decrease in SST firing rates with initial PYR disinhibition followed by inhibition was observed in both layers when only PV cells were driven (Fig. 3b, Supplementary Fig. 3b). However, when PV cells were stimulated, switch like ultrasensitive responses occurred at larger G-values as compared to VIP input, especially in the deep layer. By contrast, VIP cell induced inhibition on PYR cells was weaker than PYR suppression mediated by PV cells (Fig. 3a- In some biological systems ultrasensitivity with sigmoidal response curves is accompanied by bistable behavior 44 , characterized by state transitions that are not reversed when the input is withdrawn. A telltale sign of bistability is the presence of hysteresis, that is the response curves change as a function of the direction in which the state change was triggered. To test for bistability in the microcircuit, we first applied an increasing current to VIP or PV cells in both layers simultaneously, followed by current in the decreasing direction for different values of the coupling parameter. We found that hysteresis appeared at sufficiently high G-values, as visible by the appearance of noncongruent response curves for the up and down direction in all cell types of both layers for VIP (Fig. 3c, Supplementary Fig. 5a) and PV input (Fig. 3d, Supplementary Fig.   5b). Hysteresis in the deep layer for PV input required very strong input, even though a small hysteresis effect was observed for smaller G that was transmitted from superficial layers via translaminar connections ( Supplementary Fig. 5c).
Inhibition-based ultrasensitivity and hysteresis commonly require strong inhibitory interactions between the components of the system 44 . Therefore, we hypothesized that the enhanced mutual inhibitory connections between SST < > VIP and SST< >/PV cells due to the scaling by G underlie the sigmoidal and hysteretic response curves. Indeed, selectively increasing these weights was sufficient for ultrasensitivity and hysteresis to appear in the microcircuit ( Supplementary Fig. 6).
Next, to quantify the switching behavior of the microcircuit we fitted Hill function to the SST firing rate response curve (see Methods) and estimated the Hill coefficient (n H ,   Fig. 3a), a measure for (ultra)sensitivity. We also estimated the area between the up and down branches of the response curves (h) to quantify hysteresis. We found that both n H and h increased monotonically with G when either VIP cells (Fig. 4a) or PV cells (Fig.   4b) were stimulated. Within a limited range of G, the Hill coefficient (n H ) increased monotonically for the transition from SST to VIP or SST to PV states in both layers, while hysteresis was absent (h=0). Hysteresis occurred at different values of G depending on the type of switch and layer and caused an abrupt increase in n H, which stabilized with large values of G and gave rise to a virtually binary state transition.
Closer study of the bifurcation diagrams showed marked differences across switches and layers. As we increased G, the sensitivity increased rapidly for the VIP to SST switch in both layers. By contrast, a rapid increase of sensitivity for the PV to SST switch occurred at higher values of G in the superficial layer and even higher G values in the deep layer (Fig. 4c), as compared to the VIP to SST switch. Likewise, hysteresis onset increased from the VIP switches to the PV switch in the superficial and deep layer (Fig. 4d). Note that the PV switch in the deep layer showed an early increase of h due to propagated hysteresis effect from the superficial layer (G ~ 500, Supplementary Fig. 5c) and showed its own hysteresis increase later.
Subsequently, we studied the outcome of the switching dynamics on oscillation frequency and power of the LFP. Both input to VIP and PV cells strongly increased the frequency of the dominant oscillation in superficial and deep layers, whereas the power of the oscillation peak generally decreased (Figs 4e-j). This is expected from a transition from an SST dominated state with low frequency to a high oscillation state in which the frequency is imposed by dominating PV activity (see above). Note that frequency and power show sigmoidal jumps similar to the rate transitions above (Figs. 2i-j, VIP input).
Taken together these results suggest that the microcircuit can operate in two different states: An inhibited state, where SST neurons dominate and a disinhibited state with prevailing PV activity. Two mutually inhibitory circuit motifs provide two switches with different sensitivity which toggle the network between both states, characterized by different PYR rates and oscillation frequencies, while maintaining sufficient inhibition to putatively prevent runaway excitation.

Lateral inhibition switches circuit to the SST state
Next, we studied switching dynamics in the microcircuit in the opposite direction, i.e. a transition from PV/VIP toward SST governed activity. To this end we applied input to SST cells in both layers (Fig. 5a), mimicking the effect of lateral inhibition during surround suppression in the visual cortex, which was experimentally found to be mediated by horizontal pyramidal cell input from distant microcircuits to SST neurons 45,33 . Driving SST cells resulted in a monotonic decay of activity of all other cell types in both layers and for different values of G (Fig. 5b), in line with several experimental studies 24,45,46 . Stimulation of SST cells also reduced the frequency of oscillation (Figs. 5c-e). However, as we increased the input to SST cells the power of oscillations initially increased and subsequently decreased once PV cells were strongly suppressed. This finding replicates experimental findings, in which stronger surround suppression is followed by a sudden transition from high frequency (gamma range) to lower frequency oscillations (high beta, low gamma range) and a concomitant increase in oscillatory power in mice 24,33 and monkeys 47 .

Input to Pyramidal cell favors SST activity
Next, we measured the response of SST cells when PYR cells were stimulated in both layers (Fig. 6a-c, Supplementary Fig. 7a). We studied the response of SST cells in three different scenarios. In the first scenario we stimulated PYR cell and VIP and PV cells received no external input. In this scenario, PYR input strongly increased SST activity  Fig. 7b). Stimulation of PYR cells also increased the population oscillation frequency, whereas oscillation power decreased ( Supplementary Fig. 7c). In a second scenario we stimulated the PYR cells while VIP cells received a constant external input. In this scenario, sufficiently high PYR input and G-value caused a jump back to higher SST activity in both layers (Fig. 6b) with a sudden suppression of PV and VIP activity (Supplementary Figs. 8a-b). In contrast to the PYR cells, stimulation of VIP cells affected the oscillation and their power in a nonmonotonic fashion: the oscillation frequency increased initially, but dropped (superficial layer) or saturated (deep layer) at the transition to the SST state, while oscillatory power declined and suddenly increased with the switch to SST activity ( Supplementary Fig.   8c). Finally, we also stimulated PYR cells while PV cells (instead of VIP cells) received a constant external input. In this scenario we obtained results similar to those obtained in the second scenario (Fig. 6c, Supplementary Figs. 9a-c). These findings are consistent with recent optogenetic experiments in which strong PYR drive was associated with high SST activity and comparatively low PV rates 48 .

State changes propagate between superficial and deep layers
Next, we addressed the question, whether a state transition triggered in only one layer propagates to the other layer across translaminar connectivity. To this end, we induced the same state changes as studied above (Figs. 3-5) by applying current to specific inhibitory neurons in only the superficial or deep layer and measured the response of pyramidal cells in the opposite layer (Fig.7). In addition, we removed translaminar connections to test their role in the state propagation (only connections with an impact are shown). When the circuit displayed high SST activity, input to VIP cells in the superficial layer showed a disinhibitory increase in the deep layer, which was mainly due to a translaminar reduction of SST activity, rather than a direct drive from superficial to deep PYR cells (Fig. 7a). We obtained a similar result in the superficial layer after driving the deep layer VIP cells (Fig. 7b). Likewise, input to PV cells in the superficial layer caused disinhibition in the deep layer within a certain input range which was abolished by removing translaminar SST connections (Fig. 7c). Notably, translaminar PV connections reduce the disinhibition effect as their removal strongly augmented PYR activity. The same effects were found in the superficial layer after PV input to the deep layer (Fig. 7d). When we set the circuit to a VIP dominated state (I ext to VIP in both layers = 40) and applied current to SST cells in the superficial layer, PYR cell activity was suppressed in the deep layer due to a direct translaminar SST connection (Fig. 7e). The same results held true for SST input to the deep layer (Fig.   7f). Finally, a similar suppressive effect on PYR cell rates that propagated to the other layer after input to SST cells was found in the presence of the PV dominated state (I ext to PV in both layers = 40), again due to the translaminar SST connections. (Fig. 7g-h).
In summary, these results demonstrate that transitions between disinhibited and inhibited states triggered in one layer can propagate to the opposite layer and this interlayer interaction is primarily governed by translaminar SST connections.

Recurrent inhibitory connectivity differentiates inhibited from disinhibited states
The connectivity between different interneuron types and pyramidal cells allows the microcircuit to switch between a disinhibited state with high PYR cell firing and an inhibited state with reduced PYR activity, as we show above. However, for a deeper  Fig. 11c). These results indeed suggest that inhibitory state dependent alterations in excitation-inhibition balance, which are at the core of the switching properties of the microcircuit, are due to large differences in PV and SST self-connectivity (Fig. 8e).

Discussion
In this study, we showed that the mouse V1 microcircuit is endowed with two switch like mechanisms that can toggle the pyramidal cells (output of the microcircuit) between high (disinhibited) and low activity states (inhibited) across superficial and deep layers (Fig. 8f). The underlying switching mechanics are realized by the interactions among the three interneuron types (PV, SST, VIP), which compete for inhibitory influence on pyramidal cells. In the inhibited state, SST cells dominate inhibition which serve as 'master regulators' by strongly connecting and inhibiting activity of pyramidal cells and other interneurons in the circuit 24,34,[49][50][51] . In the disinhibited state, excitation is mainly balanced by PV cells 52 and to a lesser extent by VIP neurons 53 , whereas SST activity is reduced.

Difference between inhibition exerted by PV and SST neurons:
While disinhibition through SST suppression was previously shown experimentally and theoretically 18,19,27,54 , the question remains why SST cells provide more inhibition than PV or VIP cells, even though the weights of the PV to PYR connections by far outweigh SST to PYR connections (Supplementary Table 4). Similar to previous simulations of simplified neuronal networks 27 , we found that a key to this inhibitory asymmetry lies in the degree to which PV and SST cells are connected among themselves. While SST cells lack mutual connectivity, PV cells have strong mutual connectivity (that may also be reinforced by gap junctions 6,7,55 ). In our rate model, selfinhibition of PV cells reduced their impact on PYR cells and enhanced PYR rates. We note a similar effect was found in spiking network models, where PV interaction enhances PYR rate and synchrony 56 . Accordingly, we found that exchanging selfconnections of PV and SST neurons inverted their role in mediating the inhibited or disinhibited state.
Origin of switching dynamics: The switching mechanism emerges as a consequence of two mutual inhibitory connection motifs i.e. from SST to PV and VIP, and PV / VIP to SST neurons, in both layers. Thus, driving SST cells switches the microcircuit state to the 'inhibited state' by suppressing PV and VIP neurons as well as PYR neurons.
Conversely input to VIP or PV cells disinhibits the circuit by decreasing SST cells activity. The nature of this switch depended on the mutual inhibitory connectivity strength, rendering the state transition purely ultrasensitive with sigmoidal input-output curves for weaker weights or bistable with hysteresis and memory for stronger weights, consistent with recent observations made in simplified inhibitory neuronal networks 27 .
Switching based on double negative feedback has been conserved during evolution in many biological systems 43,44,57 and we found that it may also be a hallmark of cortical microcircuits. Notably, the two ways to control the switch differ in their sensitivity, with VIP cells requiring considerably less input to control SST activity and flip the circuit to the disinhibited state in both layers than PV cells. Thus, PV cells seem to be more specialized in keeping the excitation-inhibition balance at sufficiently high levels, whereas VIP cells play more a switching role, even though both cell types can assume both functions.
The switching circuitry of the microcircuit can not only be activated by simultaneous input to superficial and deep layers, but each layer can transmit its state change to the other through translaminar connectivity, and effectively synchronize inhibited or disinhibited states across the whole microcircuit. These results suggest that the twolayer microcircuit as a whole can act as a switch, whose state may be used to guide activity flow of pyramidal cells in the feedforward (via L2/3) and deep excitatory cells in the feedback direction (L5) 58,59 . However, it is conceivable that differential input to superficial and deep layers could place both in different switch states.

Bistable dynamics:
The presence of bistability based on mutual inhibitory connection motifs also provides an alternative to the dominant view that persistent transitions between low and high firing rate states across the brain 60 , which underlie working memory required for attention 61 , consciousness [62][63][64] and language processing [65][66][67] , are primarily based on local 68 or inter-areal 62,64 recurrent connectivity between excitatory neurons. In our study, bistability is controlled by properties of local inhibitory connectivity, opening up the possibility that anatomical heterogeneity and gradients across the brain may reflect the presence of bistable switches in some brain areas and ultrasensitive switches without memory in other regions [69][70][71] . Thus, our results also suggest an alternative taxonomy for oscillations, dividing them into competing SST (low frequency) and PV driven rhythms (high frequency). Notably, during the transition between (PV or SST dominated) switch states the oscillation frequency and power behave asymmetrically i.e. an increase in frequency is accompanied by a decrease in power. However, when PV or SST cells are strongly suppressed or silenced, frequency and power change symmetrically. A decrease in frequency and increase in power is also found in recent experiments in monkeys and mice, in which small stimuli trigger a high frequency oscillation (~60 Hz) that is replaced by a lower frequency (~30 Hz) in the presence of larger stimuli 24,33,47 .
Anatomical studies show that this surround suppression effect is presumably mediated by lateral excitatory input from the surround to SST neurons in the center 45 . Our model suggests that the surround switches the microcircuit from a PV/VIP dominated state with a high frequency putatively mediated by stimulus triggered feedforward and feedback drive 75,76 to a more inhibited state caused by enhanced lateral drive to SST cells. We note that experiments have also reported the inverse case with an increase in oscillation frequency and decrease in power after enhancing visual stimulus contrast 77 .

Stability of the cortical microcircuit:
The disinhibited state of the switch naturally entails the risk of runaway excitation. Our results provide evidence that the microcircuit contains supplementary homeostatic mechanisms that keep disinhibition within healthy boundaries. When the circuit is disinhibited and SST activity suppressed, strong drive to pyramidal cell can cause a sudden reversal of SST neurons to a high firing rate state and thereby restore a more inhibited state in the microcircuit. This phenomenon was reported experimentally 78 and in a recent theoretical study 28 showing elevated visually evoked SST rates, after prior suppression through VIP cells activated during locomotion.
Predictions: We found that asymmetric changes in oscillation frequency and power are abolished with silencing of PV or SST cells, a result that can be experimentally tested. Moreover, our model predicts that driving PYR cells is followed by linear or non-linear responses in inhibitory cells depending on the dominance of SST or PV/VIP cells, respectively. Finally, experiments could test whether inhibition or disinhibition mediated by driving specific inhibitory cells in one layer propagates to the other layer, as our simulations showed.
In conclusion, the function that emerges from our computational study of the microcircuit is a homeostatic switch that toggles pyramidal cells, the principal output neurons of the circuit, between an inhibited and disinhibited state. The switching dynamics is orchestrated by an array of inhibitory neurons, each performing a specific task in the switch mechanics. Feedforward, feedback and lateral input may change the position of the switch and regulate the flow of excitation to downstream microcircuits 10,15,79 . Our results also map different types of oscillations onto different interneuron types and link them with distinct switch states, which in the future may help to bring together rate and oscillation based experimental paradigms. They provide mechanistic insight into the long held notion that slow oscillations assume an inhibitory function, while fast oscillations serve information processing [79][80][81][82][83] .

Microcircuit architecture
In this study we develop a firing rate model of the visual cortical microcircuit. This model is based on pair-wise connectivity between major neuron types in superficial and deep layers of the neocortex 34  To convert the original connectivity data (see Supplementary Table 1 for the connection   probability matrix and Supplementary Table 2  Thus, we had four neuron types in both deep and superficial layers. Instead of modeling populations of neurons with N cells for each class, we modeled each cell population using a single firing rate-based neuron. However, we adapted the connectivity weights according to their relative prevalence which is computationally less expensive. To this end, we first followed the general rule that there are roughly five times more pyramidal neurons in a microcircuit than interneurons. Therefore, all inhibitory weights in the matrix were scaled down by a factor of 0.2. Next, we multiplied the weights of each interneuron type with its relative prevalence (Supplementary Table 3). This resulted in the corrected 8 x 8 connectivity matrix (Supplementary Table 4). The resulting microcircuit is schematically shown in Fig 1A.

Population activity model
The dynamics of each neuron type, i.e. pyramidal cells and interneurons, was modeled using the coarse-grained firing rate-based model (Wilson-Cowan model 84 ). The dynamics of the full microcircuit can be written in vector form as: (1) where r is the vector of rates of all 8 cell types, is the vector of population specific time constants (Supplementary Table 5 To study oscillations we simulated 50 trials of 20 second each and averaged oscillation metrics across all trials. All simulations were performed with a time step of 0.1 ms.

Control variables
To study the behavior of the microcircuit we varied several parameters. Foremost, we studied the dynamics of the microcircuit by systematically scaling the overall connectivity by a factor G. The scaling of the connectivity matrix can be loosely related to changing the absolute number of neurons in our circuit, similar to other studies 35,36 .
For the analysis we used the entire connectivity matrix without masking weak connections. The behavior of the circuit was studied by manipulating individual connections by removing or swapping them. Optogenetic silencing of individual cell types was simulated by setting specific columns of the matrix to zero i.e. we effectively removed all output of specific neuron types to the entire microcircuit (see Fig 2). To mimic stimulation of specific neuron types we injected direct current with varying amplitudes to the selected neurons type (e.g. see Figs. 3-6)

Analysis of the LFP
We used the rate of pyramidal cells in each layer as a proxy for superficial and deep local field potentials (LFP) and its oscillatory behavior was investigated as a function of external drive. To analyze oscillation in the LFP we computed the power spectrum within a range of 1 to 250 Hz with the multitaper method implemented in the Chronux toolbox of Matlab (http://chronux.org/). The power spectrum was smoothed and normalized by the summed power of the computed frequency range. We then quantified visible oscillation peaks, excluding frequencies < 10 Hz, in terms of peak frequency and power.

Measure of switching dynamics and hysteresis
Ultrasensitivity reflects the behavior of a system where small changes in input cuase large changes in output. Such behavior is observed in many natural systems such as biochemical reactions 43,88 . Ultrasensitivity can be quantified by fitting a sigmoidal curve to the input-output transfer function. Here we used the Hill equation 43 to estimate the sensitivity of the output (y) to the input (x): (6) where is the intercept, b is the maximum, k is the half-maximum of the output y and n is the Hill exponent, which we used to quantify the response curves of SST cells to VIP and PV input (Figs 4a-c in the main text). If n = 1, the Hill curve is hyperbolic, whereas n > 1 indicates a sigmoidal shape with growing slope (i.e. sensitivity) as n increases.
Hysteresis in general describes the dependence of a system's behavior on the past and implicates the presence of memory. As a consequence, system responses observed when input is steadily increased differ from responses to decreasing input. To test for hysteresis, we computed response curves of all cells (Fig. 3c-d, Supplementary Fig. 5) for ascending and descending VIP and PV input separately. For each input value (i), the rate response of all cells of the previous input value (i-1) was used to initialize the cell rates for the new input value. In the presence of hysteresis, the response curves for increasing and decreasing input do not collapse. Hysteresis (h) was then quantified as the summed difference of the ascending and descending rate curves of the SST cells in superficial and deep layers.  Table 3 Morphological interneuron types, their genetic marker and proportion.  Supplementary Table 4 Connectivity matrix corrected for cell proportions and scaled up by g = 100.