Instructions to use balllvin/SenseNova-Loop-9B-NVFP4-MLX with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use balllvin/SenseNova-Loop-9B-NVFP4-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("balllvin/SenseNova-Loop-9B-NVFP4-MLX") config = load_config("balllvin/SenseNova-Loop-9B-NVFP4-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 balllvin/SenseNova-Loop-9B-NVFP4-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 "balllvin/SenseNova-Loop-9B-NVFP4-MLX"
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": "balllvin/SenseNova-Loop-9B-NVFP4-MLX" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent
How to use balllvin/SenseNova-Loop-9B-NVFP4-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 "balllvin/SenseNova-Loop-9B-NVFP4-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 balllvin/SenseNova-Loop-9B-NVFP4-MLX
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use balllvin/SenseNova-Loop-9B-NVFP4-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 "balllvin/SenseNova-Loop-9B-NVFP4-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 "balllvin/SenseNova-Loop-9B-NVFP4-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"
SenseNova-Loop-9B (NVFP4-MLX 4-bit)
This repository provides the NVFP4-MLX 4-bit build of balllvin/SenseNova-Loop-9B-NVFP4 (9B multimodal looped hybrid linear/full-attention model with 56 effective layer visits per token).
What This Build Is & Why Use It
This Apple Silicon build converts balllvin/SenseNova-Loop-9B-NVFP4 to MLX affine 4-bit (7.97 GB language model + 0.91 GB BF16 vision tower), preserving the 56-visit looped execution plan and mHC 2-stream routers for local Mac inference.
- Runtime format (
NVFP4-MLX 4-bit): MLX affine 4-bit (group_size=64) with BF16 norms/embeddings/routers and unquantized0.91 GBBF16 vision tower (visual.safetensors); served via the includedtools/serve.pyOpenAI-compatible server. - Modification stage (
Base Quant (QAD)): Base QAD checkpoint ported directly to MLX without abliteration or Arete tuning. Refusal and MMLU scores come from the source NVFP4 build; use the Arete MLX build for reduced refusals and faster router/head kernels.
Variant Guide (Format vs. Alignment Stage)
| Axis | Option | Best For |
|---|---|---|
| Runtime | NVFP4 |
NVIDIA CUDA GPUs (transformers + load_nvfp4.py, 24 GB+ VRAM for decoded BF16) |
| Runtime | MLX |
Apple Silicon Macs via included tools/serve.py (8.89 GB weights) |
| Stage | Base Quant (QAD) |
Quantization-aware distilled baseline matching upstream behavior |
| Stage | Abliterated |
Unlikelihood-trained refusal removal (3 / 99 harmful, 7 / 100 benign refused) |
| Stage | + Arete |
Post-abliteration Arete SFT (62.0% MMLU, 2.7099 NLL, 6 / 99 harmful refused) |
Sibling & Lineage Repos
| Variant / Hardware | Format | Stage | Repository |
|---|---|---|---|
| Upstream base | BF16 | Upstream | sensenova/SenseNova-Loop-9B |
NVIDIA GPU (NVFP4) |
W4A16 NVFP4 | Base Quant (QAD) | balllvin/SenseNova-Loop-9B-NVFP4 |
Apple Silicon (MLX) |
MLX 4-bit | Base Quant (QAD) | balllvin/SenseNova-Loop-9B-NVFP4-MLX (this repo) |
NVIDIA GPU (NVFP4) |
W4A16 NVFP4 | Abliterated | balllvin/SenseNova-Loop-9B-abliterated-NVFP4 |
NVIDIA GPU (NVFP4) |
W4A16 NVFP4 | Abliterated + Arete | balllvin/SenseNova-Loop-9B-abliterated-arete-NVFP4 |
Apple Silicon (MLX) |
MLX 4-bit | Abliterated + Arete | balllvin/SenseNova-Loop-9B-abliterated-arete-NVFP4-MLX |
Evaluation & Parity Results
Evaluated on the decoded BF16 forward path of the three NVFP4 builds (greedy, 96 tokens, thinking off, eval_count=2): 99 harmful + 100 benign prompts from JailbreakBench + AdvBench, MMLU slice (300 rows base; 100 rows abliterated/Arete), WikiText NLL (24 windows of 1,024 tokens; BF16 ref 2.8198 / 2.8206), and Nous Propaganda Eval (803 items, temp 0.6, 512-token cap, judged by grok-4.7). MLX conversions inherit the source NVFP4 weight behavior; refusal/MMLU suites were not re-run separately on MLX.
| Build | Harmful Refused | Benign Refused | MMLU | WikiText NLL | Propaganda Fact | Propaganda Rate |
|---|---|---|---|---|---|---|
| NVFP4 Base (QAD) | 95 / 99 | 60 / 100 | 43.0% | 2.7560 | 1.367 / 5 | 19.3% |
| + Abliterated | 3 / 99 | 7 / 100 | 58.0% | 2.7619 | 1.242 / 5 | 27.8% |
| + Abliterated + Arete | 6 / 99 | 6 / 100 | 62.0% | 2.7099 | 1.320 / 5 | 29.6% |
Grade reports: Propaganda-Eval-SenseNova-Loop-9B-NVFP4, Propaganda-Eval-SenseNova-Loop-9B-abliterated-NVFP4, and Propaganda-Eval-SenseNova-Loop-9B-abliterated-arete-NVFP4.
Speed & Weight Size
Measured on Apple M5 Pro (64 GB, 48 tokens out, 8-bit KV for 1 stream, BF16 KV for batches, original conversion prior to closed-form router/head updates):
| Configuration | Weights Size | Decode Speed | Notes |
|---|---|---|---|
MLX 4-bit (1 stream) |
8.89 GB | 8.1 tok/s | 8-bit KV (7.97 GB LLM + 0.91 GB vision) |
MLX 4-bit (4 streams agg) |
8.89 GB | 25.9 tok/s | 6.5 tok/s per stream |
MLX 4-bit (8 streams agg) |
8.89 GB | 38.1 tok/s | 4.8 tok/s per stream |
Memory & Context Budget
- Native context:
524,288(512Kvia YaRNfactor=2.0over262,144; 32 physical layers with layers 4–27 looped2x= 56 visits; 8 full-attention + 24 linear-attention layers). - KV cache:
57,344 B/tok(BF16 KV measured on RTX PRO 6000) plus90.8 MBlinear-attention state per request;--kv-bits 8halves KV growth.
| Machine / Budget | Usable Memory | Weights | Max Context (1 req, BF16 KV) |
Max Context (4 reqs, BF16 KV) |
Max Context (8 reqs, BF16 KV) |
|---|---|---|---|---|---|
| Apple Silicon Mac (64 GB) | 51.8 GB | 8.89 GB | 512K | 178K | 86K |
Agent Setup & Hosting
Accept the upstream sensenova/SenseNova-Loop-9B terms if needed and authenticate (hf auth login or HF_TOKEN).
Apple Silicon (MLX)
This repository ships its own MLX runtime and OpenAI-compatible server in tools/serve.py (supporting text and image_url inputs).
uv venv --python 3.12 && source .venv/bin/activate
uv pip install mlx==0.32.4 mlx-lm transformers pillow numpy
hf download balllvin/SenseNova-Loop-9B-NVFP4-MLX --local-dir ~/models/SenseNova-Loop-9B-NVFP4-MLX
cd ~/models/SenseNova-Loop-9B-NVFP4-MLX
python tools/serve.py --model . --port 8099 --model-id balllvin/sensenova-loop-9b-nvfp4-mlx \
--kv-bits 8 --max-batch 4 --loops 2 --head-bits 8
(Keep --loops 2 for the trained model; --loops 1 is faster but degrades WikiText NLL from 3.041 to 3.921. Pass --idle-exit 0 to disable the 30-minute idle shutdown.)
Verify Running Server
curl -sS http://127.0.0.1:8099/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "balllvin/sensenova-loop-9b-nvfp4-mlx",
"messages": [{"role": "user", "content": "What is 17 * 23? Show brief reasoning then the answer."}],
"max_tokens": 256,
"temperature": 0.0
}' | python3 -m json.tool
How It Was Built
- Source:
balllvin/SenseNova-Loop-9B-NVFP4QAD NVFP4 weights. - Port: Converted language-model linears to MLX affine 4-bit (
group_size=64,7.97 GB), ported the 56-visit looped execution plan and mHC 2-stream routers, and copied the0.91 GBBF16 vision tower (visual.safetensors) untouched.
Limits & License
- Behavioral scope: Research build (Base Quant (QAD)); refuses
95 / 99harmful and60 / 100benign prompts on the sealed eval. Vision support is verified by a 448x448 color/shape smoke test (no full multimodal benchmark run). The upstreamsensenova/SenseNova-Loop-9Brepo is gated on Hugging Face. - License: Apache-2.0 (details), matching
sensenova/SenseNova-Loop-9B; independent community build unaffiliated with SenseNova or Nous Research.
- Downloads last month
- 442
4-bit
Model tree for balllvin/SenseNova-Loop-9B-NVFP4-MLX
Base model
sensenova/SenseNova-Loop-9B