GeNN  2.2.3
GPU enhanced Neuronal Networks (GeNN)
Synapse models

A synapse model is a weightUpdateModel object which consists of variables, parameters, and string objects which will be substituted in the code. The three strings that will be substituted in the code for synapse update are:

  • simCode: Simulation code that is used when a true spike is detected. The update is performed only once, one time step after threshold condition detection, which is defined by thresholdConditionCode in the neuron model of the corresponding presynaptic neuron population.
    Typically, spikes lead to update of synaptic variables that then lead to the activation of input into the post-synaptic neuron. Most of the time these inputs add linearly at the post-synaptic neuron. This is assumed in GeNN and the term to be added to the activation of the post-synaptic neuron should be provided as the value of the by the $(addtoinsyn) snippet. For example
    "\$(addtoinsyn) = $(inc);"
    where "inc" is a parameter of the weightupdate model, would define a constant increment of the synaptic input of a post-synaptic neuron for each pre-synaptic spike.
    When a spike is detected in the presynaptic neuron population, the simCode is executed. Within the code snippet the $(addtoinSyn) update just discussed should be be followed by the $(updatelinsyn) keyword to indicate that the summation of synaptic inputs can now occur. This can then be followed by updates on the internal synapse variables that may have contributed to addtoinSyn. For an example, see NSYNAPSE (No Learning) for a simple synapse update model and LEARN1SYNAPSE (Learning Synapse with a Primitive Piece-wise Linear Rule) for a more complicated model that uses STDP.
  • evntThreshold: Code that defines the condition for a synaptic event. This typically involves the pre-synaptic variables, e.g. the membrane potential:
    "$(V_pre) > -0.02"
    Whenever this expression evaluates to true, the code in simCodeEvnt is executed. For an example, see NGRADSYNAPSE (Graded Synapse).
  • simCodeEvnt: Simulation code that is used for spike like events, where updates are done for all instances in which the event condition defined by evntThreshold is met. evntThreshold is also be provided as a code string. For an example, see NGRADSYNAPSE (Graded Synapse).
  • simLearnPost: Simulation code which is used in the learnSynapsesPost kernel/function, which performs updates to synapses that are triggered by post-synaptic spikes. This is rather unusual other than in learning rules like e.g. STDP. For an example that uses simLearnPost, see LEARN1SYNAPSE (Learning Synapse with a Primitive Piece-wise Linear Rule).
  • synapseDynamics: Simulation code that applies for every time step, i.e.is unlike the others not gated with a condition. This can be used where synapses have internal variables and dynamics that are described in continuous time, e.g. by ODEs. Usng this mechnanism is typically computationally veruy costly because of the large number of synapses in a typical network.
  • extraGlobalSynapseKernelParameters of type vector<string>: On occasion, the synapses in a synapse population share a global parameter. This could, for example, be a global reward signal. This is supported in GeNN with extraGlobalSynapseKernelParameters. The user defines the names of such parameters and pushes them into this vector. GeNN creates variables of this name, with the name of the synapse population appended, that can take a single value per population of the type defined in the extraGlobalSynapseKernelParameterTypes vector. This variable is then available to all synapses in the population.
    Note
    No implicit or explicit copy of extraGlobalSynapseKernelParameters is necessary as they are communicated as kernel parameters.
  • extraGlobalSynapseKernelParameterTypes of type vector<string>: These are the types of the extraGlobalSynapseKernelParameters. Types are matched to names by their position in the vector.

All code snippets can be used to manipulate any synapse variable and so implement both synaptic dynamics and learning processes.

Built-in Models

Currently 3 predefined synapse models are available:

These are defined in lib.include/utils.h. The MBody_userdef example also includes a modified version of these models as user-defined models.

NSYNAPSE (No Learning)

If this model is selected, no learning rule is applied to the synapse and for each pre-synaptic spikes the synaptic conductances are simply added to the postsynaptic input variable. The model has 1 variable:

  • g - conductance of scalar type

and no other parameters.

simCode is:

" $(addtoinSyn) = $(g);\n\
$(updatelinsyn);\n"

NGRADSYNAPSE (Graded Synapse)

In a graded synapse, the conductance is updated gradually with the rule:

\[ gSyn= g * tanh((V - E_{pre}) / V_{slope} \]

whenever the membrane potential $V$ is larger than the threshold $E_{pre}$. The model has 1 variable:

  • g: conductance of scalar type

The parameters are:

  • Epre: Presynaptic threshold potential
  • Vslope: Activation slope of graded release

simCodeEvnt is:

" $(addtoinSyn) = $(g)* tanh(($(V_pre)-($(Epre)))*DT*2/$(Vslope));\n\
$(updatelinsyn);\n"

evntThreshold is:

" $(V_pre) > $(Epre)"
Note
The pre-synaptic variables are referenced with the suffix _pre in synapse related code such as an evntThreshold. Users can also access post-synaptic neuron variables using the suffix _post.

LEARN1SYNAPSE (Learning Synapse with a Primitive Piece-wise Linear Rule)

This is a simple STDP rule including a time delay for the finite transmission speed of the synapse, defined as a piecewise function:

LEARN1SYNAPSE_explain_html.png

The STDP curve is applied to the raw synaptic conductance gRaw, which is then filtered through the sugmoidal filter displayed above to obtain the value of g.

Note
The STDP curve implies that unpaired pre- and post-synaptic spikes incur a negative increment in gRaw (and hence in g).
The time of the last spike in each neuron, "sTXX", where XX is the name of a neuron population is (somewhat arbitrarily) initialised to -10.0 ms. If neurons never spike, these spike times are used.
It is the raw synaptic conductance gRaw that is subject to the STDP rule. The resulting synaptic conductance is a sigmoid filter of gRaw. This implies that g is initialised but not gRaw, the synapse will revert to the value that corresponds to gRaw.

An example how to use this synapse correctly is given in map_classol.cc (MBody1 userproject):

for (int i= 0; i < model.neuronN[1]*model.neuronN[3]; i++) {
if (gKCDN[i] < 2.0*SCALAR_MIN){
cnt++;
fprintf(stdout, "Too low conductance value %e detected and set to 2*SCALAR_MIN= %e, at index %d \n", gKCDN[i], 2*SCALAR_MIN, i);
gKCDN[i] = 2.0*SCALAR_MIN; //to avoid log(0)/0 below
}
scalar tmp = gKCDN[i] / myKCDN_p[5]*2.0 ;
gRawKCDN[i]= 0.5 * log( tmp / (2.0 - tmp)) /myKCDN_p[7] + myKCDN_p[6];
}
cerr << "Total number of low value corrections: " << cnt << endl;
Note
One cannot set values of g fully to 0, as this leads to gRaw= -infinity and this is not support. I.e., 'g' needs to be some nominal value > 0 (but can be extremely small so that it acts like it's 0).

The model has 2 variables:

  • g: conductance of scalar type
  • gRaw: raw conductance of scalar type

Parameters are (compare to the figure above):

  • Epre: Presynaptic threshold potential
  • tLrn: Time scale of learning changes
  • tChng: Width of learning window
  • tDecay: Time scale of synaptic strength decay
  • tPunish10: Time window of suppression in response to 1/0
  • tPunish01: Time window of suppression in response to 0/1
  • gMax: Maximal conductance achievable
  • gMid: Midpoint of sigmoid g filter curve
  • gSlope: Slope of sigmoid g filter curve
  • tauShift: Shift of learning curve
  • gSyn0: Value of syn conductance g decays to

For more details about these built-in synapse models, see [3].

Defining a new synapse model

If users want to define their own models, they can add a new weightUpdateModel that includes the variables, parameters, and update codes as desired, and then push this object in the weightUpdateModels vector. The model can be used by referring to its index in the weightUpdateModels vector when adding a new population by with a call to addSynapsePopulation.

Conductance definition methods

The available options work as follows:

  • INDIVIDUALG: When this option is chosen in the addSynapsePopulation command, GeNN reserves an array of size n_pre x n_post float for individual conductance values for each combination of pre and postsynaptic neuron. The actual values of the conductances are passed at runtime from the user side code, using the pushXXXXXToDevice function, where XXXX is the name of the synapse population.
  • GLOBALG: When this option is chosen, the value of the variables of the synapse model (including its conductance) is taken to be the initial value provided for the synapse model's variables. This option can only be sensibly combined with connectivity type ALLTOALL.
  • INDIVIDUALID: When this option is chosen, GeNN expects to use the same maximal conductance for all existing synaptic connections but which synapses exist will be defined at runtime from the user side code, provided as a binary array (see Insect olfaction model).

Connectivity types

Available options are DENSE and SPARSE. Various tools are provided under userproject/tools for creating different connectivity schemes.

Different strategies are used by GeNN for different combinations of connecticity types and Conductance definition methods, as explained in the table below:

ALLTOALL DENSE SPARSE
GLOBALG Fixed values for all synapse members Fixed values for all synapse members Fixed values for some synapse members (using sparse indexing)
INDIVIDUALG Variable values for all synapse members Variable values for all synapse members Variable values for some synapse members
INDIVIDUALID Fixed values for some synapse members (using a binary array). Technically possible but not meaningful. Fixed values for some synapse members (using a binary array) N/A

If INDIVIDUALG is used with ALLTOALL or DENSE connectivity (these are equivalent in this case), synapse variables are stored in an array of size npre * npost .

If the connectivity is of SPARSE type, connectivity indices are stored in a struct named SparseProjection in order to minimize the memory requirements. The struct SparseProjection contains the following members: 1: unsigned int connN: number of connections in the population. This value is needed for allocation of arrays. The indices that correspond to these values are defined in a pre-to-post basis by the following arrays: 2: unsigned int ind, of size connN: Indices of corresponding postsynaptic neurons concatenated for each presynaptic neuron. 3: unsigned int *indInG, of size model.neuronN[model.synapseSource[synInd]]+1: This array defines from which index in the synapse variable array the indices in ind would correspond to the presynaptic neuron that corresponds to the index of the indInG array, with the number of connections being the size of ind. More specifically, indIng[n+1]-indIng[n] would give the number of postsynaptic connections for neuron n.

For example, consider a network of two presynaptic neurons connected to three postsynaptic neurons: 0th presynaptic neuron connected to 1st and 2nd postsynaptic neurons, the 1st presynaptic neuron connected to 0th and 2nd neurons. The struct SparseProjection should have these members, with indexing from 0:

    ConnN = 4

    ind= [1 2 0 2]

    indIng= [0 2 4]  

A synapse variable of a sparsely connected synapse will be kept in an array using this conductance for indexing. For example, a variable caled g will be kept in an array such as: g=[g_Pre0-Post1 g_pre0-post2 g_pre1-post0 g_pre1-post2] If there are no connections for a presynaptic neuron, then g[indIng[n]]=gp[indIng[n]+1].

See tools/gen_syns_sparse_IzhModel used in Izh_sparse project to see a working example.

Postsynaptic integration methods

The postSynModel defines how synaptic activation translates into an input current (or other input term for models that are not current based). It also can contain equations defining dynamics that are applied to the (summed) synaptic activation, e.g. an exponential decay over time.

A postSynModel object consists of variables, parameters, derived parameters and two strings that define the code for current generation and continuous dynamics.

  • string postSynDecay: This code defines the continuous time dynamics of the summed presynaptic inputs at the postsynaptic neuron. This usually consists of some kind of decay function.
  • string postSyntoCurrent: This code defines how the synaptic inputs lead to an input input current (Isyn) to the postsynaptic neuron.

There are currently 2 built-in postsynaptic integration methods:

EXPDECAY: Exponential decay. Decay time constant and reversal potential parameters are needed for this postsynaptic mechanism.

This model has no variables and two parameters:

  • tau : Decay time constant
  • E : Reversal potential

tau is used by the derived parameter expdecay which returns expf(-dt/tau).

IZHIKEVICH_PS: Empty postsynaptic rule to be used with Izhikevich neurons.


Previous | Top | Next