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.

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"). Pass enable_thinking=False (CLI: --no-enable-thinking) or a lower reasoning_effort to the chat template for direct answers. Thinking counts against max_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
Safetensors
Model size
35B params
Tensor type
U32
·
BF16
·
I64
·
MLX
Hardware compatibility
Log In to add your hardware

4-bit

Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for VisualInference/Qwen4-35B-A3B-MLX-2bit-24GB

Quantized
(816)
this model

Collection including VisualInference/Qwen4-35B-A3B-MLX-2bit-24GB