Obit Mallard 1.0-27B 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.8-27B with a 5.2x smaller KV cache. At the full 262,144-token context Mallard's cache is 3.32 GB, where the original model's f16 cache is 17.18 GB. Long-context retrieval, knowledge and code match or beat the original; strict instruction following trails by 4.5 points, and hard math and science need a long thinking budget (details below).
Full 262k context in about 21 GB at 4-bit weights (UD-Q4_K_XL, weights plus cache), where the original model at the same weights needs about 35 GB with its 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. The smaller sibling, Obit Mallard 1.0-9B, uses the same design.
Technical Details
Mallard is a conversion of Qwen/Qwen3.8-27B, not a new pre-train. Qwen3.8-27B has 64 layers: 48 Gated-DeltaNet layers (a recurrent state of fixed size per sequence, no KV cache) and 16 full-attention layers (indices 3, 7, ..., 63), which hold the whole KV cache. Mallard keeps everything bit-identical except those 16 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. Both are the same files as the 9B's; the 27B differs only in
its config (64 layers, 24 query heads per 4 KV heads, the per-layer latent ranks in mla_kv_ranks).
Files
| File | What it is |
|---|---|
model-000NN-of-00014.safetensors, model.safetensors.index.json |
bf16 weights (53.9 GB in 14 shards, text decoder only) |
config.json, configuration_mallard.py |
config (model_type: "mallard", Qwen3.8 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.8-27B |
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-27B-*.gguf, BF16/ |
GGUF files for llama.cpp, from UD-Q2_K_XL (9.7 GB) to BF16 (54.0 GB, in two parts); see GGUF / llama.cpp |
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.8-27B, f16 cache (default) | 65,536 | 17.18 GB |
Qwen3.8-27B, 8-bit cache (q8_0 K and V) |
34,816 | 9.13 GB |
Qwen3.8-27B, 4-bit cache (q4_0 K and V) |
18,432 | 4.83 GB |
| Mallard 1.0-27B | 12,656 | 3.32 GB |
Weights plus cache at the full 262k context (approximate, before runtime buffers):
| Weights | Qwen3.8-27B, f16 cache | Qwen3.8-27B, 8-bit cache | Mallard 1.0-27B |
|---|---|---|---|
| UD-Q4_K_XL (17.4 GB) | ~34.6 GB | ~26.5 GB | ~20.7 GB |
| Q8_0 (28.7 GB) | ~45.9 GB | ~37.8 GB | ~32.0 GB |
| BF16 (54.0 GB) | ~71.1 GB | ~63.1 GB | ~57.3 GB |
Every sequence also carries the unchanged Gated-DeltaNet recurrent state (fixed size, the same in both models).
Quality vs Qwen3.8-27B
Every comparison is paired: the same prompts, sampling settings and random draws for both models, on the same GPU class (H100 80 GB). Thinking is on, with the Qwen team's recommended sampling.
| Area | Benchmark | Qwen3.8-27B | Mallard 1.0-27B |
|---|---|---|---|
| Long-context retrieval | RULER, 1,440 rows, at 8k / 32k / 128k | reference | −1.38 / +8.06 / −0.07 |
| Knowledge | MMLU-Pro (500) | 80.8 | 83.4 |
| Instruction following | IFEval (200), strict / loose | 94.0 / 97.7 | 89.5 / 95.4 |
| Code | HumanEval+ (164), pass@1 | 91.46 | 94.51 |
| Science reasoning | GPQA Diamond (198), ~80k thinking budget | 89.90 | 87.88 |
| Math reasoning | AIME 2025 + 2026 (120), 81,920-token cap | 98.33 | 96.67 |
- RULER: every needle, variable-tracking and word-frequency cell scores 99-100 for both models at every length, including 128k. Most of the 32k gain comes from one task, common-word extraction. RULER allows a 256-token answer: at 32k Mallard lists the words directly while Qwen spends the 256 tokens counting, and at 8k both models count and Mallard scores lower on that task (12 vs 28). Without that task the pooled deltas are +0.71 at 8k and −0.24 at 32k.
- IFEval strict is the one line where Mallard trails by more than 2 points (−4.5, 9 prompts net). Those are finished answers that miss a formatting instruction, not cut-off ones.
Long reasoning: give it room to think
Mallard's reasoning length is close to Qwen3.8-27B's: 0.94x on MMLU-Pro, 0.91x on HumanEval+, 1.12x on GPQA and about 1.16x on AIME (median trace).
- GPQA Diamond: at a 32,768-token cap, 31 of 198 Mallard answers are still thinking when the cap hits (Qwen: 23), and it scores 79.29 vs 83.33. With an ~80k budget 28 of the 31 finish, 17 turn right and none turns wrong: 87.88 vs 89.90.
- AIME 2025 + 2026: at an 81,920-token cap both models finish all but 2 of 120 attempts: 96.67 vs 98.33. At a 32,768-token cap the gap is 3.5 times as large (−5.83).
Recommendation: for hard math and science, set the thinking budget to at least 80k tokens. Mallard's small cache is what makes long budgets cheap to hold.
Export check (done). The published files were compared with the research implementation they were exported from, on held-out text and on 20 greedy generations of 512 tokens:
- next-token distributions at 8k and 32k context: the KL divergence and top-1 agreement are within the bars set by bf16 rounding (the reference run against itself);
- greedy generation: 16 of 20 generations are token-for-token identical. The other 4 diverge where the model's top two
tokens are tied in bf16, and the whole-cache read (
config.mallard_reference_decode=True) reproduces all 20.
Usage
Transformers (reference implementation)
Tested with transformers 5.22.2, torch 2.7.1 (CUDA 12.6) and accelerate 1.15, on one 80 GB H100. The bf16 weights
are 53.9 GB, so this needs an 80 GB GPU. Splitting the model over two smaller GPUs with device_map="auto" should work
but has not been tested yet.
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-27B"
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.8's chat template). The reply starts with a reasoning trace that ends in
</think>. Passenable_thinking=Falsetoapply_chat_templateto turn it off. - 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. model.cache_bytes_per_token()returns 12,656.- Speed: not measured yet. The reference implementation is written to be read and is slow; use the GGUF files below with llama.cpp for speed.
from_pretrainedfetches only the safetensors weights and their config files, not the GGUFs.
GGUF / llama.cpp
GGUF files are in this repository, next to the safetensors weights. They need a llama.cpp build with Mallard
support: obit_llama.cpp (default branch mallard). Stock
llama.cpp, Ollama, LM Studio and other llama.cpp-based apps stop with unknown model architecture: 'mallard'. Upstream
support is planned. The build, server and sampling instructions are the same as for the
9B's GGUFs, with the 27B file names.
The whole repository is about 253 GB, so download only the file you need:
git clone https://github.com/ObitDevelopment/obit_llama.cpp && cd obit_llama.cpp
# sm_86 = RTX 30xx / A40 / A6000, sm_89 = RTX 40xx / L4 / L40, sm_90 = H100, sm_120 = RTX 50xx
cmake -B build -DCMAKE_BUILD_TYPE=Release -DGGML_CUDA=ON -DCMAKE_CUDA_ARCHITECTURES=86 -DGGML_NATIVE=OFF
cmake --build build -j "$(nproc)" --target llama-server llama-completion llama-bench
python3 -m venv hfenv && hfenv/bin/pip install -U huggingface_hub # provides the `hf` command
hfenv/bin/hf download obitresearch/Obit-Mallard-1.0-27B Obit-Mallard-1.0-27B-UD-Q4_K_XL.gguf --local-dir .
build/bin/llama-server -m Obit-Mallard-1.0-27B-UD-Q4_K_XL.gguf --port 8080 \
--temp 1.0 --top-p 0.95 --top-k 20 --presence-penalty 1.5 # full 262k context, 4 slots; OpenAI API + web UI
Faster generation (speculative decoding). Mallard keeps Qwen3.8-27B's trunk, so Qwen's own multi-token-prediction
(MTP) head drafts tokens for it unchanged. Use ggml-org's GGUF of it, mtp-Qwen3.8-27B-Q8_0.gguf (3.2 GB):
hfenv/bin/hf download ggml-org/Qwen3.8-27B-GGUF mtp-Qwen3.8-27B-Q8_0.gguf --local-dir .
build/bin/llama-server -m Obit-Mallard-1.0-27B-UD-Q4_K_XL.gguf --port 8080 \
-md mtp-Qwen3.8-27B-Q8_0.gguf -ngld 99 --spec-type draft-mtp --spec-draft-n-max 3 \
--temp 1.0 --top-p 0.95 --top-k 20 --presence-penalty 1.5
On one A40 (48 GB) with UD-Q4_K_XL at temperature 0 (an earlier obit_llama.cpp build, before the fused kernels): 27.1 -> 48.8 tokens/s over 9 prompts of
code, prose and tool calls (1.80x, 58% of drafted tokens accepted; the original Qwen3.8-27B with the same head: 1.77x,
63%), and 27.8 -> 65.9 tokens/s on one llama-server code request (2.37x). --spec-draft-n-max 3 was fastest; longer
drafts and --spec-draft-p-min were slower. Speedups with sampling were not measured. The draft file also goes on the GPU
(3.2 GB plus its own small context). On a 24 GB card the model and the draft start at about 71k context.
The BF16 file is split in two (Hugging Face's 50 GB per-file limit). Download both parts and pass the first one; llama.cpp loads the second automatically:
hfenv/bin/hf download obitresearch/Obit-Mallard-1.0-27B --include "BF16/*" --local-dir .
build/bin/llama-server -m BF16/Obit-Mallard-1.0-27B-BF16-00001-of-00002.gguf --port 8080
Quality is measured against the BF16 GGUF on the same text (KL divergence of the next-token distribution, and how often the quantized model's top token matches BF16's). Lower KLD is better.
| File | Size | Mean KLD vs BF16 | Same top token | Notes |
|---|---|---|---|---|
Obit-Mallard-1.0-27B-UD-Q2_K_XL.gguf |
9.72 GB | 0.0824 | 86.1% | smallest; noticeable quality loss |
Obit-Mallard-1.0-27B-UD-Q3_K_XL.gguf |
12.91 GB | 0.0251 | 92.2% | |
Obit-Mallard-1.0-27B-UD-Q4_K_XL.gguf |
17.39 GB | 0.0068 | 95.8% | recommended |
Obit-Mallard-1.0-27B-UD-Q5_K_XL.gguf |
20.71 GB | 0.0038 | 97.2% | |
Obit-Mallard-1.0-27B-UD-Q6_K_XL.gguf |
25.03 GB | 0.0023 | 97.8% | |
Obit-Mallard-1.0-27B-Q8_0.gguf |
28.68 GB | 0.0018 | 98.1% | |
Obit-Mallard-1.0-27B-UD-Q8_K_XL.gguf |
31.04 GB | 0.0015 | 98.1% | |
BF16/Obit-Mallard-1.0-27B-BF16-0000{1,2}-of-00002.gguf |
53.96 GB | reference | reference | unquantized |
-csets the context; anything up to 262,144 is supported, and it is the default:llama-server -m <file>alone starts at 262k with 4 slots on a 24 GB card (20.3 GiB with UD-Q4_K_XL). The micro-batch (-ub) needs no tuning: prefill works in blocks, so its scratch memory does not grow with the context.- Flash attention is not supported for Mallard's attention layers and is switched off automatically. The default 4 slots are tested (4 concurrent long prompts, each answered correctly).
- Thinking is on by default; for one request without it, send
"chat_template_kwargs": {"enable_thinking": false}. - Status: beta, as the 9B's GGUFs. Checked against the reference PyTorch implementation on one H100: the cache
formats are byte-equal, the next-token distributions differ from it about as much as the reference differs from itself
when only its prefill chunk size changes (mean KL 1.4-2.0e-3 vs 1.7-1.8e-3, at 8k and 32k context), and one decode step after a prefill matches
the prefill's own prediction more closely than the reference does. Speed on one A40 with UD-Q4_K_XL (obit_llama.cpp
mallard-1.0-beta): generation 28.5 / 28.1 / 27.8 / 26.7 tokens/s at 0 / 8k / 32k / 131k context (stock llama.cpp on Qwen3.8-27B: 30.0 / 29.1 / 27.0 / 20.7), prefill (pp512) 1,145 / 933 / 881 / 737 tokens/s (stock: 1,227 / 1,173 / 978 / 578). Consumer GPUs are not measured yet.
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.8-27B. The new attention tensors are calibrated by us and kept at 8 bits in every quant.
Limitations
- IFEval strict is 4.5 points below Qwen3.8-27B (see the table above).
- At the common 32,768-token thinking cap, GPQA Diamond is 4 points below Qwen3.8-27B; give hard science and math at least 80k tokens.
- Not measured: agentic tool use, multilingual quality, safety behaviour, multi-turn reasoning.
- Text only: the original model's vision tower is not included. Its multi-token-prediction head is not part of this repo; ggml-org's GGUF of it works as a speculative-decoding draft (see GGUF / llama.cpp).
- The transformers implementation runs one sequence at a time for the sparse read (batches are looped) and is slow.
Attribution and license
Mallard is built on Qwen3.8-27B 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).