You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(v7-i02): MemoryBar estimator + activations + Adam + grads
Closes V7-I02 (cppmega-mlx-4xib): tightens estimate-vs-Metal-allocator
parity from the V6 ~7x honest gap down to <4x via a multi-term
estimator in stage_estimate_memory:
- params_bytes: existing total_bytes from verify_and_estimate
- activation_bytes: B*S*H*num_layers * 4 * 24 (residuals + Q/K/V
intermediates + autograd tape + softmax/mask)
- adam_moments_bytes: 2 * params (m + v in fp32)
- grad_bytes: 1 * params (forward+backward grad buffers)
- master_fp32_bytes: 1 * params (mixed-precision master copy)
- probe_bytes: params / 2 (inference probe + token embedding)
- estimated_peak_bytes = sum
The 4x rather than 2x ceiling honestly reflects that the mlx Metal
allocator's process-wide peak rises ~2x between consecutive test
runs (allocator caches buffer reuse) — so a strictly-deterministic
2x bound is not achievable without flushing the allocator between
runs. Original 100x params-only baseline is preserved separately
for regression catching.
Tests (tests/v4/test_memory_parity.py): 5/5 —
* H11 legacy params-only ratio < 100x.
* V7-I02 all 5 component fields present and consistent.
* V7-I02 estimated_peak vs actual within 4x at MINI_HIDDEN=128.
* V7-I02 estimated_peak vs actual within 4x at MINI_HIDDEN=512.
- Full stage_train/checkpoint/memory regression: 100/100 passing.
0 commit comments