Run this model with HF Jobs
Run VisualInference/Qwen4-35B-A3B-MLX-2bit-24GB on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/VisualInference/Qwen4-35B-A3B-MLX-2bit-24GB. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/VisualInference/Qwen4-35B-A3B-MLX-2bit-24GB on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Evaluate on a benchmark
Use HF Jobs to evaluate https://huggingface.co/VisualInference/Qwen4-35B-A3B-MLX-2bit-24GB. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.
Instructions to use VisualInference/Qwen4-35B-A3B-MLX-2bit-24GB with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use VisualInference/Qwen4-35B-A3B-MLX-2bit-24GB with MLX:
# Make sure mlx-vlm is installed # pip install --upgrade mlx-vlm from mlx_vlm import load, generate from mlx_vlm.prompt_utils import apply_chat_template from mlx_vlm.utils import load_config # Load the model model, processor = load("VisualInference/Qwen4-35B-A3B-MLX-2bit-24GB") config = load_config("VisualInference/Qwen4-35B-A3B-MLX-2bit-24GB") # Prepare input image = ["http://images.cocodataset.org/val2017/000000039769.jpg"] prompt = "Describe this image." # Apply chat template formatted_prompt = apply_chat_template( processor, config, prompt, num_images=1 ) # Generate output output = generate(model, processor, formatted_prompt, image) print(output) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Pi
How to use VisualInference/Qwen4-35B-A3B-MLX-2bit-24GB with Pi:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "VisualInference/Qwen4-35B-A3B-MLX-2bit-24GB"
Configure the model in Pi
# Install Pi: npm install -g @earendil-works/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "mlx-lm": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "VisualInference/Qwen4-35B-A3B-MLX-2bit-24GB" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent
How to use VisualInference/Qwen4-35B-A3B-MLX-2bit-24GB 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 "VisualInference/Qwen4-35B-A3B-MLX-2bit-24GB"
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 VisualInference/Qwen4-35B-A3B-MLX-2bit-24GB
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use VisualInference/Qwen4-35B-A3B-MLX-2bit-24GB with OpenClaw:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "VisualInference/Qwen4-35B-A3B-MLX-2bit-24GB"
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:8080/v1 \ --custom-model-id "VisualInference/Qwen4-35B-A3B-MLX-2bit-24GB" \ --custom-provider-id mlx-lm \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
Qwen4-35B-A3B for MLX, sized for 24 GB Macs
For Macs with 24 GB of memory. Qwen4-35B-A3B is Qwen's hybrid linear/sparse-attention mixture-of-experts model (35B parameters, 3B active, plus a 20B n-gram embedding; text, image and video in, text out; Apache 2.0). This is a mixed-precision build in mlx-vlm format: 13.6 GiB of weights stay in memory, and the 9.5 GiB n-gram table is read from the SSD a few rows per token.
Why it fits
20.5B of the model's 56.8B parameters are one n-gram embedding table at layer 2. Each token reads 16 rows of it
(about 64 bytes each). MLX builds that keep the table in the safetensors load all of it into memory, which is why a
plain 3-bit build (24.8 GB) does not fit a 32 GB Mac. This build stores the table as one row file
(ple-q3.rows) that mlx-vlm memory-maps through text_config.ple_storage in config.json. Nothing extra to set:
load() picks it up. Memory holds the experts, attention, embeddings and vision tower; the table stays on disk
and in the file cache, which macOS can drop under pressure.
| Build | Mac | In memory | n-gram table (SSD) | Routed experts | Decode | Peak memory, short prompt |
|---|---|---|---|---|---|---|
| 2bit-24GB (this repo) | 24 GB | 13.6 GiB | 9.5 GiB | 2-bit gate/up, 3-bit down; first and last two layers 3-bit | 50–56 tok/s | 13.8 GiB |
| 4bit-36GB | 36 GB | 22.0 GiB | 11.9 GiB | 4-bit gate/up, 5-bit down; first and last two layers 6-bit | 48–59 tok/s | 22.2 GiB |
Measured on a MacBook Pro (M5 Max, 36 GB), mlx 0.32.5, mlx-vlm 0.8.2 (commit bb224121), greedy, short prompt.
The 32 GB build from the same job is Qwen4-35B-A3B-MLX-3bit-32GB.
Held-out loss against bf16 and task scores: coming.
Use
pip install -U "git+https://github.com/Neywa-Labs/mlx-vlm"
mlx_vlm.generate --model VisualInference/Qwen4-35B-A3B-MLX-2bit-24GB --max-tokens 2048 \
--prompt "Write a Python function that merges overlapping intervals."
Add --image photo.jpg for image input. In Python:
from mlx_vlm import load, generate
from mlx_vlm.prompt_utils import apply_chat_template
model, processor = load("VisualInference/Qwen4-35B-A3B-MLX-2bit-24GB")
prompt = apply_chat_template(processor, model.config, "Why is the sky blue?")
print(generate(model, processor, prompt, max_tokens=2048).text)
Qwen4 support and ple_storage are on mlx-vlm's main branch, newer than the 0.8.2 release on PyPI, so install from
source. Tested at commit bb224121.
Settings that matter
- Thinking. Qwen4 thinks by default (
reasoning_effort="high"). Passenable_thinking=False(CLI:--no-enable-thinking) or a lowerreasoning_effortto the chat template for direct answers. Thinking counts againstmax_tokens. - Sampling. Qwen recommends temperature 1.0, top_p 0.95, top_k 20 with thinking; temperature 0.7, top_p 0.8, top_k 20, presence penalty 1.5 without. The checks below use temperature 0.
- SSD. The n-gram table is read from wherever the Hugging Face cache lives. Keep it on the internal SSD.
What was changed
| Part of the model | Parameters | This build |
|---|---|---|
| Routed experts, gate and up projections, layers 2-37 | 19.3B | 2-bit, groups of 64 (2.5 bits per weight) |
| Routed experts, down projections, layers 2-37 | 9.7B | 3-bit, groups of 64 (3.5 bits per weight) |
| Routed experts, layers 0, 1, 38, 39 | 3.2B | 3-bit, groups of 64 |
| n-gram embedding table (on SSD) | 20.5B | 3-bit, groups of 32 (4 bits per weight) |
| Linear-attention projections | 1.0B | 4-bit; decay and gate inputs 8-bit |
| Sparse-attention projections and indexer | 0.29B | 6-bit |
| Gated-residual (hyper-connection) projections | 0.34B | 8-bit |
| Shared expert | 0.13B | 6-bit |
| Router and shared-expert gate | 0.02B | 8-bit |
| Token embedding / output head | 0.51B / 0.51B | 4-bit / 6-bit |
| Vision tower | 0.45B | bf16, unchanged |
| Norms, convolutions, n-gram projections | small | bf16 / 6-bit |
Affine quantization, round to nearest, bf16 scales. config.json lists every module's bits. The MTP drafter
(2B parameters) is not included; mlx-vlm does not load it as part of the base model.
Checks
Greedy, thinking off, on this build as uploaded:
| Check | Result |
|---|---|
| Code: interval merge | correct, idiomatic sort-and-sweep function |
| Reasoning: 4 pens at $3 + 3 notebooks at $5, change from $50 (23) | thinking on: 23, correct. Thinking off: wrote 20, then recalculated to 23 in the same answer |
| Translation to Spanish and Chinese | correct: «La biblioteca abre a las nueve de la mañana.» / «图书馆早上九点开门。» |
| Image: read "MLX 42", name the shapes and colours | read "MLX 42", red circle on the left, blue square on the right: correct |
These separate a working build from a broken one; they are not benchmarks.
Limitations
- Held-out loss and task scores are not measured yet.
- Peak memory was measured on one machine; the 24 GB guidance follows from it and was not run on a 24 GB Mac.
- Low-bit experts cost quality; if your Mac has more memory, use the larger build.
Credits and licence
Model and weights: the Qwen team, Apache 2.0 (LICENSE included), see the
original card. MLX runtime: the mlx-vlm authors. Quantization and this card:
VisualInference.
- Downloads last month
- 1,288
4-bit
Model tree for VisualInference/Qwen4-35B-A3B-MLX-2bit-24GB
Base model
Qwen/Qwen4-35B-A3B