Instructions to use duckwork-ai/mallard-2b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use duckwork-ai/mallard-2b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="duckwork-ai/mallard-2b") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("duckwork-ai/mallard-2b") model = AutoModelForCausalLM.from_pretrained("duckwork-ai/mallard-2b", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use duckwork-ai/mallard-2b with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf duckwork-ai/mallard-2b:Q4_K_M # Run inference directly in the terminal: llama cli -hf duckwork-ai/mallard-2b:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf duckwork-ai/mallard-2b:Q4_K_M # Run inference directly in the terminal: llama cli -hf duckwork-ai/mallard-2b:Q4_K_M
Build from source code
git clone https://github.com/ggml-org/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-app # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama serve -hf duckwork-ai/mallard-2b:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama cli -hf duckwork-ai/mallard-2b:Q4_K_M
Use Docker
docker model run hf.co/duckwork-ai/mallard-2b:Q4_K_M
- Llama new
- LM Studio
- Jan
- vLLM
How to use duckwork-ai/mallard-2b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "duckwork-ai/mallard-2b" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "duckwork-ai/mallard-2b", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/duckwork-ai/mallard-2b:Q4_K_M
- SGLang
How to use duckwork-ai/mallard-2b with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "duckwork-ai/mallard-2b" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "duckwork-ai/mallard-2b", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "duckwork-ai/mallard-2b" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "duckwork-ai/mallard-2b", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use duckwork-ai/mallard-2b with Ollama:
ollama run hf.co/duckwork-ai/mallard-2b:Q4_K_M
- Unsloth Desktop
- Pi
How to use duckwork-ai/mallard-2b with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf duckwork-ai/mallard-2b:Q4_K_M
Configure the model in Pi
# Install Pi: npm install -g @earendil-works/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:9931/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "duckwork-ai/mallard-2b:Q4_K_M" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Docker Model Runner
How to use duckwork-ai/mallard-2b with Docker Model Runner:
docker model run hf.co/duckwork-ai/mallard-2b:Q4_K_M
- Lemonade
How to use duckwork-ai/mallard-2b with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull duckwork-ai/mallard-2b:Q4_K_M
Run and chat with the model
lemonade run user.mallard-2b-Q4_K_M
List all available models
lemonade list
- Hermes Agent
How to use duckwork-ai/mallard-2b with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf duckwork-ai/mallard-2b:Q4_K_M
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:9931/v1 hermes config set model.default duckwork-ai/mallard-2b:Q4_K_M
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use duckwork-ai/mallard-2b with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf duckwork-ai/mallard-2b:Q4_K_M
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:9931/v1 \ --custom-model-id "duckwork-ai/mallard-2b:Q4_K_M" \ --custom-provider-id llama-cpp \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
Mallard 2B
Mallard 2B is the model behind Duckwork, a macOS app you think out loud to, like explaining a problem to a rubber duck. It is Qwen3.5-2B, fine-tuned to be a good listener in a voice app: short spoken answers, the right tool at the right moment, and a question back when what it heard was cut off.
Outside Duckwork it behaves like Qwen3.5-2B: on open benchmarks it stays within 2 points of its base everywhere except on prompts that require another language (see English only below).
| Base | Qwen3.5-2B, text model only |
| Parameters | 1.63B (Qwen3.5-2B text model: 2.27B) |
| Vocabulary | 95,232 tokens, English and code (Qwen3.5: 248,320) |
| Thinking | off; every number here is measured with thinking off |
| Licence | Apache-2.0, as its base |
Files in this repo: bf16 safetensors (3.26 GB) for transformers and vLLM, and GGUF files for llama.cpp and Ollama. The MLX build Duckwork runs is in duckwork-ai/mallard-2b-mlx-6bit.
Choices made on purpose
- English only. The vocabulary keeps the 95,232 tokens English, code and Duckwork need, with every merge they use and all 256 byte tokens, so any text still encodes and every English prompt splits exactly as in Qwen3.5. Other languages still work byte by byte, but slowly and weakly. Mallard answers in English and says once that it only speaks English. This removes 28% of the parameters and makes generation about 17% faster.
- Text only. Qwen3.5's vision encoder (about 300M parameters) is removed. Training never touched it, so the original can be attached again.
- Little formatting inside Duckwork. Duckwork speaks its answers, so with Duckwork's instructions Mallard answers in short plain sentences: no bold, headings or tables, and plain numbered lines only when asked for steps. Without those instructions it formats like Qwen3.5.
- Thinking off. Duckwork runs without thinking, so the model was trained and measured that way. The numbers are not comparable with Qwen's own card, which mostly reports thinking mode.
Benchmarks
All measured by us on the trimmed release model and on Qwen3.5-2B in the same setup, thinking off, greedy.
Open benchmarks
| Qwen3.5-2B | Mallard 2B | ||
|---|---|---|---|
| IFEval (prompt level, loose) | 70.6 | 66.7 | โ3.9 |
| IFEval without the 31 prompts that require another language | 69.2 | 67.8 | โ1.4 |
| IFBench | 29.0 | 27.3 | โ1.7 |
| MMLU-Pro | 51.3 | 50.8 | โ0.6 |
| GPQA Diamond | 39.4 | 38.4 | โ1.0 |
| BFCL non-live (AST) | 61.1 | 60.3 | โ0.7 |
| BFCL live | 71.0 | 72.2 | +1.2 |
| BFCL multi-turn | 13.8 | 14.0 | +0.3 |
| BFCL relevance | 87.5 | 87.5 | 0 |
| BFCL irrelevance | 73.3 | 75.6 | +2.3 |
IFEval, MMLU-Pro and GPQA Diamond with lm-evaluation-harness, IFBench with its own scorer, BFCL with bfcl-eval in function-calling mode.
Two checks that these measurements are sound:
- BFCL depends a lot on the setup (prompt format, how tool calls are read). We ran Qwen3-4B-Instruct-2507, a model Berkeley publishes official BFCL results for, through the same setup: our numbers are within 0.7 points of Berkeley's in four of five categories.
- IFEval measured a second time with an independent tool (Inspect): without the language prompts, Mallard is 0.8 points behind Qwen3.5-2B there (lm-evaluation-harness: 1.4).
Duckwork's tasks
324 held-out moments from Duckwork sessions, each checked automatically: the right tool or none, no formatting in spoken answers, a word limit, no pretending to see a screen, and so on.
| What the moment needs | Qwen3.5-2B | Mallard 2B |
|---|---|---|
| A spoken thinking-partner reply | 1 | 22 |
| A follow-up in a back-and-forth | 1 | 22 |
| No tool, although it sounds like one | 2 | 20 |
| Steps or a list, explicitly asked for | 4 | 22 |
| A written summary of a session | 10 | 22 |
| Non-English input | 8 | 22 |
| Who are you? | 11 | 19 |
| Something from an earlier session | 20 | 20 |
| A cut-off sentence pointing to an earlier session (search it) | 6 | 20 |
| A cut-off sentence with nothing to look up (ask back) | 5 | 13 |
| Look something up in connected docs | 8 | 21 |
| Use a connected app's tool | 17 | 19 |
| An action only mentioned (ask first) | 13 | 19 |
| Time, dates, sums, units (use the tools) | 13 | 21 |
| Hand-written checks | 11 | 15 |
| Total | 130 / 324 | 297 / 324 |
Each kind has 22 moments (hand-written: 16). The median spoken answer is 44 words, against Qwen3.5-2B's 92. Qwen3.5-2B searched past sessions needlessly 72 times, Mallard 10 times; each acted without asking 3โ4 times.
Which file to use
| File | Size | Duckwork's tasks | |
|---|---|---|---|
| bf16 safetensors | 3.26 GB | 297 | transformers, vLLM |
mallard-2b-Q8_0.gguf |
1.74 GB | 297 | |
mallard-2b-Q6_K.gguf |
1.34 GB | 298 | recommended for llama.cpp and Ollama |
mallard-2b-Q4_K_M.gguf |
1.06 GB | 286 | little memory; calls a tool a little too eagerly |
mallard-2b-bf16.gguf |
3.26 GB | for your own quantizations | |
| MLX 6-bit | 1.2 GB | 294 | Apple silicon; what Duckwork runs |
GGUF scores through llama.cpp's server, MLX scores with mlx-lm on an M4. Avoid 4-bit MLX: it halves the tool calls (259 of 324). Group size 32 and mixed 4/6-bit did not help; 6-bit keeps them.
The GGUF files split every test prompt exactly as Qwen3.5-2B's own GGUF does. Like every Qwen3.5 GGUF, they split escaped quotes slightly differently from the Hugging Face tokenizer; this comes from llama.cpp, not from the trimming.
Speed on a Mac
Measured on a MacBook Air with an M4 (10 cores, 24 GB) with mlx-lm, nothing else running. 72 moments from Duckwork's tasks, asked one at a time as the app asks them: 4 of each of the 14 kinds above and 16 hand-written ones. Each prompt is what Duckwork sends (its instructions, the tool descriptions and what was said), typically 1,561 tokens, from 255 to 2,472. Greedy, thinking off.
| Mallard 2B (MLX 6-bit) | Qwen3.5-2B (MLX 4-bit) | |
|---|---|---|
| Until the first word (median / slowest 10%) | 2.3 s / 3.1 s | 2.6 s / 3.1 s |
| Reading the prompt | 726 tokens/s | 632 tokens/s |
| Writing the answer | 65 tokens/s | 81 tokens/s |
| Whole answer (median / slowest 10%) | 3.0 s / 4.5 s | 3.7 s / 5.7 s |
| Answer length (median) | 40 tokens | 90 tokens |
| Peak memory | 2.5 GB | 2.3 GB |
| Loading the model | 0.6 s | 1.3 s |
| Duckwork's tasks passed | 63 of 72 | 26 of 72 |
Mallard starts sooner, because its smaller vocabulary makes reading the prompt faster, and finishes sooner, because its answers are shorter. It writes about 20% slower than Qwen's 4-bit build, the price of 6 bits, which is still some 20 times faster than speech. Duckwork reads its instructions while you are still talking, so in the app the first word comes sooner than measured here.
Use
transformers (a version with Qwen3.5 support):
from transformers import AutoModelForCausalLM, AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained("duckwork-ai/mallard-2b")
model = AutoModelForCausalLM.from_pretrained("duckwork-ai/mallard-2b", dtype="bfloat16")
messages = [{"role": "user", "content": "um so I keep going back and forth on whether to rewrite the parser"}]
inputs = tokenizer.apply_chat_template(messages, add_generation_prompt=True, enable_thinking=False,
return_tensors="pt", return_dict=True)
output = model.generate(**inputs, max_new_tokens=200)
print(tokenizer.decode(output[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))
llama.cpp:
llama-server -hf duckwork-ai/mallard-2b:Q6_K --jinja
MLX:
mlx_lm.generate --model duckwork-ai/mallard-2b-mlx-6bit --prompt "um so what do you think"
Tools are passed the usual way through the chat template (tools=), as for
Qwen3.5.
How it was made
- Duckwork data. 31,021 conversations generated by Qwen3.6-35B-A3B (Apache-2.0) playing both sides: the person as speech recognition would transcribe them, and the duck under a style guide the examples leave out. Tool results come back in the format the app produces. Every example was checked before it was kept.
- General data. 20,681 general requests (format instructions, knowledge, maths, writing, code, tool use) written by the same teacher and answered by Qwen3.5-2B itself, thinking off. Outside Duckwork, Mallard learns what Qwen3.5-2B already does, which leaves little to forget. A first version without this data lost 10 to 36 points on open benchmarks.
- Training. LoRA, rank 32, on the attention, linear-attention and MLP projections of every layer, in bf16; one epoch over 55,124 samples of up to 4,096 tokens, learning rate 1e-4, effective batch 16; about an hour on two H100s.
- Export. The vision encoder is removed and the vocabulary trimmed after training. The trimmed model was checked to predict exactly what the untrimmed one does (largest logit difference 0.0).
The training data and the 2,736 held-out test tasks, with the checks that score them, are published as duckwork-ai/mallard-data.
Limitations
- English only, by design; other languages are slow and weak.
- Tuned for Duckwork's prompts and tools. With other prompts it behaves like Qwen3.5-2B, with Duckwork's habits showing in places (short answers).
- Measured with thinking off only.
- Cut-off sentences remain hard: it sometimes searches past sessions where asking back would do (13 of 22).
- A 2B model: it can state facts confidently that are wrong.
Credit
- Base model: Qwen3.5-2B by the Qwen team (Apache-2.0).
- Training data: written by Qwen3.6-35B-A3B (Apache-2.0) and, for the general part, answered by Qwen3.5-2B (duckwork-ai/mallard-data). No other datasets and no benchmark items were used.
- Training: Unsloth and transformers; data generation with vLLM.
- Builds: mlx-lm and llama.cpp.
- Benchmarks: lm-evaluation-harness (IFEval, MMLU-Pro, GPQA Diamond), IFBench (Allen AI), BFCL (Berkeley), and Inspect (UK AI Security Institute).
- Downloads last month
- 1,525