image representing the current explore topic

Computational Modeling & Theory

Model of Layer 4 of the Mouse Primary Visual Cortex

Biophysically detailed and point-neuron circuit models of Layer IV (L4) of mouse primary visual cortex (V1), receiving thalamo-cortical visual inputs, were constructed from data generated by the Allen Institute.  The 45,000-neuron models were subjected to a battery of visual stimuli, and results were compared to in vivo experimental data.  Simulations reproduced a variety of observations, including effects of optogenetic perturbations.  

Publication | Code

The Layer IV model story

As a quote attributed to Richard Feynman goes, “What I cannot create, I do not understand.” 1  In this spirit, teams at the Allen Institute for Brain Science are building biologically realistic, data-driven models of cortical circuits, and use them for in silico experiments to elucidate mechanisms underlying activity and computations observed in in vivo experiments. 

One of the first goals was to build a model of an input layer of the mouse primary visual cortex (area V1), cortical Layer 4 (L4).  The model was used to ask three major questions: 

  • How well does a detailed network model reproduce observations from in vivo experiments? 
  • What are the major mechanisms that determine the observed neuronal activity patterns?   
  • To what extent does the ability to reproduce experimental recordings depend on the level of granularity of the model? 

The model was designed to represent the central portion of V1 (Fig 1).  The model consisted of 10,000 biophysical cells, and 35,000 much simpler leaky-integrate-and-fire (LIF) neurons that were placed around the biophysically detailed “core” to prevent boundary artifacts. 

Figure 1.  Schematic of the Layer 4 model architecture.  (a) The range of biophysical and LIF portions of the model are shown on a surface map of the mouse cortex (VISp is V1).  (b) Example morphologies of the five neuron models used to generate the L4 network.


A model to describe how movies are processed through the retina and the lateral geniculate nucleus (LGN) of the thalamus was created, to provide spiking inputs to L4 (Fig. 2).   The LGN filters sample portions of an image and generate spikes that provide input to the target L4 cell.  This permitted the use of arbitrary movies as visual stimuli – including the actual movies used in in vivo experiments from the Allen Brain Observatory.

Figure 2.  Input to the Layer 4 model is generated from filter-based models of LGN cells.  Superimposed on a sample image stimulus frame, three types of LGN filters (ON, OFF, and ON/OFF) are distributed in the visual space, and individual LGN filters provide input to a specific L4 cell, as illustrated here in grey.


How well does a detailed network model reproduce observations from in vivo experiments? 

Analysis of evoked cellular responses to visual stimuli (drifting gratings, natural movies, full-field flashes, etc.) in mice showed that the L4 model could recapitulate experimental data, on many metrics.  For example, Figure 3 shows the orientation selectivity of excitatory cells, sparsity of responses, and oscillations in the 15-50 Hz range (sometimes referred to as “mouse gamma”), with a peak at ~20 Hz 7.


Equally important, however, was the observation that certain features were not reproduced well. The direction selectivity was absent in the model due to the way the LGN filters were constructed, providing insight into areas for improvement in the next generation of cortical models7

Figure 3.  Examples of the simulation results, as compared with in vivo data.  (a) Comparison of the orientation selectivity index (OSI) between simulations (segregated by cell type) and experimental data, measured by extracellular electrophysiological recordings (grey bars; An.L4, data from anesthetized mice;  Aw.L4, data from awake mice).  (b) Lifetime sparsity of simulated (green bars) and experimental responses (grey bars) of excitatory neurons, using drifting gratings or natural movies as visual stimuli.  (c) The local field potential (LFP) at the L4 model center, using a drifting grating stimulus.  The spectra from 10 trials are shown in pink, and the average spectrum is in solid red.  The peak at ~20 Hz indicates network-wide oscillations at that frequency, consistent with experimentally observed "mouse gamma" oscillations at 20-30 Hz 2.  


What are the major mechanisms that determine the observed neuronal activity patterns? 

A major mechanistic insight into modulation of cortical function was uncovered, by testing cell connectivity scenarios.  In one case, a “like-to-like” rule3, 4, 5, 6 was used for excitatory-to-excitatory connectivity (i.e., cells that selectively respond to similarly-oriented stimuli have a higher probability of being connected, and stronger synaptic weights).  In another, both connectivity and synaptic weights were randomly assigned, independent of cell tuning.  The model showed that orientation selectivity was strongly reduced when connections were random (Fig. 4), suggesting that like-to-like connectivity rules are crucial for cortical tuning.  Other mechanistic insights were observed and are discussed by Arkhipov, et al.7, some of which were obtained using in silico optogenetic perturbations.


Figure 4.  Comparison of the effect of like-to-like versus random connectivity on the orientation selectivity index of excitatory cells in L4.  The like-to-like scenario provides the highest indices, consistent with in vivo experimental data. 


To what extent does the ability to reproduce experimental recordings depend on the level of granularity of the model?

To test model parameters, two versions of a radically simplified model were constructed (Fig. 5).  Biophysical neurons and bi-exponential synapses were replaced, respectively, by LIF neurons (Fig. 5a) and either instantaneous “charge-dump” synapses (using NEURON’s IntFire1 function) or synapses with exponential time dependence of synaptic current (NEURON’s IntFire4 function).  The results of such all-LIF simulations (Fig. 5b) were qualitatively similar to the results from biophysical simulations, although specific quantitative distinctions were observed.  For example, the orientation selectivity was elevated when the IntFire1 function was used, and the gamma oscillation was largely absent (Fig. 5c).

Figure 5.  Examples of comparisons of biophysical and all-LIF simulations employing the IntFire1 or IntFire4 models.  (a) All biophysical neuron models were converted to point neurons.  An example spike raster in response to a drifting grating in an all-LIF IntFire1 simulation is shown.  (b) Parameter comparisons are evaluated based on orientation selectivity index (OSI), by cell type.  IntFire1 exhibits higher OSI values than the biophysical model and experiment, whereas IntFire4 is more consistent with both.  (c) Spectra of multi-unit activity (weighted by 1/r, where r is the distance from the cell to the center of the system; this is used as a proxy to LFP).  Both IntFire1 and IntFire4 fail to reproduce strong peaks in the spectra observed in the biophysical model (and consistent with the "mouse gamma" oscillation observed experimentally), although IntFire4 does exhibit a smaller peak in the 10-20 Hz range, indicating a better agreement with the biophysical model. 


The Layer 4 models were built using a high degree of biological realism and simulated in a framework of an in silico visual physiology experiment.  The models reproduced many features of in vivo observations.  Strong recurrent amplification employing the like-to-like rule was found to be critical for shaping the selectivity of the network.  Additionally, many features of activity were captured qualitatively in a much-simplified LIF network model, while a number of specific quantitative distinctions were observed7.  Software code, the model, and simulation results from this study are available to enable further efforts in modeling in vivo activity and function. 


  1. California Institute of Technology.  Caltech Library Archives [Internet]. Available from: 

  2. Welle C.G. and Contreras D.  Sensory-driven and spontaneous gamma oscillations engage distinct cortical circuitry.  J. Neurophysiol. 115, 1821-1835 (2016). 

  3. Ko, H. et al.  Functional specificity of local synaptic connections in neocortical networks.  Nature 473, 87-91 (2011). 

  4. Cossell L. et al.,  Functional organization of excitatory synaptic strength in primary visual cortex.  Nature 518: 399-403 (2015). 

  5. Lee, W.C. et al.,  Anatomy and function of an excitatory network in the visual cortex.  Nature 532: 370-374 (2016). 

  6. Wertz, A., et al., Single-cell–initiated monosynaptic tracing reveals layer-specific cortical network modules.  Science 349, 70-74 (2015). 

  7. Arkipov, A., et al., Visual physiology of the Layer 4 cortical circuit in silico. PLoS Computational Biology (2018),

Software, data and code

Details of the models and simulations are described in the publication, "Visual physiology of the layer 4 cortical circuit in silico."  The Layer 4 models were constructed and simulated between 2013 and 2016, using software that pre-dated the current modeling tools developed by the Allen Institute for Brain Science (such as BMTK and SONATA).  The code (Python/NEURON), models, and simulation results are provided as described below. 

The code for building the models, simulating them, and analyzing them is provided on GitHub.   This GitHub repo also contains examples of a model and a simulation using that model, as well as natural movies and natural images used as visual stimuli. Examples of the results are downloadable below, in directories named SI_1, SI_2, SI_3, SI_4, and SI_5

Model files SI_6:  Simulated LGN spike trains evoked by various visual stimuli and simulated spike trains from background sources generated independently from visual stimuli by a “traveling wave” background process (see instructions in SI_6_README.txt).

An example of a Layer 4 model converted to the SONATA format can be accessed here.

Model files SI_7:  Models of the Layer 4 network, including cell positions and properties, recurrent connections, and external connections from the LGN and background sources (see instructions in SI_7_README.txt).

Simulation outputs SI_8: Spike output of simulations.  The complete spike dataset is 21 GB; it is available via hard drive per request.  A substantial subset of the data is available below, such as the complete spike output of two models (LL2 and RR2).