Repository navigation
Chronos 0.3.6 fixes two ways a training run could lose supervision. Long chat prompts could leave no assistant tokens in the training window. MLX could report the expected forward loss while computing incorrect gradients for packed documents during activation recomputation.
Training data and validation
- The streaming supervised fine-tuning (SFT) loader identifies assistant tokens before choosing a training window. When the initial window contains no predictable answer token, the loader selects a contiguous span containing the answer and its preceding context. Packed binary SFT applies the same rule when an oversized record starts a row.
- PyTorch returns zero cross-entropy (CE) for a batch whose labels are all ignored. MLX validation and checkpoint inspection use the configured document mask, label alignment and chunked CE. The training workbench weights validation CE by the number of supervised tokens.
Long-context kernels and recurrent depth
- Both backends pass document boundaries into attention during recomputation. After cache eviction, the MLX sliding-window path aligns the document IDs of each query with the retained keys.
- PyTorch pretraining, SFT and the workbench use a loss-only forward when they can. With
ce_chunk_sizeenabled, the readout computes CE in FP32 chunks. Callers that request logits retain the full-output path. - PyTorch now supports query-blocked attention, per-block expansion of latent keys and values, chunked expert computation and feed-forward-only activation recomputation. The existing controls are
attention_block_size,mla_upproj_recompute,moe_chunk_tokensandrecompute_scope="mlp". - In
shared_firsttraining, later iterations of a multi-head latent attention (MLA) layer can reuse the first iteration's expanded keys and values. Each iteration computes fresh queries from its current hidden state, and generation continues to use the configured compressed cache. - PyTorch and MLX now agree on how routing losses weight recurrent dispatches, padding and partial cluster windows. The router still learns expert assignments from hidden states, and the lazy runtime still loads experts by page. Existing 0.3.5 checkpoints load directly and use the corrected gradient rules when training resumes on packed or padded data.
Verification on Apple M5 Max
| Measurement | Result |
|---|---|
| Packed MLX gradient check, recomputation on versus off | The worst per-parameter relative error fell from 2.30 in 0.3.5 to at most 6.4 × 10⁻⁷ across full and blocked attention. |
| BF16 forward and backward, 49.8M-parameter checkpoint | MLX GPU and PyTorch MPS produced finite, nonzero gradients at 16 × 512, 2 × 4,096 and 1 × 16,384 tokens. |
| Same checkpoint and input on both GPU backends | After 8,724 English source tokens, the highest-scoring token agreed at all 64 scored target positions. CE was 4.25786 on MLX and 4.26243 on PyTorch. |
| One recurrent MLA layer, three iterations at 16,384 tokens | The median forward-plus-backward time fell from 130.15 ms to 127.98 ms with projection reuse, a 1.7% reduction over seven timed samples per mode. |
The timing measures a single layer. Evaluating throughput and quality over a full training run requires a separate experiment. The regression suite also compares total loss and individual parameter gradients and checks paged inference against fully resident experts. Benchmark records and reproduction instructions · Changes since v0.3.5
Ten-seed MLX GPU training diagnostic
Four configurations compared 0.3.5 and 0.3.6 with whole-block recomputation enabled and disabled. Each configuration ran 10 initializations for 10,000 optimizer updates on the Apple M5 Max GPU. The four runs at each seed shared the initial weights and batch order on the synthetic packed-document retrieval task.
| Metric | 0.3.5 on | 0.3.6 on | 0.3.5 off | 0.3.6 off |
|---|---|---|---|---|
| Held-out accuracy, two pairs per document | 27.25% ± 6.71 pp | 98.53% ± 3.88 pp | 99.93% ± 0.10 pp | 99.20% ± 1.22 pp |
| Both queries correct on the same document | 1.65% ± 1.30 pp | 97.25% ± 8.31 pp | 99.78% ± 0.46 pp | 98.46% ± 2.55 pp |
| Three-pair extrapolation accuracy | 20.40% ± 5.06 pp | 55.54% ± 7.03 pp | 58.40% ± 6.88 pp | 55.35% ± 9.81 pp |
| Held-out cross-entropy | 1.808 ± 0.114 | 0.04995 ± 0.1234 | 0.00197 ± 0.001963 | 0.03333 ± 0.05041 |
Results are means ± sample standard deviations across ten seeds. Accuracy standard deviations are in percentage points. With recomputation enabled, the paired same-length accuracy difference for 0.3.6 versus 0.3.5 was +71.28 [+66.36, +76.13] percentage points (mean and 95% paired bootstrap interval). The enabled comparison favored 0.3.6 in all ten pairs. For the 0.3.6 on–off comparison, the difference was -0.67 [-3.31, +1.10] percentage points. The synthetic inputs contained 11 or 15 tokens. Individual trials, mean curves, architecture, and reproduction instructions