Instructions to use obitresearch/Obit-Mallard-1.0-9B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use obitresearch/Obit-Mallard-1.0-9B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="obitresearch/Obit-Mallard-1.0-9B", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("obitresearch/Obit-Mallard-1.0-9B", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use obitresearch/Obit-Mallard-1.0-9B 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 obitresearch/Obit-Mallard-1.0-9B:UD-Q4_K_XL # Run inference directly in the terminal: llama cli -hf obitresearch/Obit-Mallard-1.0-9B:UD-Q4_K_XL
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf obitresearch/Obit-Mallard-1.0-9B:UD-Q4_K_XL # Run inference directly in the terminal: llama cli -hf obitresearch/Obit-Mallard-1.0-9B:UD-Q4_K_XL
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 obitresearch/Obit-Mallard-1.0-9B:UD-Q4_K_XL # Run inference directly in the terminal: ./build/bin/llama cli -hf obitresearch/Obit-Mallard-1.0-9B:UD-Q4_K_XL
Use Docker
docker model run hf.co/obitresearch/Obit-Mallard-1.0-9B:UD-Q4_K_XL
- Llama new
- LM Studio
- Jan
- vLLM
How to use obitresearch/Obit-Mallard-1.0-9B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "obitresearch/Obit-Mallard-1.0-9B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "obitresearch/Obit-Mallard-1.0-9B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/obitresearch/Obit-Mallard-1.0-9B:UD-Q4_K_XL
- SGLang
How to use obitresearch/Obit-Mallard-1.0-9B 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 "obitresearch/Obit-Mallard-1.0-9B" \ --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": "obitresearch/Obit-Mallard-1.0-9B", "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 "obitresearch/Obit-Mallard-1.0-9B" \ --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": "obitresearch/Obit-Mallard-1.0-9B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use obitresearch/Obit-Mallard-1.0-9B with Ollama:
ollama run hf.co/obitresearch/Obit-Mallard-1.0-9B:UD-Q4_K_XL
- Unsloth Desktop
- Pi
How to use obitresearch/Obit-Mallard-1.0-9B with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf obitresearch/Obit-Mallard-1.0-9B:UD-Q4_K_XL
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": "obitresearch/Obit-Mallard-1.0-9B:UD-Q4_K_XL" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Docker Model Runner
How to use obitresearch/Obit-Mallard-1.0-9B with Docker Model Runner:
docker model run hf.co/obitresearch/Obit-Mallard-1.0-9B:UD-Q4_K_XL
- Lemonade
How to use obitresearch/Obit-Mallard-1.0-9B with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull obitresearch/Obit-Mallard-1.0-9B:UD-Q4_K_XL
Run and chat with the model
lemonade run user.Obit-Mallard-1.0-9B-UD-Q4_K_XL
List all available models
lemonade list
- Hermes Agent
How to use obitresearch/Obit-Mallard-1.0-9B with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf obitresearch/Obit-Mallard-1.0-9B:UD-Q4_K_XL
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 obitresearch/Obit-Mallard-1.0-9B:UD-Q4_K_XL
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use obitresearch/Obit-Mallard-1.0-9B with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf obitresearch/Obit-Mallard-1.0-9B:UD-Q4_K_XL
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 "obitresearch/Obit-Mallard-1.0-9B:UD-Q4_K_XL" \ --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"
Obit Mallard 1.0-9B Quickstart
Obit Mallard is a model based on the Qwen3 architecture that focuses on improving speed and decreasing KV cache size. Some highlights of this model:
Qwen3.5-9B with a 5.2x smaller KV cache. At the full 262,144-token context Mallard's cache is 1.65 GB, where the original model's f16 cache is 8.59 GB. Long-context retrieval, chat, instruction following, knowledge and code are close to the original; on hard math and science it thinks somewhat longer (details below).
Full 262k context on a 12 GB GPU at 8-bit weights (Q8_0), where the original model at the same weights needs a 16 GB card even with an 8-bit KV cache, and a 24 GB card with the default f16 cache.
This is an Obit Research model. We make open-weight models that lower the bar for consumer inference. You can follow our other models and architectures here.
Technical Details
Mallard is a conversion of Qwen/Qwen3.5-9B, not a new pre-train. Qwen3.5-9B has 32 layers: 24 Gated-DeltaNet layers (a recurrent state of fixed size, about 50 MB per sequence, no KV cache) and 8 full-attention layers (indices 3, 7, ..., 31), which hold the whole KV cache. Mallard keeps everything bit-identical except those 8 attention layers, where:
- the key/value cache is a low-rank latent (multi-head latent attention, as introduced by DeepSeek-V2): per token and layer, one vector of rank 512-1,024 instead of 4 key and 4 value heads of 256 dims. The latent is stored at 4 bits (q4_1, group 32), together with 4-bit rotary keys and 4 fp32 key-norm scales;
- each query reads only the 4,096 most relevant past tokens (DeepSeek Sparse Attention, as in DeepSeek-V3.2). A small "lightning indexer" scores every past token from an 8-bit (FP8 E4M3) indexer key and picks the top 4,096; before position 4,096 every token is read;
- on-policy distillation trained the converted layers to match the original model's outputs on the converted model's own generations.
The byte-exact specification (tensors, forward math, cache formats) is in FORMAT.md; the executable
reference is modeling_mallard.py.
Files
| File | What it is |
|---|---|
model-0000N-of-00005.safetensors, model.safetensors.index.json |
bf16 weights (17.97 GB, text decoder only) |
config.json, configuration_mallard.py |
config (model_type: "mallard", Qwen3.5 keys + the mla_* / index_* keys) |
modeling_mallard.py |
the reference PyTorch implementation, loaded with trust_remote_code=True |
tokenizer files, chat_template.jinja, generation_config.json |
unchanged from Qwen3.5-9B |
FORMAT.md |
the full specification, written so the model can be ported to another engine |
export_manifest.json, SHA256SUMS |
provenance (input hashes) and file checksums |
Obit-Mallard-1.0-9B-*.gguf, GGUF.md |
GGUF files for llama.cpp, from UD-Q2_K_XL (3.4 GB) to BF16 (18.0 GB); which one to pick is in GGUF.md |
mtp-Qwen3.5-9B-Q8_0.gguf |
Qwen3.5-9B's own multi-token-prediction head (unchanged, Q8_0, 2.4 GB), a speculative-decoding draft for the GGUFs: 1.3-1.7x faster generation; see GGUF.md |
imatrix_*.gguf, kld.tsv, quant_summary.json |
the importance matrices used for the quants, and each quant's measured KL divergence from BF16 |
Why it matters: full context on smaller GPUs
| Cache at 262,144 tokens | Bytes per token | Size |
|---|---|---|
| Qwen3.5-9B, f16 cache (default) | 32,768 | 8.59 GB |
Qwen3.5-9B, 8-bit cache (q8_0 K and V) |
17,408 | 4.56 GB |
Qwen3.5-9B, 4-bit cache (q4_0 K and V) |
9,216 | 2.42 GB |
| Mallard 1.0-9B | 6,288 | 1.65 GB |
Weights plus cache at the full 262k context (approximate, before runtime buffers):
| Weights | Qwen3.5-9B, f16 cache | Qwen3.5-9B, 8-bit cache | Mallard 1.0-9B |
|---|---|---|---|
| Q4 (~5.9 GB) | ~14.5 GB | ~10.5 GB | ~7.6 GB |
| Q8_0 (~9.5 GB) | ~18.1 GB | ~14.1 GB | ~11.2 GB: fits a 12 GB card |
| BF16 (~18.0 GB) | ~26.6 GB | ~22.6 GB | ~19.6 GB |
The cache also stays small under concurrency: 16 requests at 82,944 tokens each need 7.8 GiB of KV cache with Mallard, versus 40.5 GiB for the original with an f16 cache and 21.5 GiB with an 8-bit cache. (Every sequence also carries the unchanged Gated-DeltaNet recurrent state, about 50 MB, in both models.)
Quality vs Qwen3.5-9B
Every comparison is paired: the same prompts, sampling settings and random draws for both models. Thinking is on, with the Qwen team's recommended sampling.
| Area | Benchmark | Qwen3.5-9B | Mallard 1.0-9B |
|---|---|---|---|
| Long-context retrieval | RULER, 1,440 rows, at 8k / 32k / 128k | reference | โ0.15 / +0.18 / โ0.74 |
| Long-context code | RepoQA (pooled @0.8) | 71.25 | 74.17 |
| Long-context QA | LongBench v2 (pooled) | 28.0 | 28.0 |
| Knowledge | MMLU-Pro (500) | 78.8 | 77.6 |
| Instruction following | IFEval (200), strict / loose | 91.0 / 96.1 | 90.5 / 94.8 |
| Chat | IFEval (chat) / judged head-to-head | 82.0 / 10 of 30 | 83.0 / 11 of 30 |
| Code | HumanEval+ (164), pass@1 | 89.63 | 87.80 |
| Science reasoning | GPQA Diamond (198), ~80k thinking budget | 83.33 | 81.31 |
| Math reasoning | AIME 2025 + 2026 (120), 130k thinking budget | 89.17 | 85.83 |
Long reasoning: give it room to think
Mallard reasons about 1.1โ1.25x longer than Qwen3.5-9B: 1.11x on MMLU-Pro, 1.23x on GPQA and on AIME, 1.07x on HumanEval+.
- GPQA Diamond: at a 32,768-token cap, 18 of 198 Mallard answers are still thinking when the cap hits (Qwen: 3), and it scores 76.26 vs 82.83. With an ~80k budget every one of them finishes (median 37k tokens, longest 68k), 10 turn right and none turns wrong: 81.31 vs 83.33.
- AIME 2025 + 2026: with a 130k budget Mallard scores 85.83 vs 89.17, at 1.24x the generated tokens per problem. At an 81,920-token cap the gap is about twice as large.
Recommendation: for hard math and science, set the thinking budget to at least 80k tokens, and 128k for competition math. Mallard's small cache is what makes long budgets cheap to hold.
Usage
Transformers (reference implementation)
Tested with transformers 5.22.2, torch 2.7.1 (CUDA 12.6) and accelerate 1.15 (for device_map), on one GPU.
Needs about 19 GB of GPU memory for the weights plus the (small) cache.
pip install "transformers>=5.22" accelerate
# optional, faster Gated-DeltaNet layers: pip install flash-linear-attention causal-conv1d
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
repo = "obitresearch/Obit-Mallard-1.0-9B"
tok = AutoTokenizer.from_pretrained(repo)
model = AutoModelForCausalLM.from_pretrained(repo, trust_remote_code=True, dtype=torch.bfloat16, device_map="auto")
messages = [{"role": "user", "content": "Prove that there are infinitely many primes."}]
inputs = tok.apply_chat_template(messages, add_generation_prompt=True, return_dict=True,
return_tensors="pt").to(model.device)
out = model.generate(**inputs, max_new_tokens=4096, do_sample=True, temperature=1.0, top_p=0.95, top_k=20)
print(tok.decode(out[0, inputs["input_ids"].shape[1]:], skip_special_tokens=True))
trust_remote_code=Trueis required: it loadsmodeling_mallard.pyfrom this repo.- Thinking is on by default (Qwen3.5's chat template). The reply starts with a reasoning trace that ends in
</think>. Passenable_thinking=Falsetoapply_chat_templateto turn it off (in an OpenAI-compatible server, send"chat_template_kwargs": {"enable_thinking": false}with the request). - Sampling: the thinking-on benchmarks above used
generation_config.json's settings (temperature 1.0, top_p 0.95, top_k 20, presence penalty 1.5); the example sets the first three, and llama.cpp / vLLM-style servers also take the presence penalty. - Speed: this is the reference implementation in plain PyTorch, not a serving engine. It stores the real compressed
cache (
model.cache_bytes_per_token()returns 6,288) and each decode step dequantises only the (at most 4,096) cached tokens it reads. Measured on one A40 withflash-linear-attentioninstalled: 15 tokens/s at short context and 12 tokens/s at 16k-64k context (the original Qwen3.5-9B in the same transformers setup: 21 tokens/s at short context and 20 tokens/s at 16k-64k). Prefill runs at ~2,000-3,700 tokens/s at 16k-64k. The llama.cpp build below is ~5x faster at short context and ~6x faster at 32k. - Without
flash-linear-attentionandcausal-conv1d, transformers falls back to slow PyTorch kernels for the Gated-DeltaNet layers (it prints a warning); the output is the same.
GGUF / llama.cpp
GGUF files (UD-Q2_K_XL to UD-Q8_K_XL, Q8_0 and BF16) are in this repository, next to the safetensors weights; the quant
table, prefill speeds, memory figures and the status of the port are in GGUF.md. They need a llama.cpp build
with Mallard support, obit_llama.cpp (default branch mallard);
stock llama.cpp, Ollama and LM Studio do not load them yet. Upstream support is planned.
The whole repository is about 86 GB (the safetensors weights plus every GGUF), so download only the file you need:
git clone https://github.com/ObitDevelopment/obit_llama.cpp && cd obit_llama.cpp
cmake -B build -DCMAKE_BUILD_TYPE=Release -DGGML_CUDA=ON -DCMAKE_CUDA_ARCHITECTURES=86 -DGGML_NATIVE=OFF # 86 = RTX 30xx / A40
cmake --build build -j 16 --target llama-server llama-completion llama-bench
hf download obitresearch/Obit-Mallard-1.0-9B Obit-Mallard-1.0-9B-UD-Q4_K_XL.gguf --local-dir .
build/bin/llama-server -m Obit-Mallard-1.0-9B-UD-Q4_K_XL.gguf --port 8080 # full 262k context, 4 slots; OpenAI API + web UI
from_pretrained (above) fetches only the safetensors weights and their config files, not the GGUFs.
On one A40, UD-Q4_K_XL generates 84 tokens/s at short context, 82 at 8k, 80 at 32k and 74 at 131k (stock llama.cpp on
Qwen3.5-9B: 88 / 84 / 75 / 52), and prefills a 32k-token prompt in about 12 s. With Qwen3.5-9B's
MTP head as a speculative-decoding draft (mtp-Qwen3.5-9B-Q8_0.gguf, in this repo) it is 1.3-1.8x faster. GGUF.md has
the full numbers.
The quantized GGUFs follow the Unsloth Dynamic 3.1 method, so credit for the quantization recipe goes to Unsloth. Each tensor gets its own precision, using the per-tensor layouts from Unsloth's Dynamic 3.1 quants of the Qwen3.5 / 3.8 family and Unsloth's published imatrix calibration for the tensors Mallard shares with Qwen3.5-9B. The new attention tensors are calibrated by us and kept at 8 bits in every quant. Mixed-precision GGUFs need an engine that supports per-tensor quant types (llama.cpp does).
Limitations
- Reasoning traces run ~1.1โ1.25x longer, so hard math and science need a larger thinking budget (see above).
- Quality was measured up to 128k context. 262k uses the same mechanism but was not separately benchmarked.
- Not measured: agentic tool use, multilingual quality, safety behaviour, multi-turn reasoning.
- Most benchmarks were run with one sampling seed; GPQA's 198 and AIME's 120 rows carry ยฑ1.5โ2.5 points of draw noise.
- Text only: the original model's vision tower is not included. Its multi-token-prediction head is not part of the safetensors model; it ships as a separate GGUF draft for llama.cpp (see GGUF.md).
- The transformers implementation runs one sequence at a time for the sparse read (batches are looped) and is slow; see Usage.
Attribution and license
Mallard is built on Qwen3.5-9B by the Qwen team, Alibaba Cloud, released under Apache-2.0, and is distributed under the same license. All credit for the base model's pre-training and post-training belongs to the Qwen team; Mallard is an independent conversion and is not an official Qwen release. The attention design follows DeepSeek's multi-head latent attention (DeepSeek-V2) and DeepSeek Sparse Attention (DeepSeek-V3.2).
- Downloads last month
- 6,500