Verace Neocortex: production package
A packaged cortical column language network with local learning, subcortical systems, autonomous wake-sleep operation and brain-inspired decoding.
- L1 top-down modulation: Context arriving from above into the column
- Windowed Hebbian association: Replaces attention over a causal window
- L5 output with precision: Carries a precision estimate for the column
- L6 feedback: Enters thalamic gating with weight 0.1
Overview
The production package is the packaged release of Verace Neocortex: one Python package, production, that implements the V11 Cortical Column Network, known in the lab's research as the NeuroCortex Transformer (NCT). The design specification describes a language model that replaces transformer blocks with stacked six-layer cortical columns. It uses no Q/K/V attention and no global backpropagation in its default modes. Learning comes from predictive coding, Hebbian rules, neuromodulation and structural plasticity. The question it addresses is whether a network built only from such local, biologically grounded mechanisms can be trained and run as a complete language system.
Text passes through a four-stage embedding and a thalamic router into a chain of columns, then into a language model head. Each CorticalColumn wires L4 input, L1 top-down modulation, L2/3 windowed Hebbian association, VIP, SST and PV interneurons, working memory, theta-gamma oscillations, L5 output with a precision estimate , and L6 feedback. Subcortical modules surround the columns: hippocampus, basal ganglia, cerebellum, brainstem neuromodulators, a global workspace and a metacognitive monitor. Every module starts as an identity operation and gains influence through learning. An AutonomousLoop runs wake learning, sleep replay, dreaming, consolidation, curiosity and self-play.
The package also contains a 13,817-token dual-route morphological tokenizer, drift-diffusion decoding with inhibition of return, grow, split, merge and autoscale operations on columns, muP-style transfer after Yang and Hu 2021, quantization tiers, column-aware FSDP, SFT and DPO variants weighted by , and a self-hosted FastAPI dashboard backed by SQLite. Three size presets are defined: default (106M parameters), laptop (300M) and 1b (1,008M). The package description counts 211 pytest tests in 32 files that run on CPU in about 2 seconds. The lab's own audit found nine bugs and mapped each to a disease analogue.
The package is implemented end to end. It has training, evaluation, smoke-test and dashboard entry points, and the test suite checks behavioural contracts. The package's own records hold no training run, loss curve, perplexity or benchmark figure; the lab's technical reference records a WikiText-2 validation perplexity of 54.0 for the 300M V11 model after 5,000 steps. Fused Triton kernels for V11 exist only as a roadmap with estimated speedups; 14 Triton kernels of V10.2 exist and are listed for porting. In several places the code and its own documentation disagree. The code uses softmax in workspace competition, the delta-rule head correction and replay sampling, although its description says it uses no softmax. Whether local learning alone trains a useful language model remains open.
Status
Prototype. The full model, learning rules, autonomous loop and tooling are implemented and covered by a test suite that the package description counts at 211 tests, but this package's own records hold no training run or evaluation result; the lab's technical reference records a WikiText-2 validation perplexity of 54.0 for the 300M V11 model after 5,000 steps.
Simulator
A made-up signal jumps a few times. A running prediction follows it, and a gate passes the prediction error upwards only when it is large for the precision it is given.
- signal (white) and prediction (colour), synthetic data
- prediction error: passed upwards (colour) or held (faint)
- Steps passed upwards
- 27%
- Gate stays open after a jump for
- 10.0 steps
- Mean size of the error
- 0.31
- Jumps in the signal
- 4
Raise the precision and small errors pass as well. Lower the learning rate and the prediction takes longer to catch up after a jump.
This simulator is an illustration of the principle, with made-up numbers. It does not run the lab's code or show the lab's data, and nothing in it is a measurement.
Architecture
Cortical column
The basic compute unit. It chains L4, L1, L2/3, interneurons, working memory, oscillations, L5 and L6 with homeostasis, and replaces a transformer block.
Subcortical systems
Thalamus (routing with TRN gating), hippocampus (episodic memory), basal ganglia (D1/D2 selection), cerebellum (forward model), brainstem (DA, NE, 5-HT, ACh), global workspace and a parameter-free self-assessment monitor.
Brain embedding cascade
V11BrainEmbeddingapplies a base lookup, then morpheme dual-route composition, a hub-and-spoke bottleneck and a sparse distributed projection, each as a gated residual. Position comes from a learnable grid-cell generalisation of RoPE.Brain language model head
BrainLMHeaduses the tied embedding plus a low-rank production delta, a per-word frequency bias and gated competitive inhibition between semantically similar words.Brain decoding
BrainDecoderreplaces top-k and nucleus sampling with inhibition of return, drift-diffusion evidence accumulation and a confidence-gated fast path, with optional speculative drafting from the hippocampus.Learning manager
V11LearningManagercoordinates the predictive coding, Hebbian, neuromodulation, wake-sleep and developmental sub-optimisers throughwake_stepandsleep_phase.Autonomous lifecycle
AutonomousLoopruns always-on learning, sleep pressure, dreaming, consolidation, curiosity, self-play, an activation-based form of elastic weight consolidation (EWC, Kirkpatrick 2017) and self-evaluation.PrenatalDevelopmentself-organises the network before any data.Structural scaling
Code to grow, split, merge, kill, freeze and unfreeze columns, an
AutoScalecontroller, and muP-style transfer to larger configurations.NCT tokenizer
NCTTokenizer, a 13,817-token tokenizer after the Coltheart Dual-Route Cascaded model. It has a lexical route, a morphological affix-stripping route and a lossless byte fallback.Deployment tools
Quantization tiers, column-aware FSDP sharding, SFT and DPO weighted by , and adapters that gate tool use and retrieval with , dopamine and conflict signals.
Diagnostics and dashboard
DiagnosticsCollectorproduces a flat per-step metrics dictionary.MetricsLoggerstores it in SQLite, and a FastAPI and WebSocket server with 12 chart panels replaces Weights & Biases.Training and evaluation entry points
train.pytakes presets, learning modes, prenatal steps and resume flags.eval.pycomputes WikiText validation loss, perplexity and PC loss and can generate samples.
Implementation
Mechanisms as they are implemented in the source code, with the constants the code uses.
- Identity-at-init gated residual
- Every submodule outputs with
gate_raw, so . Its output projection is zero-initialised, so the network starts near the plain embedding and brain mechanisms switch on through learning. - Precision-weighted predictive coding loss
- Each column predicts the input of the column below and minimises . The precision is , with the bias set so that starts at 1.0 and no clamps are applied.
- Closed-form local PC update
- Under no_grad, . The softplus derivative in the update is approximated by . Settling repeats until the relative change in summed error falls below
pc_convergence_threshold, with extra steps added under high inter-column conflict. - BCM sliding threshold and metaplasticity
- The Hebbian change is , where tracks an EMA of with tau 1000. The learning rate is further scaled by , where is an EMA (tau 500) of recent update magnitude.
- Error-modulated BCM Hebbian in L2/3
- The update zeroes the diagonal and caps the error ratio at 5. The effective rate is also multiplied by , so uncertain columns learn up to 11x faster.
- Windowed Hebbian association
- This replaces attention at cost . Per head it combines content recall with a causal window of positions weighted by and normalised to sum 1. It then subtracts anti-Hebbian lateral decorrelation, in the docstring, and keeps the top 15% of activations by k-WTA.
- Synaptogenesis and pruning
- A binary mask over
W_assocpermanently removes entries that stay below 0.01 for 1000 steps. When prediction error exceeds 2.0, 5% of dead connections regrow with small random weights. - Neuromodulatory plasticity gate
- Plasticity is . Brainstem projections learn analytically: DA from error times hidden state, NE from , ACh from , and 5-HT from a stability term .
- Analytical delta-rule head correction
- With in float32, the code updates the output bias by and the low-rank factors A and B by their closed-form cross-entropy gradients. Each gradient is norm-clipped to
MAX_GRAD_NORM1.0 and applied at 100x the base learning rate. Column weights are untouched. - Adenosine-like sleep pressure
- Each wake step adds to pressure , capped at 1, and wake learning efficiency is . Sleep starts when or after
sleep_intervalsteps (default 100), runs replay, dreaming and consolidation, then resets to 0. - Three-phase sleep consolidation
- Phase 1 replays memories with a PC update plus Hebbian learning at 0.5x LR. Phase 2 applies anti-Hebbian learning on noisy inputs and BCM on clean inputs at 0.15x LR, and phase 2.5 trains semantic patterns with BCM at 0.3x LR. Phase 3 applies a global multiplicative weight shrink after Tononi, excluding gates, biases, , decay rates, periods and kinetic constants.
- Surprise-gated hippocampal buffer
- An episode is stored when times a sigmoid write gate exceeds
hpc_surprise_threshold0.1, with FIFO eviction. Replay samples with probabilities , by recency, or uniformly. Consolidation runs k-means with and 10 Lloyd iterations, then keeps centroids of clusters with at least 3 members. - Three-timescale working memory
- There are 4 NMDA attractor slots decaying by per token, and an 8-slot phonological loop decaying by with rehearsal of the latest slot. A Tsodyks-Markram trace reads and updates , clamped to .
- Theta-gamma phase-amplitude coupling
- Phases are with learnable , initialised at theta 8, alpha 20 and delta 64 tokens. Gamma amplitude rises with the theta and delta cosines and falls with alpha. Coupling strengths learn from the phase-aligned normalised error at 0.1x the local LR and are clamped to .
- TRN relevance gating
- The thalamus gates each token with , blended as . A bimodality loss pushes gates toward binary values, and L6 feedback enters with weight 0.1.
- Surprise-weighted global workspace
- Columns compete through with initialised to 1.0 to write into a bottleneck of width .
W_writeis zero-initialised, so nothing is broadcast at the start. - Inhibition of return
- Emitting token sets its trace to . The trace decays by with , floored at 1, base tokens, and logits are reduced by the trace.
- Neuromodulated drift-diffusion sampling
- Accumulators follow over the top 64 logits. The threshold collapses as , with and noise scaled by . When the top-1 margin divided by exceeds 2.5, the top token is taken directly (System 1).
- Net2Net column split
- Following Net2Net (Chen et al. 2015), both daughter columns receive , so their summed output preserves the function. The second daughter receives Gaussian noise with
noise_scale0.01 to break symmetry. The overload score is times the normalised prediction error plus times the normalised gate activation, averaged over 50 batches. - Column lifecycle autoscaling
- In the V11 production code (
autoscale.py), every 10000 steps by default, the controller kills columns with gate mean below 0.05 and merges pairs with cosine similarity above 0.95. It splits columns with and gate above 0.8, and grows when 80% of gates exceed 0.64, within 2 to 32 columns. Growth keeps intra-column weights and rebuilds only the thalamic, lateral and workspace routing. - Activation-based EWC
- This variant of elastic weight consolidation (Kirkpatrick 2017) works without autograd: importance accumulates as over replayed memories, with old importance decayed first. Each step pulls parameters toward their anchors by . EWC is off by default.
- Sigma2-weighted alignment
- SFT weights each token by and adds 0.1 times the PC, cerebellar and TRN losses. DPO uses .
Results
From the lab's own experiments and records. They have not been independently replicated.
Lab audit found nine bugs
The lab's own audit recorded nine bugs and mapped each to a disease analogue. They include a reduction using
.sum, an untrained brainstem, an unused IOR tau, deaddream_stepsand sleep pressure that stayed at zero.Brainstem neuromodulators needed their own learning
According to the learning code, without error-correlated learning of the brainstem projections the neuromodulator signals stay at 0.5. Analytical Hebbian learning was added to make them adaptive.
Hippocampal surprise threshold lowered to 0.1
The records state that the surprise threshold for episodic storage was corrected from 0.5 to 0.1.
Test suite of 211 tests
The package description counts 211 pytest tests in 32 files that mirror the module structure. They run on CPU in about 2 seconds with a small configuration of
d_model64 and 2 columns.No results in the package's own records
The package defines presets of 106M, 300M and 1,008M parameters and an evaluation script for perplexity, but its own records report no loss, perplexity or benchmark figure. The lab's technical reference records a WikiText-2 validation perplexity of 54.0 for the 300M V11 model after 5,000 steps.
Code and documentation disagree in places
The quantization docstring assigns INT4 to L2/3 but the code uses INT8. The overload docstring lists sparsity and differentiation terms that the code does not compute. The description says the model uses no softmax, yet softmax appears in workspace competition, the delta-rule head correction and replay sampling.
Windowed Hebbian kernel is the main bottleneck
The kernel roadmap identifies the L2/3 windowed association as the main cost and targets a 5 to 10x speedup from a fused Triton kernel. Fused Triton kernels for V11 exist only as this roadmap with estimated speedups; 14 Triton kernels of V10.2 exist and are listed for porting.
Concepts
- Predictive coding
- A learning scheme in which each layer predicts the activity of the layer below and learns only from its own prediction error. In the lab's Theorem A, it replaces backpropagation with closed-form local updates.
- Precision sigma2
- A learned per-token variance that weights prediction errors. It is split into token, phrase, sentence and discourse bands after Hasson's temporal receptive fields, and it drives decoding, early exit, tools, alignment and autoscaling.
- Sigma2 positivity contract
- must stay strictly positive because it sits in PC denominators. Softplus enforces this, and the test suite checks it.
- Identity at initialisation
- New modules start as near-identity residuals, with gates at and zero output weights. A freshly built or grown network therefore behaves like its simpler predecessor.
- BCM rule
- A Hebbian rule with a sliding threshold. Activity above the threshold strengthens synapses and activity below it weakens them, which prevents runaway potentiation.
- k-Winners-Take-All
- A sparsity operation that keeps only the top activations of a vector and zeroes the rest. It is used in L2/3 and the L5 feedforward network with ratio 0.15.
- Four neuromodulators
- Dopamine, noradrenaline, serotonin and acetylcholine are computed by the brainstem from cortical state and broadcast to all columns. In the lab's Theorem C, DA gates whether to learn, ACh what, NE how broadly and 5-HT on what timescale.
- Complementary learning systems
- The account, after McClelland 1995, that a hippocampus stores episodes quickly while cortex integrates them slowly through interleaved replay. The consolidation code implements it with k-means gist extraction.
- Synaptic homeostasis
- Tononi's hypothesis that sleep shrinks synaptic weights globally while keeping their relative sizes. It forms phase 3 of sleep consolidation.
- Four learning modes
- Hybrid (the default), predictive_coding, hebbian, and a backprop baseline that uses AdamW. The local modes run through
AutonomousLoopunder no_grad, followed by the local output correction. - Global workspace
- After Global Workspace Theory, columns compete to write into a shared bottleneck that every column then reads as top-down context.
- Dual-route tokenization
- After the Coltheart (2001) DRC model of reading, frequent words map to one token and other words are split into prefix, root and suffix morphemes. Anything left falls back to bytes, so
decode(encode(text)) == text. - Drift-diffusion decoding
- Token choice modelled as noisy evidence accumulation toward a collapsing threshold, as in decision models of reaction time. It replaces sampling from a softmax distribution.
- Disease-mapping principle
- The lab's design rule that removing any one brain component should yield a known disease analogue. The rule serves as specification, debugging tool and completeness audit.
- Developmental critical periods
- Training passes through sensory, association, integration and refinement stages at steps 0, 1K, 5K and 20K. Each stage changes learning rate, inhibition, Hebbian weight and structural plasticity.
- Prenatal self-organisation
- A phase before any data, built from spontaneous waves (30%), motor babbling (25%), structured patterns (25%) and oscillatory calibration (20%), using local learning only.
- Net2Net and muP
- Net2Net (Chen et al. 2015) grows a network while preserving its function. muP (Yang and Hu 2021) keeps hyperparameters fixed as width scales. The lab argues that local rules make column dynamics independent of column count.
- Contract tests
- The test suite specifies behavioural contracts, such as and identity at initialisation, rather than only checking that functions run.
About this page
Written from the lab's own documents and source code. Figures and results are the lab's measurements as it recorded them at the time, and have not been independently replicated.
Published under the PolyForm Noncommercial License 1.0.0: free for noncommercial use.