Skip to content

Add NGB v4 tuned nanoGPT protocols and 4×4 model - #50

Draft
charlesmartin14 wants to merge 19 commits into
mainfrom
agent/ngb-v4-protocol
Draft

Add NGB v4 tuned nanoGPT protocols and 4×4 model#50
charlesmartin14 wants to merge 19 commits into
mainfrom
agent/ngb-v4-protocol

Conversation

@charlesmartin14

Copy link
Copy Markdown
Member

Purpose

Create a separate version-4 nanoGPT experiment family under baseline/ngb without changing or overwriting the existing version-3 one-head results. NGB v4 addresses the one-epoch undertraining and seed-dependent adaptive-optimizer instability observed in the checked-in v3 comparison, and adds a distinct, more expressive small language-model architecture.

New experiment family

  • baseline/ngb/configs/v4_one_head.yaml
    • one block, one head, width 128
    • two corpus-equivalent epochs
    • isolated result slug v4_one_head
  • baseline/ngb/configs/v4_small_4x4.yaml
    • four blocks, four heads, width 128
    • two corpus-equivalent epochs
    • isolated result slug v4_small_4x4

Both reuse the same pinned, document-disjoint FineWeb-Edu token cache and common train/validation/test/BLEU probes. Validation cross-entropy selects checkpoints; test metrics and WeightWatcher diagnostics remain monitoring-only.

Tuned optimizer centers

One-head v4

  • SGD + Nesterov: peak 0.05, floor 5e-4, 5% warm-up, momentum 0.90, weight decay 0.01
  • AdamW: peak 3e-4, floor 1e-5, 2.5% warm-up, betas (0.90, 0.95), weight decay 0.10
  • Muon matrices: peak 0.01, floor 1e-4, weight decay 0.02
  • Muon auxiliary AdamW: peak 2e-4, floor 1e-5, weight decay 0.10

Small 4×4 v4

The adaptive centers are the same; SGD uses peak 0.03 and floor 3e-4 for the deeper model.

These are conservative qualification centers, not declarations of global optimality. baseline/ngb/QUALIFICATION.md defines the stress-seed screen, three-seed qualification, and frozen eight-seed replication protocol.

Runtime and architecture changes

  • generalize the shared GPT implementation from exactly one block/head to arbitrary positive layer/head counts with width divisibility checks
  • generalize WeightWatcher inventory from six matrices to 6 × n_layer
  • keep Muon on all hidden two-dimensional transformer matrices while the tied embedding/head and other parameters use auxiliary AdamW
  • isolate v4 roots under /tmp/rg-ngb/results/<run_slug> while retaining the v3 /tmp/rg-nanogpt-one-head contract
  • retain conda-native execution; no project venv, shell wrapper, or home-directory default
  • include model identity in manifests and completed-run validation so architectures cannot silently reuse each other's artifacts

Comparison notebooks

NGB adds six python3/Papermill notebooks:

  1. run v4 one-head
  2. compare v4 one-head optimizers
  3. run v4 small 4×4
  4. compare v4 small 4×4 optimizers
  5. compare the two v4 architectures
  6. compare v3 versus v4 one-head

The comparison path now supports arbitrary matched completed seed sets rather than hard-coding three seeds. It adds:

  • run-level 95% Student-t intervals
  • matched-seed paired optimizer contrasts
  • validation-selected and final checkpoint tables
  • best-validation step and final-minus-best drift
  • clipping frequency and maximum update-to-weight ratio
  • layer/block-resolved alpha, ERG gap, and trap diagnostics
  • perplexity intervals obtained by exponentiating loss-space intervals rather than constructing impossible symmetric intervals directly in perplexity space

Validation

Completed before opening this PR:

  • git diff --check
  • compilation of shared source and all tests
  • validation and Python parsing of all six notebook files
  • pip check
  • existing one-head suite: 27 passed
  • direct NGB v4 suite: 6 passed

The full two-epoch scientific campaigns have not been run in CI; this PR supplies the tested protocols, runtime support, analysis notebooks, and qualification plan. Existing v3 result directories and checked-in output notebook are not modified.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant