Verace Neocortex: test suite
A pytest contract suite pinning initial states, local learning rules, homeostasis and substrate causality in a cortical-column language model.
- Top-down error: Drives the no-grad local updates
- L2/3 output: Frozen to backprop, learns through a local rule
- L4 projection: Starts small-random, standard deviation near 0.02
- L5 SwiGLU: Local updates kept finite by weight-norm caps
Overview
The test suite of Verace Neocortex is the pytest collection that specifies and checks the behaviour of the cortical-column language model the lab's code calls NeuroCortex Transformer. It encodes the model's design rules as executable contracts: how every layer, subcortical system and gate must look when the model is first built, how parameters frozen during backpropagation still learn through local rules, how homeostatic controllers settle, and whether per-column metabolic state actually drives behaviour. The question each test answers is narrow: does the code obey the stated mechanism, at the stated constants?
The suite is organised by anatomy and by contract type. Column tests cover layers L2/3, L4 and L5, interneurons, working memory and homeostasis. System tests audit the hippocampus, thalamus, cerebellum, brainstem, workspace and prefrontal cortex. Cross-cutting families include neonatal-initialisation contracts, the FreezeMode contract, invisible-on-disable contracts for an optional metabolic substrate, source-versus-observer perturbation tests, C++ kernel parity tests against pure-Python references, the three-commit Waltz sleep-consolidation tests, scenario traces for 14 brain processes, and checks that forward passes contain no .item() host synchronisation. Shared fixtures in conftest.py build a tiny configuration on CPU.
The tests fix concrete constants. Gates start at ; L4 projections start with standard deviation near 0.02; local updates are capped at weight norms of 5.0 or 10.0; the multicast layer is an exact no-op at alpha_raw = -5; the metaplasticity time constant starts at 500 and is bounded to ; Broca structure thresholds track a 15% boundary rate and an 8% merge rate; the tokenizer has a base vocabulary of 262. Pacemaker clone tests require phases to re-diverge by at least 0.05 rad within 100 steps, and a toy Kuramoto test requires a mid-band order parameter at coupling 0.03.
The suite is written and exercises the model's real classes, so it shows which mechanisms are implemented and what their contracts are. It records no pass or fail outcomes, training runs or benchmark figures, so nothing here is a measured result. Some tests specify work that is not built: the parallel-columns file notes the fused column kernel is not implemented, and the C++ parity tests are skipped when the extensions are not compiled. Several files are regression tests written after the lab's own audits, which records that earlier versions broke these contracts.
Status
Prototype. The test code exists and exercises implemented model classes, but no test run results or evaluations are recorded, and some tested features, such as the fused kernel, are marked unimplemented.
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
- 28%
- Gate stays open after a jump for
- 10.0 steps
- Mean size of the error
- 0.30
- 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
Neonatal initialisation contracts
Per-module tests for L2/3, L4, L5, interneurons, working memory, homeostasis and the hippocampus that pin the state at construction: small-random weights, no dead zero layers, set gate biases, and frozen biological constants.
System audit tests
Regression tests for the hippocampus, thalamus, cerebellum, brainstem, workspace, self-assessment and prefrontal modules. They check initial weights, which tensors are frozen buffers and which are learnable parameters, and that forward passes avoid
.item()calls.FreezeMode contract tests
Tests of the per-layer freeze modes TRUNCATE, F_FWD, PLASTIC, GATED and F_TRACK. They cover single layers, the column forward pass, the predictive-coding optimizer and a prenatal overshoot case.
Metabolic substrate tests
Construction, invisible-on-disable, pacemaker and causal-verification tests for
MetabolicBudget, which holds per-column ATP and firing averages that can scale plasticity and firing once armed.Kernel parity tests
Tests that run pure-Python reference implementations of the Broca loop and the phonological loop, then require the C++ extensions to match within float32 tolerance. They are skipped when the extensions are not compiled.
Waltz consolidation tests
Three test files that follow Broca chain events from a wake forward pass into hippocampal episodes, recall by slot tuple, and sleep consolidation that trains
W_chain.Scenario trace tests
Behavioural traces for 14 brain processes, including anti-Hebbian learning, neuromodulatory gating, working memory, oscillations, thalamus, hippocampus, basal ganglia, cerebellum, sleep and structural plasticity.
Parallel column contracts
Test-driven contracts for running columns in parallel, batched and as a fused kernel. Each violation is mapped to a named brain disorder, and the fused kernel is recorded as not implemented.
Tokenizer and pipeline tests
Contract tests for
NCTTokenizer, the training pipeline's logits path, batch-size transitions, the retrieval language model and the autonomous loop components.
Implementation
Mechanisms as they are implemented in the source code, with the constants the code uses.
- Neonatal init doctrine
- Modules are born small-random and active rather than zero, so no layer is disconnected at construction. Gates start at , and L4
projstarts with standard deviation near 0.02. Each contract test also checks that the module's learning rule can move every pinned weight away from its initial value. - Depth-scaled sigma2 EMA
- Each column's precision estimate sigma2 is an exponential moving average with rate , where is the column index and a scale. Shallow columns therefore integrate over short time spans and deep columns over long ones, and the tests require sigma2 to stay positive.
- Sigma2 surprise rescue
- When per-token prediction error exceeds the sigma2 estimate by a ratio above 100, a per-column distribution-shift rescale re-bootstraps the precision state. This happens before the predictive-coding gradient can overflow.
- Norm-guarded local learning
- Parameters that backpropagation leaves frozen, including the L5 SwiGLU, dendrites, L2/3 output, L4 projection and working-memory weights, are updated under
no_gradfrom top-down error. Weight-norm caps of 5.0 or 10.0 and gate clamps keep the updates finite, and awake_stepintegration test exercises the whole path. - Neuromodulatory plasticity gate
- Plasticity is computed as . The scenario tests require low dopamine or acetylcholine to suppress plasticity and require norepinephrine or serotonin to raise it.
- Critical period closure
- A plasticity factor decays exponentially with wake steps to a locked floor. Joint phasic acetylcholine and norepinephrine firing can re-open it up to
EPSILON_OPEN. The tests also check the decay curve, a checkpoint round trip, and that interneuron gate differentiation survives wake. - Meta-meta homeostatic rule
- Over a BCM threshold initialised at , the metaplasticity time constant
tau_rawstarts at 500. It shortens under high plasticity, lengthens under low plasticity, holds still in a middle band, and is bounded to . Non-finite inputs must leave the state safe. - Multicast identity-at-init gating
- Each bus gate is applied as , centred on the multicast value . Together with an initial threshold bypass, this makes the multicast layer an exact no-op at
alpha_raw= -5, so the model starts identical to the version without the multicast layer. - Multicast bus weight homeostat
- Per-signal bus weights are slowly rescaled so that each bus's running mean drifts toward a 0.5 setpoint, with an L2 anchor term. A utility-shifted setpoint is bounded to , and the first manager step must leave the weights unchanged.
- Rate-target threshold homeostasis
- Inside the Broca structure builder, the boundary threshold, merge threshold and chain gate drift so that the observed boundary rate holds at 15% and the merge rate at 8%. At the fixed point the thresholds stay still. The rules run through
HebbianOptimizer._update_oscillations. - Content-dependent phase-amplitude coupling
- The scalar coupling constants are deleted and replaced by
W_kappa, a trainableLinear(d_column,3)with biased initialisation. It maps column content to three phase-amplitude coupling strengths, and the forward pass is free of.item()calls. The code and its theorem disagree here: the head has 3 outputs, while the lab's theorem documents specify a 4-vector of coupling strengths. - Relational chaining in the Broca buffer
- When active slots have similar content but different roles,
W_chainderives a new slot from them, gated bychain_gate. The code cites Thm 103 for single hops and Thm 113 for multiple hops. The C++ kernel must reproduce the Python reference within float32 tolerance. - Waltz sleep training of W_chain
- During wake, Broca stores its last chain pair in
_last_chain_pair, which resets on every forward pass. The network harvests chain events from columns that fired, andencode_episodestores them in hippocampal episodes.recall_by_slot_tuplereturns a score-weighted top-k mean, andConsolidationManagermovesW_chaintoward that recall target during sleep. - FreezeMode semantics
- TRUNCATE bypasses a layer, F_FWD detaches it and runs it under
no_grad, PLASTIC trains normally, GATED scales the updates, and F_TRACK only observes. The predictive-coding optimizer must skip TRUNCATE columns, and Turrigiano scaling must be skipped when scaling is not plastic. - Frozen buffer versus parameter split
- Anatomical and circuit constants, such as the thalamic
fb_scaleand the prefrontal conflict thresholds, are registered as frozen buffers. Adaptive targets, such as the prefrontal dopamine thresholds andgoal_decay, staynn.Parameterobjects with clamped, prediction-error-driven drift rules. - Invisible-on-disable substrate
MetabolicBudgetstarts disarmed. Untilarm()is called,plasticity_scaleandfiring_gainreturn 1.0 andstepdoes nothing. With the flag off, the logits must be identical and the buffers unchanged, and arming the pacemaker without ATP must be a no-op.- Source versus observer perturbations
- Shuffle and clone tests swap or copy per-column ATP and
firing_emaacross columns, then measure the divergence ofW_assocand L5 under a plasticity-scaled Hebbian update. A further test compares pacemaker phase trajectories with per-column Kolmogorov-Smirnov tests, and another clones column 3 onto column 7 and requires phases to re-diverge by 0.05 rad within 100 steps. - Kuramoto metastable lift
- A toy simulation of coupled phase oscillators with near-critical coupling must place the order parameter in a middle band rather than at full synchrony. With zero coupling, the oscillators must drift freely.
- Rostrocaudal NMDA gradient
- The NMDA decay bias must follow a gradient across columns, which implements hierarchical temporal abstraction. A lesion flag removes the gradient so its effect can be ablated.
- Lossless tokenizer roundtrip
NCTTokenizerhas a base vocabulary of 262 with byte-fallback tokens and case markers, so any text decodes back exactly.build_vocabmust be deterministic and idempotent, and save and load must give the same results.
Results
From the lab's own experiments and records. They have not been independently replicated.
Fused column kernel is not implemented
The parallel-columns contract file specifies three levels: parallel, batched and fused kernel. It records that the fused kernel does not exist yet, and most of its other checks are shape, finiteness and stability checks.
Formerly frozen parameters now learn locally
The learning tests record that the L5 SwiGLU, dendrites, L2/3 output, L4 projection and working-memory weights, which were previously frozen, now update through no-grad rules with norm caps of 5.0 or 10.0.
Audits produced regression tests for init defects
The hippocampus, thalamus, subcortical and prefrontal audit tests, the deletion of the scalar coupling aliases, and a fix that sets the metaplasticity time constant to 500 all record defects that the lab's own audits found and the suite now guards against.
Coupling head and theorem disagree in size
The regression tests pin
W_kappaas aLinear(d_column,3)with 3 outputs, while the lab's theorem documents specify a 4-vector of coupling strengths. The tests therefore guard the code's 3-output form, not the theorem's.Imagination engine counter fix
The autonomous tests pin a recorded fix, Bug Fix #4:
ImaginationEnginestoresdream_steps, with a default of 10, and starts with zerototal_dreams.No run outcomes are recorded
The suite defines the model's expected behaviour and its thresholds, but it holds no recorded pass rates, training curves or benchmark figures.
Concepts
- Contract test
- A test that states a design rule of the model as an assertion, for example that a weight is never zero at birth. A failing contract then points to the exact rule that was broken.
- Neonatal initialisation
- The lab's term for the state of the model at construction. It requires every pathway to be weakly active and able to learn, never silent.
- Cortical column
- The model's repeated unit, with layers named after cortical layers L2/3, L4 and L5. Each column produces an output, a prediction and a precision estimate.
- Sigma2 precision
- A per-column running estimate of prediction-error variance. Predictive coding uses it to weight errors.
- Predictive coding
- A learning scheme in which layers predict their inputs and learn from the prediction error. The suite tests its optimizer and the caches that feed it.
- Local learning rule
- An update computed from signals available at the layer, such as top-down error, without backpropagation. The suite checks these rules for parameters frozen to gradients.
- BCM homeostasis
- A sliding-threshold plasticity rule in which a neuron's modification threshold tracks its own activity. It sits under a metaplasticity layer that scales the learning rate.
- Critical period
- A developmental window in which plasticity is high before it closes to a floor. Here neuromodulator bursts can re-open it.
- Neuromodulators
- The global signals dopamine, acetylcholine, norepinephrine and serotonin. They scale plasticity and drive the multicast bus gates.
- Multicast bus
- A shared routing layer that broadcasts neuromodulator-derived gate values to subscribing modules. It is built to be an exact identity at initialisation.
- Metabolic substrate
- An optional per-column energy budget of ATP and firing averages. Once armed, it can scale plasticity and firing and can drive a pacemaker phase.
- Source versus observer
- The question whether a state variable causally drives behaviour or merely records it. The suite answers it by shuffling and cloning the state across columns.
- Kuramoto order parameter
- The magnitude of the mean phase vector of coupled oscillators. It runs from 0, no synchrony, to 1, full synchrony, and the lab targets a metastable middle band.
- Phase-amplitude coupling
- The modulation of a fast oscillation's amplitude by a slow oscillation's phase. Here its strength depends on column content through
W_kappa. - Broca structure builder
- The production-side buffer of slots with content and roles. It detects boundaries, merges slots and chains relations through
W_chain. - Waltz consolidation
- The lab's name for the path that carries chain events from wake, through hippocampal episodes, into sleep-time training of
W_chain. - FreezeMode
- A per-layer setting that decides whether a layer is bypassed, forward-only, observed, gated or fully trained.
- Frozen buffer
- A tensor saved with the model that receives no updates. It is used for anatomical constants, as opposed to learnable parameters.
- Kernel parity
- The requirement that a compiled C++ kernel produce the same outputs as its pure-Python reference within float32 tolerance.
- Hierarchical temporal abstraction
- The design in which columns further along the hierarchy integrate over longer time spans. The suite tests it through the depth-scaled sigma2 EMA and the NMDA decay gradient.
- Host synchronisation guard
- A test that forbids
.item()in forward passes. Such calls force device-to-host synchronisation and break graph compilation.
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.