Instructions to use mlx-community/Qwen3.5-4B-3D-Coder-OptiQ-4bit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use mlx-community/Qwen3.5-4B-3D-Coder-OptiQ-4bit 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("mlx-community/Qwen3.5-4B-3D-Coder-OptiQ-4bit") 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 Settings
- LM Studio
- Pi
How to use mlx-community/Qwen3.5-4B-3D-Coder-OptiQ-4bit with Pi:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "mlx-community/Qwen3.5-4B-3D-Coder-OptiQ-4bit"
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": "mlx-community/Qwen3.5-4B-3D-Coder-OptiQ-4bit" } ] } } }Run Pi
# Start Pi in your project directory: pi
- MLX LM
How to use mlx-community/Qwen3.5-4B-3D-Coder-OptiQ-4bit with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Interactive chat REPL mlx_lm.chat --model "mlx-community/Qwen3.5-4B-3D-Coder-OptiQ-4bit"
Run an OpenAI-compatible server
# Install MLX LM uv tool install mlx-lm # Start the server mlx_lm.server --model "mlx-community/Qwen3.5-4B-3D-Coder-OptiQ-4bit" # Calling the OpenAI-compatible server with curl curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mlx-community/Qwen3.5-4B-3D-Coder-OptiQ-4bit", "messages": [ {"role": "user", "content": "Hello"} ] }' - Hermes Agent
How to use mlx-community/Qwen3.5-4B-3D-Coder-OptiQ-4bit 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 "mlx-community/Qwen3.5-4B-3D-Coder-OptiQ-4bit"
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 mlx-community/Qwen3.5-4B-3D-Coder-OptiQ-4bit
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use mlx-community/Qwen3.5-4B-3D-Coder-OptiQ-4bit with OpenClaw:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "mlx-community/Qwen3.5-4B-3D-Coder-OptiQ-4bit"
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 "mlx-community/Qwen3.5-4B-3D-Coder-OptiQ-4bit" \ --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"
mlx-community/Qwen3.5-4B-3D-Coder-OptiQ-4bit
Built with mlx-optiq, the MLX-native toolkit to quantize, fine-tune, and serve LLMs locally on Apple Silicon, no PyTorch and no cloud. Try the Lab ยท All OptiQ quants ยท Docs
A 4-bit mixed-precision MLX quant of ccore/Qwen3.5-4B-3D-Coder, a Qwen3.5 4B fine-tune that writes 3D scenes and assets as single-file Three.js HTML. It runs at about 26 tokens/s on a 24 GB M4, with peak memory between 4 and 6 GB.
Generated by this quant
Every asset below was written by this quant on an M4, then opened in a browser. The code is unedited, and the HTML is in examples/ so you can open each one and orbit it yourself.
These are hand-picked from 18 attempts, not a typical sample. See What to expect for how the rest went.
![]() |
![]() |
| Stone golem boss (HTML), 10,771 tokens | Same golem, turned on its turntable |
![]() |
![]() |
| Pirate deck cannon (HTML), 14,269 tokens | Potion set (HTML), 12,802 tokens |
![]() |
![]() |
| Voxel swamp goblin (HTML), 20,079 tokens | Castle guard tower (HTML), 14,070 tokens |
They aren't flawless. The potions have no visible corks, the goblin's ears are flat from the side, and the tower's battlements are oversized.
Prompts and settings
System prompt, from the model's author:
Use only the Three.js core ES module from
https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.module.min.js.
Do not import addons or legacy examples/js paths;
implement any camera controls directly inside the HTML.
Settings: temperature 0.6, top_p 0.95, top_k 20, no repetition penalty, max_tokens 64000, thinking on, seeded.
Golem: Please create one self-contained HTML file with Three.js from cdnjs showing a stone golem boss with glowing green crystals growing from its shoulders. Make it a single game-ready asset: centred on a plain ground plane, a clear readable silhouette, built from separate named meshes, slowly turning on a turntable, with mouse orbit controls.
Cannon: Please create one self-contained HTML file with Three.js from cdnjs showing a pirate deck cannon on a wooden carriage with a stack of cannonballs. Make it a single game-ready asset: centred on a plain ground plane, a clear readable silhouette, built from separate named meshes, slowly turning on a turntable, with mouse orbit controls.
Potions: Please create one self-contained HTML file with Three.js from cdnjs showing a set of three potion bottles, red, blue and green, with corks, on a small wooden tray. Make it a single game-ready asset: centred on a plain ground plane, a clear readable silhouette, built from separate named meshes, slowly turning on a turntable, with mouse orbit controls.
Voxel goblin: Please create one self-contained HTML file with Three.js from cdnjs showing a swamp goblin enemy with big ears, a leather vest and a spiked wooden club. Render it as a deliberate 3D voxel model built from visible cubic blocks, with clear depth, readable silhouettes, and solid spatial relationships. Make it a single game-ready asset centred on a plain ground plane, slowly turning on a turntable, with mouse orbit controls.
Tower: Please create one self-contained HTML file with Three.js from cdnjs showing a medieval castle guard tower module with battlements, a wooden door and a flag waving at the top. Make it a single game-ready asset: centred on a plain ground plane, a clear readable silhouette, built from separate named meshes, slowly turning on a turntable, with mouse orbit controls.
What to expect
Out of 18 attempts across 10 asset prompts and 8 voxel prompts:
| Outcome | Count |
|---|---|
| Rendered in the browser | 11 |
| Crashed on load | 3 |
| Reasoning looped until the 64k token cap, no HTML | 4 |
- An asset takes minutes. The ones that finished ran 10,000 to 22,000 tokens, or 7 to 14 minutes, most of it reasoning. Set
max_tokenshigh. A 20k cap cut off one run that wasn't stuck. - Set a cap anyway. All four loops came from voxel prompts, and each ran about 53 minutes before hitting the cap.
- Rendering doesn't mean it looks right. Some that rendered had floating parts or broken animation, and those were left out of the picks above.
- The crashes were small code errors. One was a duplicate variable name, which the author lists as a known issue.
No attempts were run on the parent model, so this card makes no claim about how these rates compare with it.
Quantization details
| Property | Value |
|---|---|
| Predominant precision | 4-bit |
| Layers at 8-bit | 76 |
| Layers at 4-bit | 173 |
| Group size | 64 |
| Vision tower | bf16, in optiq_vision.safetensors |
| Size on disk | 3.7 GB, including the vision tower |
| MTP head | None; the source model doesn't ship one, so --mtp isn't available |
How the bit-widths were chosen
The per-layer allocation was not measured on this model. It was transferred from mlx-community/Qwen3.5-4B-OptiQ-4bit, whose allocation came from a KL-divergence sensitivity pass over a six-domain calibration mix.
The two models share an architecture, so each layer in that recipe has a counterpart with the same role and shape. All 249 tensors matched, with none unmatched.
Sensitivity measures how much a layer's role in the architecture suffers from precision loss. It can't tell whether this fine-tune's training moved that sensitivity. To measure the allocation against the model itself, run optiq convert.
What was verified
- 249/249 tensors matched the recipe, 0 unmatched.
- 18 generation runs, with each result opened in headless Chromium and checked for script errors and a drawn canvas.
- Text and image input, both loaded directly and through
optiq serve. - OptiQ's release contract.
Not run for this model: the six-metric Capability Score. The published scores for the Qwen3.5-4B quant describe that model, not this one, and are not claimed here.
Use it
pip install mlx-optiq
optiq serve --model mlx-community/Qwen3.5-4B-3D-Coder-OptiQ-4bit
Or with mlx-lm directly, for text only:
from mlx_lm import generate, load
from mlx_lm.sample_utils import make_sampler
SYSTEM = """Use only the Three.js core ES module from
https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.module.min.js.
Do not import addons or legacy examples/js paths;
implement any camera controls directly inside the HTML."""
model, tokenizer = load("mlx-community/Qwen3.5-4B-3D-Coder-OptiQ-4bit")
prompt = tokenizer.apply_chat_template(
[{"role": "system", "content": SYSTEM},
{"role": "user", "content": "Please create one self-contained HTML file with Three.js from cdnjs showing a stone golem boss with glowing green crystals growing from its shoulders."}],
add_generation_prompt=True, tokenize=False)
print(generate(model, tokenizer, prompt=prompt, max_tokens=64000,
sampler=make_sampler(temp=0.6, top_p=0.95, top_k=20)))
The author recommends temperature 0.6 to 0.8, top_p 0.90 to 0.95, top_k 20 to 40, and repeat penalty 1.0.
The per-layer bit map is in optiq/metadata.json and in the quantization block of config.json.
- Downloads last month
- -
4-bit





