You've learned the Mean Field Approximation from La Camera's paper. The key insight was simple but powerful:
La Camera's Core Move:
Replace actual spikes xj with expected rates ⟨xj⟩ = rj
This gave us a self-consistent equation for the firing rate:
r = σ(J × r + Iext)
Now we want to understand the stochastic Wilson-Cowan model used by de Candia et al. to study criticality. But their equations look different! This tutorial bridges the gap.
The Core Pattern: Throughout this tutorial, we follow a microscopic → macroscopic structure: • Microscopic: Individual neurons with discrete states (aᵢ ∈ {0,1}) • Macroscopic: Population averages and firing rates (r, S)
This is the essence of mean field theory: start with individual neurons, derive equations for collective behavior.
The Questions We'll Answer
How does the microscopic → macroscopic derivation work?
Why do we need separate E and I populations?
What changes when we go from discrete to continuous time?
Where does the noise term come from (finite-size effects)?
What is the critical point and why does it matter?
How does this relate to co-transmission (your ultimate goal)?
1
Binary Neurons — La Camera's Foundation
La Camera (2022), Section 2-4
The Model: What We Start With
We have a network of N binary neurons. Each neuron i is either spiking (xi = 1) or silent (xi = 0).
Variables Introduced
xi
State of neuron i: 0 (silent) or 1 (spiking)
Jij
Synaptic weight from neuron j to neuron i
Iext
External input current (from outside the network)
Ii
Total input to neuron i: Ii = Σj Jijxj + Iext
The Spiking Rule (Transfer Function)
Each neuron spikes with a probability that depends on its input via a sigmoid transfer function:
P(xi = 1 | Ii) = σ(Ii) = 1 / (1 + e−2β(Ii − θ))
New Variables
β
Inverse temperature or gain. Controls how “sharp” the decision is. High β → nearly deterministic. Low β → nearly random.
θ
Threshold. The input value where σ(I) = 0.5. Often set to 0 for simplicity, but in La Camera's formulation it appears inside the sigmoid.
The Threshold θ: When I = θ, the sigmoid outputs exactly 0.5 (maximum uncertainty). For I > θ, spiking becomes more likely; for I < θ, it becomes less likely. Setting θ = 0 is common but not required.
The Mean Field Approximation
The key move: instead of tracking individual spikes, we track the expected firing rate:
ri = ⟨xi⟩ = P(xi = 1) = σ(Ii)
New Variable
ri
Firing rate of neuron i. This is what mean field theory tracks. It equals the probability that the neuron is spiking at any given moment.
For a homogeneous network (all neurons identical, uniform weights J/N):
Homogeneous Mean Field:
r = σ(J × r + Iext − θ)
Self-Consistency: The rate r appears on both sides of the equation! We need to find the value where the output equals the input. This is a fixed point.
Try It: Find the Fixed Point
Stage 1 Summary
Binary neurons with probabilistic spiking: P(spike) = σ(input − θ)
The sigmoid has two key parameters: β (gain) and θ (threshold)
Mean field replaces spikes with rates: xj → rj
Self-consistent equation: r = σ(J × r + Iext − θ)
This is a single homogeneous population
2
E/I Populations — The Wilson-Cowan Step
Chow & Karimipanah (2020)
Why Separate E and I?
La Camera's homogeneous network is a simplification. Real brains have two fundamentally different types of neurons:
Excitatory (~80%)
Release glutamate
Increase postsynaptic activity
Positive effect on target
Inhibitory (~20%)
Release GABA
Decrease postsynaptic activity
Negative effect on target
Dale's Law: A neuron is either excitatory OR inhibitory — it can't switch. This is why we need separate populations!
The Weight Matrix
New Variables: The Weight Matrix
wEE
E → E: Excitatory neurons exciting each other (recurrent excitation)
wEI
I → E: Inhibitory neurons inhibiting excitatory neurons
wIE
E → I: Excitatory neurons driving inhibitory neurons
wII
I → I: Inhibitory neurons inhibiting each other
Weight Matrix: W =
+wEE−wEI
+wIE−wII
Two Coupled Mean Field Equations
New Variables
rE
Firing rate of the excitatory population (fraction of E neurons active)
rI
Firing rate of the inhibitory population (fraction of I neurons active)
E/I Mean Field Equations:
rE = σ(wEE × rE − wEI × rI + IE)
rI = σ(wIE × rE − wII × rI + II)
Same structure as La Camera! Just two coupled equations instead of one. The firing rate of each population depends only on the current firing rates of both populations. We iterate until self-consistent.
E/I Balance
The brain maintains a delicate balance between excitation and inhibition:
Too much E → Seizures, runaway activity
Too much I → Silence, no computation
Balanced → Rich dynamics, optimal processing
Try It: E/I Fixed Point
Stage 2 Summary
Separate E and I populations (Dale's Law)
Four connection weights: wEE, wEI, wIE, wII
Two coupled self-consistent equations
Firing rates depend on current state only (no memory/hysteresis yet)
E/I balance is crucial for brain function
3
Continuous Time — The Wilson-Cowan ODEs
Chow & Karimipanah (2020), Wilson & Cowan (1972)
From Discrete to Continuous Time
In Stage 2, the firing rate at time n+1 depends only on the rates at time n. But real neurons have temporal dynamics — their activity doesn't instantly snap to new values. Wilson and Cowan introduced differential equations to capture this:
Key Change from Stage 2: In Stage 2, the new firing rate immediately equals σ(input). In Stage 3, the firing rate approaches σ(input) gradually, with a time constant τ. This gives the system memory/hysteresis — the firing rate depends on recent history, not just the current input.
New Variables
τE, τI
Time constants (in ms). How fast each population responds. Typically τE ≈ 10ms, τI ≈ 20ms (I neurons are often slower).
dr/dt
Rate of change of firing rate. This is the derivative — how quickly r changes.
Wilson-Cowan Rate Equations:
τE × drE/dt = −rE + σ(wEErE − wEIrI + IE)
τI × drI/dt = −rI + σ(wIErE − wIIrI + II)
Understanding the Terms
−rE (decay term)This represents exponential decay. Without any input, the firing rate decays toward zero. This is NOT just “negative firing rate” — it's the mathematical form of relaxation. The equation dr/dt = −r/τ has solution r(t) = r₀ × e−t/τ.
+σ(input) (drive term)Input pushes the firing rate toward σ(input). Combined with the decay term, the rate approaches σ(input) exponentially.
τ (time constant)Sets the speed of dynamics. Larger τ → slower response. With a differential equation, you can choose your integration time step (dt) explicitly — smaller dt gives more accurate simulation.
At Equilibrium (Fixed Point): When dr/dt = 0, we get:
0 = −r + σ(input) → r = σ(input)
This is exactly the same fixed point as Stage 2! The difference is the dynamics — how the system gets there. The τ parameter determines how many “previous time steps” influence the current state (the larger τ, the more history matters).
Try It: Watch the Dynamics
wEE=1.5wEI=2wIE=1.5wII=0.5
Stage 3 Summary
Continuous time via differential equations: τ × dr/dt = −r + σ(I)
The −r term is decay/relaxation, not “negative rate”
Time constants τ set the dynamics speed and introduce memory
At equilibrium, we get the same fixed points as Stage 2
The difference: how the system approaches equilibrium matters for transient behavior
4
Stochastic Wilson-Cowan — de Candia's Model
de Candia et al. (2021)
The Two-Level Structure (Just Like Stage 1!)
Remember in Stage 1, we started with individual binary neurons (microscopic), then derived the mean field equations (macroscopic)? de Candia does the same thing, but with a crucial difference: they keep track of finite-size fluctuations.
The Two Levels: 1. Microscopic: N individual neurons, each with state aᵢ ∈ {0, 1} 2. Macroscopic: Population activity S = (1/N) × Σ aᵢ (the mean field)
The deterministic models (Stages 1-3) assume N → ∞ so fluctuations vanish. de Candia keeps N finite, so we get stochastic dynamics!
Part A: The Microscopic Model (Individual Neurons)
Just like La Camera's binary neurons, de Candia starts with N individual neurons. Each neuron i has a binary state:
Variables Introduced (Microscopic Level)
ai
State of neuron i: 0 (quiescent) or 1 (active/firing)
si
Total synaptic input to neuron i: si = Σj wijaj + h
wij
Synaptic weight from neuron j to neuron i
h
Small external input (keeps system from getting stuck at all-silent)
de Candia Eq. 1 (Synaptic Input):
si = Σj wij × aj + h
The Transition Rates (Stochastic Dynamics)
Unlike La Camera's instantaneous updates, de Candia uses a continuous-time Markov process. Neurons don't flip instantly — they transition at specific rates:
Active → Quiescent (1 → 0)Rate = α (constant). An active neuron spontaneously becomes quiescent. This represents spike termination and refractory effects.In time dt: P(deactivate) = α × dt
Quiescent → Active (0 → 1)Rate = f(si) (input-dependent). A quiescent neuron becomes active based on its synaptic input. This is where the “activation function” enters.In time dt: P(activate) = f(si) × dt
Activation Function (de Candia Eq. 2)
f(s)
Activation rate: f(s) = β·tanh(s) for s > 0, else 0 Unlike the sigmoid in Stage 1, this is zero for negative input — no spontaneous firing without positive drive!
Key Difference from La Camera: In La Camera's model (Stage 1), neurons have probability σ(I) of being in state 1 at any instant. In de Candia's model, neurons have persistent states that change via stochastic transitions. An active neuron stays active until it deactivates (at rate α). This creates temporal correlations!
The Microscopic Simulation (What the Code Does)
For each neuron i at each timestep dt:
if (neuron[i] is ACTIVE) {
// Deactivate with probability α × dt
if (random() < α × dt) {
neuron[i] = QUIESCENT;
}
} else {
// QUIESCENT neuron: compute input
s_i = Σⱼ wᵢⱼ × aⱼ + h;
// Activate with probability f(s_i) × dt
if (random() < f(s_i) × dt) {
neuron[i] = ACTIVE;
}
}
This is exactly what our SpikingWilsonCowan class does in the CriticalityProject!
Part B: The Mean Field Approximation
Now comes the key step — just like in Stage 1! We go from individual neurons to population averages. But unlike Stage 1, we keep the finite-size fluctuations.
Population Activity (Definition):
S = (1/N) × Σi ai
S is the fraction of active neurons — exactly like r in La Camera's model! But how does S evolve? Let's count the transitions:
Rate of decrease (active → quiescent)There are N×S active neurons, each deactivating at rate α. Expected decrease: α × S (per unit time)
Rate of increase (quiescent → active)There are N×(1−S) quiescent neurons, each activating at rate f(s). Expected increase: (1−S) × f(s) (per unit time)
Deterministic Mean Field (Expected Value):
dS/dt = −αS + (1−S)f(s)
The Isomorphism with Stage 1: Compare this to La Camera! La Camera: r = σ(J×r + Iext) [self-consistent fixed point] de Candia: dS/dt = −αS + (1−S)f(s) [time evolution]
At equilibrium (dS/dt = 0): αS = (1−S)f(s), which gives a self-consistent equation! The difference is that La Camera is instantaneous while de Candia has explicit time dynamics.
Part C: Where Does the Noise Come From?
Here's where de Candia differs from La Camera's Stage 1: instead of taking N → ∞ and discarding fluctuations, we keep N finite and derive the noise term.
Finite-Size Fluctuations
Consider N neurons, each firing or quiescent. In time dt:
Some quiescent neurons fire (Poisson process with rate f(s))
Some firing neurons stop (Poisson process with rate α)
Both are random processes — individual neurons flip stochastically
The actual number of transitions fluctuates around the expected value
The Central Limit Theorem Derivation
Let ai be the state of neuron i (0 or 1). The population average is:
S = (1/N) × Σ ai
Each ai is a Bernoulli random variable. By the CLT, for large N:
where σ² is the variance of a single neuron's state.
Therefore: Std(S) = σ/√N, so fluctuations scale as 1/√N
For N = 10,000 neurons: fluctuations ~ 1/100 = 0.01 of the mean For N = 100 neurons: fluctuations ~ 1/10 = 0.1 of the mean (much larger!)
The Variance of Transitions: The noise amplitude isn't just 1/√N — it depends on how many transitions are happening! More transitions = more variance.
Variance = αS + f(s)(1−S) This is the sum of: (rate of deactivations) + (rate of activations)
The Complete Isomorphism: Microscopic ↔ Macroscopic
Here's the precise correspondence between the two levels of description.They use the same physics — just described at different scales:
One-to-One Correspondence
Aspect
Microscopic (SpikingWilsonCowan)
Macroscopic (StochasticMeanFieldWC)
State variable
ai ∈ {0, 1} for each neuron i
S ∈ [0, 1] = fraction of active neurons
Interpretation
Binary: active (1) or quiescent (0)
Continuous: population activity rate
Deactivation
P(1→0) = α × dt per neuron
Drift term: −αS
Activation
P(0→1) = f(s) × dt per neuron
Drift term: +(1−S)f(s)
f(s)
β×tanh(s) for s>0, else 0
Same: β×tanh(s) for s>0, else 0
Noise source
Stochastic transitions (Bernoulli)
Langevin: √[αS + f(s)(1−S)] × η(t)
Finite-size
Implicit (N discrete neurons)
Explicit: noise ∝ 1/√N
Why Show Both? • Microscopic: Where criticality actually emerges — real individual neuron dynamics • Macroscopic: Faster to compute, analytically tractable, captures essential behavior • For large N, they produce statistically equivalent results (de Candia Fig. 12)
Complete Variable Reference
S
Fraction of active neurons = (1/N)×Σai. Same as firing rate r.
Net coupling strength (see criticality section for full definition).
h
Small external input (prevents absorbing state S=0).
N
Number of neurons. Noise scales as 1/√N.
η(t)
White noise: Gaussian, zero mean, unit variance.
Part D: The Full Langevin Equation (de Candia Eq. 4)
Combining the mean field drift with the finite-size noise gives us the complete Langevin equation:
What is a Langevin Equation?
A Langevin equation is a stochastic differential equation (SDE) of the form:
dX/dt = drift(X) + noise amplitude(X) × η(t)
It combines:
Drift: The deterministic part — where the system would go without randomness
Noise: Random fluctuations that perturb the system. η(t) is “white noise” (Gaussian, uncorrelated in time)
Langevin equations are fundamental in physics (Brownian motion) and are the continuous-time limit of discrete random walks. They're essential for studying systems near criticality!
−αS (drift: decay)Firing neurons become quiescent at rate α. This pulls S toward 0.
(1−S)f(s) (drift: activation)Quiescent neurons (fraction 1−S) fire at rate f(s). This pushes S up.
(1/√N)·√[...]·η(t)The noise term. η(t) is white noise. The √[αS + f(s)(1−S)] is the noiseamplitude — it depends on both transition rates because fluctuations come from both firing and stopping.
Activation Function
f(s)
Activation rate: f(s) = β·tanh(s) for s > 0, else 0 where s = w₀·S + h (total synaptic input). Unlike the smooth sigmoid, this is zero for negative input, which creates an absorbing state at S=0.
Microscopic Model: N neurons with states ai ∈ {0,1}, transitioning at rates α and f(s)
Macroscopic Model: Population activity S, evolving via Langevin equation
The derivation: Mean field (S = ⟨a⟩) + Central Limit Theorem (noise ∝ 1/√N)
Key isomorphism: P(deactivate) = α×dt → drift term −αS
Key isomorphism: P(activate) = f(s)×dt → drift term (1−S)f(s)
Why both? Microscopic is the “ground truth”; macroscopic is the approximation
Same physics, different levels of description — just like La Camera's Stage 1!
★
Criticality — The Main Event
de Candia et al. (2021), Section “Critical point”
Understanding the Control Parameter w₀
Clarifying w₀: In the full E/I model, we have separate weights wE (excitatory) and wI (inhibitory). The effective coupling is their difference:
w₀ = wE − wI
In de Candia's simplified model, we work directly with this single parameter w₀. Positive w₀ means excitation dominates; negative w₀ means inhibition dominates.
The Critical Point
At the critical point, the system is perfectly balanced between activity dying out (subcritical) and runaway activity (supercritical).
Critical Condition:
w₀c = α/β = 0.1 ms⁻¹ / 1 ms⁻¹ = 0.1
Why α/β? At steady state with no noise, dS/dt = 0 means: αS = (1−S)f(s) = (1−S)β·tanh(w₀S) For small S near the transition: αS ≈ (1−S)β·(w₀S) ≈ β·w₀·S The transition between stable S=0 and unstable S=0 occurs when α = β·w₀, i.e., w₀ = α/β.
So: if your activation/deactivation rates satisfy w₀ = α/β, AND your net E/I coupling (wE − wI) equals this w₀, then you're at criticality!