MLX LM
$ mlx_lm Official Low RiskMLX LM (mlx_lm) is Apple's official toolkit for running, quantizing (mlx_lm convert -q), LoRA fine-tuning, and serving (mlx_lm server) LLMs on Apple Silicon unified memory. It supports deterministic generation flags (--temp 0.0, --seed, --max-tokens) and Hugging Face model pulls.
pip install mlx-lm mlx_lm compiles and runs Apple Metal GPU kernels locally on unified memory; it is strictly a host-local compute CLI.
Agent-Readiness Checklist
Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.
FCRS-1.0 6-Dimension Breakdown
Clean non-interactive mlx_lm.generate and mlx_lm.convert flags with --seed and --max-tokens, though outputs are plain text without a --json flag.
mlx_lm.generatesupports--prompt,--max-tokens,--temp, and--seed- No native
--jsonCLI output flag
Local Apple Silicon execution; --upload-repo on convert is strictly opt-in.
- Local unified-memory execution with opt-in Hugging Face uploads
Strictly limited to macOS on Apple Silicon (arm64); unavailable on Linux, Windows, or Intel Macs.
- Requires Apple Silicon macOS hardware
Fastest native inference, 4-bit quantization, and LoRA fine-tuning workflow on Apple Silicon Macs.
- Native Metal acceleration for inference, quantization, and LoRA tuning
Official Apple MLX repository (ml-explore/mlx-lm) under MIT license.
- Official
ml-explore/mlx-lmrepo (MIT)
Well-maintained README and subcommand --help pages.
- Clear CLI documentation in repository README and
--help
Security, Auth & Guardrails
No auth needed for public models; gated Hugging Face repos read HF_TOKEN or ~/.cache/huggingface/token.
MIT open-source Python package from Apple MLX; requires an Apple Silicon Mac (M1/M2/M3/M4+).
# MLX LM Agent Rules - Always pass `--max-tokens` on `mlx_lm.generate` and avoid `mlx_lm.chat` or `mlx_lm.server` in synchronous calls. - Omit `--upload-repo` on `mlx_lm.convert` unless explicitly asked to publish weights to Hugging Face.
Agent-Ready Command Recipes
Safe Read-Only Queries
mlx_lm.generate --help
Prints supported model, sampling, seed, and token-limit flags without downloading weights.
mlx_lm.generate --model mlx-community/Llama-3.2-3B-Instruct-4bit --prompt "List 3 HTTP status codes." --max-tokens 64 --temp 0.0
Generates a bounded greedy-decoded completion locally on Apple Silicon.
Controlled Writes & Previews
mlx_lm.convert --hf-path Qwen/Qwen2.5-1.5B-Instruct -q --q-bits 4 -o ./mlx_model
Downloads and quantizes Hugging Face weights into a local ./mlx_model directory without uploading.
Strengths for Agents
- + First-party Apple Silicon Metal acceleration for local inference, quantization, and LoRA fine-tuning.
- + Supports reproducible
--temp 0.0and--seedflags inmlx_lm.generate.
Caveats & Pitfalls
- ! Restricted exclusively to Apple Silicon macOS machines.
- ! Lacks a native
--jsonoutput mode on CLI commands.