Inspect statically
Read configs, safetensors headers, project files, licenses, and remote-code risks before trusting any model code.
Apple MLX porting runbook
MLX Porter gives engineers and agents a concrete path from PyTorch modules, checkpoints, and local MLX code to verified Apple Silicon implementations.
MLX Porter turns model archaeology, checkpoint mapping, parity debugging, and Apple Silicon tuning into an ordered workflow an agent can execute without inventing the plan from scratch.
Read configs, safetensors headers, project files, licenses, and remote-code risks before trusting any model code.
Route the work to the right playbook: decoder, ASR, diffusion, audio, VLM, SSM, MoE, graph, CV, or a new gap.
Freeze source behavior, capture intermediate tensors, and make correctness debuggable before the MLX rewrite begins.
Start with the smallest readable MLX graph. Keep compile, kernels, quantization, and batching out until parity holds.
Account for every weight, pass parity, profile the real bottleneck, then change one optimization dimension at a time.
Point the skill at a local port, served app, notebook, or converted checkpoint. It maps what is already there, what is still unproven, and what is worth improving next.
Find MLX packages, module surfaces, eval boundaries, compile regions, fast attention, caches, quantization, custom kernels, and risk flags.
Name the missing proof first: source oracle, parity evidence, benchmark metadata, cache policy, quantization path, or intake blocker.
Promote novel local patterns only when they come with fixtures, parity checks, benchmark receipts, rollback notes, and an affected runbook.
Run this against a local project. Add --model when the checkpoint should be inspected in the same report.
python3 mlx-model-porting/scripts/inspect_mlx_project.py /path/to/mlx-project \ --model /path/to/local-model \ --markdown MLX_INSPECTION.md \ --output inspection.json
A large cloud model may discover these moves on the fly. MLX Porter packages them into a step-by-step runbook that smaller open models and local agents can follow reliably.
mlx-model-porting/SKILL.md stays small and routes the agent to the exact reference files and scripts for the current model.
Architecture families, technique states, evidence depth, and benchmark receipts live where agents can read them.
Unsupported formats, missing keys, unreviewed remote code, and parity drift are blockers, not excuses to improvise.
MLX Porter lives in the repo: a skill contract, reference runbooks, structured assets, and scripts that generate inspection reports, port plans, parity checks, and benchmark receipts.
Point at a model folder or local MLX project and get JSON/Markdown evidence instead of vibes.
Turn model metadata into a family route, runbook, weight-map requirements, and parity ladder.
Run source validation, tensor comparison, and benchmark commands before claiming an optimization.
Use the generated artifacts as handoff packets for an agent or as a checklist for a human port.
S=mlx-model-porting/scripts python3 $S/inspect_model.py \ /path/to/model \ --output inspection.json python3 $S/make_port_plan.py \ inspection.json \ --output PORT_PLAN.md python3 $S/recommend_optimizations.py \ inspection.json \ --markdown OPTIMIZATIONS.md python3 $S/inspect_mlx_project.py \ /path/to/mlx-project \ --markdown MLX_INSPECTION.md
A pasted module, a checkpoint, an ASR block, or a diffusion component should not get generic advice. Each start maps to an oracle, weight map, parity ladder, and optimization gate.
QKV maps, RoPE, masks, KV cache, and fast SDPA once tensor parity is clean.
Static safetensors intake, deterministic transforms, and no silent missing keys.
Waveform, log-mel, encoder states, token IDs, WER/CER, and timestamp checks.
One denoiser timestep, scheduler math, and a fixed-seed latent trajectory.
Humans can skim the path; agents can run it. Start with the skill contract, then follow the family runbook, inspector, and validation scripts.
Test the routing, planning, recommendation, source validation, and golden scenarios without downloading a real model.
python3 mlx-model-porting/scripts/inspect_model.py tests/fixtures/models/decoder --output /tmp/inspection.json python3 mlx-model-porting/scripts/make_port_plan.py /tmp/inspection.json --output /tmp/PORT_PLAN.md python3 mlx-model-porting/scripts/recommend_optimizations.py /tmp/inspection.json --markdown /tmp/OPTIMIZATIONS.md python3 mlx-model-porting/scripts/audit_skill.py --strict mlx-model-porting python3 -m unittest discover -s tests -v
Source provenance, project inspection, eager MLX, parity, profiling, and measured Apple Silicon optimization in one repeatable path.