-
Notifications
You must be signed in to change notification settings - Fork 0
Reference LSM
Raul Montoya Cardenas edited this page Jul 29, 2026
·
2 revisions

Generated with Grok Build: Grok 4.5 · xAI Imagine (/imagine)
A 2,048-neuron dense CUDA reservoir for rapid prototyping. Not exported on the public API surface (call via LiquidCortex.run_lsm_step / module-qualified internals). Prefer SparseBrain / EnsembleBrain for production capacity.
| Constant | Value |
|---|---|
REF_N |
2048 |
REF_IN_DEFAULT |
16 |
REF_OUT_DEFAULT |
16 |
Globals start as nothing / defaults so using LiquidCortex works without a GPU:
| Ref | Content |
|---|---|
_ref_W |
CuMatrix{Float32} recurrent weights |
_ref_Win |
CuMatrix{Float32} input weights |
_ref_Wout |
CuMatrix{Float32} readout |
_ref_x |
CuVector{Float32} reservoir state |
_ref_n_in / _ref_n_out
|
Locked dimensions after init |
_ref_initialized |
Boolean gate |
LiquidCortex._init_ref_lsm!(; n_in=8, n_out=4)- Validates positive dimensions.
- Initializes
W ~ N(0, 0.02),Win ~ N(0, 0.5),Wout ~ N(0, 0.1)viacpu_randn_cu. - Zeros state vector of length
REF_N.
First run_lsm_step without prior init:
- Errors if
!_cuda_available[]. - Calls
_init_ref_lsm!(; n_in=length(inputs_vec), n_out=n_out).
y = LiquidCortex.run_lsm_step(inputs_vec::Vector{Float32}, inhibit_val::Float32; n_out=16)
# y :: Vector{Float32} on CPUDynamics:
u = cu(inputs_vec)
gain = 1 − 0.4 * inhibit_val
x ← tanh(gain * (W x + Win u))
y = Array(Wout * x)
Throws DimensionMismatch if length(inputs_vec) ≠ _ref_n_in after init.
s = LiquidCortex.run_lsm_step_str(inputs_vec, inhibit_val; n_out=16)
# comma-separated floats for IPC / shell integration| Aspect | Reference LSM | SparseBrain |
|---|---|---|
| Size | 2,048 dense | 65,536 sparse |
| Activation | Continuous tanh state | LIF spikes + OU noise |
| Inhibition | Recurrent gain shrink | Dynamic threshold raise |
| Plasticity | None online | STDP traces + W_out Hebb |
| State model | Module-level singleton | Instance structs |
| Export | Internal helpers | Public API |
test/runtests.jl (main) includes GPU tests that:
- Snapshot / clear / restore reference globals to avoid cross-test pollution.
- Cover lazy init, custom dims,
ArgumentError/DimensionMismatch, and string output.
See Test Suite.
Last updated: July 28, 2026
Updated by: Grok Build: Grok 4.5
Package tip reference: 4e2698c (main)