feat(ds4): SSD streaming + quality engine options, 128GB DeepSeek gallery models - #10374
Merged
Conversation
…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]
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.
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_optionsand 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
LoadModelnow mapsModelOptions.Options[]ontods4_engine_optionsthrough a declarative table (kEngineOptSpecs+apply_engine_option) rather than per-field branches.ds4_engine_optionsis fixed C with no reflection, so the field set is enumerated once; adding a future knob is a one-line table row. Details:ssd_streaming_cache_experts(count orNGB, sets experts+bytes viads4_parse_streaming_cache_experts_arg) andsimulate_used_memory(NGBviads4_parse_gib_arg).ssd_streamingwith no value) meantrue.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_marginare now validated instead of parsed with throwingstd::stoi/std::stof.ds4_role/ds4_layers/ds4_listen/ds4_route_timeout/kv_cache_dirkeep 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)
deepseek-v4-flash-q2-q4deepseek-v4-flash-q4-ssddeepseek-v4-flash-q2-mtpdeepseek-v4-pro-q2-ssdsha256s 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
-ssdgallery 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 fullcpu-ds4link build was not run locally; CIbackend-jobsis the first full compile.Assisted-by: Claude:claude-opus-4-8 [Claude Code]