Verace Neocortex: training and evaluation scripts
Launch, monitoring, evaluation, data and packaging scripts for training Verace Neocortex models and scoring their uncertainty signal.
- V6: Detached precision let PCC go negative
- True ELBO precision: From V7, precision gets the full ELBO gradient
- V10.2: Auxiliary weight stops at a 0.05 floor
- V11 cortical column network: Delta-rule LM head in its non-backprop modes
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 is the central quantity. It is mapped to a confidence 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
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.
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.
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.
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.
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.
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.
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.
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 uncertainty signal calibrated.
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.
Training diagnostics dashboards
Parse V11 training logs or pull run history from an experiment tracker. They render multi-section plots of loss, , 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 , an EMA with base rate . A metaplastic EMA of gives and , clamped to . Gradients are scaled by and clipped to .
- Astrocyte calcium block gain
- For each block, the change in RMS gradient norm feeds a calcium trace . Block gradients are multiplied by , composed with the BCM factor. In the NCT-Adapt trainer a variant instead scales each layer by , 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_sigma1x,gate_raw20x, hippocampal 5x, and neuromodulation, oscillation and grid parameters 0.3x. A notebook variant also scales the hippocampal rate by at each step. - Auxiliary loss annealing with residual
- The auxiliary weight follows with . 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 .
- 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 of their deltas is computed. If a dampening factor is multiplied by 0.95 (floor 0.3), and if 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 , with padding masked. Low-rank updates and are each clipped to norm 1.0 and applied with a learning rate 100 times the base rate, because the error is of order .
- Dopamine-weighted NTP with variance calibration
- In NCT-Adapt the per-token cross-entropy is weighted by dopamine surprise weights , where . The uncertainty term is capped at 50, and a boundary penalty keeps in . The total is NTP plus 0.01 times the uncertainty term plus 0.1 times the boundary term.
- Gated identity initialisation
- Adapter modules return with
gate_rawinitialised to -2 and zero-initialised output projections. The block output adds to the frozen output. Setting everygate_rawto -100 reproduces the frozen backbone, which supplies the base perplexity and logit identity tests. - Gated-decay linear memory slots
- Keys and queries pass through . Each step reads and writes and . The retention is and the write gate is .
- STDP retention boost
- V9's thalamic memory sets , 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 units active per position, which is 30 for . 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 without stop-gradient and a term is added, so receives the full ELBO gradient and settles at the mean squared error. V8 adds vocabulary predictive coding, , which ties to next-token quality.
- Variance-based hallucination AUROC
- High-error tokens have and low-error tokens have . AUROC counts pairs where the high-error token has larger , 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 and per-token cross-entropy, which should be positive. CAA is the accuracy of the lowest- group minus the highest- group, using quartiles in the custom suite and median splits in the adapter trainer.
- Variance-adaptive DPO
- Per example, , clamped to , with default . The mean of 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 . If the mean 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 tokens are drawn only from documents at least that long, so no sequence crosses a document boundary.
- Composite intelligence index
- The composite score is , where is average accuracy. Calibration is , and the base model gets calibration 0.
Results
From the lab's own experiments and records. They have not been independently replicated.
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.
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.
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.
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.
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%.
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.
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 was introduced to keep PCC positive after annealing.
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.
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.
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 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 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- tokens minus the accuracy on high- tokens. A positive value means 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_sigmaor keep a small calibration loss, so fine-tuning does not destroy the 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.