Skip to content

Bump mlx to 0.32.4 and nanobind to 3.1.0 - #41

Open
Wildebeest wants to merge 1 commit into
recursive-oss:mainfrom
Wildebeest:bump-mlx-0.32.4
Open

Wildebeest wants to merge 1 commit into
recursive-oss:mainfrom
Wildebeest:bump-mlx-0.32.4

Conversation

@Wildebeest

Copy link
Copy Markdown

Summary

Upgrades mlx from 0.32.0 to 0.32.4 and nanobind from 2.13.0 to 3.1.0:

  1. mlx==0.32.4 (engine/pyproject.toml):
    • Picks up Apple Silicon Metal (g13–g16 + M5 g17 NAX) kernel improvements between 0.32.0 and 0.32.4, including faster quantized MoE (SwitchGLU) / gather_qmm / SDPA prefill kernels, the Metal concurrent fence deadlock fix (ml-explore/mlx#3469), and the NAX >32K prompt token integer-overflow fix (ml-explore/mlx#3492).
  2. nanobind==3.1.0 (engine/pyproject.toml):
    • mlx==0.32.4 wheels are built against nanobind 3.1.0 (ml-explore/mlx#3512). Bumping the build-system requirement from 2.13.0 to 3.1.0 keeps engine/native/grammar_native.cpp's nb::ndarray type-caster ABI matched with libmlx.
  3. Immutable mx.random.state compatibility (engine/src/rec_mlx/kernels/masked_sampling.py, engine/tests/validate_resident.py):
    • In mlx>=0.32.2 (ml-explore/mlx#3495), mx.random.state returns a read-only tuple rather than a mutable list, so mx.random.state[0] = key raises TypeError: 'tuple' object does not support item assignment.
    • Restoring a 2×uint32 Threefry key [hi, lo] via mx.random.seed((int(hi) << 32) | int(lo)) constructs the identical mx.random.key state (mx.array([hi, lo], dtype=mx.uint32)) and preserves exact EOS RNG truncation parity.

Benchmarks & Testing

Measured on flint-int4 (Apple Silicon Metal, 64 GB unified memory, 128-token greedy decode after cold prefill):

Prompt Tokens mlx==0.32.0 TTFT mlx==0.32.4 TTFT mlx==0.32.0 Prefill mlx==0.32.4 Prefill Prefill Speedup
1,024 (warm) 1.89 s 1.46 s 546.6 tok/s 716.2 tok/s +31.0%
4,096 (rep 0) 7.10 s 5.71 s 578.1 tok/s 719.5 tok/s +24.5%
4,096 (rep 1) 7.07 s 5.79 s 580.7 tok/s 708.7 tok/s +22.0%
8,192 (rep 0) 15.14 s 12.24 s 541.6 tok/s 670.1 tok/s +23.7%
8,192 (rep 1) 15.03 s 12.27 s 545.5 tok/s 668.9 tok/s +22.6%

Tested:

  • cd engine && .venv/bin/pytest -v -rs: 66 passed, 1 skipped (including native _grammar_native C++ extension rebuild and m4_max_prefill Metal kernel compilation check)
  • make test-engine runtime packaging (packaging/build-mlx-runtime.py on standalone CPython 3.12.12, tests/smoke_test.py, and tests/protocol_test.py): all passed
  • engine/tests/validate_resident.py: 61 / 61 numerical parity cases, 9 / 9 EOS truncation RNG checks, and 3 / 3 cancellation checks pass
  • uvx ruff@0.17.1 check and uvx ruff@0.17.1 format --check: clean

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