Skip to content
In depthPrototype

Verace Neocortex: production package

A packaged cortical column language network with local learning, subcortical systems, autonomous wake-sleep operation and brain-inspired decoding.

Verace Research
  1. L1 top-down modulation: Context arriving from above into the column
  2. Windowed Hebbian association: Replaces attention over a causal window
  3. L5 output with precision: Carries a precision estimate for the column
  4. L6 feedback: Enters thalamic gating with weight 0.1
Figure 1. Six-layer cortical column in Verace Neocortex. Schematic: stacked six-layer cortical columns that replace transformer blocks and learn by local rules. Implemented as a prototype; the package's own records hold no training result.
Open the simulator on its own pageA gate that passes only surprise: an interactive toy model of the principle. You can also try it below

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 σ2\sigma^2, 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 σ2\sigma^2, 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

  1. 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.

  2. 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.

  3. Brain embedding cascade

    V11BrainEmbedding applies 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.

  4. Brain language model head

    BrainLMHead uses the tied embedding plus a low-rank production delta, a per-word frequency bias and gated competitive inhibition between semantically similar words.

  5. Brain decoding

    BrainDecoder replaces 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.

  6. Learning manager

    V11LearningManager coordinates the predictive coding, Hebbian, neuromodulation, wake-sleep and developmental sub-optimisers through wake_step and sleep_phase.

  7. Autonomous lifecycle

    AutonomousLoop runs always-on learning, sleep pressure, dreaming, consolidation, curiosity, self-play, an activation-based form of elastic weight consolidation (EWC, Kirkpatrick 2017) and self-evaluation. PrenatalDevelopment self-organises the network before any data.

  8. Structural scaling

    Code to grow, split, merge, kill, freeze and unfreeze columns, an AutoScale controller, and muP-style transfer to larger configurations.

  9. 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.

  10. Deployment tools

    Quantization tiers, column-aware FSDP sharding, SFT and DPO weighted by σ2\sigma^2, and adapters that gate tool use and retrieval with σ2\sigma^2, dopamine and conflict signals.

  11. Diagnostics and dashboard

    DiagnosticsCollector produces a flat per-step metrics dictionary. MetricsLogger stores it in SQLite, and a FastAPI and WebSocket server with 12 chart panels replaces Weights & Biases.

  12. Training and evaluation entry points

    train.py takes presets, learning modes, prenatal steps and resume flags. eval.py computes 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 y=x+σ(g)Δy = x + \sigma(g) \Delta with gate_raw g=−2g = -2, so σ(−2)≈0.12\sigma(-2) \approx 0.12. 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 Ll=∥tl−pl∥22σl2+12log⁡σl2L_l = \frac{\lVert t_l - p_l \rVert^2}{2\sigma_l^2} + \frac{1}{2} \log \sigma_l^2. The precision is σ2=softplus(Wσh)+10−6\sigma^2 = \mathrm{softplus}(W_\sigma h) + 10^{-6}, with the bias set so that σ2\sigma^2 starts at 1.0 and no clamps are applied.
Closed-form local PC update
Under no_grad, Wpred←Wpred+η(e/σ2)⊤h/NW_{\mathrm{pred}} \leftarrow W_{\mathrm{pred}} + \eta (e/\sigma^2)^\top h / N. The softplus derivative in the WσW_\sigma update is approximated by clamp(1−e−(σ2−10−6),0.01,0.99)\mathrm{clamp}(1 - e^{-(\sigma^2 - 10^{-6})}, 0.01, 0.99). 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 Δw∝y(y−θ)x\Delta w \propto y (y - \theta) x, where θ\theta tracks an EMA of y2y^2 with tau 1000. The learning rate is further scaled by 1/(1+m)1/(1+m), where mm is an EMA (tau 500) of recent update magnitude.
Error-modulated BCM Hebbian in L2/3
The update ΔW=η[y(y−θ)((1−we)+we∥et∥/∥e∥‾)]⊤x/N\Delta W = \eta [y(y - \sqrt{\theta}) ((1-w_e) + w_e \lVert e_t \rVert / \overline{\lVert e \rVert})]^\top x / N zeroes the diagonal and caps the error ratio at 5. The effective rate is also multiplied by 1+min⁡(σˉ2,10)1 + \min(\bar{\sigma}^2, 10), so uncertain columns learn up to 11x faster.
Windowed Hebbian association
This replaces attention at cost O(Tw)O(T w). Per head it combines content recall a=xWassoc(h)a = x W_{\mathrm{assoc}}^{(h)} with a causal window of w+1w+1 positions weighted by softplus((xt−xj)Wdist(h))\mathrm{softplus}((x_t - x_j) W_{\mathrm{dist}}^{(h)}) and normalised to sum 1. It then subtracts anti-Hebbian lateral decorrelation, ΔW=η(Y⊤Y−I)/N\Delta W = \eta (Y^\top Y - I)/N in the docstring, and keeps the top 15% of activations by k-WTA.
Synaptogenesis and pruning
A binary mask over W_assoc permanently 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 P=DA⋅ACh⋅(0.5+0.5NE)(0.5+0.5⋅5-HT)P = \mathrm{DA} \cdot \mathrm{ACh} \cdot (0.5 + 0.5 \mathrm{NE})(0.5 + 0.5 \cdot \text{5-HT}). Brainstem projections learn analytically: DA from error times hidden state, NE from σ2\sigma^2, ACh from 1/(1+e)1/(1+e), and 5-HT from a stability term 1/(1+std/mean)1/(1 + \mathrm{std}/\mathrm{mean}).
Analytical delta-rule head correction
With E=softmax(z)−onehot(y)E = \mathrm{softmax}(z) - \mathrm{onehot}(y) in float32, the code updates the output bias by ∑E/N\sum E / N and the low-rank factors A and B by their closed-form cross-entropy gradients. Each gradient is norm-clipped to MAX_GRAD_NORM 1.0 and applied at 100x the base learning rate. Column weights are untouched.
Adenosine-like sleep pressure
Each wake step adds 0.001(1+min⁡(ϵ,5))0.001 (1 + \min(\epsilon, 5)) to pressure pp, capped at 1, and wake learning efficiency is max⁡(0.1,1−p)\max(0.1, 1 - p). Sleep starts when p≥0.7p \geq 0.7 or after sleep_interval steps (default 100), runs replay, dreaming and consolidation, then resets pp 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, σ2\sigma^2, decay rates, periods and kinetic constants.
Surprise-gated hippocampal buffer
An episode is stored when mean(e2/σ2)\mathrm{mean}(e^2/\sigma^2) times a sigmoid write gate exceeds hpc_surprise_threshold 0.1, with FIFO eviction. Replay samples with probabilities softmax(surprise)\mathrm{softmax}(\mathrm{surprise}), by recency, or uniformly. Consolidation runs k-means with k=min⁡(8,⌊N/3⌋)k = \min(8, \lfloor N/3 \rfloor) 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 σ(6)≈0.9975\sigma(6) \approx 0.9975 per token, and an 8-slot phonological loop decaying by σ(4)≈0.982\sigma(4) \approx 0.982 with rehearsal of the latest slot. A Tsodyks-Markram trace reads uxu x and updates x←adx+(1−ad)(1−x)−fuxx \leftarrow a_d x + (1-a_d)(1-x) - f u x, clamped to [0,1][0,1].
Theta-gamma phase-amplitude coupling
Phases are ϕ=2πt/P\phi = 2\pi t / P with learnable P=softplus(⋅)P = \mathrm{softplus}(\cdot), 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 [−2,2][-2, 2].
TRN relevance gating
The thalamus gates each token with r=σ(q⋅k/dtrn)r = \sigma(q \cdot k / \sqrt{d_{\mathrm{trn}}}), blended as (1−σ(g))+σ(g)r(1 - \sigma(g)) + \sigma(g) r. A bimodality loss mean(r(1−r))\mathrm{mean}(r(1-r)) pushes gates toward binary values, and L6 feedback enters with weight 0.1.
Surprise-weighted global workspace
Columns compete through softmax(sl/softplus(T))\mathrm{softmax}(s_l / \mathrm{softplus}(T)) with TT initialised to 1.0 to write into a bottleneck of width max⁡(d/4,64)\max(d/4, 64). W_write is zero-initialised, so nothing is broadcast at the start.
Inhibition of return
Emitting token ww sets its trace to A=2.0A = 2.0. The trace decays by e−1/τeffe^{-1/\tau_{\mathrm{eff}}} with τeff=τ(0.5+ACh)(1.5−NE)\tau_{\mathrm{eff}} = \tau (0.5 + \mathrm{ACh})(1.5 - \mathrm{NE}), floored at 1, base τ=25\tau = 25 tokens, and logits are reduced by the trace.
Neuromodulated drift-diffusion sampling
Accumulators follow ai(t+1)=ai(t)+di+σξa_i(t+1) = a_i(t) + d_i + \sigma \xi over the top 64 logits. The threshold collapses as θ(t)=θ0e−t/8\theta(t) = \theta_0 e^{-t/8}, with θ0=θbase(1+0.6(0.5−DA))\theta_0 = \theta_{\mathrm{base}}(1 + 0.6(0.5 - \mathrm{DA})) and noise scaled by σ2\sqrt{\sigma^2}. When the top-1 margin divided by σ\sigma exceeds 2.5, the top token is taken directly (System 1).
Net2Net column split
Following Net2Net (Chen et al. 2015), both daughter columns receive 0.5Wout0.5 W_{\mathrm{out}}, so their summed output preserves the function. The second daughter receives Gaussian noise with noise_scale 0.01 to break symmetry. The overload score is 0.60.6 times the normalised prediction error plus 0.40.4 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 σ2>3\sigma^2 > 3 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 Fi←Fi+θi2e2‾F_i \leftarrow F_i + \theta_i^2 \overline{e^2} over replayed memories, with old importance decayed first. Each step pulls parameters toward their anchors by 10−4F(θ−θ∗)10^{-4} F (\theta - \theta^*). EWC is off by default.
Sigma2-weighted alignment
SFT weights each token by 1/(1+0.1max⁡(0,σsent2−2))1/(1 + 0.1 \max(0, \sigma^2_{\mathrm{sent}} - 2)) and adds 0.1 times the PC, cerebellar and TRN losses. DPO uses βeff=0.1/max⁡(σˉ2,0.1)\beta_{\mathrm{eff}} = 0.1 / \max(\bar{\sigma}^2, 0.1).

Results

From the lab's own experiments and records. They have not been independently replicated.

  1. Lab audit found nine bugs

    The lab's own audit recorded nine bugs and mapped each to a disease analogue. They include a σ2\sigma^2 reduction using .sum, an untrained brainstem, an unused IOR tau, dead dream_steps and sleep pressure that stayed at zero.

  2. 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.

  3. 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.

  4. 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_model 64 and 2 columns.

  5. 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.

  6. 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.

  7. 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 σ2\sigma^2 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
σ2\sigma^2 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 σ(−2)\sigma(-2) 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 kk 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 AutonomousLoop under 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 σ2>0\sigma^2 > 0 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.