Run this model with HF Jobs

Run xquantize/nemotron-labs-dory1.0-4b-mlx-6bit 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/xquantize/nemotron-labs-dory1.0-4b-mlx-6bit. 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/xquantize/nemotron-labs-dory1.0-4b-mlx-6bit 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/xquantize/nemotron-labs-dory1.0-4b-mlx-6bit. 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.

Dory 1.0 4B, MLX 6-bit, with a measured guide to its loop dial

A 6-bit MLX build of NVIDIA's Nemotron-Labs Dory 1.0 4B for Apple Silicon (3.0 GB, 6.5 bits per weight), plus measurements of what Dory's looped architecture actually costs and buys you on a Mac.

Dory is a looped language model: a shared block of 20 layers can run 1, 2 or 4 times per token. More loops make it smarter without adding parameters, but slower. This card measures that trade-off across bf16, 8-bit, 6-bit and 4-bit builds.

Dory architecture

Findings at a glance

  • Loops help, with diminishing returns. Prediction loss (bf16) falls from 1.450 at k=1 to 1.403 at k=2 and 1.388 at k=4. The first extra loop gains three times more than the next two combined.
  • Loops cost speed, not memory. Generation runs at about 66% speed at k=2 and 39% at k=4, at every precision. At short context, memory barely changes.
  • Spend on loops before precision. 4-bit at k=2 matched bf16 at k=1 on prediction loss (1.4501 vs 1.4501), running 2x faster in under a third of the memory.
  • Quantization error compounds with loops, but only at 4-bit. 8-bit and 6-bit stay flat across k; 4-bit drifts 13% further from bf16 between k=1 and k=4.
  • last_loop cache mode currently uses more memory, not less, at 8,000 tokens (details below).

Quick start

Dory is not in a released version of mlx-lm yet. Install the pull request that adds it (ml-explore/mlx-lm#1988):

pip install "git+https://github.com/ml-explore/mlx-lm.git@refs/pull/1988/head"
from mlx_lm import load, generate
from mlx_lm.sample_utils import make_sampler

# n_recurrent_loops sets k: 1 (fastest), 2 (default), 4 (smartest)
model, tokenizer = load(
    "xquantize/nemotron-labs-dory1.0-4b-mlx-6bit",
    model_config={"n_recurrent_loops": 2},
)

messages = [{"role": "user", "content": "How many positive integers below 1000 are divisible by 7 but not 11?"}]
prompt = tokenizer.apply_chat_template(messages, add_generation_prompt=True, tokenize=False)

# NVIDIA recommends temperature 1.0, top-p 0.95
out = generate(model, tokenizer, prompt=prompt, max_tokens=4096,
               sampler=make_sampler(temp=1.0, top_p=0.95))
print(out.split("</think>")[-1].strip())   # the model reasons first; keep only the answer

Dory is a reasoning model and often writes 1,000+ tokens of thinking before answering, so give it a generous max_tokens.

Choosing k on this build

k Speed Peak memory Good for
1 39.1 tok/s 3.40 GB Quick replies, simple tasks
2 25.7 tok/s 3.42 GB Default balance
4 15.1 tok/s 3.46 GB Hard reasoning, when speed matters less

Measured on an M3 Pro (18 GB), 128-token generations from a short prompt.

Loops vs precision

Speed vs prediction loss

Each line is one build, each dot one loop setting. Moving up means better predictions; moving right means faster. The 6-bit line sits close to the top-right edge: at k=2 it predicts about as well as bf16 at k=2 while running 2.3x faster.

Does quantization error compound with loops?

Quantization error vs loops

In a normal model each quantized layer runs once. In Dory the 20 recurrent blocks reuse the same quantized weights k times, so their error could build up. Each build was compared to bf16 at the same k. At 8-bit and 6-bit there is no measurable build-up. At 4-bit, KL divergence rises from 0.113 to 0.128 and the loss gap to bf16 widens from 0.036 to 0.054: the error does accumulate, but only matters when it is large to begin with.

Same question, three loop settings

How many positive integers less than 1000 are divisible by 7 but not by 11? (answer: 130). Greedy decoding, 6-bit build.

k Thinking + answer tokens Time Answer
1 1,316 35.1 s 130 ✓
2 1,288 52.8 s 130 ✓
4 1,022 70.0 s 130 ✓

More loops meant 22% fewer tokens of reasoning, since each token does more work, but each token also costs more, so k=4 still took twice as long here. One question only, so this is an illustration rather than a benchmark.

KV cache modes

KV cache modes

The mlx-lm implementation offers two cache modes:

  • per_loop (default) keeps a separate KV cache for each loop. At 8,000 tokens it grew from 0.42 GB (k=1) to 0.65 GB (k=2) to 1.11 GB (k=4). Those ratios match what the architecture predicts from its sliding windows to within 1%.
  • last_loop keeps one cache for the looped block, but in the current implementation it also gives every attention layer a full cache, including the 16 input and output blocks that never loop. The 27 sliding-window layers then store all 8,000 tokens instead of 1,024, so it used 1.21 GB at every k: more than per_loop even at k=4. Only the recurrent layers should need a full cache in this mode.

Output quality in last_loop mode stayed very close to per_loop (99.8% top-1 agreement, KL 0.0017), but those test passages were shorter than the 1,024-token window, so long-context behaviour in this mode is untested.

How this was measured

Everything was run with bench_dory.py, included in this repo:

  • Prediction loss, KL and top-1 agreement: 6 short passages (prose, science, Python, a maths word problem, a how-to, geology), processed in 64-token chunks through the KV cache. Each quantized build is compared with bf16 at the same k.
  • Speed and memory: 128 generated tokens after a warm-up, per build and k.
  • Cache modes: the 6-bit build with an 8,000-token prompt.
  • Environment: Apple M3 Pro, 18 GB; mlx 0.32.2; mlx-lm 0.32.3.dev3 at PR #1988.

Limitations

These are small tests from one Mac, meant as a practical guide rather than a benchmark. Loss differences under about 0.01 are within noise. Speeds will differ on other chips and at longer contexts. For the model's intended use, training and safety evaluation, see NVIDIA's model card.

Other MLX builds

  • bf16 and 8-bit: netprojects, from the author of the mlx-lm Dory port
  • 4-bit and NVIDIA's NVFP4 weights for mlx-swift: smdesai

Credits and license

Model by NVIDIA, released under the OpenMDW License 1.1, which this build keeps. MLX implementation from ml-explore/mlx-lm#1988 by pmichalas. Conversion, measurements and figures by xquantize.

Downloads last month
106
Safetensors
Model size
4B params
Tensor type
U32
·
BF16
·
MLX
Hardware compatibility
Log In to add your hardware

6-bit

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

Model tree for xquantize/nemotron-labs-dory1.0-4b-mlx-6bit

Quantized
(15)
this model