Run this model with HF Jobs

Run VisualInference/DR-Tulu2-4B-MLX-bf16 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/DR-Tulu2-4B-MLX-bf16. 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/DR-Tulu2-4B-MLX-bf16 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/DR-Tulu2-4B-MLX-bf16. 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.
VisualInference's picture
DR-Tulu2-4B MLX bf16
f7a6bfb verified
|
Raw History Blame Contribute Delete
4.8 kB
---
license: apache-2.0
license_link: https://www.apache.org/licenses/LICENSE-2.0
base_model: allenai/DR-Tulu2-4B
base_model_relation: quantized
library_name: mlx
pipeline_tag: text-generation
language:
- en
tags:
- mlx
- mlx-lm
- apple-silicon
- bf16
- qwen3_5
- deep-research
- agent
- search
---
# DR-Tulu2-4B for MLX, bf16
[DR-Tulu2-4B](https://huggingface.co/allenai/DR-Tulu2-4B) is Ai2's 4B-parameter Deep Research agent, trained with
reinforcement learning from Qwen3.5-4B to answer questions by searching, reading and reasoning over many turns
(Apache 2.0). This repository is the unquantized bf16 weights converted for Apple silicon in
[mlx-lm](https://github.com/ml-explore/mlx-lm) format: 7.83 GiB of weights, for Macs with 16 GB of memory or more.
| Build | Weights | Bits per weight | Decode speed | Peak memory | Measured on |
|---|---|---|---|---|---|
| [original](https://huggingface.co/allenai/DR-Tulu2-4B) (bf16, loaded as is) | 8.4 GiB | 16 | 28 tok/s | 8.0 GiB | Mac mini M4 Pro, 48 GB |
| [4bit](https://huggingface.co/VisualInference/DR-Tulu2-4B-MLX-4bit) | 2.24 GiB | 4.50 | 89 tok/s | 2.5 GiB | Mac mini M4 Pro, 48 GB |
| [6bit](https://huggingface.co/VisualInference/DR-Tulu2-4B-MLX-6bit) | 3.18 GiB | 6.50 | 92 tok/s | 3.4 GiB | MacBook Pro M5 Max, 36 GB |
| [8bit](https://huggingface.co/VisualInference/DR-Tulu2-4B-MLX-8bit) | 4.19 GiB | 8.50 | 51 tok/s | 4.4 GiB | Mac mini M4 Pro, 48 GB |
| **bf16** (this repo) | 7.83 GiB | 16 | 46 tok/s | 8.1 GiB | MacBook Pro M5 Max, 36 GB |
Greedy decoding, mlx 0.32.5. Decode speed: a 23-token question with thinking off, 256-token limit (median of 3 runs
for the laptop rows). Peak memory: during the smoke tests below. The 4bit, 8bit and original rows were measured on a
Mac mini and the 6bit and bf16 rows on a MacBook Pro, so compare speeds within a machine, not across. Another job
shared the laptop's GPU during part of the laptop runs; its speeds may be a little low. Sizes are in GiB, the unit
Mac memory comes in.
## Use
```sh
pip install -U mlx-lm
mlx_lm.generate --model VisualInference/DR-Tulu2-4B-MLX-bf16 \
--prompt "Write a Python function that merges overlapping intervals." --max-tokens 4096
```
```python
from mlx_lm import load, generate
model, tokenizer = load("VisualInference/DR-Tulu2-4B-MLX-bf16")
prompt = tokenizer.apply_chat_template(
[{"role": "user", "content": "Why is the sky blue?"}], add_generation_prompt=True, tokenize=False
)
print(generate(model, tokenizer, prompt=prompt, max_tokens=4096))
```
For the agent loop itself (search and web tools), see Ai2's code: [github.com/allenai/dr-tulu2](https://github.com/allenai/dr-tulu2).
An OpenAI-compatible server: `mlx_lm.server --host 127.0.0.1 --port 8080 --model VisualInference/DR-Tulu2-4B-MLX-bf16`.
### Settings that matter
- **Thinking is on by default** and long: this build reasoned for 707, 1,788 and 4,795 tokens
on the three short prompts below. Allow at least 4,096 output tokens per turn (6,000 for safety), or pass
`--chat-template-config '{"enable_thinking": false}'` to skip it.
- The chat template, tokenizer and generation config are Ai2's files, unchanged.
## What was changed
No quantization: Ai2's bf16 weights, converted to MLX format (`mlx_lm.convert --dtype bfloat16`). Use it as the reference for the quantized builds, or when memory is not a constraint. The checkpoint also carries a Qwen3.5 vision tower, which Ai2 does not use (the model takes text in) and
mlx-lm does not load; it is not included. Built from upstream revision `bde87918a225`.
## Validation
Three fixed prompts with the chat template, greedy, thinking on, 6,000-token limit:
- Code (merge overlapping intervals): correct function, 707 tokens.
- Arithmetic word problem (14 pencils at 3 for $0.75): $3.50, correct, 1,788 tokens.
- Translation to Spanish and Chinese: correct in both languages, 4,795 tokens. With thinking off: the same
Spanish sentence and 图书馆上午九点开门。
Not measured yet: held-out loss against the original, task sets (GSM8K, HumanEval), tool-call checks, and peak
memory at long prompts. Coming.
## Limitations
- Ai2's notes apply: the model is meant to be used as a Deep Research agent with search tools, not for open-ended
coding or answers from its own knowledge alone. English only.
- Greedy decoding with thinking on can reason past 4,000 tokens on simple prompts; cap output tokens.
- Tested on one machine (MacBook Pro, M5 Max, 36 GB).
## Credits and licence
Model and weights: Allen Institute for AI (Ai2), Apache 2.0 (`LICENSE` in this repository), see the
[original card](https://huggingface.co/allenai/DR-Tulu2-4B) and Ai2's
[Responsible Use Guidelines](https://allenai.org/responsible-use). Base model: Qwen3.5-4B by the Qwen team.
Conversion and this card: VisualInference.