Skip to content
In depthExperiments

Verace Neocortex: training and evaluation scripts

Launch, monitoring, evaluation, data and packaging scripts for training Verace Neocortex models and scoring their uncertainty signal.

Verace Research
  1. V6: Detached precision let PCC go negative
  2. True ELBO precision: From V7, precision gets the full ELBO gradient
  3. V10.2: Auxiliary weight stops at a 0.05 floor
  4. V11 cortical column network: Delta-rule LM head in its non-backprop modes
Figure 1. The line of Verace Neocortex versions these scripts train and score. Schematic: the versions of Verace Neocortex from V4.8 to V11, each launched, watched and evaluated by these scripts, with what later versions carried forward. No benchmark scores are drawn.
Open the simulator on its own pageWhat a line of versions keeps: an interactive toy model of the principle. You can also try it below

Overview

The training and evaluation scripts of Verace Neocortex are the Python and shell layer that trains, watches, evaluates and packages each version of the model, whose research name is NeuroCortex Transformer (NCT). They cover the versions from V4.8 through V10.2, the V11 cortical column network, and NCT-Adapt, which adds brain-inspired adapters to a frozen pretrained language model built by others. Each version has a launch script paired with a checkpoint watcher. Around them sit custom metric suites, zero-shot benchmarks, a synthetic cognitive dataset generator with its audit, alignment, distillation and LoRA trainers, and bundlers that produce single-file releases.

The scripts handle two jobs. In training, brain-inspired homeostasis is applied to the optimizer: BCM sliding-threshold gradient scaling, astrocyte calcium gains per block, AdamW with five learning-rate groups, and auxiliary predictive-coding losses that anneal towards a small residual. In evaluation, the model's predicted variance σ2\sigma^2 is the central quantity. It is mapped to a confidence C=1/(1+σ2/σref2)C = 1/(1+\sigma^2/\sigma^2_{\mathrm{ref}}) and scored by AUROC for hallucination detection, Pearson correlation with token loss (PCC), quartile accuracy contrast (CAA) and selective abstention. Each version is also compared against a matched baseline transformer on fixed replacement criteria.

The lab's dataset audit recorded the synthetic cognitive corpus at 15,000 documents and 30,500,710 tokens. It passed 5 of 10 checks, and 31.09% of documents fell below the 1000-token minimum, so the corpus was judged unsuitable. The launch scripts record lessons from earlier runs. Detaching precision in V6 let PCC go negative, and V7 fixed this with a true ELBO term. In V10.2, annealing the auxiliary loss to zero degraded entity memory (WMDP_genuine), so the weight now stops at a 0.05 floor. The V10.2 cloud launcher cites a validation perplexity of 99 for Run 18.

Status: the scripts are implemented, and they define and launch training runs, evaluations and packaging for every version listed. The recorded outcomes are the dataset audit and the run observations written into script headers and comments. Benchmark scores for the trained checkpoints are not recorded here. Some components are only imported, such as the gradient consolidation class and the brain-inspired decoder, so their internals are not shown. The scripts also disagree about the auxiliary floor: 0.0 from V4.10 onward, to avoid CAA inversion, but 0.05 in V10.2. Whether the regenerated dataset was produced is not recorded.

Status

Experiments. Launch, watcher and evaluation scripts exist for many model versions, and the lab recorded a dataset audit and run observations in script comments, but no benchmark results for the checkpoints are recorded here.

Simulator

A made-up line of thirteen versions of twelve parts. Each version replaces a few parts of the one before it and keeps the rest. Move along the line and change how much each version replaces.

  • versions, the baseline first
  • grey: a part of the baseline · colour: a part introduced later, brighter the newer
Baseline still in version 6
33%
Parts replaced since the baseline
8 of 12
Its oldest part is
6 versions old
Less than half baseline from
Version 5

Move along the line of versions, then replace more parts at each step and see how soon the baseline is gone.

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. Per-version launch scripts

    Shell launchers for V4.8 to V11 that set step counts, annealing fractions, decay initialisations and sparsity flags, wait for a free GPU, then run evaluation. Their headers record what each version adds.

  2. Checkpoint watchers and monitors

    Scripts that poll the training log or the step stored in a checkpoint every 30 to 120 seconds and run evaluations at milestone steps. Separate monitors for V11 log progress and detect crashes.

  3. NCT custom evaluation suite

    Compares NCT checkpoints with a baseline transformer on entity, memory, calibration and sparsity metrics such as WMDP, PCC, CAA, LIS and precision-weighted perplexity.

  4. Zero-shot benchmark harness

    Scores multiple-choice tasks including HellaSwag, ARC-Easy, BoolQ and WinoGrande by length-normalised log-likelihood, and turns task wins into a replacement verdict.

  5. NCT-Adapt trainers and scorecards

    Wrap each layer of a frozen TinyLlama or Llama-3.2-1B-Instruct model, both by other parties, in adapter blocks and train only the adapters. Benchmark scripts compare the adapted model with the base model on calibration, hallucination, memory, safety and knowledge preservation.

  6. Synthetic cognitive dataset generator

    Produces a JSONL corpus from eight module-targeted category generators, a four-phase curriculum, a multi-category composer and a quality filter, with 15K documents by default and seed 42.

  7. Dataset audit tools

    Check the corpus against its specification for size, document length, category and phase distributions, module coverage and garbage text. They print a compliance scorecard and map dataset module codes onto the 26 canonical names.

  8. Alignment, distillation and LoRA trainers

    Run supervised fine-tuning on Alpaca and DPO on HH-RLHF, both public datasets by others, plus teacher-student distillation and LoRA fine-tuning. Each keeps the σ2\sigma^2 uncertainty signal calibrated.

  9. Bundlers and notebook builders

    Concatenate package modules in dependency order, or extract classes by AST, into single standalone files and self-contained notebooks for V10.2, V11 and NCT-Adapt. Each output is checked to parse.

  10. Training diagnostics dashboards

    Parse V11 training logs or pull run history from an experiment tracker. They render multi-section plots of loss, σ2\sigma^2, neuromodulators, memory and sleep, generalisation and GPU use.

Implementation

Mechanisms as they are implemented in the source code, with the constants the code uses.

BCM sliding-threshold gradient scaling
Every 10 steps each parameter's mean squared gradient is compared with a threshold θ\theta, an EMA with base rate β0=0.00065\beta_0 = 0.00065. A metaplastic EMA mm of (g2−θ)2(g^2-\theta)^2 gives stab=1/(1+m/θ2)\mathrm{stab} = 1/(1+m/\theta^2) and β=β0(0.5+1.5 stab)\beta = \beta_0(0.5+1.5\,\mathrm{stab}), clamped to [0.000325,0.0013][0.000325, 0.0013]. Gradients are scaled by 1±0.051 \pm 0.05 and clipped to [0.8,1.2][0.8, 1.2].
Astrocyte calcium block gain
For each block, the change in RMS gradient norm feeds a calcium trace c←0.97c+0.03(gn−gnprev)c \leftarrow 0.97c + 0.03(g_n - g_{n}^{\mathrm{prev}}). Block gradients are multiplied by 1+0.5tanh⁡(c)1+0.5\tanh(c), composed with the BCM factor. In the NCT-Adapt trainer a variant instead scales each layer by clamp(slow/fast,0.8,1.2)\mathrm{clamp}(\mathrm{slow}/\mathrm{fast}, 0.8, 1.2), using EMAs with time constants 50 and 500.
Five-group timescale-separated AdamW
Parameters are split by name into AdamW groups with weight decay 0.1 and betas 0.9 and 0.95. The learning-rate multipliers are base 1x, W_sigma 1x, gate_raw 20x, hippocampal 5x, and neuromodulation, oscillation and grid parameters 0.3x. A notebook variant also scales the hippocampal rate by clip(1+0.3(DA−1),0.5,2)\mathrm{clip}(1+0.3(\mathrm{DA}-1), 0.5, 2) at each step.
Auxiliary loss annealing with residual
The auxiliary weight follows a=r+(1−r)max⁡(0,1−s/(0.7S))a = r + (1-r)\max(0, 1 - s/(0.7S)) with r=0.05r = 0.05. It scales the predictive-coding, bidirectional, KL, VPC, TPC and replay losses, while slot orthogonality and z-loss are never annealed. Gumbel and dendritic temperatures follow τ=max⁡(0.1,e−3s/S)\tau = \max(0.1, e^{-3s/S}).
Gradient-alignment auxiliary dampening
Every 5 steps the next-token loss and the auxiliary loss are sampled into 50-sample windows. Every 50 steps the Pearson ρ\rho of their deltas is computed. If ρ<−0.1\rho < -0.1 a dampening factor is multiplied by 0.95 (floor 0.3), and if ρ>0.1\rho > 0.1 it is multiplied by 1.02 (cap 1.0).
Sleep replay buffer with reverse replay
A 20-slot buffer keeps the micro-batches with the highest dopamine signal. Every 1000 steps, if at least 5 are stored, it runs 10 DA-weighted replay steps with per-group learning-rate factors. In V10.2, odd replay steps flip the sequence.
Analytical delta-rule LM head
In V11's non-backprop modes, the head error is e=softmax(z)−onehot(y)e = \mathrm{softmax}(z) - \mathrm{onehot}(y), with padding masked. Low-rank updates dA=e⊤(hBδ⊤)/NdA = e^\top (h B_\delta^\top)/N and dB=(eAδ)⊤h/NdB = (e A_\delta)^\top h / N are each clipped to norm 1.0 and applied with a learning rate 100 times the base rate, because the error is of order 1/V1/V.
Dopamine-weighted NTP with variance calibration
In NCT-Adapt the per-token cross-entropy is weighted by dopamine surprise weights w=1+stanh⁡(da−1)w = 1 + s\tanh(\mathrm{da}-1), where da=3r/(1+r)\mathrm{da} = 3r/(1+r). The uncertainty term is mean(min⁡(eγ,100) CE2−γ)\mathrm{mean}(\min(e^{\gamma},100)\,\mathrm{CE}^2 - \gamma) capped at 50, and a boundary penalty keeps σ2\sigma^2 in [0.3,4][0.3, 4]. The total is NTP plus 0.01 times the uncertainty term plus 0.1 times the boundary term.
Gated identity initialisation
Adapter modules return X+σ(g)f(X)X + \sigma(g)f(X) with gate_raw initialised to -2 and zero-initialised output projections. The block output adds 0.1 σ(−3)(Xnct−Xfrozen)0.1\,\sigma(-3)(X_{\mathrm{nct}} - X_{\mathrm{frozen}}) to the frozen output. Setting every gate_raw to -100 reproduces the frozen backbone, which supplies the base perplexity and logit identity tests.
Gated-decay linear memory slots
Keys and queries pass through ϕ(x)=elu(x)+1\phi(x) = \mathrm{elu}(x)+1. Each step reads (Sq)/(z⊤q)(Sq)/(z^\top q) and writes S←aS+g kv⊤S \leftarrow aS + g\,kv^\top and z←az+gkz \leftarrow az + gk. The retention is a=σ(6.0)a = \sigma(6.0) and the write gate is g=σ(Wx−2)g = \sigma(Wx - 2).
STDP retention boost
V9's thalamic memory sets aeff,t=at+λ gt−1(1−at)a_{\mathrm{eff},t} = a_t + \lambda\, g_{t-1}(1-a_t), so consecutive strong writes raise retention. It adds one scalar per block, with gain near zero at initialisation.
Exact-k sparse dendritic FFN
V10 keeps exactly k=max⁡(1,⌊0.02 dff⌋)k = \max(1, \lfloor 0.02\,d_{ff} \rfloor) units active per position, which is 30 for dff=1536d_{ff} = 1536. Selection is top-k with Gumbel noise during training, and the backward pass uses a straight-through estimator.
True ELBO precision
From V7, precision is 1/σ21/\sigma^2 without stop-gradient and a log⁡σ2\log \sigma^2 term is added, so σ2\sigma^2 receives the full ELBO gradient and settles at the mean squared error. V8 adds vocabulary predictive coding, LVPC=mean(π^top CE)L_{\mathrm{VPC}} = \mathrm{mean}(\hat{\pi}_{\mathrm{top}}\,\mathrm{CE}), which ties σ2\sigma^2 to next-token quality.
Variance-based hallucination AUROC
High-error tokens have CE>2⋅median\mathrm{CE} > 2\cdot\mathrm{median} and low-error tokens have CE<0.5⋅median\mathrm{CE} < 0.5\cdot\mathrm{median}. AUROC counts pairs where the high-error token has larger σ2\sigma^2, with ties counted as 0.5. Selective abstention drops the 30% most uncertain tokens and measures the accuracy gain.
PCC and CAA calibration probes
PCC is the Pearson correlation between mean σ2\sigma^2 and per-token cross-entropy, which should be positive. CAA is the accuracy of the lowest-σ2\sigma^2 group minus the highest-σ2\sigma^2 group, using quartiles in the custom suite and median splits in the adapter trainer.
Variance-adaptive DPO
Per example, βeff=β(1+0.3 clamp(σr2−σc2,−2,2))\beta_{\mathrm{eff}} = \beta(1 + 0.3\,\mathrm{clamp}(\sigma^2_{r} - \sigma^2_{c}, -2, 2)), clamped to [0.5β,2β][0.5\beta, 2\beta], with default β=0.1\beta = 0.1. The mean of σr2−σc2\sigma^2_{r} - \sigma^2_{c} is tracked as an alignment signal.
Variance-guided decoding with backtracking
Low-confidence tokens are replaced by the top-k candidate with the lowest next-step σ2\sigma^2. If the mean σ2\sigma^2 of the last 5 tokens exceeds 8.0, those tokens are regenerated, at most 2 times.
Replacement verdict thresholds
The benchmark verdict is STRONG YES if NCT wins every task with a gap of at least 0, YES for at least 75% wins with a gap of at least -5%, and CONDITIONAL for at least 50% wins with a gap of at least -10%. V9's criteria are a perplexity gap under 2%, WMDP_genuine above 0.10, LIS below 0.10 and PCC above 0.
Document-aware sequence sampling
Each domain is stored as a flat int32 token file plus an int64 offsets file. Windows of T+1T+1 tokens are drawn only from documents at least that long, so no sequence crosses a document boundary.
Composite intelligence index
The composite score is 0.6⋅100aˉ+0.4⋅c0.6\cdot 100\bar{a} + 0.4\cdot c, where aˉ\bar{a} is average accuracy. Calibration is c=40 AUROC+30max⁡(0,PCC)+30max⁡(0,trust)c = 40\,\mathrm{AUROC} + 30\max(0,\mathrm{PCC}) + 30\max(0,\mathrm{trust}), and the base model gets calibration 0.

Results

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

  1. Cognitive dataset failed its audit

    The lab's audit found 15,000 documents and 30,500,710 tokens but only 5 of 10 checks passed, and the dataset was judged unsuitable.

  2. Short documents do not exercise long context

    The audit counted 4,663 documents, or 31.09%, under the 1000-token minimum, with a minimum length of 616 tokens. Long-context mechanisms such as NMDA and the phonological loop would not be trained.

  3. Module names matched the specification 0%

    The dataset used lowercase abbreviated module codes instead of canonical PascalCase names, so none matched. A mapping script was written to translate them.

  4. Category counts were inflated by multi-category documents

    With 1.78 categories per document on average, token counts summed across categories, and every category exceeded its target by 12 to 32 points.

  5. Curriculum skewed towards the hardest phase

    Phase 3 held 42.4% of documents against a 27% target, while Phase 1 held only 6.8%. The recommendation was to regenerate with a 1000-token minimum and stratified phases, or to post-process and keep about 65%.

  6. 206 documents contained HTML email headers

    The audit's garbage-text check flagged 206 documents containing HTML email headers, which it rated a minor issue.

  7. Detached precision let PCC turn negative

    The V7 launch notes record that in V6 the detached precision term let PCC go negative. The true ELBO gradient on σ2\sigma^2 was introduced to keep PCC positive after annealing.

  8. Annealing auxiliary losses to zero hurt entity memory

    The V10.2 extended launcher records that annealing to 0 degraded WMDP_genuine, so the weight stops at 0.05. The V4.10 scripts had set the floor to 0.0 to avoid CAA inversion, so the two choices conflict.

  9. Run 18 reached validation perplexity 99

    The V10.2 cloud launcher cites a validation perplexity of 99 for Run 18 and lists the fixes made before Run 19.

  10. Multi-token candidates dropped from custom probes

    The custom suite keeps only candidates that encode to a single BPE token, so multi-token options are silently excluded from those probes.

Concepts

Predicted variance sigma squared
The precision-weighted predictive-coding variance σ2\sigma^2 each layer outputs. The scripts treat it as the model's uncertainty, average it across layers and map it to confidence.
PCC
The Pearson correlation between σ2\sigma^2 and token cross-entropy. A positive value means the model is more uncertain where it is wrong.
CAA
Confidence-accuracy alignment: the accuracy on low-σ2\sigma^2 tokens minus the accuracy on high-σ2\sigma^2 tokens. A positive value means σ2\sigma^2 carries information.
WMDP_genuine
An entity-memory probe in the custom suite. Launch comments use its collapse as the signal that annealing the auxiliary loss to zero was harmful.
Lateral inhibition score
LIS, a sparsity measure. The launch scripts target LIS below 0.25 for V4.11 and below 0.10 for V9.
Auxiliary loss annealing
Gradually reducing the predictive-coding and related auxiliary losses during training, so late training is dominated by next-token prediction, optionally leaving a small floor.
BCM metaplasticity
A rule from synaptic plasticity theory in which a sliding threshold separates strengthening from weakening. Here it is applied to gradient magnitudes, and the threshold's own rate adapts to its stability.
Astrocyte modulation
Block-level gradient gains driven by a slow calcium-like trace of gradient change, modelled on astrocyte signalling in the brain.
NCT-Adapt
The adapter form of the model: brain-inspired modules wrapped around the layers of a frozen pretrained language model by others, with only the adapters trained.
Dopamine surprise weighting
Per-token reweighting of the next-token loss by a reward-prediction-error style signal computed from a token's loss relative to its running mean.
Selective abstention
Declining to answer on the most uncertain fraction of tokens, 30% in these scripts, and measuring how much accuracy improves on the rest.
Replacement verdict
A fixed rubric that converts NCT versus baseline task wins and accuracy gaps into a graded answer on whether NCT can replace a standard transformer.
Four-phase cognitive curriculum
Warm-up, full cognitive training, integration and instruction phases with rising difficulty. The specification targets 13%, 40%, 27% and 20% of documents.
Module-targeted data categories
Eight synthetic categories, such as entity tracking at 25% and temporal ordering at 15%, each written to exercise particular NCT modules.
Gumbel temperature schedule
An annealed temperature for hard Gumbel-Softmax column assignment and dendritic spike gates, moving from 1.0 to 0.1 so that assignments become discrete.
Calibration-preserving fine-tuning
SFT, DPO, distillation and LoRA trainers that freeze W_sigma or keep a small calibration loss, so fine-tuning does not destroy the σ2\sigma^2 signal.
Wake-sleep training in V11
V11 modes interleave predictive-coding inference and local updates with sleep consolidation every 100 steps, with an optional 500-step prenatal self-organisation phase.
Oscillatory ablation matrix
Nine experiment configurations that switch the alpha, delta, theta, hippocampal and nested-oscillation mechanisms on and off.

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.