logo
Kurashizu Blogwhere ideas flow
  • Home
  • News
  • Blog
  • About
  • Home
  • News
  • Blog
  • About

© 2026 Kurashizu. All rights reserved.

Admin·New Post·Service Status
Powered by Cloudflare·31.10.26
← Back to news

From the creator of Redis; run LLM locally with ds4

Original article
dwarfstar.sh|312 points|90 comments|by fibo|Oct 2, 2026

From the Architect of Redis: Local LLM Execution via ds4

DwarfStar 4 (ds4) is a specialized inference engine written in C, designed specifically for high-memory hardware utilizing Mac (Metal), CUDA, and ROCm. It enables the local execution of frontier open-weights models, bridging the gap between massive cloud-based MoEs and local hardware.

🚀 Supported Model Ecosystem

The engine is optimized for a specific set of high-performance layouts:

  • DeepSeek: V4 and V4.1 Flash
  • GLM: 5.x series
  • Qwen: 3.8 Flash Next
  • Capabilities: Supports both text and vision modalities, integrated local APIs, a command-line interface, and a built-in native agent.

🛠 The Evolution of the Stack

The development of ds4 followed a three-stage conceptual pipeline:

  1. The Giant: Starting with the massive ≈284B\approx 284\text{B}≈284B parameter scale of DeepSeek V4 Flash. While most users rely on remote APIs, ds4 was built to challenge that constraint.
  2. The Collapse: Implementing Asymmetric Quantization. This process compresses the routed experts to save space without lobotomizing sacrificing the critical shared paths of the model.
  3. The Dwarf Star: The final result—a dense, resident local engine. It provides a unified state and cache shared across a CLI, HTTP APIs, and a native agent.

Design Philosophy: ds4 is not a generic GGUF runner. It is narrow on purpose, focusing on a limited set of model families to ensure end-to-end validation of every supported layout.


🧠 Core Technical Innovations

01. Asymmetric 2-bit Quantization

To fit routed-MoE (Mixture of Experts) builds onto consumer or prosumer hardware, ds4 employs a precision-splitting strategy:

  • Routed Experts: Highly compressed (2-bit).
  • Critical Paths: Maintained at higher precision to preserve intelligence.

02. Persistent KV Cache

The engine treats the KV cache as a "disk citizen."

  • Mechanism: The rendered prompt prefix is hashed using SHA1.
  • Persistence: This hash is used as a key to save the cache to the SSD.
  • Benefit: Upon restart, if a matching prefix is detected, the engine reloads the cache from disk rather than recomputing it.

03. Unified Interface Triad

A single engine powers three distinct interaction modes:

InterfaceCommandPrimary Use Case
Chat./ds4Interactive CLI conversations
API./ds4-serverLocal OpenAI/Anthropic compatible endpoints
Agent./ds4-agentPersistent, stateful coding sessions

🏗 System Architecture

The following diagram illustrates how the ds4 components interact:

ds4 Architecture Visualization


💻 Deployment Guide

Quickstart Checklist

  • Clone the repository
  • Fetch model weights
  • Compile for specific backend
  • Launch interface

Execution Steps

# Step 1: Fetch the weights
git clone https://github.com/antirez/ds4
cd ds4 && ./download_model.sh ds4f-q2

# Step 2: Build for your hardware
make              # For Apple Silicon (Metal)
make cuda-spark   # For Linux (NVIDIA DGX Spark)

# Step 3: Initialize
./ds4                             # Start interactive chat
./ds4-server --ctx 100000         # Start API server with 100k context

🖥 Hardware Compatibility Matrix

Depending on your available VRAM/RAM, different execution modes (local, streamed, or distributed) apply.

Platform32GB64GB96GB128GB256GB512GB2×512GB2 \times 512\text{GB}2×512GB
Apple Silicon❌✓✓✓✓✓❌
NVIDIA (CUDA)❌✓✓✓✓✓✓
AMD (ROCm)❌✓✓✓✓✓❌
  • Baseline: V4 Flash Q2 is the minimum requirement.
  • Mid-Tier (128GB): Supports GLM 5.3 Q2 and Qwen Q4; V4.1 Q2 utilizes SSD streaming.
  • High-Tier (512GB+): Provides headroom for V4.1 Q4 or PRO-class configurations.

📊 Performance Benchmarks

Metrics are divided between Prefill (initial processing) and Generation (token output), which is critical for agentic workflows.

Reference Hardware: M5 Max (128GB) and DGX Spark (128GB) using q2 quantization.

MachineContextPrefill (t/s\text{t/s}t/s)Generation (t/s\text{t/s}t/s)
M5 Max2,048 tok2,048\text{ tok}2,048 tok790.2790.2790.239.439.439.4
M5 Max65,536 tok65,536\text{ tok}65,536 tok398.5398.5398.527.627.627.6
DGX Spark2,048 tok2,048\text{ tok}2,048 tok825.8825.8825.818.118.118.1
DGX Spark65,536 tok65,536\text{ tok}65,536 tok823.0823.0823.013.813.813.8

🤖 Integration with AI Agents

Because ds4-server implements standard API schemas, it can act as the backend for professional coding tools. By pointing the base URL to your local machine, you can use:

  • OpenCode
  • Claude Code
  • Codex CLI

Supported endpoints include: /v1/chat/completions →\rightarrow→ /v1/messages →\rightarrow→ /v1/responses

Final Word: Take control of your inference. Use the quickstart, verify your hardware fit, and connect your favorite editor or agent to your own local silicon.