V11 Configuration
Source: nct_v2/v11_config.py Lines: 219
Design Philosophy
The V11Config dataclass is the single source of truth for every hyperparameter in NCT. It serves three purposes: (1) complete specification, every parameter needed to instantiate, train, and evaluate NCT is contained in this single dataclass; (2) neuroscience documentation, every parameter has an inline comment explaining its biological rationale, creating a living record of design decisions; (3) reproducibility, given a V11Config instance, the model is fully deterministic (up to random initialization).
The dataclass contains 50+ parameters organized into 15 categories matching the brain systems they configure: core dimensions, L2/3 lateral association, predictive coding, interneurons, working memory, neuromodulation, oscillatory dynamics, thalamic routing, hippocampal memory, basal ganglia, wake-sleep cycling, structural plasticity, L5 dendritic computation, learning mode, BCM/metaplasticity, and training regularization.
The critical design constraint: all default values must produce a working model that fits in 6GB VRAM (NVIDIA RTX 4050 Laptop GPU). This means the default preset (106M parameters, 12 columns, ) must complete a full forward pass including PC inference iterations (up to 5 re-settlings), Hebbian updates to all L2/3 association matrices, working memory state persistence, oscillatory modulation, and wake-sleep consolidation, all within 6GB of GPU memory using bfloat16 mixed precision.
Two computed properties derive from the config: d_head (, the per-head dimension) and columns_per_relay (, how many columns share each thalamic relay group).
Complete Parameter Specification
| Parameter | Type | Default | Neuroscience Rationale |
|---|---|---|---|
| Core Dimensions | |||
| d_model | int | 512 | Inter-column representation dimension |
| d_column | int | 512 | Intra-column processing dimension |
| n_columns | int | 12 | Number of hierarchical columns (like transformer layers) |
| d_ff | int | 2048 | L5 feedforward expansion () |
| vocab_size | int | 14000 | NCT morphological tokenizer () |
| max_seq_len | int | 1024 | Maximum sequence length |
| L2/3 Lateral Association (Theorem B) | |||
| n_assoc_heads | int | 8 | Association heads (analogous to attention heads) |
| n_settle_steps | int | 1 | Competitive settling iterations ( = recurrent) |
| k_wta_ratio | float | 0.15 | k-WTA sparsity: top 15% active |
| hebbian_lr | float | Hebbian learning rate for | |
| assoc_dropout | float | 0.1 | Dropout on association weights |
| assoc_window_size | int | 16 | Causal window: 16 tokens = 2 theta cycles |
| Predictive Coding (Theorem A) | |||
| pc_min_steps | int | 2 | Minimum PC inference iterations |
| pc_max_steps | int | 5 | Maximum PC inference iterations |
| pc_convergence_threshold | float | 0.01 | Relative error change threshold for early stop |
| sigma2_init | float | 1.0 | Initial prediction precision () |
| pc_learning_lr | float | PC weight update learning rate | |
| Interneurons | |||
| d_inhibitory | int | 128 | Inhibitory interneuron dimension |
| vip_enabled | bool | True | VIP disinhibition gate |
| sst_enabled | bool | True | SST dendritic inhibition |
| pv_enabled | bool | True | PV/Chandelier output veto |
| Working Memory | |||
| nmda_slots | int | 4 | NMDA attractor slots (Luck & Vogel: 4) |
| nmda_d_slot | int | 64 | Per-slot dimension |
| nmda_decay_init | float | 6.0 | , half-life tokens |
| silent_d_trace | int | 64 | Activity-silent trace dimension |
| phono_capacity | int | 8 | Phonological loop slots (Miller’s ) |
| Neuromodulation (Theorem C) | |||
| da_enabled | bool | True | Dopamine: reward prediction error |
| ne_enabled | bool | True | Norepinephrine: arousal/exploration |
| serotonin_enabled | bool | True | Serotonin: time horizon/patience |
| ach_enabled | bool | True | Acetylcholine: attention/plasticity gate |
| tonic_da_ema | float | 0.999 | EMA decay for tonic DA baseline |
| Oscillatory Dynamics | |||
| gamma_period | int | 1 | Gamma cycle (1 token) |
| theta_period | int | 8 | Theta cycle (8 tokens) |
| alpha_period | int | 20 | Alpha cycle (20 tokens) |
| delta_period | int | 64 | Delta cycle (64 tokens) |
| Thalamus | |||
| n_relay_groups | int | 4 | Relay groups (1 per 3 columns) |
| d_relay | int | 256 | Relay intermediate dimension |
| d_trn | int | 24 | TRN gating dimension |
| Hippocampus | |||
| hpc_memory_size | int | 2048 | Max episodic memories in buffer |
| hpc_d_sparse | int | 2048 | DG sparse expansion dimension () |
| hpc_surprise_threshold | float | 0.5 | Surprise threshold for tagging |
| Basal Ganglia | |||
| d1_ec50 / d1_slope | float | 0.65 / 8.0 | D1 receptor threshold / steepness |
| d2_ec50 / d2_slope | float | 0.25 / 8.0 | D2 receptor threshold / steepness |
| Wake-Sleep (Theorem D) | |||
| sleep_interval | int | 100 | Wake steps between sleep phases |
| sleep_replay_steps | int | 50 | Replay steps per sleep phase |
| synaptic_downscale | float | 0.99 | Sleep downscaling (1% per phase) |
| Structural Plasticity (Theorem E) | |||
| growth_threshold | float | 2.0 | PE threshold for synaptogenesis |
| prune_threshold | float | 0.01 | Weight magnitude for pruning |
| prune_interval | int | 1000 | Steps between pruning passes |
| Training | |||
| base_lr | float | Base learning rate | |
| gate_init | float | : identity at init | |
| gate_lr_mult | float | 20.0 | Gates learn faster |
| dropout | float | 0.1 | Standard dropout |
| max_grad_norm | float | 1.0 | Gradient clipping |
Presets
Three presets scale the architecture for different hardware:
Theorem 3 (Preset Scaling). All presets maintain the following invariants:
(standard FFN ratio)
(head dimension)
(thalamic bottleneck)
(DG expansion ratio)
WM slot dimensions scale with
| Preset | Params | VRAM | |||||
|---|---|---|---|---|---|---|---|
default | 512 | 12 | 2048 | 8 | 256 | 106M | 2 GB |
v11_laptop | 768 | 16 | 3072 | 12 | 384 | 300M | 5 GB |
v11_1b | 1280 | 20 | 5120 | 20 | 640 | 1,008M | 10 GB |
Source Code
# ===========================================================================
# Configuration
# Source: nct_v2/v11_config.py
# ===========================================================================
"""
NCT V11: Cortical Column Network — Configuration
=================================================
Architecture: N cortical columns (6-layer each) replacing transformer blocks.
Learning: Local predictive coding + Hebbian, no global backprop.
Operation: Continuous wake-sleep cycle, self-improving.
Theorems:
A: Predictive Coding Replaces Backprop (Whittington & Bogacz 2017)
B: Hebbian + Anti-Hebbian = Self-Organizing Representations (Pehlevan & Chklovskii 2019)
C: Neuromodulatory Reward = RL Without Backprop (Schultz 1997, Dayan & Yu 2006)
D: Wake-Sleep Cycle = Autonomous Self-Improvement (Tononi 2006)
E: Structural Plasticity = Growing Architecture
"""
@dataclass
class V11Config:
"""Configuration for the Cortical Column Network."""
# ── Core Dimensions ──────────────────────────────────────────────
d_model: int = 512 # Inter-column dimension
d_column: int = 512 # Intra-column processing dimension
n_columns: int = 12 # Hierarchical column count (like layers)
d_ff: int = 2048 # L5 feedforward expansion
vocab_size: int = 14000 # NCT morphological tokenizer (~13,817 tokens)
max_seq_len: int = 1024 # Maximum sequence length
# ── L2/3 Lateral Association (Theorem B) ─────────────────────────
n_assoc_heads: int = 8 # Association heads (like attention heads)
n_settle_steps: int = 1 # Competitive settling iterations in L2/3 (>1 = recurrent settling)
k_wta_ratio: float = 0.15 # k-WTA sparsity (top 15% active)
hebbian_lr: float = 1e-4 # Hebbian learning rate for W_assoc
assoc_dropout: float = 0.1 # Dropout on association weights
assoc_window_size: int = 16 # Local causal window — O(T×w) not O(T²). 16 tokens = 2 theta cycles.
# ── Predictive Coding (Theorem A) ────────────────────────────────
n_inference_steps: int = 5 # PC inference iterations per input (legacy, see pc_max_steps)
pc_min_steps: int = 2 # Minimum PC inference iterations
pc_max_steps: int = 5 # Maximum PC inference iterations (reduced for memory efficiency)
pc_convergence_threshold: float = 0.01 # Early-stop when error delta < this
sigma2_init: float = 1.0 # Initial prediction precision (σ²)
pc_learning_lr: float = 3e-4 # Weight update learning rate for PC
# ── Interneurons ─────────────────────────────────────────────────
d_inhibitory: int = 128 # Inhibitory interneuron dimension
vip_enabled: bool = True # VIP disinhibition (Thm 38)
sst_enabled: bool = True # SST dendritic inhibition (Thm 46)
pv_enabled: bool = True # PV/Chandelier output veto (Thm 41)
# ── Working Memory ───────────────────────────────────────────────
wm_enabled: bool = True
nmda_slots: int = 4 # NMDA attractor slots (Luck & Vogel: ~4)
nmda_d_slot: int = 64 # Per-slot dimension
nmda_decay_init: float = 6.0 # sigmoid(6)≈0.9975, half-life ~277 tokens
silent_d_trace: int = 64 # Activity-silent trace dimension
silent_facil_init: float = 4.6 # sigmoid(4.6)≈0.990
silent_depress_init: float = 2.5 # sigmoid(2.5)≈0.924
phono_capacity: int = 8 # Phonological loop slots (Miller's 7±2)
phono_d_slot: int = 64 # Per-slot dimension
# ── Neuromodulation (Theorem C) ──────────────────────────────────
da_enabled: bool = True # Dopamine — prediction error / reward
ne_enabled: bool = True # Norepinephrine — arousal / exploration
serotonin_enabled: bool = True # Serotonin — time horizon / patience
ach_enabled: bool = True # Acetylcholine — attention / plasticity gate
tonic_da_ema: float = 0.999 # EMA decay for tonic DA
# ── Oscillatory ──────────────────────────────────────────────────
oscillations_enabled: bool = True
gamma_period: int = 1 # Gamma cycle (tokens)
theta_period: int = 8 # Theta cycle
alpha_period: int = 20 # Alpha cycle
delta_period: int = 64 # Delta cycle
# ── Thalamus ─────────────────────────────────────────────────────
thalamic_enabled: bool = True
n_relay_groups: int = 4 # Relay groups (1 per 3 columns)
d_relay: int = 256 # Relay intermediate dimension
d_trn: int = 24 # TRN dimension (small, efficient)
# ── Hippocampus ──────────────────────────────────────────────────
hpc_enabled: bool = True
hpc_memory_size: int = 2048 # Max episodic memories
hpc_d_sparse: int = 2048 # Dentate gyrus sparse expansion
hpc_surprise_threshold: float = 0.1 # Tag threshold (lowered from 0.5 — was starving HPC at 2 memories)
hpc_decay_init: float = 4.95 # sigmoid(4.95)≈0.993, ultra-slow
# ── Cerebellum ───────────────────────────────────────────────────
cerebellum_enabled: bool = True
d_cerebellar: int = 256 # Cerebellar intermediate dimension
# ── Basal Ganglia ────────────────────────────────────────────────
bg_enabled: bool = True
d_bg: int = 128 # BG intermediate dimension
d1_ec50: float = 0.65 # D1 receptor threshold (high)
d1_slope: float = 8.0 # D1 receptor steepness
d2_ec50: float = 0.25 # D2 receptor threshold (low)
d2_slope: float = 8.0 # D2 receptor steepness
# ── Wake-Sleep Cycle (Theorem D) ─────────────────────────────────
wake_sleep_enabled: bool = True
sleep_interval: int = 100 # Wake steps between sleep phases
sleep_replay_steps: int = 50 # Replay steps per sleep phase
synaptic_downscale: float = 0.99 # Sleep downscaling (Tononi 2006) — 1% per sleep phase
replay_priority: str = 'surprise' # 'surprise', 'recency', 'uniform'
sleep_contrastive_noise: float = 0.1 # Noise for contrastive consolidation
# ── Structural Plasticity (Theorem E) — brain continuously prunes/grows
structural_plasticity: bool = True
growth_threshold: float = 2.0 # PE threshold for synaptogenesis
prune_threshold: float = 0.01 # Weight magnitude for pruning
prune_interval: int = 1000 # Steps between pruning passes
# ── L5 Dendritic Computation ──────────────────────────────────────
l5_dendritic: bool = True # Enable basal/apical dendritic gating in L5
l5_kwta: bool = True # Enable k-WTA sparsity in L5 FFN
# ── Learning Mode ────────────────────────────────────────────────
learning_mode: str = 'hybrid' # 'backprop', 'predictive_coding', 'hebbian', 'hybrid'
# hybrid = PC for vertical + Hebbian for L2/3 + neuromod gating
error_hebbian_weight: float = 0.5 # Blend: 0=blind Hebbian, 1=fully error-driven
ntp_output_only: bool = True # Restrict NTP backprop to output pathway (LM head + final L5)
autonomous_training: bool = True # Use AutonomousLoop in hybrid/PC/hebbian modes
# ── BCM / Metaplasticity ─────────────────────────────────────────
bcm_enabled: bool = True
bcm_tau: float = 1000.0 # BCM threshold time constant
metaplasticity_enabled: bool = True
# ── Regularization ───────────────────────────────────────────────
dropout: float = 0.1
weight_decay: float = 0.01
max_grad_norm: float = 1.0
# ── Training ─────────────────────────────────────────────────────
base_lr: float = 3e-4
batch_size: int = 4
seq_len: int = 512
# ── Gate Initialization ──────────────────────────────────────────
gate_init: float = -2.0 # sigmoid(-2)≈0.12, identity at init
gate_lr_mult: float = 20.0 # Gates learn 20x faster
# ── Precision ────────────────────────────────────────────────────
use_bf16: bool = False # bfloat16 mixed precision
@property
def d_head(self) -> int:
"""Per-head dimension for L2/3 association."""
return self.d_column // self.n_assoc_heads
@property
def columns_per_relay(self) -> int:
"""How many columns share a thalamic relay group."""
return max(1, self.n_columns // self.n_relay_groups)
@classmethod
def v11_laptop(cls, **overrides) -> 'V11Config':
"""~300M preset for 6GB laptop GPUs (RTX 4050/3060 etc).
Scaling: d=768, 16 columns, 4× FFN ratio.
Memory budget: ~600MB weights (bf16) + ~2.4GB optimizer + ~2GB activations = ~5GB.
"""
defaults = dict(
d_model=768,
d_column=768,
n_columns=16,
d_ff=3072,
vocab_size=14000,
max_seq_len=1024,
n_assoc_heads=12, # 768/12 = 64 per head
d_inhibitory=192,
nmda_d_slot=80,
silent_d_trace=80,
phono_d_slot=80,
d_relay=384,
d_trn=28,
n_relay_groups=4,
hpc_d_sparse=3072,
hpc_memory_size=4096,
d_cerebellar=384,
d_bg=192,
)
defaults.update(overrides)
return cls(**defaults)
@classmethod
def v11_1b(cls, **overrides) -> 'V11Config':
"""1B parameter preset: d=1280, 20 columns, ~1006M params."""
defaults = dict(
d_model=1280,
d_column=1280,
n_columns=20,
d_ff=5120,
vocab_size=14000,
max_seq_len=2048,
n_assoc_heads=20,
d_inhibitory=320,
nmda_d_slot=128,
silent_d_trace=128,
phono_d_slot=128,
d_relay=640,
d_trn=40,
n_relay_groups=5,
hpc_d_sparse=5120,
hpc_memory_size=8192,
d_cerebellar=640,
d_bg=320,
)
defaults.update(overrides)
return cls(**defaults)