NEF–SPA CIRCUIT LAB

EXAMPLE 08 · §2.4.2 · NEURAL GATING

Closing and reopening a neural pathway

Recorded Nengo simulation

The source population represents a value with its spikes. The relay receives their weighted, filtered effects and produces its own spikes. A separate block population also sends spikes. Their combined effect can prevent relay neurons from reaching their firing threshold, closing this route while the source stays active.

Read §2.4.2 · population recording and block interval · PDF page 44 · Build the connections in Nengo · §2.4.4

A content pathway controlled by a neural block populationA supplied scalar drives a 100-neuron source, which drives a 100-neuron relay. A separate supplied command drives a 100-neuron block population. Its weighted, filtered spikes supply blocking drive, scaled by each relay neuron’s gain, that reduces the total current. A probe observes the relay output. All connections and readout filters are 10 milliseconds. Supplied command0 = open · 1 = block Block control b100 LIF neurons −5b̂ before target gainblocking drive Supplied content+0.65, then −0.55 Source100 LIF neurons Relay100 LIF neurons Decoded outputobservation only Every connection: 10 ms low-pass filter · decoded probes: another 10 ms

Ellipses are spiking populations. The two input boxes are supplied diagnostic signals; the output box is an observation. The purple bar marks the connection’s combined suppressive effect. Its drive is multiplied by each relay neuron’s gain at the relay.neurons interface. Connections remain in place when the gate closes.

Content: what is transmitted?

The source represents one signed scalar. A negative value is still carried by ordinary positive spikes. This small example isolates transmission before applying the same principle to vector-valued items.

Control: may it pass?

High block activity has a weighted, filtered effect that lowers the relay neurons’ total current. When blocking subsides, source activity can recruit the relay again. This is local gating; a basal-ganglia–thalamus circuit could supply control in a larger model.

From spikes to current and voltage: what b and −5b mean

The block population sends spikes, not a negative value

Each block neuron emits spikes with a fixed amplitude parameter in this LIF model. The control value is carried by the population’s pattern of spike timing and rates. The neurons need not fire together or at equal rates. Their spikes do not have amplitude b or 5b.

b is the represented block value: zero requests an open route; one requests blocking. The supplied command drives a population of 100 neurons. A weighted, filtered estimate read from its spikes is written b̂. It builds up, fluctuates and decays. During the settled interval 0.60–0.75 s, the observed block readout averages 0.991, while the population emits 1,806 spikes. The first number is a decoded value; the second counts spike events.

The connection turns weighted spikes into an input effect

Synaptic filtering spreads spike effects over time. Their weighted sum contributes to the receiving neuron’s input current. The factor −5 sets the connection’s blocking strength before target gain. Nengo 4.1.0 then applies each relay neuron’s positive gain αj. Thus its control-current contribution is Jblock,j = −5αjb̂conn. The total current also includes the source-dependent input and the neuron’s bias. The connection’s estimate b̂conn is causal; a separate observation probe does not itself drive the relay.

A LIF neuron has a membrane-voltage state. Current and voltage here use normalized model units, not amperes and millivolts. Input current drives it towards threshold, while a leak opposes accumulation. Here the membrane time constant is 20 ms. On crossing the normalized voltage threshold 1, the neuron emits a spike, resets to zero and has a 2-ms refractory period.

  1. Open: blocking activity is absent. Source input and bias make some relay neurons reach threshold repeatedly. Their own new spikes carry the content onward.
  2. Blocked: the added contribution lowers total current enough that the relay neurons no longer reach threshold. Source signals still arrive. Without new relay spikes, the previous filtered output decays.
  3. Reopened: block activity and its filtered effect subside. Source input can again bring relay neurons to threshold. The connections remain in place throughout.

Inside relay neuron 1

These additional probes observe the same circuit. Every original input, decoded trace and spike array was reproduced exactly. The figure shows a shorter interval with constant source value +0.65.

Four recorded panels: block spikes, filtered block value, total current of relay neuron 1, and its voltage with output spikes. During blocking the current falls and voltage stays at zero; after release it rises and firing resumes.
A: spikes from 10 block cells. B: weighted, filtered block value from all 100 block neurons, reaching the relay. C: the cell’s total current. D: its normalized voltage; black marks identify output spikes. The sampled voltage has already been reset at a spike. Purple shading marks the supplied command. Dashed lines in C and D mark the constant-current firing boundary J = 1 and voltage threshold V = 1, respectively.

With constant total current, values above 1 can sustain firing; values below 1 cannot. For changing inputs, voltage history matters. The default LIF voltage has a floor of zero: strong inhibition holds this neuron at that floor, rather than creating a negative activation pattern. The plotted cell has gain 3.656 and bias approximately 1. At ideal steady values x = 0.65 and b̂conn = 0, J is approximately 3.38; at b̂conn = 1, it is approximately −14.91. The actual recorded current fluctuates.

What “inhibitory connection” means here. The route’s combined effect is suppressive in the blocking state. Its fitted decoding coefficients include both signs, so individual block spikes do not necessarily all lower current. This circuit does not enforce a separate biological inhibitory cell class. A sign-constrained interneuron implementation would need further assumptions. A negative represented content is also different from inhibition: the open relay can represent −0.55 while its neurons continue firing.

Additional recorded arrays (NPZ) · Current reconstruction and equality checks · Reproduce the additional probes and figure (ZIP)

— / 2.400 s

Loading the recorded simulation…

Inspect:

These controls replay saved samples. They do not change the circuit or its supplied commands.

AT THE CURRENT CURSORLoading…

Source—Content stays available
Block control—High activity closes the relay
Relay—Content passes when enabled

Each group shows the same first 20 neurons used in its raster. Dots remain lit for 25 ms after a recorded spike; they do not show membrane voltage. Numbers are decoded values from all 100 neurons.

SourceRelayBlock controlSupplied input / command (dashed)
A Content: source and relay readouts10-ms observation filter
B Control: block command and neural readoutPurple bands: blocking requested
C Source populationCells 1–20 of 100
D Block populationCells 1–20 of 100
E Relay populationCells 1–20 of 100

All panels share the same time axis. Curves and spikes are revealed up to the playback cursor. Shading shows the scheduled commands throughout. All 300 neurons were recorded; the downloads retain every spike.

A closed path does not erase its source

The inhibition targets the relay, so the source continues representing the supplied value. Here the source is input-driven; no recurrent memory is present. A closed relay’s filtered output also takes time to decay.

A value near zero does not by itself prove that neurons are silent. Compare the rasters and spike counts as well as the decoded value.

Saved values at —
ObservationValue

What the settled windows show

Means use the full populations. Spike counts below include all 100 source and all 100 relay neurons within each listed window.

Local observations in this single recorded run
Window (s)Source meanRelay meanSource spikesRelay spikes
Positive open · 0.15–0.350.6480.643795773
Positive blocked · 0.60–0.750.646≈06010
Negative open · 1.40–1.55−0.550−0.544507425
Negative blocked · 1.80–1.95−0.550≈05000

Both signs pass through an open relay. Both are suppressed when it is blocked. Inhibition means a suppressive contribution to neuronal current, not a negative firing rate.

LOOK CLOSER · LOCAL RESPONSE TIMES

Opening and closing take time

The supplied command, control-population response, relay response and filtered readout do not change simultaneously. Inspect one transition in the complete saved recording, independently of the playback cursor.

Closure is the first crossing below |relay readout| = 0.1 sustained for 20 ms; reopening uses |relay readout| > 0.4 for 20 ms. The recorded delays are 32 and 30 ms to close, and 47 and 51 ms to reopen. These include neuronal recruitment, connection filters and the observation filter. They describe this circuit, seed and input range, not a general gating latency or whole-model performance.

How this example was recorded

This is the original isolated 300-neuron simulation shown in §2.4.2, replayed from saved arrays. No artificial noise or new spikes have been added.

Neurons
Three ensembles × 100 LIF neurons · 1 dimension each · radius 1
Duration and recording
2.4 s · 1-ms integration and recording · 2,400 samples
Supplied content
+0.65 before 1.20 s; −0.55 from 1.20 s
Block commands
[0.40, 0.80) s and [1.60, 2.00) s
Connections and readouts
All four connections: 10-ms low-pass filters; decoded probes: 10 ms
Block population
Positive encoders; intercepts Uniform(0.2, 0.8); evaluation points Uniform(0, 1)
Neuronal settings
All maximum rates: Uniform(80, 160) Hz; source and relay encoders/intercepts: Nengo defaults
Inhibitory transformation
Pre-gain drive −5b̂conn; current contribution −5αjb̂conn for target neuron j
Software and seed
Nengo 4.1.0 · network seed 240
Spikes retained
23,255 events: source 8,762; block 9,338; relay 5,155

The two nengo.Node inputs supply diagnostic timing. Both content and control are then represented by spiking neurons. There is no recurrent buffer, learning rule or action-selection network in this isolated example. Other neuronal parameters retain Nengo defaults. The factor 5 is specific to these neurons and this input range. It is a connection coefficient, not a spike amplitude.

Replay data (JSON) · Original arrays (NPZ) · Original local observations · Static figure

The Nengo circuit in a few lines

The content connection targets the represented value of relay. The blocking connection targets relay.neurons; Nengo scales that input by each target neuron’s gain before adding it to the neuronal current. Nengo fits decoding weights when building the network; during simulation, weighted neural activity carries both effects.

# Inside with nengo.Network(seed=240):
# All populations use LIF and max_rates=Uniform(80, 160).
source = nengo.Ensemble(100, dimensions=1)
relay = nengo.Ensemble(100, dimensions=1)
block = nengo.Ensemble(100, dimensions=1,
    encoders=np.ones((100, 1)),
    intercepts=nengo.dists.Uniform(0.2, 0.8),
    eval_points=nengo.dists.Uniform(0, 1))

nengo.Connection(source, relay, synapse=0.01)
nengo.Connection(block, relay.neurons,
    transform=-5.0 * np.ones((100, 1)),
    synapse=0.01)

relay_readout = nengo.Probe(relay, synapse=0.01)
relay_spikes = nengo.Probe(relay.neurons)

The download includes both supplied inputs, every connection, probes, simulation, data saving and the checks for settled transmission, silence and response times. It is a standalone Nengo Core example; a Semantic Pointer vocabulary is unnecessary for this scalar circuit.

Complete Nengo example (Python) · Source, requirements and instructions (ZIP)

The official Nengo inhibitory-gating example documents the same target-neuron interface. This teaching circuit specifies effective current contributions; a cell-type-specific interneuron implementation would require additional assumptions.

TWO SEPARATE GATES · CHAPTER 2.4.5

Holding an item and reading it can happen together

The central recurrent buffer is the reference point. Write means writing into this buffer; read means reading from it; hold means maintaining its current item; and clear means removing its current item. These names keep the same reference point throughout the explanation.

Imagine a recurrent buffer holding item A while the incoming path already offers item B. Figure 2.24 in the teaching script shows two separately controlled gates: a write gate with its own relay population, and a read gate with a different relay population. Closing one does not require closing the other.

The upstream source offers the following item B. The central buffer holds the current item A. The downstream recipient can use A when the read gate opens. The central buffer receives content during writing and supplies content during reading. Whether the downstream recipient also stores that content depends on its own circuit.

Both gates can use the same kind of inhibition, applied to their respective relay neurons. The read relay carries the buffer’s content to a recipient. The write relay carries a correction to the stored content: the offered vector minus the buffer’s current decoded vector.

One coordination pattern for updating and reading a stable item
OperationWrite gateRead gateClear
Write/updateOpenClosed hereOff
Hold without readingClosedClosedOff
Hold and readClosedOpenOff
Clear/resetClosedClosed hereOn

Hold does not mean closing the read gate. Holding means that maintenance feedback supports the stored item while writing is blocked and clearing is inactive. The read gate can be closed or open. In Figure 2.24 it is open: A is held and read, although B is being offered.

Read does not inherently require a closed write gate. Keeping the write gate closed protects the stable item being read. Both gates could be open together, but the recipient would then receive a potentially changing state during updating. The table closes reading during writing and clearing to keep those transitions from reaching the recipient.

Two return connections with different jobs

The buffer’s maintenance feedback supports its stored item. A separate comparison connection sends the current state to the write-error relay, where it is subtracted from the offer. With writing enabled, the relay’s correction changes the buffer towards the offered item. With writing disabled, inhibition suppresses that correction, even if the inputs still arrive.

Figure 2.25 enlarges this same write circuit. It explains writing into the central buffer; the read relay and downstream recipient from Figure 2.24 are not shown. The write error compares the offered input with the central buffer’s current state. Closing the outgoing read gate does not interrupt this internal comparison connection. Clearing instead acts directly on the central buffer’s state neurons, with writing blocked to prevent immediate reloading.

The upper boxes in Figure 2.24 report write and read permissions. Each complete gate also includes its relay and control circuitry. The next explanation shows how neural conditions produce a permission and how it opens a relay.

Read §2.4.5 and Figures 2.24–2.25 (PDF pages 49–52) · §2.4.6: permission · Chapter 3: the protected word register.

FROM CONDITIONS TO TRANSMISSION · CHAPTER 2.4.6

How permission opens the gate we already know

Our running example is word gating. The central recurrent buffer holds the current word A while the source already offers the following word B. Read permission governs whether A can influence the downstream recipient; write permission governs whether B can update the central buffer. The scalar demonstrations isolate a coordinate of this mechanism; they do not represent complete words.

A permission signal represents that a particular operation is allowed. It can drive a control population, or it can be the decoded output of a population that already combines the relevant conditions. Its connections determine how it affects the relay. An additional control population is not required at every step.

The complete gate includes the relay and its control circuitry. Returning to Figure 2.24 in the manuscript: its upper boxes report write and read permissions, and its two relays below are where transmission is suppressed or enabled. Write and read permissions can differ.

The diagram below is Figure 2.26. It expands the control of one relay: conditions produce permission, whose connections change the relay’s drive. It does not redraw both gates around the recurrent buffer.

Neural conditions produce permission that releases a relay Ready, free and blocker populations converge on a condition population with a supplied constant minus-one offset. This offset and the tonic blocking drive are constant Nodes, whose neural sources are not modeled here. Its weighted spikes produce permission w at a pass-through Node, which adds no neurons. A positive control contribution plus k times w counteracts a tonic minus-k drive at the relay neurons. A separate content source drives the relay, which drives a target. In a write circuit, the current-state comparison input needed for the write error is additionally required. Readysignal r Freesignal f Blockerveto signal v Supplied constantoffset −1 Condition populationz = r + f − 1 − v +r+f−v Decodespikes Permission port wpass-through Nodeno neurons Supplied constantblocking drive −k Release drive +kw Contentsource Relay populationcontrolled transmission Targetpopulation Ellipses: neural populations · rectangles: ports or supplied constants

Figure 2.26: control of one relay. Ellipses are neural populations. The two constant-input rectangles prescribe drives whose neural sources are not modeled. The permission rectangle only passes a signal onward. Permission counteracts blocking at the relay’s neurons. For writing, the relay additionally needs the current-state comparison input from Figure 2.25. This is a circuit explanation, not a new recording.

What is neural, and what is a Nengo Node?

A nengo.Ensemble contains model neurons. A nengo.Node is an interface or a computation specified by the model builder. It has no membrane potential, firing threshold or spike generator of its own. Calling something a Node does not make it neuronal.

The permission port only passes a signal onward. nengo.Node(size_in=1) receives the weighted, filtered output of the condition neurons and supplies it to another connection. It does not make an additional decision. This port is useful for connecting, branching or observing the signal, but the neural interpretation does not require another population at this point.

The offset −1 is a supplied constant. It changes the condition neurons’ currents through their encoders and gains. The code contains no separate population whose spikes generate that offset. Similarly, the tonic blocking drive is supplied by a constant Node connected to relay.neurons. “Tonic” means that this drive persists; the rectangle is not an inhibitory neuron.

How could these constants be implemented neurally? Their current contributions could be incorporated into target-neuron biases, with tuning and decoding calibrated consistently. A bias summarizes background drive without identifying its biological source. Alternatively, a tonically active population could supply weighted, filtered spikes to approximate the required drive. Permission could counteract that drive or inhibit its source. These are circuit extensions that must be built and checked; neither is implemented merely by drawing a rectangle.

The present circuit combines conditions through neurons and decoded connections, and its relay responds through neurons. Its two constant drives remain explicit modeling assumptions.

Decoding is part of the synaptic connection

A decoded permission does not require a neuron to turn spikes into a written number. Each condition neuron has a fitted decoding weight dᵢ. Combined with the opening strength k and the target neuron’s gain αⱼ, it gives an effective connection weight Wⱼᵢ = αⱼ k dᵢ. Weighted, filtered spikes change the relay neurons’ currents. The numerical description and the neuronal effect describe the same connection.

Condition neurons connect directly to relay neurons A direct connection incorporates the decoding weights. The content input and constant blocking drive from Figure 2.26 remain required but are omitted here. Condition populationspiking neurons Relay populationspiking neurons weighted, filtered spikesWⱼᵢ = αⱼ k dᵢ

Figure 2.27: the permission-dependent connection without a pass-through Node. Content input and constant blocking from Figure 2.26 are omitted from this enlargement, but remain required.

The direct connection below replaces the two connections through the permission port. Nengo fits its function= into weights acting on spikes; this does not insert a Python decision process between the populations. The fitted weights are not automatically restricted to the excitatory or inhibitory sign of a biological cell class.

Three conditions, introduced one at a time

In the word example, ready, free and blocker describe conditions for handling the current or following word. They are control signals, not additional word identities.

Ready (r): the offered item meets a specified readiness criterion. A detection circuit must produce this signal. It indicates that an item can be used; the source buffer separately represents which item it is.

Free (f): the central recurrent buffer is available for the proposed write. In a protected word register, this can require release of the preceding item and confirmation of clearing. It does not refer to the downstream recipient of the read path.

Blocker, or veto (v): a reason to withhold permission is present, such as a temporary pause request. This is an input to the condition population. It is distinct from the earlier block signal b, which directly controls relay inhibition.

The combination z = r + f − 1 − v makes both positive conditions necessary for ideal zero/one inputs. The fixed −1 offset makes one positive condition insufficient. A positive-response population converts sufficiently positive z into a graded permission w.

Intended settled conditions for this write example
SituationReadyFreeVetoPermission
B ready, current A still protected1000
B ready, central buffer available1101
B ready and buffer free, but pause requested1110
Buffer free, offered item not ready0100

These are desired values. Real neural signals fluctuate and take time to settle. The combination requires appropriately bounded input signals; it is not an exact Boolean operation for arbitrary amplitudes. Read permission needs its own conditions, such as a valid current item and a downstream request. A central buffer holding that item need not be free for replacement.

Does a high control signal open or close?

In the earlier relay example, high block b closes the route. Here, high permission w opens it by counteracting tonic inhibition. The combined pre-gain control drive is −k + kw: approximately −k when permission is absent, and approximately zero when permission is present. The connection filter and each relay neuron’s gain also affect the resulting current.

Permission enables the relay to respond to arriving content. It does not carry that content itself. A change in conditions first affects the control population, then permission, then relay current and spikes. Permission onset, gate opening and completed writing are therefore separate events.

The Nengo condition circuit and its relay connection

The first excerpt expects neural sources named ready, free and blocker. The second connects its permission output to an existing relay. The third is an alternative: use it instead of the two connections through the permission port. Keep the constant blocking connection. Adding both release paths would double the intended drive.

Combine the conditions

condition = nengo.Ensemble(240, 1, radius=1.5,
    encoders=np.ones((240, 1)),
    intercepts=nengo.dists.Uniform(0.08, 0.65),
    eval_points=nengo.dists.Uniform(0, 1.5))
nengo.Connection(ready, condition, synapse=0.01)
nengo.Connection(free, condition, synapse=0.01)
nengo.Connection(nengo.Node([-1]), condition,
                 synapse=None)
nengo.Connection(blocker, condition,
                 transform=-1, synapse=0.01)
permission = nengo.Node(size_in=1)
nengo.Connection(condition, permission,
    function=lambda x: np.clip((x[0]-0.2)/0.5, 0, 1),
    synapse=0.005)

Connect through the permission port

k = 5.0
n = relay.n_neurons
tonic_block = nengo.Node([1])
nengo.Connection(tonic_block, relay.neurons,
    transform=-k * np.ones((n, 1)), synapse=None)
nengo.Connection(permission, relay.neurons,
    transform=k * np.ones((n, 1)), synapse=0.01)

Alternative: connect directly to the relay

# Alternative: replace the path through the permission port.
control_filter = nengo.Lowpass(0.005).combine(
    nengo.Lowpass(0.01))
nengo.Connection(condition, relay.neurons,
    function=lambda x: np.clip((x[0]-0.2)/0.5, 0, 1),
    transform=k * np.ones((relay.n_neurons, 1)),
    synapse=control_filter)

The permission Node is a numerical pass-through port. The nonlinear function is fitted into decoding weights acting on condition-population spikes; np.clip specifies the desired decoding function, not an exact runtime clamp. The port-based and direct variants were built separately with Nengo 4.1.0. Their effective decoded weights matched, and the direct filter combines the two intended time constants. This construction check took zero simulation steps; it does not establish identical discrete timing or provide a new behavior recording. No tonic source population has been added.

Read §2.4.6 and Figure 2.26 · PDF pages 53–58 · Return to §2.4.1: what a gate changes.