antirez Strikes Again: ds4, a Pure C Local Inference Engine for DeepSeek 4

antirez builds ds4, a pure C inference engine for DeepSeek 4 with Metal/CUDA/ROCm support.
Redis creator antirez has open-sourced ds4, a local inference engine for DeepSeek 4 Flash and PRO models written entirely in pure C with native support for Metal, CUDA, and ROCm GPU backends. The project quickly earned nearly 20K GitHub stars, reflecting strong community demand for lightweight, dependency-free local inference solutions that work across Apple Silicon, NVIDIA, and AMD hardware.
When the Creator of Redis Meets DeepSeek
In the open-source world, Salvatore Sanfilippo (known as antirez) is a name that needs no introduction — he's the original author of Redis, renowned for his minimalist, high-performance C coding style. Now, this veteran hacker has turned his attention to local LLM inference, open-sourcing a project called ds4: a local inference engine designed for DeepSeek 4 Flash and PRO models.
Since releasing Redis in 2009, Sanfilippo's in-memory data structure store has become one of the most widely used NoSQL databases globally. Redis's design philosophy — single-threaded event loop, compact data structure implementations, extremely low code complexity — achieves remarkable performance density in just tens of thousands of lines of C code. After stepping down as Redis maintainer in 2020, antirez spent time researching natural language processing and small neural network implementations, laying the groundwork for his entry into LLM inference. His earlier open-source neural network projects already demonstrated his ability to implement complex computations in minimal C code.
The project quickly climbed GitHub's trending charts after release, amassing nearly 20,000 Stars (19,822) and 1,759 forks in a short period, with 150 new stars per day. For a nascent inference engine, this level of attention stems both from antirez's personal reputation and the community's strong demand for lightweight local inference solutions.
What's most noteworthy is the technical approach: the entire engine is written in pure C, with native support for Metal, CUDA, and ROCm backends. This means whether you have an Apple Silicon Mac, an NVIDIA GPU workstation, or an AMD GPU device, you can run the same inference code.

Why Pure C and Multi-Backend Architecture
A Continuation of Engineering Minimalism
antirez's technical philosophy has always been "do the most reliable thing with the fewest dependencies." Redis has stood strong in the server space for years largely thanks to its codebase's readability and maintainability. ds4 continues this approach — no bloated frameworks, no complex runtimes, just C code close to the hardware.
For local inference scenarios, the advantages of pure C are straightforward: small binaries, fast startup, controllable memory usage, and easy embedding into various applications and embedded environments. Compared to inference stacks that require gigabytes of Python dependencies, a self-contained C engine is far cleaner to deploy. The mainstream AI inference stack is built on Python — PyTorch, Transformers, vLLM all rely on extensive Python code and complex dependency chains. A typical Python inference environment may require hundreds of packages, occupy several GB of disk space, and take seconds to start. Pure C takes the opposite extreme: compiled binaries are typically just a few MB, startup is in milliseconds, and memory usage is fully predictable. This makes it particularly suited for embedding in mobile apps, desktop software, IoT devices, or any scenario sensitive to deployment size and startup speed. The trade-off is lower development efficiency and manual memory management, but for a systems programmer of antirez's caliber, this is precisely where his strengths lie.
Metal, CUDA, ROCm: Covering All Major GPU Hardware
ds4's simultaneous support for Metal, CUDA, and ROCm is uncommon among open-source inference projects. These three GPU compute backends represent the complete heterogeneous computing landscape:
- Metal: For Apple Silicon (M-series chips), letting Mac users fully leverage the unified memory architecture for local inference. Metal is Apple's low-level graphics and compute API. On M-series chips, the unified memory architecture (CPU and GPU sharing the same physical memory) eliminates data copy overhead — hugely beneficial for LLM inference. An M4 Max with 128GB unified memory can directly hold large model weights without being constrained by discrete GPU VRAM limits.
- CUDA: Covers the dominant NVIDIA GPU ecosystem, balancing performance and ubiquity. CUDA is NVIDIA's parallel computing platform built since 2006, with the most mature ecosystem and richest optimization libraries (cuBLAS, cuDNN, TensorRT, etc.).
- ROCm: Provides support for AMD GPU users — especially valuable since many inference frameworks have long neglected the AMD ecosystem. ROCm (Radeon Open Compute) is AMD's open-source answer to CUDA. While its ecosystem maturity lags behind CUDA, its importance is rapidly growing with datacenter GPUs like MI300X and consumer RX 7900 series.
Supporting all three means writing different compute kernel code for each backend — no small engineering feat. This cross-platform strategy gives ds4 inherent "write once, run anywhere" potential, reducing migration costs for users on different hardware.
Targeting DeepSeek 4 Flash and PRO Models
ds4 explicitly targets DeepSeek 4 Flash and PRO models. The DeepSeek series has been impressive in the open-source LLM space recently, widely recognized for balancing reasoning capability with cost efficiency.
DeepSeek models employ several innovative architectural designs, most notably MLA (Multi-head Latent Attention) and DeepSeekMoE (Mixture of Experts). MLA compresses KV-Cache through low-rank projection, dramatically reducing inference memory usage — traditional multi-head attention requires caching full Key and Value tensors for each layer, while MLA compresses them into low-dimensional latent representations, potentially reducing memory requirements by several times. The MoE architecture allows models to have massive total parameters while only activating a subset of expert networks per inference (e.g., hundreds of billions total but only tens of billions active), maintaining high capability while controlling actual computation.
Building an inference engine tailored to specific models enables deeper optimization in operator implementation, memory layout, and quantization strategies, extracting higher performance.
- Flash version targets lighter, faster inference, likely using more aggressive expert routing and fewer activated parameters — suited for latency-sensitive or resource-constrained local scenarios.
- PRO version targets higher capability ceilings, likely activating more experts for stronger reasoning, with greater memory and compute requirements.
Optimizing for both tiers means users can flexibly trade off speed versus quality based on their hardware.
Why Local Inference Keeps Being Emphasized
ds4's popularity is another footnote in the "local-first" trend. Local LLM inference means running model computations on user-owned devices rather than cloud servers. This field has exploded in recent years thanks to llama.cpp's success (also pure C/C++). The core challenge: models have billions to hundreds of billions of parameters, requiring quantization, KV-Cache optimization, operator fusion and other techniques to achieve acceptable inference speeds on consumer hardware.
As model capabilities improve and quantization matures, more developers want to bring inference back to local devices:
- Data Privacy: Sensitive data never leaves the device. For healthcare, finance, and legal industries, this isn't just preference — it's compliance.
- Cost Control: One-time hardware investment replaces ongoing API fees. GPT-4-level API usage can cost thousands of dollars monthly; local inference has near-zero marginal cost.
- Offline Availability: No network dependency, ideal for edge and privacy-sensitive scenarios.
- Customizability: Open-source code enables deep modification and tuning.
Quantization is the core enabling technology for local inference. Original model weights are typically stored in FP16 or BF16 — a 7B parameter model needs ~14GB VRAM. Quantizing weights to 4-bit integers (INT4) reduces the same model to ~3.5GB, runnable on consumer GPUs or even phones. Common methods include GPTQ (layer-wise quantization using second-order information), AWQ (activation-aware quantization), and GGUF (llama.cpp ecosystem format). ds4's model-specific optimization means it can choose optimal quantization strategies for DeepSeek's weight distribution characteristics, finding the best balance between precision loss and inference speed.
With a developer like antirez who prioritizes engineering quality at the helm, ds4 has the potential to set benchmarks in code readability and stability, making it a project worth watching long-term.
A Realistic Perspective: Boundaries of an Early-Stage Project
ds4 is still in its early stages. The high star count reflects community anticipation and the author's reputation more than project maturity. For developers considering trying it, keep these points in mind:
- Whether actual performance is consistent across all three backends — developers typically optimize their most familiar platform first, with other backends potentially lagging;
- Compatibility and quantization support for DeepSeek 4 variants — completeness of different quantization precisions (Q4, Q5, Q8, etc.) directly impacts practical usability;
- Documentation, build process, and long-term maintenance commitment — antirez has previously slowed projects due to divided attention, making community co-development crucial.
Regardless, a local inference engine led by a veteran systems engineer, implemented in pure C, covering three major GPU ecosystems, carries significant demonstrative value. It reminds us that in an AI engineering world dominated by the Python ecosystem, solid low-level C engineering still holds irreplaceable value. After llama.cpp proved the viability and popularity of pure C/C++ inference engines, ds4 represents further evolution of this technical approach toward model-specific optimization.
Key Takeaways
Related articles

Why AI Benchmarks Are Hitting Their Ceiling: Causes of Saturation and How to Respond
AI benchmarks are saturating as models score near-perfect. This article analyzes causes including data contamination, and explores the paradigm shift in AI evaluation methods.

Perplexity Comet's Declining Agent Capabilities: Why This AI Browser Is Becoming Timid
Perplexity Comet users report declining AI agent capabilities, with form-filling and automation tasks frequently refused. We analyze the causes from anti-automation detection, compliance risks, and model policy tightening perspectives.

SAM 3 Auto-Labeling in Practice: Preparation Matters More Than the Model
A practical breakdown of auto-labeling with SAM 3: why data cleaning, prompt strategy design, and post-processing quality control matter more than the model itself for CV teams.