Skip to content

STDP and Covariance

Raul Montoya Cardenas edited this page Jul 29, 2026 · 2 revisions

STDP Covariance Learning

Plasticity and statistics paths in sparse_brain.jl.

Learning Constants

Constant Value Role
ETA 0.001 Default learning rate (reflex_eta default)
TAU_TRACE 20.0 Eligibility-trace decay time
TAU_SPIKE 20.0 Documented STDP time constant (design note)
W_MAX 1.0 Clamp on W_out after updates

Conceptual covariance / STDP framing used in docs:

ΔW_ij = η (⟨s_i s_j⟩ − ⟨s_i⟩⟨s_j⟩)

Bi & Poo (1998); Hebb (1949)

Eligibility Traces (every tick)

After spikes are written:

trace_pre  ← trace_pre  * (1 − DT/TAU_TRACE) + S
trace_post ← trace_post * (1 − DT/TAU_TRACE) + S

Traces live as CuVector{Float32} of length N on each SparseBrain.

Hebbian Readout Update (every 10 ticks)

Recurrent sparse W is not rewritten each step on the hot path. The implemented online plasticity updates W_out:

when tick_count % 10 == 0:
  S_out = (output .> 0)
  dW_out = reflex_eta * (S_out * trace_pre')
  W_out += dW_out
  clamp!(W_out, -W_MAX, W_MAX)

reflex_eta can be elevated on the Fast ensemble lobe under reflex gating (5×). See Inhibition and Reflex Gating.

Reservoir Covariance (compute_reservoir_covariance!)

Offline / diagnostic-style statistic over the rolling spike history:

result = compute_reservoir_covariance!(brain)
# nothing until history has wrapped once (hist_full)
# else (C::CuMatrix, indices::Vector{Int})

Algorithm:

  1. Require brain.hist_full (at least HIST_DEPTH ticks recorded).
  2. Draw COV_SUBSAMPLE (8192) random neuron indices.
  3. Slice X = history[:, indices] → size 1000 × 8192 on GPU.
  4. Mean-center columns.
  5. Form covariance C = (X' X) / (HIST_DEPTH - 1) (dense GEMM / SYRK-class workload).

Why subsample?

Full N×N at N=65,536 and Float32 would be:

65536² × 4 bytes ≈ 17 GB

which does not fit a 16 GB card. Subsampled:

8192² × 4 bytes ≈ 268 MB

while still stressing GPU tensor throughput for diagnostics or downstream analysis.

History Buffer

Field Role
history HIST_DEPTH × N Float32 spikes on GPU
hist_idx Next write row (1-based circular)
hist_full true after first wrap

Each step: history[hist_idx, :] .= S, then advance index.

Note on Monte Carlo Paths

Older design notes / Devin outline text mention background Geometric Brownian Motion path generation. That generator is not present on current main after domain decoupling. Consumers who need synthetic time series should generate them outside LiquidCortex and feed CuVector{Float32} inputs.

Related


Last updated: July 28, 2026 Updated by: Grok Build: Grok 4.5 Package tip reference: 4e2698c (main)

Clone this wiki locally