Text Generation
MLX
Safetensors
English
qwen3_5
mlx-lm
apple-silicon
quantized
deep-research
agent
search
conversational
8-bit precision
Run this model with HF Jobs
Run VisualInference/DR-Tulu2-4B-MLX-8bit 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-8bit. 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-8bit 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-8bit. 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.
Instructions to use VisualInference/DR-Tulu2-4B-MLX-8bit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use VisualInference/DR-Tulu2-4B-MLX-8bit 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("VisualInference/DR-Tulu2-4B-MLX-8bit") 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 VisualInference/DR-Tulu2-4B-MLX-8bit with Pi:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "VisualInference/DR-Tulu2-4B-MLX-8bit"
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": "VisualInference/DR-Tulu2-4B-MLX-8bit" } ] } } }Run Pi
# Start Pi in your project directory: pi
- MLX LM
How to use VisualInference/DR-Tulu2-4B-MLX-8bit with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Interactive chat REPL mlx_lm.chat --model "VisualInference/DR-Tulu2-4B-MLX-8bit"
Run an OpenAI-compatible server
# Install MLX LM uv tool install mlx-lm # Start the server mlx_lm.server --model "VisualInference/DR-Tulu2-4B-MLX-8bit" # Calling the OpenAI-compatible server with curl curl -X POST "http://localhost:8080/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "VisualInference/DR-Tulu2-4B-MLX-8bit", "messages": [ {"role": "user", "content": "Hello"} ] }' - Hermes Agent
How to use VisualInference/DR-Tulu2-4B-MLX-8bit 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 "VisualInference/DR-Tulu2-4B-MLX-8bit"
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 VisualInference/DR-Tulu2-4B-MLX-8bit
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use VisualInference/DR-Tulu2-4B-MLX-8bit with OpenClaw:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "VisualInference/DR-Tulu2-4B-MLX-8bit"
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 "VisualInference/DR-Tulu2-4B-MLX-8bit" \ --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"
|
Download README.md from VisualInference/DR-Tulu2-4B-MLX-8bit: direct link, hf CLI and curl.
- Browser
- Download file 4.13 kB
-
https://huggingface.co/VisualInference/DR-Tulu2-4B-MLX-8bit/resolve/main/README.md
- Command line
-
hf download hf://VisualInference/DR-Tulu2-4B-MLX-8bit/README.md
-
curl -L -o README.md https://huggingface.co/VisualInference/DR-Tulu2-4B-MLX-8bit/resolve/main/README.md
4.13 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 | |
| - quantized | |
| - qwen3_5 | |
| - deep-research | |
| - agent | |
| - search | |
| # DR-Tulu2-4B for MLX, 8bit | |
| [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 a 8-bit quantized build for Apple silicon in | |
| [mlx-lm](https://github.com/ml-explore/mlx-lm) format: 4.19 GiB of weights, for any Apple silicon Mac with 8 GB or more. | |
| | Build | Weights | Bits per weight | Decode speed | Peak memory | | |
| |---|---|---|---|---| | |
| | [original](https://huggingface.co/allenai/DR-Tulu2-4B) (bf16, loaded as is) | 8.4 GiB | 16 | 28 tok/s | 8.0 GiB | | |
| | [4bit](https://huggingface.co/VisualInference/DR-Tulu2-4B-MLX-4bit) | 2.24 GiB | 4.50 | 89 tok/s | 2.5 GiB | | |
| | **8bit** (this repo) | 4.19 GiB | 8.50 | 51 tok/s | 4.4 GiB | | |
| Measured on one Mac mini (M4 Pro, 48 GB), mlx 0.32.5, greedy decoding: decode speed on a 23-token question with | |
| thinking off, 256-token limit; peak memory during the smoke tests below. Sizes are in GiB, the unit Mac memory comes in. | |
| Other model-watch lanes may add 6bit and bf16 builds; this table will link them when they are public. | |
| ## Use | |
| ```sh | |
| pip install -U mlx-lm | |
| mlx_lm.generate --model VisualInference/DR-Tulu2-4B-MLX-8bit \ | |
| --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-8bit") | |
| 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-8bit`. | |
| ### Settings that matter | |
| - **Thinking is on by default** and long: the model reasoned for about 2,000 to 4,000 tokens on short questions | |
| in the tests below, and the bf16 original does the same. Allow at least 4,096 output tokens per turn, 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 | |
| All linear layers of the language model quantized to 8-bit affine, groups of 64 (`mlx_lm.convert -q --q-bits 8 | |
| --q-group-size 64`, round to nearest). 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, against the bf16 original: | |
| - Code (merge overlapping intervals): correct function. | |
| - Arithmetic word problem (train moving time): 185 minutes, correct. | |
| - Translation to Spanish and Chinese: correct in both languages. The original reasons for 4,099 tokens on this prompt | |
| before answering; this build for 4,555. | |
| 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. | |
| - Tested on one machine (M4 Pro, 48 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. | |
| Quantization and this card: VisualInference. | |