Skip to content

0.3.2a0: native kernel, compiled MLX step, MLX activation recomputation - #48

Merged
FonaTech merged 1 commit into
devfrom
native-kernel
Nov 8, 2026
Merged

FonaTech merged 1 commit into
devfrom
native-kernel

Conversation

@FonaTech

@FonaTech FonaTech commented Nov 8, 2026

Copy link
Copy Markdown
Owner

Summary

  • Native kernel (chronos/model/kernel.py) replaces minimind: no clone, no sys.path change, offline import. Logits are bit-identical on out/chronos_256_moe.pth and the 50M en→zh checkpoint (full, padded, prefill+decode). One shared FP32 RoPE table (3.50 → 0.50 MiB at 50M, 216 → 24 MiB at 768H).
  • Fixes that came with the migration: dense GQA mode (crashed on Torch and MLX), BF16 release checkpoint rewritten as FP16, trainer logs missing from the Web UI.
  • Tool-call tags: decode_visible keeps <tool_call>/<tools> when a custom HF tokenizer registers them as special tokens.
  • MLX training: compiled micro step on by default (measured 1.08× SFT, 1.18× pretrain on the 50M config), and activation recomputation (peak 5.62 → 3.50 GB SFT, 6.07 → 3.62 GB pretrain; off by default at 50M).
    • mlx 0.32.4 drops the gradient of a repeated checkpoint output, and a full-length cache slice is the same graph node without being the same Python object (37–40% wrong gradients). Region outputs are packed per dtype.
    • Exactness is tested per micro step on the same state inside the LongRun loop.
  • Versions 0.3.2a0 (kernel and chronos-translate pin). README (en/zh) and CHANGELOG updated.

Test plan

  • MLX-CPU suite: 531 passed, 1 skipped (six-stage deselected; run on GPU: passed)
  • No-MLX CI simulation (py3.11, transformers 5.22.1): 395 passed, 67 skipped
  • ruff 0.17.4 clean
  • Wheel build + fresh-venv import with HOME empty: version 0.3.2a0, legacy tokenizer bundled, no minimind, nothing downloaded
  • Real-data A/B (en→zh shards, 50M config): loss curves of eager / compiled / recompute / both agree within 2e-3 (SFT, 16 steps) and 2e-4 (pretrain, 12 steps)

🤖 Generated with Claude Code

- chronos/model/kernel.py replaces the minimind kernel: no clone, no
  sys.path changes, offline import; logits bit-identical on the existing
  checkpoints; one shared FP32 RoPE table (3.50 -> 0.50 MiB at 50M).
- Dense GQA mode works on Torch and MLX (both crashed before); BF16
  release checkpoints keep their dtype; trainer logs reach the Web UI.
- decode_visible keeps <tool_call>/<tools> tags that a custom tokenizer
  registers as special tokens (serving, workbench, GRPO rewards).
- MLX: compiled micro step by default (1.08x SFT, 1.18x pretrain measured
  on the 50M en->zh config) and activation recomputation with replayed
  draws and per-dtype packed region outputs (mlx 0.32.4 drops gradients
  of repeated region outputs; peak 5.62 -> 3.50 GB SFT).
- RoPE tables built single-threaded (1-ulp prefix mismatch at 18 threads).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@FonaTech
FonaTech merged commit ee1b2d2 into dev Nov 8, 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