Text Generation
MLX
Safetensors
qwen3_5
apple-silicon
speculative-decoding
qwen
qwen3
mtp
mtplx
local-ai
q8
8-bit precision
conversational
Instructions to use Youssofal/Qwen3.5-4B-Optimized-MTPLX with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use Youssofal/Qwen3.5-4B-Optimized-MTPLX with MLX:
# Make sure mlx-lm is installed # pip install --upgrade mlx-lm # Generate text with mlx-lm from mlx_lm import load, generate model, tokenizer = load("Youssofal/Qwen3.5-4B-Optimized-MTPLX") prompt = "Write a story about Einstein" messages = [{"role": "user", "content": prompt}] prompt = tokenizer.apply_chat_template( messages, add_generation_prompt=True ) text = generate(model, tokenizer, prompt=prompt, verbose=True) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- LM Studio
- Pi new
How to use Youssofal/Qwen3.5-4B-Optimized-MTPLX with Pi:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "Youssofal/Qwen3.5-4B-Optimized-MTPLX"
Configure the model in Pi
# Install Pi: npm install -g @mariozechner/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "mlx-lm": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "Youssofal/Qwen3.5-4B-Optimized-MTPLX" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent new
How to use Youssofal/Qwen3.5-4B-Optimized-MTPLX with Hermes Agent:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "Youssofal/Qwen3.5-4B-Optimized-MTPLX"
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default Youssofal/Qwen3.5-4B-Optimized-MTPLX
Run Hermes
hermes
- MLX LM
How to use Youssofal/Qwen3.5-4B-Optimized-MTPLX with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Interactive chat REPL mlx_lm.chat --model "Youssofal/Qwen3.5-4B-Optimized-MTPLX"
Run an OpenAI-compatible server
# Install MLX LM uv tool install mlx-lm # Start the server mlx_lm.server --model "Youssofal/Qwen3.5-4B-Optimized-MTPLX" # Calling the OpenAI-compatible server with curl curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Youssofal/Qwen3.5-4B-Optimized-MTPLX", "messages": [ {"role": "user", "content": "Hello"} ] }'
| { | |
| "arch_id": "qwen3-next-mtp", | |
| "artifact_role": "small-q8-speed-test", | |
| "base_trunk": "mlx-community/Qwen3.5-4B-MLX-8bit", | |
| "exactness_baseline": { | |
| "artifact": "/Users/youssof/.mtplx/qwen35_4b_q8trunk_mtp1_gate.json", | |
| "gate": "mtp1-greedy-ar-equivalence", | |
| "max_tokens": 16, | |
| "matches": 1, | |
| "scope": "greedy AR and MTP1 generated identical token sequence on the warm_code_continuation prompt", | |
| "seed": 0, | |
| "status": "passed", | |
| "total": 1 | |
| }, | |
| "mtp_depth_max": 2, | |
| "mtp_sidecar": "official Qwen/Qwen3.5-4B MTP tensors; quantization recorded in config.json", | |
| "mtplx_version": "0.1.0-preview", | |
| "recommended_draft_lm_head": { | |
| "bits": 4, | |
| "group_size": 64, | |
| "mode": "affine" | |
| }, | |
| "recommended_draft_sampler": { | |
| "temperature": 0.7, | |
| "top_k": 20, | |
| "top_p": 0.95 | |
| }, | |
| "recommended_profile": "performance-cold", | |
| "sampler": { | |
| "temperature": 0.6, | |
| "top_k": 20, | |
| "top_p": 0.95 | |
| }, | |
| "speed_evidence": { | |
| "acceptance_by_depth": [ | |
| 0.7647058823529411, | |
| 0.47058823529411764 | |
| ], | |
| "accepted_drafts": 21, | |
| "ar_tok_s": 75.62701983984475, | |
| "artifact": "/Users/youssof/.mtplx/qwen35_4b_depth_grid_q8_body4_draftt0p7.json", | |
| "draft_lm_head": "8-bit tied embedding requantized as 4-bit affine group64 draft head", | |
| "draft_temperature": 0.7, | |
| "enable_thinking": false, | |
| "generated_tokens": 48, | |
| "mtp_depth": 2, | |
| "mtp_tok_s": 105.20912101297236, | |
| "note": "Q8 trunk gives the best multiplier in the local one-prompt matrix, but the Q4 trunk remains faster in absolute tok/s.", | |
| "sampler": { | |
| "temperature": 0.6, | |
| "top_k": 20, | |
| "top_p": 0.95 | |
| }, | |
| "speedup_vs_ar": 1.391157832686963 | |
| }, | |
| "verified_on": { | |
| "hardware": "Apple Silicon local MTPLX workstation", | |
| "machine_arch": "arm64", | |
| "model": "Qwen3.5-4B-MTPLX-Optimized-Speed-Q8Trunk", | |
| "timestamp": "2026-05-04T06:17:00+0100" | |
| } | |
| } | |