This tutorial helps users deploy and run large language models locally on Apple Silicon Macs using the native [MLX-LM](https://github.com/ml-explore/mlx-lm) framework. ## πŸ”§ Environment Setup ```bash # Create Conda virtual environment conda create -n mlx-lm python=3.11 conda activate mlx-lm # Install dependencies pip install -r requirements.txt ``` ## πŸ“ Project Structure ``` models_mlx/ β”œβ”€β”€ run_app_gradio.py # Gradio interactive app (download + chat) β”œβ”€β”€ requirements.txt # Python dependencies β”œβ”€β”€ configs/ # Model configs (JSON, hot-reloadable) β”‚ └── model_info/ β”‚ β”œβ”€β”€ mlx.json # MLX quantized model list β”‚ └── original.json # Original HuggingFace model list β”œβ”€β”€ modules/ # Functional modules β”‚ └── download_model.py # Model download module (standalone runnable) β”œβ”€β”€ models/ # Downloaded model storage β”œβ”€β”€ notebooks/ # Jupyter Notebook tutorials β”‚ β”œβ”€β”€ Qwen3_MLX_ιƒ¨η½²δΈŽδΊ€δΊ’.ipynb β”‚ └── Qwen3_Transformers_ιƒ¨η½²δΈŽδΊ€δΊ’.ipynb └── docs/ # Documentation └── MLX-LM_Intro.md # MLX framework introduction ``` ## πŸ“– Tutorials ### Theory
β€’ MLX Framework Introduction
### Notebook Tutorials | Notebook | Description | |----------|-------------| | [Qwen3_MLX_ιƒ¨η½²δΈŽδΊ€δΊ’](./notebooks/Qwen3_MLX_ιƒ¨η½²δΈŽδΊ€δΊ’.ipynb) | Deploy Qwen3 with MLX (recommended for Apple Silicon) | | [Qwen3_Transformers_ιƒ¨η½²δΈŽδΊ€δΊ’](./notebooks/Qwen3_Transformers_ιƒ¨η½²δΈŽδΊ€δΊ’.ipynb) | Deploy Qwen3 with Transformers (universal compatibility) | ### Gradio Interactive App An all-in-one web interface for model downloading and chatting: - **Model Download**: Three-level selection (Company β†’ Series β†’ Model) with local existence detection - **Model Chat**: Supports both MLX and Transformers backends; MLX supports streaming output - **Parameter Tuning**: Temperature, Top-p, Max Tokens, Thinking mode - **Hot Reload**: Edit JSON configs in `configs/`, then refresh the page or click the refresh button ```bash python run_app_gradio.py ``` ### CLI Model Download You can also download models via an interactive command-line interface (no Gradio needed): ```bash python -m modules.download_model ``` ## πŸš€ Supported Models Model lists are configured via JSON files in the `configs/` directory. | Company | Series | Models | |---------|--------|-----------------------| | Alibaba | QwQ | `QwQ-0.5B-4bit` | | Alibaba | Qwen1.5 | `Qwen1.5-0.5B-Chat-4bit`
`Qwen1.5-1.8B-Chat-4bit`
`Qwen1.5-MoE-A2.7B-4bit`
`Qwen1.5-MoE-A2.7B-Chat-4bit` | | Alibaba | Qwen2 | `Qwen2-0.5B-Instruct-4bit`
`Qwen2-1.5B-4bit`
`Qwen2-1.5B-Instruct-4bit` | | Alibaba | Qwen2-Math | `Qwen2-Math-1.5B-Instruct-4bit` | | Alibaba | Qwen2.5 | `Qwen2.5-0.5B-4bit`
`Qwen2.5-0.5B-Instruct-4bit`
`Qwen2.5-1.5B-4bit`
`Qwen2.5-1.5B-Instruct-4bit`
`Qwen2.5-3B-4bit`
`Qwen2.5-3B-Instruct-4bit` | | Alibaba | Qwen2.5-Coder | `Qwen2.5-Coder-0.5B-4bit`
`Qwen2.5-Coder-0.5B-Instruct-4bit`
`Qwen2.5-Coder-1.5B-4bit`
`Qwen2.5-Coder-1.5B-Instruct-4bit`
`Qwen2.5-Coder-3B-4bit`
`Qwen2.5-Coder-3B-Instruct-4bit` | | Alibaba | Qwen2.5-Math | `Qwen2.5-Math-1.5B-4bit`
`Qwen2.5-Math-1.5B-Instruct-4bit` | | Alibaba | Qwen3 | `Qwen3-0.6B-4bit`
`Qwen3-0.6B-Base-4bit`
`Qwen3-1.7B-4bit` | | Alibaba | Qwen3.5 | `Qwen3.5-0.8B-4bit`
`Qwen3.5-2B-4bit` | | DeepSeek | DeepSeek-R1 | `DeepSeek-R1-Distill-Qwen-1.5B-4bit` | | DeepSeek | DeepSeek-V3 | - | | Google | Gemma-2 | `gemma-2-2b-4bit`
`gemma-2-2b-it-4bit`
`gemma-2-2b-jpn-it-4bit`
`gemma-2-baku-2b-it-4bit` | | Google | Gemma-3 | `gemma-3-1b-it-4bit`
`gemma-3-1b-pt-4bit`
`gemma-3-270m-4bit`
`gemma-3-270m-it-4bit` | | Meta | Llama-3.1 | - | | Meta | Llama-3.2 | `Llama-3.2-1B-Instruct-4bit`
`Llama-3.2-3B-Instruct-4bit` | | Meta | Llama-4 | - | | Microsoft | Phi-2 | `phi-2-super-4bit` | | Microsoft | Phi-4 | - | | Mistral | Mistral | `Ministral-3-3B-Instruct-2512-4bit`
`Ministral-3-3B-Reasoning-2512-4bit` | | Moonshot | Kimi | - | To add new models, simply edit `configs/model_info/mlx.json` or `configs/model_info/original.json`.