Skip to content

0.3.2a2: MLP-scope recompute, lookahead options, web UI fields, compiled document-reset fix - #54

Merged
FonaTech merged 1 commit into
devfrom
long-context-0.3.2a2
Nov 9, 2026
Merged

FonaTech merged 1 commit into
devfrom
long-context-0.3.2a2

Conversation

@FonaTech

@FonaTech FonaTech commented Nov 9, 2026

Copy link
Copy Markdown
Owner

Summary

Follow-up to 0.3.2a1. Every new switch is off by default.

  • recompute_scope="mlp": recompute only each block's MoE/FFN. At 32k on the real corpus: saves 1.4 GB (5%), loses 11% speed; whole-block recompute saves 6.9 GB (25%), loses 19%.
  • mla_upproj_recompute: implemented and exact, but measured no memory benefit (24.47 -> 24.29 GiB at 64k, 6.7% slower), so it stays off.
  • lookahead_input_detach, temporal_grad_span: implemented; neutral on the en-zh data (validation CE within 1e-3), so they stay off.
  • Web UI: all long-context fields, labels and help in zh-Hans, zh-Hant, en, ja.
  • Bug found by real-corpus training: reset_router_at_documents / document_masking crashed inside the compiled LongRun step (NumPy on a traced array). Fixed with segment_ids_mx plus a test that runs the option through mx.compile.
  • Bug: reset_lookahead_at_documents="false" (what the UI sends) was read as true.
  • Version 0.3.2a2, CHANGELOG, reports/long_context_20261109/real_corpus_ab.json.

Evidence (real en-zh shards, production 50M config, random init, M5 Max, bf16; validation CE differs by <= 3e-3 between arms)

Context Default long (block 1024 + CE chunk 1024 + MoE chunk 8192)
8k 8.9k tok/s, 40.6 GiB 19.5k, 7.5 GiB
16k 1.9k, 141.5 GiB (over this machine's RAM) 15.2k, 13.8 GiB
32k - 8.8k, 27.0 GiB
64k - 3.7k, 54.6 GiB

Limits: 2-6 optimizer steps per arm, so the CE column shows equal quality between arms, not final quality. Block-size sweep: larger blocks speed up one MLA layer but slow the whole model; 1024 stays.

Test plan

  • tests/test_long_context.py + tests/test_webui.py: 101 passed
  • Full suite, MLX on CPU: 591 passed, 4 skipped (test_mlx_training_six_stage_loss_paths deselected: known MLX CPU segfault)
  • Full suite, no-MLX CI simulation: 422 passed, 63 skipped
  • ruff 0.17.4 clean
  • CI on the PR

🤖 Generated with Claude Code

…led document-reset fix

Adds recompute_scope=mlp, mla_upproj_recompute, lookahead_input_detach and
temporal_grad_span (all off by default), web UI fields in four languages, and a
real-corpus A/B report. Fixes reset_router_at_documents / document_masking crashing
inside the compiled LongRun step (found by training on the real corpus) and the
"false" string read as true for reset_lookahead_at_documents.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@FonaTech
FonaTech merged commit b27ef98 into dev Nov 9, 2026
2 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.

1 participant