Skip to content

[2.0] Add new Frontier-CS 2.0 problem: nanoslm_hybrid_arch_design - #170

Merged
momoway merged 9 commits into
FrontierCS:mainfrom
sijial430:problem/nanoslm
Aug 12, 2026
Merged

[2.0] Add new Frontier-CS 2.0 problem: nanoslm_hybrid_arch_design#170
momoway merged 9 commits into
FrontierCS:mainfrom
sijial430:problem/nanoslm

Conversation

@sijial430

@sijial430 sijial430 commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Problem id: nanoslm_hybrid_arch_design
  • Task: Design a hybrid language-model architecture (attention + a
    linear-recurrent sequence mixer) that reaches the lowest held-out
    bits-per-byte (val_bpb) when trained from scratch under a fixed
    wall-clock budget of 15 minutes
    on one H100. The agent submits a single
    model.py; the hidden judge drops it into a locked dolma2-BPE train+eval
    harness, trains it for T = 900 s (the LR cosine spans a full 6-hour horizon,
    so each run is the prefix of a long schedule), and scores it as
    score = 100·2^(−γ·val_bpb), γ = log₂(100/70)/ref_bpb. Perfect fit (0 bpb) = 100, the measured reference
    solution = 70 exactly, failures = 0.
  • Iteration loop: submissions are asynchronous. agents can keep improving their next candidate while a run is being scored (~20 min wall-clock per result).
  • Grounding: a hybrid architecture (following Olmo Hybrid, arXiv:2604.03444) which is a 3:1 GDN:attention interleave at the ~190M olmo3_190M shape (d=768, L=12,
    H=12), using dolma2 tokenizer.

Measured calibration

Architecture @ 15 min (current: bpb → score) @ 30 min (bpb) @ 6 h (bpb)
Locked baseline 1.58648 → 69.49 (327 steps) 1.33325 (655 steps) 0.98112 (7,897 steps)
Reference 3:1 hybrid 1.55484 → 70.00 (264 steps) 1.31208 (496 steps) 0.93795 (6,544 steps)

The 15-min column is the scored configuration; earlier budgets are historical
calibration.

Validation

Commands (from repo root):

uv run frontier list 2.0
uv run frontier show 2.0 nanoslm_hybrid_arch_design
PYTHONPYCACHEPREFIX=/private/tmp/frontier-cs-pycache \
  python3 -m py_compile 2.0/problems/nanoslm_hybrid_arch_design/evaluator.py
# torch-free CPU self-test (policy + scoring + fingerprint + real-load fixtures):
python3 2.0/problems/nanoslm_hybrid_arch_design/evaluator.py --selftest
# Harbor smoke trial (see CONTRIBUTING.md; a scored run takes ~20 min at the
# 15-min budget, so give the verifier headroom):
uv run frontier harbor trial 2.0 nanoslm_hybrid_arch_design \
  -a codex -m <model> --agent-timeout 600 --verifier-timeout 1800 --force-build --json

Judge-side hardening (dual Claude+Codex review): spawn+poll Modal dispatch with
a config-fingerprint + code-version staleness gate, logits-width guard,
warm-container env hygiene, isolation audit (no experiment data or held-out
stream reachable from the agent container).

Validation logs with codex (gpt-5.5 one-shot + gpt-5.6 iterative campaigns)
(access needs to be granted):
wandb: https://api.wandb.ai/links/sijial-ai2/u86xnx57
results (updated, 15-mins interval): https://drive.google.com/drive/folders/1Xcyu0hJSh2p7tmMFNbY5SGkfFQNcovCS?usp=drive_link
results (old, 30-mins interval): https://drive.google.com/drive/folders/157qqq--nHlSpkkur7TT-HkCHBjaAFQdH?usp=drive_link

sijial-ai2 and others added 6 commits July 20, 2026 21:09
Hybrid LM architecture-design task (Olmo Hybrid, ~190M): agents submit a
model.py scored on held-out val_bpb vs a locked olmo3_190M baseline, trained
under a fixed wall-clock budget on a single H100.

- Embedding tying + param_cap reconciled: 400M cap in config.yaml and
  settings.py; baseline_model.py and reference.py both tie embeddings so the
  arms differ only in the sequence mixer; reference.py analytic/self-check
  updated to the tied count.
- repro/: paper-faithful rig for Olmo Hybrid Table 5 (190M Base-Easy BPB) --
  paper-spec pre-norm transformer + GDN-3:1 hybrid, WSD-S schedule, Modal
  training on the dolma3 mix.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ia Modal

- settings.py: batch_size 8 -> 2, grad_accum 4 -> 16 (effective batch 32
  unchanged). MEASURED: micro-batch 8 at ctx 8192 OOMs an H100 -- the fp32 CE
  logits are ~26GB and the baseline arm alone tried to allocate 24.48GiB, so the
  reference could not run under production settings. micro-batch 2 fits both arms
  (incl. the GDN hybrid) with margin. A fused/chunked CE would let it grow again
  (noted as a TODO in-file).
- modal_app.py: mount the real FineWeb-Edu corpus (Modal Volume nanoslm-corpus)
  at the data path so the GPU arms train on real tokens instead of data.py's
  synthetic fallback; add PYTORCH_CUDA_ALLOC_CONF=expandable_segments to reduce
  allocator fragmentation for the large CE logits.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
… hardened gate

Training/eval harness:
- Cosine LR now decays over wall-clock fraction (elapsed/train_seconds), not a
  hardcoded step horizon -- identical schedule for every architecture under
  the fixed budget; dead max_train_seconds loop check removed.
- Modal run_pair_remote honors the agent/final role split: agent role reuses a
  baseline cached on the corpus Volume (keyed by config fingerprint +
  train.bin size + CODE_VERSION v8) and trains only the submission (~T);
  guard rejections return their public reason instead of environment_error.
- Baseline SWA layers run FlexAttention's block-sparse kernel, with autocast
  dtype unification at the flex boundary (SDPA silently unified mixed
  q/k fp32 vs v bf16; flex refuses -- the old silent mask fallback had been
  hiding both the bug and a 2x baseline slowdown).
- CUDA-only, no fallbacks: reference requires fla or raises; baseline requires
  flex or raises; FRONTIER_NANOSLM_SMOKE mode removed entirely.
- Warmup fast-fails a model that cannot run at the 8192 eval context before
  spending the 6h budget; training exceptions of any type now classify as
  guard errors instead of escaping as environment errors.
- compile_model added to the config fingerprint.

Reference / baseline fidelity (arXiv 2604.03444 + OLMo-core @ fa6c5014):
- GDN head_dim 128 kept per the paper's ladder convention ceil_128(0.75*d/h),
  with the 7B script's divergent int() rule documented; head_dim 48 probed on
  H100 (works, but slower via Triton autotune).
- allow_neg_eigval=True passed explicitly (fla defaults False; paper requires
  it); GDN o_proj included in the depth-scaled output init.
- vocab padded to 100352 (Olmo 3 convention; ids on disk stay < 100278).
- reordered_norm documented against the paper's "pre-norm" wording.

Data & scoring:
- Corpus staged at 2B train tokens for the 6h budget (prep sizing rationale
  updated); val re-staged with byte-additivity verified.
- AST policy gate: strict import allowlist (torch/numpy/fla/einops/triton +
  pure-stdlib), banned dynamic-access primitives, banned dunder attributes,
  banned raw-file-reader names; plausibility floor (bpb < 0.4 -> guard) as
  the runtime backstop.
- Docs: problem-structure section in readme, agent README updated (starter is
  a byte-identical copy of reference.py).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- score IS the submission's held-out val_bpb (lower better), no scale/clip;
  bpb_score_scale removed; failure paths return sentinel 9999
- train_seconds 21600 -> 1800 for fast iteration; fingerprinted
  lr_schedule_seconds=21600 keeps the full 6h cosine (a 30-min run is the
  prefix of a long run, not a compressed anneal)
- opt-in wandb logging (operator-only env gate; scored paths byte-identical)
  incl. pre-clip grad_norm; stop shipping stale .assets into the GPU image
- calibrated @30min (CRN pairs, full-horizon LR): baseline 1.33325,
  reference 1.31208; 6h numbers unchanged (0.98112 / 0.93795)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@sijial430 sijial430 changed the title [2.0] nanoslm: raw-bpb scoring, 30-min budget, full-horizon LR, wandb [2.0] Add new Frontier-CS 2.0 problem: nanoslm_hybrid_arch_design Jul 24, 2026
@sijial430
sijial430 marked this pull request as draft July 24, 2026 23:19
@sijial430
sijial430 marked this pull request as ready for review July 24, 2026 23:19
sijial-ai2 and others added 2 commits August 11, 2026 23:10
…guidance

- score = 100*2^(-gamma*val_bpb), gamma = log2(100/70)/ref_bpb: smooth
  tempered per-byte likelihood -- perfect fit = 100, measured reference
  (1.55484 @15min) = 70, failures 0, no interior clipping
- train_seconds 1800 -> 900 for faster agent iteration; LR cosine keeps the
  full 6h horizon (each run is the prefix of a long schedule);
  CODE_VERSION -> 15min-likelihood-v9
- agents keep editing while the judge scores: async submission workflow
  (~20 min/result, 2-slot queue, cancel superseded) now documented in the
  problem docs, matching the vllm problem's guidance
- hardening from claude+codex reviews: spawn+poll Modal dispatch with a
  fingerprint+version staleness gate, logits-width guard, warm-container
  env purge, doc fact-fixes

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Mkjzqe7TQbS2QYQAML8Te3
@sijial430

sijial430 commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator Author

Updated (b57c492):

  1. New score formula: score = 100·2^(−γ·val_bpb) with γ = log₂(100/70)/ref_bpb: a smooth tempered per-byte likelihood. Perfect fit (0 bpb) = 100, the measured reference solution = 70 exactly, failures = 0, no manual capping; val_bpb always reported alongside.
  2. Shorter iteration interval: training budget cut to 15 minutes per run (was 30) so agents get scored feedback in ~20 min wall-clock; the LR cosine keeps its full 6-hour horizon, so every run is the prefix of a long schedule rather than a compressed anneal.
  3. Agents can iterate while the judge works: submissions are asynchronous (submit returns a UUID immediately; 2-slot queue; cancel supported), and agents are encouraged to keep improving their next solution while a run is being scored, mirroring the vllm problem's workflow.

…rkflow

Docker Hub org access lapsed; images now live at
ghcr.io/frontiercs/nanoslm-hybrid-arch-design-{agent,judge}:experimental-v0
(pushed from the reviewed b57c492 build, image IDs verified identical).
build_images.sh notes the manual push workflow and the visibility rule:
agent package may be public, judge package must stay PRIVATE (embeds the
held-out val.bin).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Mkjzqe7TQbS2QYQAML8Te3
@momoway

momoway commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator

LGTM!

@momoway
momoway merged commit a3ac5cc into FrontierCS:main Aug 12, 2026
3 of 4 checks passed
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.

3 participants