MLX AutoQuant
mlx-autoquant converts a Hugging Face Transformers checkpoint to MLX, choosing the highest quantization precision that safely fits the current Apple-silicon Mac.
It reads your unified-memory capacity, profiles config.json and Hugging Face safetensors metadata, reserves memory for macOS and a KV cache, then calls the maintained mlx_lm.convert API.
Install
Install the released package from PyPI:
pip install mlx-autoquant
For local development:
python3 -m venv .venv
source .venv/bin/activate
pip install -e .
Use
Preview the decision without downloading weights. The context default is read from the model config and capped at 8192 tokens; pass --context-length to override it:
mlx-autoquant Qwen/Qwen2.5-7B-Instruct --dry-run
mlx-autoquant Qwen/Qwen2.5-7B-Instruct --dry-run --context-length 16384
Convert using the automatic decision:
mlx-autoquant Qwen/Qwen2.5-7B-Instruct --output ./Qwen2.5-7B-MLX
Use a larger expected context window, or take responsibility for a fixed precision:
mlx-autoquant Qwen/Qwen2.5-7B-Instruct --context-length 16384
mlx-autoquant Qwen/Qwen2.5-7B-Instruct --bits 4 --output ./Qwen-4bit
Add --json for machine-readable output. It includes every tested bit-width and whether it fits:
mlx-autoquant Qwen/Qwen2.5-7B-Instruct --dry-run --json
Conversions run an 8-token generation smoke test after quantization. Use
--no-verify to skip it, or --verify-tokens 16 to generate more tokens.
Each completed conversion writes autoquant-report.json next to the MLX model. It records the detected machine, the model dimensions, the selected bits, and the memory assumptions. Parameter counts come from Hugging Face's safetensors metadata; when a repository has no safetensors weights, the tool falls back to an estimate from config.json and labels it as such.
Errors are printed to stderr with a non-zero exit code instead of a traceback. Downloads are cached under ~/.cache/mlx-autoquant; set HF_HOME to move the Hugging Face cache, and HF_TOKEN to authenticate private or gated models.
During a real conversion you get two progress indicators: an aggregate bar while the weights download, then an activity bar while the model is quantized. The verification result and peak MLX memory are written to autoquant-report.json.
Design boundaries
- Apple silicon only: MLX does not run on other hardware.
- Supports standard Transformers checkpoints with
config.json; remote code is opt-in. - A 15% conversion/sharding allowance and a 25% (minimum 4 GiB) system reserve make the automatic choice conservative.
- The user can always choose
--bits, but the command intentionally displays the resulting plan first. - Without safetensors weights, parameter counts are estimates; the report and summary mark them as estimated.
Development
python3 -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"
ruff check src tests # lint
ruff format --check src tests # format
mypy src/mlx_autoquant # type check
pytest # tests
make coverage # test coverage
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mlx_autoquant-0.2.0.tar.gz.
File metadata
- Download URL: mlx_autoquant-0.2.0.tar.gz
- Upload date:
- Size: 15.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e57420398d24ad5ed60b94dd22ef74b4c571791e74819974a2b50de5cba4c07b
|
|
| MD5 |
f2cbed9409f421ffb897292a0e9f3d61
|
|
| BLAKE2b-256 |
de6646bd90a67c22b6649bb6609ad7b7580db3b0d4b4bd6a98a41ae46efebf5e
|
Provenance
The following attestation bundles were made for mlx_autoquant-0.2.0.tar.gz:
Publisher:
release.yml on asmit404/mlx-autoquant
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mlx_autoquant-0.2.0.tar.gz -
Subject digest:
e57420398d24ad5ed60b94dd22ef74b4c571791e74819974a2b50de5cba4c07b - Sigstore transparency entry: 2440704000
- Sigstore integration time:
-
Permalink:
asmit404/mlx-autoquant@49d807734092000fbb3e69030a85bd86f5172ea0 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/asmit404
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@49d807734092000fbb3e69030a85bd86f5172ea0 -
Trigger Event:
push
-
Statement type:
File details
Details for the file mlx_autoquant-0.2.0-py3-none-any.whl.
File metadata
- Download URL: mlx_autoquant-0.2.0-py3-none-any.whl
- Upload date:
- Size: 12.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0d7fee7cef59470483fd4df51e106c6e26484c4b18bc7aadd9de25dd951624d9
|
|
| MD5 |
c964138feff3a927320a8f69798d5a3f
|
|
| BLAKE2b-256 |
77d934fdaff6e64ae8857b156ea58f10ec40beedc5418eec8f5412ba43671496
|
Provenance
The following attestation bundles were made for mlx_autoquant-0.2.0-py3-none-any.whl:
Publisher:
release.yml on asmit404/mlx-autoquant
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mlx_autoquant-0.2.0-py3-none-any.whl -
Subject digest:
0d7fee7cef59470483fd4df51e106c6e26484c4b18bc7aadd9de25dd951624d9 - Sigstore transparency entry: 2440704042
- Sigstore integration time:
-
Permalink:
asmit404/mlx-autoquant@49d807734092000fbb3e69030a85bd86f5172ea0 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/asmit404
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@49d807734092000fbb3e69030a85bd86f5172ea0 -
Trigger Event:
push
-
Statement type: