Skip to content

feat(ds4): SSD streaming + quality engine options, 128GB DeepSeek gallery models - #10374

Merged
mudler merged 1 commit into
masterfrom
feat/ds4-ssd-streaming
Jun 17, 2026
Merged

feat(ds4): SSD streaming + quality engine options, 128GB DeepSeek gallery models#10374
mudler merged 1 commit into
masterfrom
feat/ds4-ssd-streaming

Conversation

@localai-bot

Copy link
Copy Markdown
Collaborator

What

Makes ds4's tunable engine knobs reachable from LocalAI model YAMLs, and adds DeepSeek gallery models targeting the 128 GB class - including the full 4-bit Flash quant that only fits via SSD streaming.

Why

The ds4 backend zero-initialized ds4_engine_options and wired none of the engine's options, so SSD streaming (run a model larger than RAM by streaming routed MoE experts from the GGUF on SSD) and the quality/perf knobs were unreachable. SSD streaming is exactly what turns "does the model fit in RAM" into a speed spectrum, so the 153 GB Flash quant can run on a 128 GB machine.

Backend

LoadModel now maps ModelOptions.Options[] onto ds4_engine_options through a declarative table (kEngineOptSpecs + apply_engine_option) rather than per-field branches. ds4_engine_options is fixed C with no reflection, so the field set is enumerated once; adding a future knob is a one-line table row. Details:

  • Two fields use ds4's own typed parsers - ssd_streaming_cache_experts (count or NGB, sets experts+bytes via ds4_parse_streaming_cache_experts_arg) and simulate_used_memory (NGB via ds4_parse_gib_arg).
  • Bare flags (e.g. ssd_streaming with no value) mean true.
  • Path-type options (mtp_path, expert_profile_path, directional_steering_file) resolve relative to the model directory, so a gallery entry can reference a companion file by bare filename; absolute values pass through.
  • mtp_draft / mtp_margin are now validated instead of parsed with throwing std::stoi/std::stof.
  • ds4_role / ds4_layers / ds4_listen / ds4_route_timeout / kv_cache_dir keep their dedicated handling (validation + coordinator wiring).

Newly reachable keys: ssd_streaming, ssd_streaming_cold, ssd_streaming_cache_experts, ssd_streaming_preload_experts, simulate_used_memory, warm_weights, quality, power_percent, prefill_chunk, expert_profile_path, directional_steering_file/attn/ffn.

Gallery (128 GB class)

Entry Size Notes
deepseek-v4-flash-q2-q4 ~91 GB mixed q2/q4 (last 6 layers Q4_K), fits RAM, higher quality
deepseek-v4-flash-q4-ssd ~153 GB full 4-bit experts, runs on 128 GB via SSD streaming
deepseek-v4-flash-q2-mtp ~81 GB IQ2XXS + MTP speculative draft weights (greedy)
deepseek-v4-pro-q2-ssd ~433 GB Pro-class, experimental SSD streaming

sha256s come from the HF LFS oids. yamllint passes.

Caveat

SSD streaming is Metal (Darwin) only upstream; the options are inert on CUDA/CPU. Documented in the -ssd gallery entries and .agents/ds4-backend.md.

Testing

The new wiring was type- and behavior-checked (-fsyntax-only + run harnesses: bare-flag, relative-path resolution, value validation, absolute passthrough) against the real ds4 headers at the pinned commit. A full cpu-ds4 link build was not run locally; CI backend-jobs is the first full compile.

Assisted-by: Claude:claude-opus-4-8 [Claude Code]

…pSeek gallery models

The ds4 backend zero-initialized ds4_engine_options and exposed none of the
engine's tunable knobs, so SSD streaming (run a model larger than RAM by
streaming routed MoE experts from the GGUF on SSD) and the quality/perf knobs
were unreachable from LocalAI model YAMLs.

Map ModelOptions.Options onto ds4_engine_options through a declarative table
(kEngineOptSpecs + apply_engine_option) instead of per-field branches: the
struct is fixed C with no reflection, so the field set is enumerated once and a
future knob is a one-line table row. Two fields use ds4's own typed parsers
(GiB budgets, cache-experts count-or-NGB). Bare flags (e.g. "ssd_streaming")
mean true; path-type options (mtp_path, expert_profile_path,
directional_steering_file) resolve relative to the model directory so a gallery
entry can reference a companion file by bare filename. mtp_draft/mtp_margin are
now validated rather than parsed with throwing std::stoi/std::stof.

Add gallery entries for the 128 GB class:
- deepseek-v4-flash-q2-q4 (~91 GB, mixed q2/q4, fits RAM, higher quality)
- deepseek-v4-flash-q4-ssd (~153 GB full 4-bit, runs on 128 GB via SSD streaming)
- deepseek-v4-flash-q2-mtp (~81 GB + MTP speculative draft weights)
- deepseek-v4-pro-q2-ssd (~433 GB Pro, experimental SSD streaming)

SSD streaming is Metal (Darwin) only; the options are inert on CUDA/CPU.

Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
Assisted-by: Claude:claude-opus-4-8 [Claude Code]
@mudler
mudler merged commit e60c094 into master Jun 17, 2026
62 checks passed
@mudler
mudler deleted the feat/ds4-ssd-streaming branch June 17, 2026 08:30
@localai-bot localai-bot added the enhancement New feature or request label Jun 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants