NeuroCortex Transformer: A Cortical Column Network with Local Predictive Coding for Language Modeling
Capabilities
- 01 / 06
NeuroCortex Transformer (NCT)
Cortical column network replacing transformer blocks with six-layer columns trained by local predictive coding and Hebbian plasticity.
- 02 / 06
Disease-Mapping Methodology
Neurological disorders used as natural ablations to find missing computational mechanisms and their NCT modules.
- 03 / 06
Precision-Weighted Predictive Coding (PWPC)
Each column minimizes its precision-weighted prediction error locally; learned is the learning signal.
- 04 / 06
L2/3 Windowed Hebbian Association
Windowed Hebbian recall with k-WTA and anti-Hebbian lateral competition replacing self-attention at cost.
- 05 / 06
Identity-at-Init Principle
All new modules start as identity via gate init -2.0 and zero output weights so adding mechanisms does not perturb existing behavior.
- 06 / 06
Three-Timescale Working Memory
NMDA attractor slots, activity-silent Tsodyks-Markram trace, and a phonological loop, all gated and identity-at-init.
Abstract
Modern language models rely on the transformer architecture, which requires global backpropagation through all parameters, produces frozen models incapable of post-deployment learning, and scales quadratically with sequence length. We propose the NeuroCortex Transformer (NCT), a cortical column network that replaces transformer blocks with biologically-grounded six-layer cortical columns. NCT learns through local predictive coding and Hebbian plasticity, requiring zero backpropagation through its column hierarchy, and operates continuously with integrated wake-sleep consolidation. Each column implements thalamic input gating (L4), top-down modulation (L1), windowed Hebbian association at complexity (L2/3), dendritic computation with sparse activation (L5), and thalamic feedback (L6), augmented by VIP/SST/PV interneurons, three-timescale working memory, nested oscillatory dynamics, and dopaminergic/noradrenergic/serotonergic/cholinergic neuromodulation. Subcortical systems, thalamus, hippocampus, basal ganglia, and cerebellum, provide routing, episodic memory, reward-driven selection, and temporal prediction. On WikiText-2 with a 300M-parameter model trained for 5,000 steps using only local learning rules, NCT achieves a validation perplexity of 54.0, representing a 256 improvement over the random baseline, with self-calibrating prediction precision (: 1.01.88) and stable autonomous operation including 150 dream-phase consolidation cycles. These results demonstrate that local predictive coding can learn meaningful language representations without global gradient propagation, establishing a foundation for continuously learning, self-improving language systems. This paper provides complete architectural specifications, mathematical formulations, initialization protocols, and all hyperparameters necessary for full reproduction.
1. Introduction
The transformer architecture (Vaswani et al. 2017) has become the dominant paradigm for language modeling, powering systems from GPT (Brown et al. 2020) to LLaMA (Touvron et al. 2023). Despite remarkable performance, transformers exhibit fundamental limitations absent in biological neural systems: (1) they require global backpropagation of error gradients through all parameters, a mechanism widely considered biologically implausible (Lillicrap et al. 2020); (2) they produce frozen models that cannot learn from individual interactions after deployment; (3) their self-attention mechanism scales quadratically as with sequence length; and (4) they lack integrated memory, consolidation, and metacognitive systems.
The mammalian neocortex processes language through cortical columns, repeating computational units organized in six layers with distinct feedforward, lateral, and feedback pathways (Mountcastle 1997; Harris and Shepherd 2015). Learning occurs through local synaptic plasticity rules: predictive coding minimizes layer-wise prediction errors (Rao and Ballard 1999; Whittington and Bogacz 2017), while Hebbian and anti-Hebbian dynamics self-organize representations (Hebb 1949; Pehlevan and Chklovskii 2019). Neuromodulatory systems (dopamine, norepinephrine, serotonin, acetylcholine) gate plasticity based on reward, arousal, and attention (Schultz, Dayan, and Montague 1997; Hasselmo 2006). Sleep consolidation transfers episodic memories to semantic knowledge (Tononi and Cirelli 2006; McClelland, McNaughton, and O’Reilly 1995). No global error signal is required.
Recent work has begun bridging predictive coding and deep learning (Millidge, Tschantz, and Buckley 2022; Salvatori et al. 2024), and biologically-inspired alternatives to backpropagation have been proposed (Hinton 2022; Ororbia and Mali 2023). However, existing approaches typically modify individual components of the transformer (e.g., replacing backprop with forward-forward) rather than designing an architecture from neural circuit principles. No prior system integrates cortical columns, predictive coding, Hebbian learning, neuromodulation, working memory, oscillatory dynamics, subcortical systems, and wake-sleep consolidation into a unified language model.
The contributions of this work are:
We propose the NeuroCortex Transformer (NCT), a cortical column network that replaces transformer blocks with six-layer columns implementing 25+ brain mechanisms, trained entirely through local learning rules.
We demonstrate that local predictive coding achieves a 256 improvement over random baseline (perplexity 13,81754.0) on WikiText-2 with zero backpropagation through the column hierarchy.
We show that the prediction precision system () self-calibrates during training, confirming precision-weighted predictive coding.
We introduce a disease-mapping methodology that systematically identifies missing computational mechanisms by mapping neurological disorders to model failure modes.
We provide complete implementation specifications, every equation, hyperparameter, initialization value, and algorithm, sufficient for full reproduction from this paper alone.
The remainder of this paper is organized as follows. Section 2 reviews related work. Section 3 presents design principles. Section 4 details the NCT architecture. Section 5 describes the local learning framework. Section 6 covers prenatal self-organization. Section 7 details the experimental setup. Section 8 presents results. Section 9 discusses scaling. Section 10 presents the disease-mapping methodology. Section 11 concludes.
3. Design Principles
Five core theorems guide NCT’s design. Each is grounded in established neuroscience and provides a specific computational guarantee.
Theorem A: Predictive Coding Replaces Backpropagation
Each column minimizes its own prediction error locally (Whittington and Bogacz 2017):
The learned precision from precision-weighted predictive coding (PWPC) is the learning signal. No global loss function is required.
Theorem B: Hebbian + Anti-Hebbian = Self-Organizing Representations
Following Pehlevan and Chklovskii (2019):
This converges to the PCA subspace, replacing Q/K/V attention with self-organizing content-addressable recall.
Theorem C: Neuromodulatory Reward = RL Without Backprop
Dopamine encodes reward prediction error (Schultz, Dayan, and Montague 1997):
Acetylcholine gates learning, norepinephrine controls exploration, serotonin modulates time horizon.
Theorem D: Wake-Sleep = Autonomous Self-Improvement
Following Tononi and Cirelli (2006): WAKE processes input and tags surprises; SLEEP replays, downscales synapses (), and consolidates episodicsemantic memory.
Theorem E: Structural Plasticity = Growing Architecture
Synaptogenesis where prediction error is persistently high; pruning where gates approach zero. The network continuously adapts its own structure.
The Identity-at-Init Principle
All new modules must be identity at initialization. This is enforced through two mechanisms:
Gate initialization: , so . Output .
Output weight initialization: . Module contribution is exactly zero until learned.
This ensures that adding any mechanism to a trained network does not perturb existing behavior.
The Parameter Bounding Principle
The brain is an open dissipative system that self-regulates through feedback loops, not imposed bounds:
Hard clamps (e.g.,
clamp(x, 0, 1)) are never used.Soft clamps (e.g., ) are never used.
Bare for positivity constraints (e.g., , , ) is the correct approach.
System stability comes from regulatory circuits: BCM homeostasis, metaplasticity, synaptic scaling, chandelier veto, endocannabinoid modulation.
4. The NCT Architecture
NCT replaces the transformer’s stack of self-attention blocks with a hierarchy of cortical columns, augmented by subcortical systems (Figure 2). The full forward pass is given in Algorithm 1.
System Overview
The processing pipeline is:
Brain Embedding (4-Stage Pipeline)
Token embedding follows a biologically-motivated 4-stage cascade:
Base embedding: Standard lookup , initialized .
Morphological composition: Dual-route (lexical + sublexical) model inspired by Coltheart’s DRC theory. A 1D convolution (kernel=3) over embeddings captures sublexical morpheme patterns, gated against direct lexical lookup.
Hub-and-spoke integration: semantic “spoke” projections (each ) combined via a central hub, modeling the anterior temporal lobe’s cross-modal binding.
Sparse distributed activation: expansion followed by top-2% activation (keeping only the largest 2% of activations nonzero), projecting back to .
Weight tying: the LM head shares from stage 1.
Grid-Cell Position Encoding
Instead of RoPE (which requires attention), positions are encoded via learnable grid-cell frequencies (Hafting et al. 2005). Per-head sinusoidal signals are added (not rotated) to embeddings with a small scale factor (0.1) to avoid dominating content at initialization.
Cortical Column
Each cortical column implements six layers, three interneuron types, working memory, oscillatory dynamics, and homeostatic regulation. The data flow is:
Layer 4: Thalamic Input
L4 receives routed feedforward input and projects to column-internal dimension:
Initialization: if , (identity). Otherwise, Kaiming normal.
Layer 1: Top-Down Modulation
L1 integrates top-down context from higher columns, global workspace, and lateral connections:
is initialized with Kaiming normal; (identity at init via residual).
Interneurons: VIP + SST (Pre-L2/3)
Applied before L2/3 at the apical dendrite level:
VIP (Vasoactive Intestinal Peptide), Disinhibitory Gate:
VIP reads top-down novelty signals. , , with at init. is the inhibitory dimension (default: 128).
SST (Somatostatin), Dendritic Inhibition:
Tonic SST () provides baseline inhibition from intrinsic Na currents. VIP disinhibits SST, allowing input through.
Layer 2/3: Windowed Hebbian Association
This is the core computational layer, replacing self-attention entirely. For each position and head :
Step 1, Content-addressable recall:
is initialized as identity and updated by Hebbian learning (not backprop).
Step 2, Local window context (causal): Gather a window of value projections (pad with zeros for positions before the sequence start):
Step 3, Distance-weighted context:
initialized at (uniform weighting at init).
Step 4, Combine and k-WTA:
retains only the top activations (default ), setting the rest to zero. This enforces sparse, competitive coding.
Step 5, Anti-Hebbian lateral competition:
Output: , where is initialized at and .
Complexity: vs. for self-attention. With , this is cheaper for and cheaper for .
Settling: L2/3 can iterate times (default ), re-anchoring to input each step for recurrent competitive settling.
Working Memory (3 Timescales)
Between L2/3 and L5, three working memory subsystems operate at different temporal scales. All are gated, identity-at-init, and maintain persistent state across sequential forward passes (state resets on batch size change).
1. NMDA Attractor Slots (Luck and Vogel 1997): competitive slots model sustained neural firing.
Per-slot learned decay: , where gives , half-life tokens.
Write: score each slot via ; ; content ; slots .
Read: query-based attention over slots; output via ().
Gate: , .
2. Activity-Silent Trace (Mongillo, Barak, and Tsodyks 2008): Tsodyks-Markram short-term plasticity.
where is facilitation, is available depression variable, with (), with (), and with .
3. Phonological Loop: circular buffer slots with decay and rehearsal.
Passive decay: slots , .
Rehearsal: most recent slot strengthened by .
Circular write: write pointer advances modulo .
Read: query-based attention ().
Oscillatory Dynamics (Nested PAC)
Cross-frequency phase-amplitude coupling (Buzsáki and Draguhn 2004; Jensen and Colgin 2007):
where phases are computed from learnable periods:
Default period initializations: , , tokens. Coupling strengths: initialized at 0.3 (theta-gamma present at rest), initialized at 0.0.
Phase-content interaction through rank-reduced projection ():
Output: . initialized (small nonzero: oscillations provide signal from the start).
Interneurons: PV/Chandelier (Post-Computation)
Applied after working memory and oscillations, before L5:
Hard gate with straight-through estimator: . bias initialized at 5.0 (nearly always open at init). Output:
Layer 5: Dendritic FFN + Prediction
Two-compartment dendritic computation with gated linear unit and k-WTA sparsity:
, , initialized at .
Prediction head for top-down PC signal:
Precision output ():
where .
Layer 6: Thalamic Feedback
initialized at . This feedback modulates the thalamic relay for the next input.
BCM Homeostasis
Per-column sliding threshold (Bienenstock, Cooper, and Munro 1982):
where is the mean squared postsynaptic activity and . The Hebbian update is modulated: potentiation when , depression when .
Metaplasticity
Plasticity of plasticity (Abraham and Bear 1996): a slow EMA () tracks recent weight change magnitude. Learning rate multiplier: .
Column Output
The column returns: output (to next column), prediction (for PC), thalamic feedback , internal state, precision , L2/3 input and output (for Hebbian update).
Residual connection: (or if ).
Subcortical Systems
Thalamus + TRN
relay groups (default ) each containing:
Column maps to relay group . L6 feedback modulates: relay .
TRN implements reticular gating via a low-rank (, default 24) gate:
Bimodality loss encourages binary gating: .
Hippocampus
Three-stage processing:
Dentate Gyrus: Sparse expansion (default ) with ReLU. Pattern separation via high expansion ratio.
CA3: autoassociative memory for pattern completion.
CA1: projects back to cortical stream.
Gated output added to stream. Episodic encoding: during training, episodes where exceeds (default 0.5) are stored in a circular buffer (max 2048 memories). Decay: .
Basal Ganglia
D1/D2 receptor pathways with inverted-U dopamine response:
Direct pathway (Go): . Indirect pathway (NoGo): . Output: .
Cerebellum
Forward model predicting next hidden state:
Prediction error provides auxiliary loss: .
Brainstem (Neuromodulation)
Computes four neuromodulatory signals from the top column’s output:
Each is a scalar or low-dimensional vector. Tonic DA is tracked as an EMA () for baseline subtraction.
Global Workspace
Following Baars (1988; Dehaene and Naccache 2001), columns compete for broadcast:
Broadcast read per column: . Added to L1 top-down context on the next PC iteration. initialized at (no broadcast at init). Bottleneck dimension: .
Self-Assessment (Metacognition)
ACC-like conflict monitor computes column disagreement:
High conflict allocate more PC inference steps (up to extra, capped). This implements metacognitive “thinking harder when uncertain.”
Brain LM Head
Instead of a standard linear projection, the LM head implements:
Low-rank weight-tied projection ( from stage 1) with learned production delta (rank 32).
WEAVER++ competition (rank 64) for lexical selection.
Log-frequency bias for common words.

5. Local Learning Framework
Predictive Coding Update
Each column updates weights to minimize its prediction error weighted by precision:
PC inference iterations (up to ) run without gradients (biologically correct: neural settling is dynamical relaxation, not gradient descent). Only the final state is used for weight updates. This saves activation memory.
Convergence criterion (relative): stop when .
Hebbian Update
L2/3 updated per Section 4.4.4. BCM threshold modulates (Section 4.4.10). Metaplasticity adjusts effective LR (Section 4.4.11).
Output Correction
In PC and Hebbian training modes, only the LM head receives an analytical output correction:
with gradient clipping at . This is the only component that uses backpropagated gradients, and it affects only the final projection layer (not the column hierarchy).
Training Modes
| Mode | Learning Rule | NTP Backprop | Use Case |
|---|---|---|---|
hebbian | Hebbian only | None | Purest biological |
predictive_coding | Local PC errors | None | Brain-like |
hybrid | PC + Hebbian + analytical NTP | LM head only | Best performance |
backprop | Standard | Full global | Baseline comparison |
Analytical LM head correction only.
6. Prenatal Self-Organization
Before processing any external data, NCT bootstraps itself through spontaneous activity, mirroring prenatal brain development. Four activity patterns run for steps (default 500):
Spontaneous waves (30%): Momentum random walk in embedding space (Meister et al. 1991). Simulates retinal waves that establish initial connectivity patterns.
Motor babbling (25%): Auto-regressive self-generation (capped at 16 tokens for memory). The model generates from its own predictions, learning basic sequential structure.
Competitive differentiation (25%): Structured patterns (e.g., one-hot, gradient) force columns to specialize through competitive Hebbian learning.
Oscillatory calibration (20%): Multi-frequency input with PAC (Khazipov and Luhmann 2006). Calibrates the oscillatory periods and coupling strengths.
Prenatal mixing: each step randomly selects a pattern type with the probabilities above. The prenatal phase establishes initial column differentiation before any data-driven learning.
7. Experimental Setup
| Category | Parameter | Value |
|---|---|---|
| Core | 768 | |
| (columns) | 16 | |
| 3,072 | ||
| (vocab) | 13,817 | |
| (max seq len) | 1,024 | |
| Association heads () | 12 | |
| L2/3 | Window | 16 |
| -WTA ratio | 0.15 | |
| Hebbian LR () | ||
| Settling steps () | 1 | |
| Assoc. dropout | 0.1 | |
| PC | PC min steps | 2 |
| PC max steps () | 5 | |
| Convergence | 0.01 | |
| 1.0 | ||
| PC LR () | ||
| WM | NMDA slots () | 4 |
| NMDA | 80 | |
| NMDA decay init () | 6.0 | |
| Silent | 80 | |
| Phono slots () | 8 | |
| Intern. | 192 | |
| PV bias init | 5.0 | |
| SST tonic | 0.10 | |
| Osc. | init | 8 |
| init | 20 | |
| init | 64 | |
| init | 0.3 | |
| init | 0.0 | |
| Thal. | Relay groups () | 4 |
| 384 | ||
| 28 | ||
| TRN bimodality weight | 1.0 | |
| HPC | 3,072 | |
| Memory capacity | 4,096 | |
| Surprise | 0.5 | |
| CB | 384 | |
| 192 | ||
| D1 EC50 / slope | 0.65 / 8.0 | |
| D2 EC50 / slope | 0.25 / 8.0 | |
| Sleep | Sleep interval | 100 steps |
| Replay steps | 50 | |
| Downscale factor | 0.99 | |
| Replay priority | surprise | |
| Structural | Growth threshold | 2.0 |
| Prune threshold | 0.01 | |
| Prune interval | 1,000 | |
| Training | Base LR () | |
| Batch size | 4 | |
| Sequence length | 256 | |
| Dropout | 0.1 | |
| Weight decay | 0.01 | |
| Gates | (all gates) | |
| Gate LR multiplier | 20 | |
| Max grad norm | 1.0 | |
| BCM | 1,000 | |
| Metaplasticity | 500 |
Dataset.
WikiText-2 (Merity et al. 2016) with the NCT morphological tokenizer ( tokens, dual-route Coltheart DRC design). 23.3% of training data seen (0.23 epochs) over 5,000 steps.
Hardware.
NVIDIA RTX 4050 Laptop (6GB VRAM), PyTorch, bfloat16. Training: hours. Evaluation: 571,136 tokens, 2,231 steps, 2.4 hours.
Training Configuration.
Predictive coding mode: local PC + analytical LM head correction ( LR). Zero backprop through columns. 500 prenatal steps. Wake-sleep every 100 steps.
8. Results and Analysis
Main Results
| Model | Val Loss | Val PPL | Backprop | Continuous | |
|---|---|---|---|---|---|
| Random baseline | 9.53 | 13,817 | – | – | |
| NCT (Hebbian) | – | 25,680 | None | Yes | |
| NCT (PC) | 3.99 | 54.0 | None | Yes |
Best training PPL at 2,230 steps. Analytical LM head correction only.
NCT achieves validation perplexity 54.0 ( over random). Training loss: (). PC loss: (). Best training loss reached 3.07 (PPL 21.6).
Training Dynamics
| Metric | Step 1 | Step 5,000 | Change |
|---|---|---|---|
| Train loss | 14.60 | 3.97 | |
| Train PPL | 2,181,724 | 52.9 | |
| PC loss | 9.43 | 6.36 | |
| (precision) | 0.77 | 1.88 | |
| Best train loss | – | 3.07 | – |
| HPC memories | 0 | 2 | – |
| Dream phases | 0 | 150 | – |
Precision Self-Calibration.
evolved from 1.0 (init) to 1.88, confirming PWPC self-calibration. The system learned that its predictions are becoming more reliable.
Train/Val Gap.
Best train loss 3.07 vs. validation 3.99 (gap 0.92) indicates effective regularization via sleep downscaling and sparse activation, despite training on only 23% of a small dataset.
Wake-Sleep.
150 dream phases completed. HPC accumulated only 2 memories, suggesting the surprise threshold () may be too conservative.
Generation Quality
| Prompt | Generated continuation |
|---|---|
| “The” | The alanosterunicabicort The . , A of Love the In It the United Re of In |
| “In the beginning” | In the beginning The A ) . of He a with . the In United Ir of on ( |
| “Scientists discovered that” | Scientists discovered that In the on of A .The , A reitestanom with Love |
| “The city of” | The city of The A , of in United . The to Stelianoderucatis Love a , ( |
| “Once upon a time” | Once upon a time Ataseronibittticon of the A with In The , De Aft A re |
The model has learned unigram frequency distributions (“the,” “of,” “in,” “a” dominate) but not sequential structure. This is expected: L2/3 Hebbian associations require many more token-transition observations, and only 23% of WikiText-2 has been seen. Morpheme fragments (e.g., “alanosterunicabicort”) indicate the sublexical route producing ill-formed compositions for rare unseen tokens.
Parameter Locality
| Component | Parameters | % |
|---|---|---|
| Column-local (16 columns) | 253.4M | 84.3% |
| Global coordination (thal + lateral + workspace) | 9.7M | 3.2% |
| Fixed (embedding + LM head + position) | 25.9M | 8.6% |
| Subcortical (HPC + BG + CB + brainstem) | 11.6M | 3.9% |
| Total | 300.1M | 100% |
84.3% of parameters are column-local, updated only by local learning rules. This modularity directly enables the scaling framework (Section 9).
9. Scaling Framework
The locality of NCT’s learning rules enables scaling unavailable to transformers.
Progressive Column Growth.
New columns are added: existing column weights (84.3%) preserved. Only thalamic routing, lateral connections, and workspace projections (3.2%) require retraining. New columns undergo prenatal self-organization. Cost: of full retrain per column.
Column Splitting.
Overloaded columns are split into two function-preserving copies ( each), then diverge via competitive Hebbian learning. Cost: per split.
P Hyperparameter Transfer.
Hyperparameters validated on a small model (learning rates, plasticity rates, oscillatory periods, gate init) transfer to larger models (Yang et al. 2021). NCT’s local learning rules are particularly amenable: each column’s dynamics are scale-independent.
Width Expansion.
increase: old subspace warm-started, new dimensions initialized near zero. Most expensive scaling operation ( of full retrain).
Recommended Scaling Path.
Small incremental: column growth/splitting. Large jumps (): P + train from scratch at target scale.
10. Disease-Mapping Methodology
NCT’s architecture was developed using neurological disorders as natural ablation studies. For each brain disease, we identify: (1) the missing/damaged mechanism, (2) the resulting computational deficit, and (3) the NCT module that implements the healthy mechanism. This provides systematic coverage guarantees unavailable to engineering-driven architecture search.
| Disease | Missing Mechanism | NCT Module |
|---|---|---|
| Vegetative state | No global broadcast | GlobalWorkspace |
| Parkinson’s | No DA prediction error | Brainstem (DA) + BG |
| ADHD | No NE arousal control | Brainstem (NE) |
| Depression | No 5-HT time horizon | Brainstem (5-HT) |
| Broca’s aphasia | No re-entrant processing | PC inference iterations |
| Schizophrenia (CFC) | Broken cross-column coupling | LateralColumnConn. |
| Schizophrenia (NMDA) | No persistent WM | NMDA attractor slots |
| Schizophrenia (PAC) | No phase-amplitude coupling | ColumnOscillations |
| Alzheimer’s (ACh) | Inverted attention gain | Brainstem (ACh) |
| Amnesia (HM) | No episodic binding | Hippocampus |
| Semantic dementia | No consolidation | Wake-Sleep cycle |
| Spinocerebellar ataxia | No temporal prediction | Cerebellum |
| Huntington’s | No action selection | BasalGanglia (D1/D2) |
| Thalamic infarct | No frequency routing | Thalamus + TRN |
| Temporal lobe epilepsy | No phase precession | ColumnOscillations |
| Phonological dyslexia | No rehearsal buffer | PhonologicalLoop |
| Autism (ASD) | No VIP disinhibition | VIP interneuron |
| OCD | No conflict monitoring | SelfAssessment (ACC) |
| Epilepsy (chandelier) | No axo-axonic veto | PV/Chandelier |
| Fragile X | No metaplasticity | Metaplasticity |
| Alzheimer’s (entorhinal) | No grid cells | GridCellPositionEnc. |
| Anomic aphasia | No production delta | BrainLMHead |
| Parkinson’s (decision) | DA-depleted threshold | DriftDiffusion |
11. Conclusion
We presented the NeuroCortex Transformer (NCT), a cortical column network that replaces transformer blocks with biologically-grounded six-layer columns trained through local predictive coding and Hebbian plasticity. A 300M-parameter NCT achieves validation perplexity 54.0 on WikiText-2 with zero backpropagation through its column hierarchy, a improvement over random baseline. The prediction precision system self-calibrates (: ), wake-sleep consolidation operates autonomously (150 dream phases), and 84.3% of parameters are column-local, enabling incremental scaling.
These results establish that local predictive coding can learn meaningful language representations without global gradient propagation. The current gap to transformer-level perplexity reflects data starvation (23% of a small dataset) rather than architectural limitation.
Future Work.
Full-data training: Train to convergence on WikiText-103 (M tokens), targeting PPL 25.
Ablation study: Systematically remove each mechanism (VIP, SST, PV, WM, oscillations, HPC, sleep) and measure impact.
Transformer baseline: Train a same-size transformer on the same data for fair comparison.
Progressive scaling: Grow from 16 32 columns via
v11_scale.py, validating P transfer.Continuous learning: Evaluate whether deployed NCT improves from user interactions without retraining.
Multi-modal: Dedicate columns to vision/audio via thalamic routing.
Reproducibility.
All architectural specifications, hyperparameters, initialization values, and algorithms in this paper are complete and self-contained. The codebase is available at https://github.com/krrish/NeuroCortex-Transformer.
12. Forward Pass Algorithm
13. RMSNorm
Used throughout instead of LayerNorm:
14. Presets
| Preset | Params | VRAM | ||||
|---|---|---|---|---|---|---|
| default | 512 | 12 | 2,048 | 8 | 106M | 2 GB |
| laptop | 768 | 16 | 3,072 | 12 | 300M | 5 GB |
| 1b | 1,280 | 20 | 5,120 | 20 | 1,008M | 10 GB |
15. Brain Embedding: Complete Specification
Stage 1: Base Embedding
Standard lookup: , , . Init: .
Stage 2: Morphological Composition (Dual-Route DRC)
The Coltheart Dual-Route Cascaded model: a lexical route (direct embedding lookup) competes with a sublexical route (character/morpheme composition).
Sublexical route: 1D convolution over embedding sequence:
Gated combination:
At init: so (lexical route dominates initially).
Stage 3: Hub-and-Spoke Integration
Models the anterior temporal lobe’s role as a semantic hub binding modality-specific spokes:
Each spoke . Hub .
Stage 4: Sparse Distributed Activation
Neocortical-style sparse coding:
initialized at ; . Only 2% of expanded activations survive, extreme sparsity matching biological neural firing rates.
16. Grid Cell Position Encoding
Inspired by entorhinal grid cells (Hafting et al. 2005). Per-head learnable frequencies replace RoPE (which requires dot-product attention).
For each head and position dimension :
Output: concatenated across , producing .
Per-head scale and boundary remapping:
(scale, init 1.0) and (boundary, init ) are learnable per head.
Position is added (not rotated) to embeddings: . The 0.1 scale prevents position from dominating content at init.
17. Brain LM Head: Lexical Production
Replaces a standard linear projection with a neurologically-grounded 3-component system:
1. Weight-tied base projection:
2. Production delta (low-rank residual):
Models the production-specific deviation from comprehension semantics. init .
3. WEAVER++ competition (lexical selection):
Applied as multiplicative gate: . Models lemma-to-phonological form selection.
4. Frequency bias:
initialized at , learns log-frequency priors.
18. Lateral Column Connections
Horizontal connections between adjacent columns (disease mapping: schizophrenia disconnection syndrome disrupted lateral fragmented perception).
Each column has send/receive projections to neighbors :
where is the set of neighbors ( and/or ). initialized at (no lateral communication at init). initialized . Gate .
19. Autonomous Operation
Always-On Learning
The brain has no eval() mode. After every forward pass, local learning updates run:
Sleep pressure accumulates during wake ( per step) and resets during sleep.
Wake-Sleep Cycle Algorithm
Prenatal Self-Organization Algorithm
Imagination Engine
Generates synthetic experiences from memory for offline learning:
Retrieve a hippocampal memory as seed
Auto-regressively generate a continuation (up to 16 tokens)
Evaluate the imagined sequence: compute prediction error
If PE is high (novel imagination), tag for additional replay
This enables “dreaming”, learning from imagined scenarios, not just replayed experiences.
Curiosity Drive
Expected free energy minimization (Friston 2010):
Inputs that would maximally reduce prediction uncertainty are prioritized. This drives the system to seek informative inputs, implementing intrinsic motivation.
Continual Learning Guard (EWC)
Elastic Weight Consolidation protects important weights from catastrophic forgetting:
where is the Fisher information (importance) of parameter and is the optimal value from previous tasks. Note: Currently disabled in the 6GB VRAM configuration due to memory constraints. Requires memory-efficient Fisher estimation for deployment.
Self-Play: Learning from Own Output
The brain processes its own speech (auditory cortex hears you speak), creating a feedback loop. NCT implements this as self-play:
Generate a continuation from a prompt ( tokens, brain-decoded)
Feed the generation BACK through the model as input
Compute prediction error on the self-generated text
If PE is high the model surprised itself learn from it
If PE is low generation is consistent reinforce patterns
Disease mapping: inner speech deficits (schizophrenia) inability to monitor own speech thought insertion. Stuttering failed forward model of own speech production.
Self-play interval: every 10 steps (after 200 step warm-up). If last 3 self-play losses all exceed 15.0, interval increases to (model still producing gibberish, slow down). Zero learnable parameters.
Consolidation Manager
Manages the episodic semantic consolidation pipeline (McClelland, McNaughton, and O’Reilly 1995):
Track which hippocampal memories have been replayed times
Frequently-replayed memories are promoted from hippocampal episodic buffer to cortical column weights (semantic storage)
Consolidated memories are removed from the HPC buffer, freeing capacity
Consolidation occurs during sleep phases (not wake)
Developmental Program (Critical Periods)
The brain changes HOW it learns over time. Hensch (2004): critical periods are opened by inhibitory maturation. Huttenlocher (1979): synapse density peaks at age 2, halves by adulthood.
| Stage | Steps | LR mult | Inhib | Hebb wt | Struct | Sleep |
|---|---|---|---|---|---|---|
| Sensory | 0–1K | 2.0 | 0.3 | 0.8 | 1.0 | 2.0 |
| Association | 1K–5K | 1.5 | 0.6 | 0.6 | 0.7 | 1.5 |
| Integration | 5K–20K | 1.0 | 0.9 | 0.4 | 0.3 | 1.0 |
| Refinement | 20K+ | 0.5 | 1.0 | 0.3 | 0.1 | 0.7 |
Like the biological brain: early stages are Hebbian-dominated (absorb everything), late stages are PC-dominated (refine predictions). Inhibitory strength increases throughout, matching GABA maturation driving critical period closure. Zero learnable parameters, purely algorithmic staging.
Brain Decoder (Generation)
Text generation uses the BrainDecoder class, which orchestrates:
Drift-Diffusion Sampling (Appendix M): Evidence accumulation for token selection with DA-modulated threshold and urgency.
Inhibition of Return: Exponentially decaying suppression of recently-generated tokens. Decay rate , initial suppression . Prevents repetition loops.
-adaptive temperature: High precision (low ) lower temperature (confident, deterministic). Low precision (high ) higher temperature (uncertain, exploratory).
Neuromodulatory signals: DA gates impulsivity (low DA conservative), NE modulates exploration noise, ACh gates whether generation continues.
Speculative generation: Generate candidates in parallel, verify with a teacher model, accept the longest correct prefix (standard speculative decoding applied to brain-decoded output).
Text Environment (Autonomous Data Acquisition)
For continuous autonomous operation, TextEnvironment provides a data stream:
Scans a directory for
.txtfilesYields batches of tokenized sequences
Handles file exhaustion (loops, shuffles, moves to next file)
Integrates with
AutonomousLoopfor never-ending training
This enables NCT to train continuously on any text corpus without a fixed dataset.
20. Structural Plasticity
The network continuously adapts its own structure (Theorem E):
Synaptogenesis (growth): Where prediction error is persistently high (, default 2.0), the L2/3 association matrix is expanded. New connections are initialized near zero and learn via Hebbian plasticity.
Pruning: Where gate values approach zero (, default 0.01), the corresponding connections are removed. Checked every steps (default 1000).
Neurogenesis: For novel concepts that cannot be represented by existing columns, a new column can be grown via the scaling framework (Section 9).
21. Complete Loss Function
The total loss in hybrid mode is:
| Term | Weight | Computation |
|---|---|---|
| 1.0 | Cross-entropy: , ignoring padding () | |
| 1.0 | Precision-weighted prediction error: | |
| 0.1 | Cerebellar prediction error: | |
| 0.1 | TRN bimodality: , encouraging binary gates |
In predictive_coding and hebbian modes, gradients propagate only to the LM head (not through columns). All column weight updates come from local PC/Hebbian rules.
22. Evaluation Metrics
Beyond standard perplexity, NCT uses brain-inspired evaluation metrics:
| Metric | Module | Measures |
|---|---|---|
| COL_DIFF | Columns | Column output differentiation: . Higher = more specialization. |
| GATE_EVO | All gates | Mean absolute change from init: . Higher = mechanisms activating. |
| PCC | PWPC | Pearson correlation between and actual . Positive = precision calibrated. |
| CAA | PWPC | Confidence-accuracy alignment: bin predictions by , compare with actual error. |
| LIS | L5 k-WTA | FFN activation sparsity per token. Target: 1–15% active. |
23. Complete Initialization Protocol
| Parameter | Init | Rationale |
|---|---|---|
| Standard embedding init | ||
| All gate params | : near-zero output | |
| (all modules) | Zero contribution at init | |
| (if ) | (identity) | Pass-through at init |
| (if ) | Kaiming normal | Standard projection init |
| (identity) | Self-recall at init | |
| (L2/3) | (identity) | Pass-through values |
| (L2/3) | Uniform window weighting | |
| (L2/3) | No lateral competition | |
| No disinhibition | ||
| No dendritic inhibition | ||
| PV score bias | : always open | |
| NMDA decay | : slow decay | |
| Silent facil | ||
| Silent depress | ||
| Phono decay | ||
| Phono rehearsal | : mild rehearsal | |
| PAC | Theta-gamma coupling at rest | |
| PAC | No delta/alpha coupling initially | |
| Osc | Small nonzero: oscillations active | |
| bias () | ||
| Tonic DA EMA | Slow baseline tracking | |
| Gate LR multiplier | Gates learn faster than weights | |
| Identity scaling |
24. Drift-Diffusion Sampling
For generation, NCT optionally uses a drift-diffusion decision model (disease mapping: Parkinson’s decision-making deficit DA-depleted threshold):
Token is committed when , where is DA-modulated:
Low DA (Parkinson’s analog) high threshold slow, conservative decisions. High DA low threshold fast, impulsive generation. Includes inhibition of return to suppress recently-generated tokens.
25. Production Interface
For continuous deployment, NCT provides production infrastructure:
Context and Deployment
Context management: Automatic working memory reset between conversations; persistent HPC across sessions.
Always-on learning: Every inference triggers local weight updates (controllable via learning rate).
Sleep scheduling: Autonomous sleep cycles during idle periods.
Self-repair: If loss diverges ( best), roll back to saved best state and reduce learning rate.
Checkpoint: Periodic auto-save of full model state including WM, HPC memories, BCM thresholds, neuromod EMAs.
Quantization (-Guided Precision Mapping)
V11 parameter categories mapped to precision levels:
FP16: (), decay rates, oscillatory phases, grid-cell periods, these are precision-critical (exponential compounding, phase sensitivity).
INT8: Column projections (L4/L5/L6), interneuron weights, gates, embedding, LM head, sufficient for sigmoid-gated or projection weights.
INT4: L2/3 association weights (bulk, high redundancy) and L5 FFN, largest weight blocks, highest redundancy.
Distributed Training (FSDP2)
FSDP wrapping policy: each CorticalColumn is one FSDP unit (all 6 layers + interneurons + WM stay together, stateful interaction must not be split). Subcortical systems, embedding, and LM head are in the outer FSDP unit. Mixed precision: bfloat16 params, float32 reduce.
Alignment (SFT/DPO)
SFT: Response-only loss with -aware weighting: uncertain tokens get reduced loss weight (brain principle: don’t force confidence on genuinely ambiguous content). Auxiliary losses (PC + cerebellar) maintained at 10% weight to preserve brain mechanisms during fine-tuning.
DPO: -adaptive : . Higher certainty stronger preference enforcement. Higher uncertainty softer preferences (don’t force strong opinions on ambiguous content).
Tool Use (V11ToolAdapter)
Adapter extracts V11’s intrinsic signals for tool selection:
should_use_tool: High + high tonic DA = uncertain + exploring try a tool. Low = confident in text generation don’t interrupt. DA modulates threshold (high DA lower threshold more tool exploration).get_tool_confidence: ACC conflict level inverted. High conflict = low confidence = maybe ask user.
Retrieval (V11RetrievalAdapter)
-gated retrieval: only retrieve external knowledge when (default 2.0). Brain principle: hippocampus supplements cortical knowledge when cortex can’t make a confident prediction on its own.
-Early Exit (Adaptive Column Depth)
The brain doesn’t process every input to the same depth. Easy inputs (low ) are resolved in early sensory areas. Hard inputs (high ) propagate to deeper prefrontal processing.
Default: columns, . This skips remaining columns, saving compute proportional to the number of skipped columns.
26. Implementation Reference
| Paper Section | Source File | LOC |
|---|---|---|
| Cortical Column (Section 4.4) | v11_column.py | 1,436 |
| Full Model (Section 4) | v11_model.py | 1,022 |
| Autonomous Op. (Appendix H) | v11_autonomous.py | 1,787 |
| Learning (Section 5) | v11_learning.py | 1,081 |
| Subcortical (Section 4.5) | v11_systems.py | 939 |
| Configuration | v11_config.py | 186 |
| Production (Appendix N) | v11_production.py | 569 |
| Scaling (Section 9) | v11_scale.py | 530 |
| Training | train_v11.py | 1,028 |
| Brain Embedding (Appendix D) | brain_embeddings.py | – |
| Position Encoding (Appendix E) | brain_position.py | – |
| LM Head (Appendix F) | brain_lm_head.py | – |
| Sampling (Appendix M) | brain_decoding.py | – |
| Tokenizer (Appendix Q) | nct_tokenizer/ | 1,073 |
| Total (V11 core + tokenizer) | 10,600 |
| Class Name | Section | Purpose |
|---|---|---|
| Tokenizer | ||
MorphemeType | Appendix Q | Enum: PREFIX, ROOT, SUFFIX, WORD, UNKNOWN |
Morpheme | Appendix Q | Dataclass: surface form + type + canonical |
NCTTokenizer | Appendix Q | Dual-route morphological tokenizer () |
Encoding | Appendix Q | Token ID sequence result |
| Configuration | ||
V11Config | Section 7 | 50+ hyperparameters, presets (default/laptop/1b) |
| Brain Modules | ||
HubAndSpokeProjection | Appendix D | Thm 56: ATL semantic hub with spokes |
SparseDistributedProjection | Appendix D | Thm 57: expansion + top-2% activation |
MorphemeCompositionGate | Appendix D | Thm 58: Dual-route lexical/sublexical blend |
V11BrainEmbedding | Appendix D | 4-stage embedding pipeline |
GridCellPositionEncoding | Appendix E | Learnable grid-cell frequencies |
BrainLMHead | Appendix F | WEAVER++ + production delta + freq bias |
DriftDiffusionSampler | Appendix M | DA-modulated evidence accumulation |
InhibitionOfReturn | Appendix M | Repetition avoidance via decaying suppression |
BrainDecoder | Section H.10 | Full generation orchestrator |
| Cortical Column | ||
L4_ThalamicInput | Section 4.4 | Feedforward input projection |
L1_TopDownModulation | Section 4.4 | Apical feedback integration |
L23_LateralAssociation | Section 4.4.4 | Windowed Hebbian , heads |
ColumnWorkingMemory | Section 4.4.5 | NMDA + Silent Trace + Phonological Loop |
ColumnOscillations | Section 4.4.6 | Nested PAC (theta-alpha-delta) |
ColumnInterneurons | Section 4.4 | VIP + SST + PV/Chandelier |
L5_OutputPrediction | Section 4.4.8 | Dendritic FFN + prediction + |
L6_ThalamicFeedback | Section 4.4 | Thalamic relay modulation |
BCMHomeostasis | Section 4.4.10 | Sliding threshold |
Metaplasticity | Section 4.4.11 | Learning rate adaptation |
LateralColumnConnection | Appendix G | Horizontal send/recv between neighbors |
CorticalColumn | Section 4.4 | Complete 6-layer column |
ColumnOutput | Section 4.4 | Dataclass: output, prediction, , state |
RMSNorm | Appendix B | Root mean square normalization |
| Subcortical Systems | ||
ThalamicRelay | Section 4.5 | Single relay group (, gate) |
ThalamicReticularNucleus | Section 4.5 | TRN gating (bimodality loss) |
Thalamus | Section 4.5 | relay groups + TRN |
Hippocampus | Section 4.5 | DG/CA3/CA1 + surprise tagging + replay |
BasalGanglia | Section 4.5 | D1/D2 pathways, action selection |
Cerebellum | Section 4.5 | Forward model, temporal prediction |
Brainstem | Section 4.5 | DA/NE/5-HT/ACh computation |
NeuromodState | Section 4.5 | Dataclass: 4 neuromod signals |
CorticalWorkspace | Section 4.5 | Global broadcast (Baars 1988) |
SelfAssessment | Section 4.5 | ACC conflict extra PC steps |
| Learning | ||
PredictiveCodingOptimizer | Section 5 | Local PC updates per column |
HebbianOptimizer | Section 5 | Hebbian + anti-Hebbian for L2/3 |
NeuromodulatedPlasticity | Section 5 | |
WakeSleepScheduler | Appendix H | Wake/sleep timing + downscaling |
DevelopmentalProgram | Section H.9 | 4-stage critical period scheduling |
V11LearningManager | Section 5 | Orchestrates PC+Hebbian+Neuromod+Sleep+Dev |
| Autonomous Operation | ||
AlwaysOnLearning | Appendix H | LR modulated by ACh, NE, surprise, sleep pressure |
ImaginationEngine | Appendix H | Dream from HPC memories |
CuriosityDrive | Appendix H | Free energy minimization (Friston) |
SelfPlay | Section H.7 | Generatere-processlearn |
ContinualLearningGuard | Appendix H | EWC synaptic importance |
ConsolidationManager | Section H.8 | Episodicsemantic transfer |
AutonomousLoop | Appendix H | Main wake-sleep-dream-evaluate orchestrator |
AutonomousConfig | Appendix H | Configuration dataclass |
PrenatalDevelopment | Section 6 | 4-phase prenatal self-organization |
MemoryLoader | Appendix H | DataLoader wrapper for HPC replay |
TextEnvironment | Section H.11 | Autonomous data acquisition |
| Full Model | ||
CorticalColumnNetwork | Section 4 | Complete NCT: columns + subcortical + learning |
| Production / Scaling | ||
V11ToolAdapter | Appendix N | BG//ACC tool selection |
V11RetrievalAdapter | Appendix N | /HPC retrieval triggers |
V11EarlyExitConfig | Appendix N | -guided adaptive column depth |
27. Training CLI
# Smoke test (12 tests, no GPU required)
python3 train_v11.py --smoke
# Default config (106M, fits 6GB GPU)
python3 train_v11.py --mode predictive_coding \
--steps 5000 --prenatal 500 --bf16 \
--batch_size 4 --seq_len 256 --lr 3e-4 \
--wake_sleep --save_dir checkpoints/v11
# Laptop preset (300M, needs ~5GB VRAM)
python3 train_v11.py --preset laptop \
--mode predictive_coding --steps 5000 \
--prenatal 500 --bf16 --wake_sleep
# 1B preset (needs ~10GB VRAM)
python3 train_v11.py --preset 1b \
--mode hebbian --steps 5000 --bf16
# Continuous training (never stops)
python3 train_v11.py --mode predictive_coding \
--steps continuous --bf16 --wake_sleep
# Resume from checkpoint
python3 train_v11.py --resume_latest --bf16
Key flags: --mode (hebbian|predictive_coding|hybrid|backprop), --preset (default|laptop|1b), --prenatal N (prenatal steps), --wake_sleep (enable sleep cycles), --inference_steps N (PC iterations), --bf16 (mixed precision).
28. NCT Morphological Tokenizer
The tokenizer implements a dual-route architecture based on the Coltheart DRC (Dual Route Cascaded) model of reading, where a lexical route handles known whole words and a sublexical route performs morphological decomposition.
Design Principles
Lossless: encode decode = identity. Every byte is recoverable.
Deterministic: same text always produces exactly the same tokens.
Morphologically faithful: never splits mid-morpheme (unlike BPE).
Cross-word safe: never merges tokens across word boundaries (unlike BPE/SentencePiece).
Oscillatory alignment: each token 1 gamma cycle ( 1 morpheme). Words span theta cycles (8–16 tokens). Phrases span alpha cycles (20 tokens). This aligns tokenization with the oscillatory hierarchy of the cortical columns.
Vocabulary Structure
Total vocabulary: tokens, organized as:
| ID Range | Token Type | Count |
|---|---|---|
| 0–5 | Special: <pad>, <unk>, <bos>, <eos>, <cap>, <allcap> | 6 |
| 6–261 | Byte fallback: <byte:0> through <byte:255> | 256 |
| 262–300 | Whitespace and punctuation tokens | 40 |
| 300–370 | Prefix morphemes (un-, re-, dis-...) | 70 |
| 370–500 | Suffix morphemes (-tion, -ness, -ing...) | 130 |
| 500–8,500 | Root morphemes (stems) | 8,000 |
| 8,500–13,816 | Whole words (high-frequency monomorphemic) | 5,300 |
Pre-tokenization
A regex splits raw text into pieces before morphological processing:
pattern = r"'s|'t|'re|'ve|'m|'ll|'d" # contractions
+ r"|[A-Za-z\u00C0-\u024F]+" # words (+ Latin Extended)
+ r"|\d+" # numbers
+ r"|\s" # whitespace (single char)
+ r"|[^\s]" # any other single charContractions are split: “don’t” “don” + “’t”. Capitalization is factored out: “Hello” <cap> + “hello”.
Encoding Algorithm
Morphological Decomposition
The sublexical route uses rule-based affix stripping:
Suffix stripping (longest match first): Try removing each suffix from the English affix inventory (130 suffixes). Apply morphophonemic rules (consonant doubling reversal: “running” “run” + “ning” “run” + “-ing”; e-dropping: “making” “mak” “make” + “-ing”; yi: “happiness” “happi” “happy” + “-ness”).
Root validation: Check if the remaining stem is a known word. If yes, accept decomposition. If not, try the next-longest suffix.
Prefix stripping: After successful suffix stripping, try removing prefixes (70 prefixes, longest match first). Validate remaining root.
Fallback: If no valid decomposition is found, treat the word as monomorphemic (whole-word token if in vocabulary, byte encoding otherwise).
The affix inventory is sourced from MorphoLex and Bauer (1983), covering 200 productive English affixes organized by decreasing length for greedy longest-match.
Decoding
Lossless reconstruction: concatenate surface forms, apply capitalization from <cap>/<allcap> markers, reconstruct bytes from <byte:> tokens.
Vocabulary Construction
Built from a text corpus using frequency-based selection:
Roots: top 8,000 by frequency (min frequency 3)
Whole words: top 5,000 monomorphemic words (min frequency 5)
All productive English prefixes and suffixes included regardless of frequency
Whitespace/punctuation tokens added for all observed characters
29. Scaling Algorithms: Complete Specification
Progressive Column Growth
Thalamus expansion: New relay groups are created with random initialization. Existing relay weights are copied position-by-position. The TRN (dimension-based, not column-count-based) transfers directly.
Lateral expansion: New columns get zero-initialized send weights (identity-at-init: no lateral signal initially). Old column positions are mapped to their new indices.
Workspace expansion: New columns get zero-initialized write projections. Old write/read weights are copied.
Cost estimate: Adding 1 column to a 12-column model costs 8% of full retraining (7.5M new column params + 0.7M routing retraining out of 106M total).
Net2Net Column Splitting
Function preservation: At the moment of split, , so network output is mathematically identical. Subsequent competitive Hebbian learning drives the two copies to differentiate.
Cost estimate: 7% of full retraining per split.
Overload Detection
To identify which columns to split, evaluate over batches:
Prediction error: Mean per column (high = overloaded)
Gate saturation: Mean gate activation (high = all mechanisms maxed out)
Overload score:
Split the column with the highest overload score.
P Hyperparameter Transfer
29 hyperparameters are extracted from a trained small model and transferred to larger configurations. These include: all learning rates (), PC dynamics (), Hebbian parameters (), gate dynamics (, gate LR mult), BCM/meta time constants, oscillatory periods, WM slot counts, sleep parameters, structural plasticity thresholds, and regularization.
Dimension-dependent parameters (, etc.) are scaled proportionally to :
Parameter Locality Analysis
| Operation | Params Affected | % of Total | Est. Cost |
|---|---|---|---|
| Add 1 column | 7.5M (new) + 0.7M (routing) | 7.7% | 8% |
| Split 1 column | 7.5M (divergence) + 0.3M (routing) | 7.3% | 7% |
| Width | All weights touching | 75% | 70% |
| Full retrain | All 106M | 100% | 100% |
30. Architecture Overview
31. Checkpoint Format
NCT checkpoints (.pt files) store:
model_state_dict: All model parameters (, , buffers)optimizer_state_dict: Optimizer state (if using external optimizer)config: FullV11Configdataclass (all hyperparameters)step: Training step countbest_loss: Best validation loss seenmetrics: Last training metrics (loss, PC loss, , gate values)hpc_memories: Hippocampal episodic buffer (for replay continuity)bcm_thresholds: Per-column BCM valuesmetaplasticity_ema: Per-column plasticity historytonic_da: Tonic dopamine EMA valueprenatal_complete: Boolean (whether prenatal phase finished)
Checkpoints are saved every 1,000 steps and at best validation loss. Loading restores all persistent state including working memory pointers, BCM thresholds, and neuromodulator EMAs.
32. Transformer Components Replaced
| Killed (Transformer) | Replaced With (Brain) |
|---|---|
| Q/K/V dot-product attention | Windowed Hebbian association |
| Causal mask | Local window ( = 2 theta cycles) |
| RoPE in attention | Grid-cell position encoding (additive) |
| Global backprop to all layers | Predictive coding (local per column) |
| Adam/SGD optimizer | Hebbian + neuromod plasticity |
| Batch training | Online learning + wake-sleep cycle |
| Fixed deployment | Continuous operation, structural plasticity |
| LayerNorm | RMSNorm |
| Learned positional embedding | Grid-cell frequencies (neuroscience-based) |
| Standard embedding | 4-stage brain embedding pipeline |
| Linear LM head | Brain LM head (WEAVER++ + drift-diffusion) |
References
- Abraham, Wickliffe C, and Mark F Bear. 1996. “Metaplasticity: The Plasticity of Synaptic Plasticity.” Trends in Neurosciences 19 (4): 126–30.
- Baars, Bernard J. 1988. “A Cognitive Theory of Consciousness.” Cambridge University Press.
- Bienenstock, Elie L, Leon N Cooper, and Paul W Munro. 1982. “Theory for the Development of Neuron Selectivity: Orientation Specificity and Binocular Interaction in Visual Cortex.” Journal of Neuroscience 2 (1): 32–48.
- Brown, Tom, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared D Kaplan, Prafulla Dhariwal, Arvind Neelakantan, et al. 2020. “Language Models Are Few-Shot Learners.” Advances in Neural Information Processing Systems 33: 1877–1901.
- Buzsáki, György, and Andreas Draguhn. 2004. “Neuronal Oscillations in Cortical Networks.” Science 304 (5679): 1926–29.
- Dehaene, Stanislas, and Lionel Naccache. 2001. “Towards a Cognitive Neuroscience of Consciousness: Basic Evidence and a Workspace Framework.” Cognition 79 (1-2): 1–37.
- Douglas, Rodney J, and Kevan AC Martin. 2004. “Neuronal Circuits of the Neocortex.” Annual Review of Neuroscience 27: 419–51.
- Friston, Karl. 2010. “The Free-Energy Principle: A Unified Brain Theory?” Nature Reviews Neuroscience 11 (2): 127–38.
- Hafting, Torkel, Marianne Fyhn, Sturla Molden, May-Britt Moser, and Edvard I Moser. 2005. “Microstructure of a Spatial Map in the Entorhinal Cortex.” Nature 436 (7052): 801–6.
- Harris, Kenneth D, and Gordon MG Shepherd. 2015. “The Neocortical Circuit: Themes and Variations.” Nature Neuroscience 18 (2): 170–81.
- Hasselmo, Michael E. 2006. “The Role of Acetylcholine in Learning and Memory.” Current Opinion in Neurobiology 16 (6): 710–15.
- Hebb, Donald O. 1949. “The Organization of Behavior: A Neuropsychological Theory.” Wiley.
- Hinton, Geoffrey. 2022. “The Forward-Forward Algorithm: Some Preliminary Investigations.” arXiv Preprint arXiv:2212.13345.
- Jensen, Ole, and Laura L Colgin. 2007. “Cross-Frequency Coupling Between Neuronal Oscillations.” Trends in Cognitive Sciences 11 (7): 267–69.
- Khazipov, Roustem, and Heiko J Luhmann. 2006. “Early Patterns of Electrical Activity in the Developing Cerebral Cortex of Humans and Rodents.” Trends in Neurosciences 29 (7): 414–18.
- Lillicrap, Timothy P, Adam Santoro, Luke Marris, Colin J Akerman, and Geoffrey Hinton. 2020. “Backpropagation and the Brain.” Nature Reviews Neuroscience 21 (6): 335–46.
- Luck, Steven J, and Edward K Vogel. 1997. “The Capacity of Visual Working Memory for Features and Conjunctions.” Nature 390 (6657): 279–81.
- McClelland, James L, Bruce L McNaughton, and Randall C O’Reilly. 1995. “Why There Are Complementary Learning Systems in the Hippocampus and Neocortex: Insights from the Successes and Failures of Connectionist Models of Learning and Memory.” Psychological Review 102 (3): 419.
- Meister, Markus, Rachel OL Wong, Denis A Baylor, and Carla J Shatz. 1991. “Synchronous Bursts of Action Potentials in Ganglion Cells of the Developing Mammalian Retina.” Science 252 (5008): 939–43.
- Merity, Stephen, Caiming Xiong, James Bradbury, and Richard Socher. 2016. “Pointer Sentinel Mixture Models.” arXiv Preprint arXiv:1609.07843.
- Millidge, Beren, Alexander Tschantz, and Christopher L Buckley. 2022. “Predictive Coding Approximates Backprop Along Arbitrary Computation Graphs.” Neural Computation 34 (6): 1329–68.
- Mongillo, Gianluigi, Omri Barak, and Misha Tsodyks. 2008. “Synaptic Theory of Working Memory.” Science 319 (5869): 1543–46.
- Mountcastle, Vernon B. 1997. “The Columnar Organization of the Neocortex.” Brain 120 (4): 701–22.
- Ororbia, Alexander G, and Ankur Mali. 2023. “The Predictive Forward-Forward Algorithm.” arXiv Preprint arXiv:2301.01452.
- Pehlevan, Cengiz, and Dmitri B Chklovskii. 2019. “Neuroscience-Inspired Online Unsupervised Learning Algorithms: Artificial Neural Networks.” IEEE Signal Processing Magazine 36 (6): 88–96.
- Rao, Rajesh PN, and Dana H Ballard. 1999. “Predictive Coding in the Visual Cortex: A Functional Interpretation of Some Extra-Classical Receptive-Field Effects.” Nature Neuroscience 2 (1): 79–87.
- Salvatori, Tommaso, Yuhang Song, Yu Hong, Lei Sha, Simon Frieder, Zhenghua Xu, Rafal Bogacz, and Thomas Lukasiewicz. 2024. “Brain-Inspired Computational Intelligence via Predictive Coding.” arXiv Preprint arXiv:2308.07870.
- Schultz, Wolfram, Peter Dayan, and P Read Montague. 1997. “A Neural Substrate of Prediction and Reward.” Science 275 (5306): 1593–99.
- Tononi, Giulio, and Chiara Cirelli. 2006. “Sleep Function and Synaptic Homeostasis.” Sleep Medicine Reviews 10 (1): 49–62.
- Touvron, Hugo, Louis Martin, Kevin Stone, Peter Albert, Amjad Almahairi, Yasmine Babaei, Nikolay Bashlykov, et al. 2023. “Llama 2: Open Foundation and Fine-Tuned Chat Models.” arXiv Preprint arXiv:2307.09288.
- Vaswani, Ashish, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. 2017. “Attention Is All You Need.” In Advances in Neural Information Processing Systems. Vol. 30.
- Whittington, James CR, and Rafal Bogacz. 2017. “An Approximation of the Error Backpropagation Algorithm in a Predictive Coding Network with Local Hebbian Synaptic Plasticity.” Neural Computation 29 (5): 1229–62.
- Yang, Greg, Edward J Hu, Igor Babuschkin, Szymon Sidor, Xiaodong Liu, David Farhi, Nick Ryder, Jakub Pachocki, Weizhu Chen, and Jianfeng Gao. 2021. “Tuning Large Neural Networks via Zero-Shot Hyperparameter Transfer.” In Advances in Neural Information Processing Systems. Vol. 34.
License
PolyForm Noncommercial License 1.0.0This work is open research. Free for any noncommercial use: research, education, personal projects, evaluation, and nonprofit or public-sector use. Commercial use requires a separate license, available by contacting krrish@verace.in.