Repository navigation
Conversation
Preserve released dense values, FP4 expert codes and scales, and Engram rows. Add native activation arithmetic, bounded SSD expert scheduling, checked lossless BF16 packing, snapshot guards, and independent bounded fixtures. Validated on M5 Max: Metal and CPU builds; conversion, source-arithmetic, Metal kernel, server, GGUF, Engram, and buffer-lifetime checks. Resident, streamed, and cached 520-token fixtures match the retained native graph bit for bit. The buffer regression fails on the unmodified upstream base. Full-checkpoint A/B/B/A ds4-bench runs at 2048/4096 tokens preserve all frontier and generation logits bit for bit. Median prefill is +0.38%/+0.15%; generation is unchanged/-2.38%, within the predeclared 3% regression gate. The retained production runtime was restored unchanged after measurement. Source/CUDA parity and full-checkpoint coding acceptance for this port are not claimed. OpenCode cache and server API changes are excluded.
jomplox
marked this pull request as ready for review
October 22, 2026 19:35
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hey @kernelpool! I'm working on running the full released V4.1 weights (FP8 dense, FP4 experts) on DwarfStar with no extra quantization. So far I can get token generation working on the full weights, but only at a barely usable speed (~1 tok/s). I saw that your branch also focuses on performance, so I thought we could combine our work in a single PR. If you'd rather not have it here, just let me know and I'll open the PR against the main repo instead.
Summary
Right now, this engine can only run the released V4.1 checkpoints after the dense weights go through another round of quantization. This PR adds an experimental
nativerecipe plus a single-Mac Metal path that run the checkpoints with their original weight values. That includes the 1017 checkpoint.Not supported with
native. These paths refuse to load it: CUDA, distributed inference, DSpark, vision, and concurrent decode batching.What's in this PR
Converter
Metal inference
Memory fix
Not touched: the server API and the OpenCode cache.
ds4_server.cis unchanged.Validation
Hardware: Apple M5 Max, 128 GiB, macOS/Metal. Base:
72ccf363174c3e1acf840b3661a956d4fb321071onds41-perf.5.960464477539063e-08.Commands run
The commands that generate the test model and source logits are in
docs/DEEPSEEK41_NATIVE.md.Full-model speed and accuracy comparison
This compares Before (my original implementation on
31786cb594121cc1ff9e5f0ad78bc766f6fde17f) with After (this PR on theds41-perfbase above). The unmodified upstream base can't load thenativerecipe, so it isn't included.ds4_bench.c, model file, 64 GiB expert cache, 262,144-token context allocation, 8,192-row prefill chunk, public prompt, and diagnostics.Median throughput (two runs per version):
Benchmark command (
ARM=beforeorafter):Raw CSVs, in the order they ran
Run 1 (Before):
Run 2 (After):
Run 3 (After):
Run 4 (Before):
After benchmarking, I restored my original runtime. I confirmed that its 39 protected source/runtime files, Git status/diff, model identities, and OpenCode configuration were unchanged.
Known gaps