Instructions to use leonsarmiento/Nex-N2-mini-5bit-mlx with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use leonsarmiento/Nex-N2-mini-5bit-mlx 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("leonsarmiento/Nex-N2-mini-5bit-mlx") config = load_config("leonsarmiento/Nex-N2-mini-5bit-mlx") # 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 leonsarmiento/Nex-N2-mini-5bit-mlx with Pi:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "leonsarmiento/Nex-N2-mini-5bit-mlx"
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": "leonsarmiento/Nex-N2-mini-5bit-mlx" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent new
How to use leonsarmiento/Nex-N2-mini-5bit-mlx 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 "leonsarmiento/Nex-N2-mini-5bit-mlx"
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 leonsarmiento/Nex-N2-mini-5bit-mlx
Run Hermes
hermes
- OpenClaw new
How to use leonsarmiento/Nex-N2-mini-5bit-mlx with OpenClaw:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "leonsarmiento/Nex-N2-mini-5bit-mlx"
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 "leonsarmiento/Nex-N2-mini-5bit-mlx" \ --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"
⚠️ DEPRECATED — Recommended: leonsarmiento/Nex-N2-mini-5bit-XL-mlx
This model has been superseded by the BaseQuant_XL variant, which keeps routing-critical layers (MoE router gate, shared expert, lm_head) in full bf16 precision for improved quality. Benchmark comparisons are available in the XL model card.
leonsarmiento/Nex-N2-mini-5bit-mlx
This model was converted to MLX format from nex-agi/Nex-N2-mini using mixed 5/8-bit quantization optimized for Apple Silicon. The vision encoder is preserved and quantized at 5-bit, making this a full multimodal model.
Nex-N2-mini is a 35B-parameter MoE (Mixture of Experts) model fine-tuned from Qwen3.5-35B-A3B-Base by Nex-AGI, featuring 256 experts (8 active per token + 1 shared expert), hybrid full + linear (Gated DeltaNet) attention, an "Agentic Thinking" framework (Adaptive Thinking + Coherent Thinking), and a vision encoder for multimodal input. Despite 35B total parameters, only ~3B are activated per token for efficient inference.
Benchmark Highlights (5-bit, text-only tests)
| Benchmark | Nex-N2-mini 5-bit | Qwen3.6-27B (SOTA) | Qwen3.6-35B-A3B |
|---|---|---|---|
| HumanEval (n=30) | 90.0% | 93.3% | 66.7% |
| MBPP (n=30) | 76.7% | — | — |
Nex-N2-mini narrows the gap to Qwen3.6-27B on coding benchmarks while maintaining a 3B-active MoE speed advantage.
Use with mlx
pip install -U mlx-vlm
python -m mlx_vlm.generate --model leonsarmiento/Nex-N2-mini-5bit-mlx --max-tokens 256 --temperature 0.7 --top-p 0.95 --prompt "Hello"
Mixed Quantization Strategy
| Bit Depth | Layers | Rationale |
|---|---|---|
| 8-bit | embed_tokens, lm_head, router gate, shared_expert_gate, shared_expert, self_attn (full attention), linear_attn (DeltaNet) |
Every token passes through these — routing accuracy, shared representation, and sequence modeling are non-negotiable |
| 5-bit | vision_tower, switch_mlp (routed experts) |
Bulk of parameters, only 8 of 256 experts active per token — natural redundancy tolerates lower precision |
Quantization Details
| Layer | Bits | Group Size |
|---|---|---|
embed_tokens |
8 | 64 |
lm_head |
8 | 64 |
mlp.gate (router) |
8 | 64 |
shared_expert_gate |
8 | 64 |
shared_expert |
8 | 64 |
self_attn (full attention) |
8 | 64 |
linear_attn (DeltaNet) |
8 | 64 |
vision_tower |
5 | 64 |
switch_mlp (routed experts) |
5 | 64 |
| Default fallback | 8 | 64 |
- Bits per weight: 5.750
- Total size: ~24 GB (5 shards)
- Quantization type: Mixed 5/8-bit (multimodal, vision preserved)
- Group size: 64
- Method: Custom
quant_predicateviamlx_vlm
Recommended Inference Parameters
| Parameter | Value |
|---|---|
temperature |
0.7 |
top_p |
0.95 |
top_k |
40 |
min_p |
0.01 |
repeat_penalty |
1.05 |
Note: This is a Qwen3.5-based model —
preserve_thinkingis not applicable.
- Downloads last month
- 90
5-bit
Model tree for leonsarmiento/Nex-N2-mini-5bit-mlx
Base model
nex-agi/Nex-N2-mini