DwarfStar (repo: antirez/ds4) is the inference engine that powers OtherU. It is a narrow, self-contained C-based runtime optimized for DeepSeek V4 Flash and PRO, not a general GGUF loader. It runs on the reference deployment via Podman with ROCm passthrough.
Source & Upstream
| Field | Value |
|---|---|
| Repository | github.com/antirez/ds4 |
| Author | antirez (Salvatore Sanfilippo) |
| License | MIT |
| Language | C (49.6%), CUDA (21.4%), Objective-C (17.1%), Metal (6.3%) |
| Stars | \~18.8k |
| Backends | Metal (macOS), CUDA (NVIDIA), ROCm (AMD Strix-Halo), CPU (diagnostics) |
| Models | DeepSeek V4 Flash (primary), DeepSeek V4 PRO (512 GB machines) |
| Status | Beta — active development, frequent releases |
The project is developed with strong GPT 5.5 assistance and builds on the foundations of llama.cpp / GGML.
Reference Deployment (Strix-Halo)
| Component | Detail |
|---|---|
| Container image | kyuz0/strix-halo-ds4-toolbox:rocm-7.2.4 |
| Runtime | Podman with GPU passthrough (/dev/kfd, /dev/dri) |
| Model | DeepSeek-V4-Flash-abliterated-imatrix-ds4.gguf (2-bit quant, imatrix-tuned) |
| Port | 8000 (OpenAI-compatible API) |
| Context | 393,216 tokens |
| GPU | AMD Radeon 8060S iGPU (gfx1151, RDNA 3.5) via ROCm |
| Power limit | 100% |
| KV cache | Disk-backed (/srv/kvcache, 2 TB budget) |
Start Command
podman run --rm --replace --name ds4-server \
--device /dev/kfd --device /dev/dri \
--security-opt seccomp=unconfined --security-opt label=disable \
--network host \
-v /srv:/srv \
docker.io/kyuz0/strix-halo-ds4-toolbox:rocm-7.2.4 \
ds4-server \
-m /srv/models/DeepSeek-V4-Flash-abliterated-imatrix-ds4.gguf \
--ctx 393216 --host 127.0.0.1 --port 8000 --power 100 \
--kv-disk-dir /srv/kvcache --kv-disk-space-mb 2097152
Architecture
DwarfStar is not a wrapper or generic runner — it is a purpose-built C program with its own graph execution engine. Key design choices:
- Single-model narrowness — only DeepSeek V4 Flash and PRO GGUFs with the expected tensor layout, quantization mix, and metadata
- Self-contained — no dependency on llama.cpp/GGML at runtime; kernels, quant formats, and prompt rendering are native
- Asymmetric quantization — routed MoE experts at
IQ2_XXS, down atQ2_K; shared experts, projections, and routing left unquantized. This is what makes 2-bit quants viable: most of the model space is aggressively compressed but the critical paths stay accurate - Disk-first KV cache — checkpoints are written to SSD at four moments (cold, continued, evict, shutdown), enabling fast session resume across restarts without re-prefilling from token zero
- Single-threaded inference — one graph worker serializes all requests; client threads handle HTTP parsing in parallel
Endpoints
| Endpoint | Method | Description |
|---|---|---|
/v1/chat/completions |
POST | Standard OpenAI chat (streaming or non-streaming) |
/v1/models |
GET | List loaded model(s) with metadata |
/v1/responses |
POST | OpenAI Responses API |
/v1/completions |
POST | Legacy completions endpoint |
/v1/messages |
POST | Anthropic-compatible messages API |
Model aliases: deepseek-v4-flash and deepseek-v4-pro — both serve the loaded GGUF.
Key CLI Flags
| Flag | Purpose |
|---|---|
--ctx N |
Allocated context tokens |
--power N |
GPU duty-cycle target (1–100) |
--kv-disk-dir DIR |
Enable disk-backed KV checkpoints |
--kv-disk-space-mb N |
Disk KV budget (default 4096 MB) |
--ssd-streaming |
Run models larger than VRAM via SSD-backed expert cache |
--rocm / --metal / --cuda / --cpu |
Select backend |
--trace FILE |
Log prompts, cache decisions, output, and tool calls |
--mtp |
Enable speculative decoding (experimental) |
Disk KV Cache Behavior
Checkpoints are written at four moments:
- cold — after a long first prompt reaches a stable prefix, before generation
- continued — when prefill or generation reaches the next aligned frontier
- evict — before an unrelated request replaces the live in-memory session
- shutdown — when the server exits cleanly
Cold saves trim the last 32 tokens and align down to a 2048-token chunk boundary to avoid BPE retokenization misses.
Model Quantization
The project provides pre-built GGUFs from HuggingFace (antirez/deepseek-v4-gguf):
| Variant | RAM Required | Description |
|---|---|---|
q2-imatrix |
96–128 GB | Default for Strix-Halo / M3/M5 Max. Imatrix-tuned 2-bit with asymmetric routed-expert quant |
q2-q4-imatrix |
96–128 GB | Same with last 6 layers at Q4 |
q4-imatrix |
≥256 GB | Higher-quality quant for large-memory machines |
pro-q2-imatrix |
≥512 GB | PRO model 2-bit quant |
pro-q4-split |
2× ≥512 GB | Distributed PRO across two machines |
Download script: download_model.sh q2-imatrix fetches from HuggingFace.
Performance Benchmarks
Upstream Reference Numbers (from antirez/ds4 repo)
These are single-run Metal CLI numbers with --ctx 32768, --nothink, greedy decoding, -n 256.
Flash (2-bit Quant) — Short Prompt
| Machine | Quant | Prefill (t/s) | Generation (t/s) |
|---|---|---|---|
| MacBook Pro M3 Max, 128 GB | q2 | 58.52 | 26.68 |
| MacBook Pro M5 Max, 128 GB | q2 | 87.25 | 34.27 |
| Mac Studio M3 Ultra, 512 GB | q2 | 84.43 | 36.86 |
| DGX Spark GB10, 128 GB | q2 | 343.81 | 13.75 |
Flash (2-bit Quant) — Long Prompt (\~11.7k tokens)
| Machine | Quant | Prefill (t/s) | Generation (t/s) |
|---|---|---|---|
| MacBook Pro M3 Max, 128 GB | q2 | 250.11 | 21.47 |
| MacBook Pro M5 Max, 128 GB | q2 | 463.44 | 25.90 |
| Mac Studio M3 Ultra, 512 GB | q2 | 468.03 | 27.39 |
Flash (4-bit Quant) — M3 Ultra 512 GB Only
| Prompt Length | Prefill (t/s) | Generation (t/s) |
|---|---|---|
| Short | 78.95 | 35.50 |
| \~12k tokens | 448.82 | 26.62 |
PRO Model (2-bit) — Mac Studio M3 Ultra 512 GB
| Prompt Length | Prefill (t/s) | Generation (t/s) |
|---|---|---|
| 32,768 tokens | 138.82 | 9.56 |
Reference Deployment (AMD Strix-Halo) — Measured
Measured under production Hermes Agent traffic (not ds4-bench): \~14 t/s sustained decode at 20k–140k context (14.1 t/s average over 300+ second generations; \~16 t/s at smaller contexts), and \~250 t/s compute prefill on long prompts. Disk KV-cache restores replay much faster than compute prefill (\~2,400 t/s effective). Short-prompt ds4-bench numbers to be added.
(Charts from the upstream repo. Our own benchmark chart to be added once *ds4-bench* data is collected on the Strix-Halo.)
SSD Streaming
When the model does not fit in GPU-addressable memory, DwarfStar can run in SSD streaming mode. Non-routed weights stay resident; routed MoE experts are cached and loaded from the GGUF file on miss. The automatic budget takes 80% of Metal recommended working set, subtracts non-routed weights, then uses the rest for expert cache.
# Automatic cache budget
ds4-server --ssd-streaming
# Explicit cache size
ds4-server --ssd-streaming --ssd-streaming-cache-experts 32GB
Tooling
| Binary | Purpose |
|---|---|
ds4 |
CLI interactive/one-shot inference |
ds4-server |
HTTP API server (OpenAI-compatible) |
ds4-bench |
Performance benchmark (prefill + decode across context frontiers) |
ds4-agent |
Integrated coding agent (alpha) |
ds4-eval |
Extractor self-test runner |
download_model.sh |
Fetch GGUFs from HuggingFace |
Additional tools under gguf-tools/: GGUF generation, imatrix collection, quantization, quality testing against official DeepSeek logits.