DeepSeek-V4 Checkpointing Fix - #25402
Conversation
Fixes prompt caching for DeepSeek-V4. Before this, --ctx-checkpoints 0 had to be used since prompt caching for DeepSeek-V4-Flash produced gibberish. - Classify DeepSeek-V4 as RS so context checkpoints stay enabled - seq_rm: evict the 1-token tail on the last-token re-eval so it is not duplicated - state_write/read: include the base and block caches in partial (checkpoint) saves, since they are not recomputable from a partial re-decode
|
Hi @danielhanchen, thanks for your contribution! Per our contribution guidelines, the automated PR checker found the following issue(s) that need your attention:
Please note that maintainers reserve the right to make final decisions on PRs. If you believe there is a mistake, please comment below. |
|
|
||
| cparams.n_rs_seq = params.n_rs_seq; | ||
| // DSV4: default to its 1-token rollback bound so it is classified RS (keeps checkpoints). | ||
| if (cparams.n_rs_seq == 0 && model.arch == LLM_ARCH_DEEPSEEK4) { |
There was a problem hiding this comment.
Pretty sure this is not required. Can you try without changing this value
|
@danielhanchen do you have a repro of the gibberish? |
|
Hey folks 👋 First things first, thanks a lot @danielhanchen and llama.cpp folks for your continuous & incredible work 🙇 I never had the chance to thank you. I still have gibberish output despite this PR. For information I'm running llama.cpp Compilation flags: Here's my configuration if that helps: |
Can confirm. This PR does not help either. CPU inference works if I set NGL to 0 on the same build. |
|
Some additional info in case that helps, broken (on strix halo) even with just these build flags: |
|
I don't get gibberish with context checkpoints and DSv4 flash on |
|
Actually I re-checked - #25202 was the one which fixed it and was merged 20 hours ago - and I was using an older llama.cpp version which caused gibberish Specifically using For folks who are getting gibberish on an old llama.cpp build - re-get from main and KV cache quantization works! I conflated the |
I opened a followup issue: |
Core DeepSeek-V4-Flash serving work on the llama runtime: - Checkpointing/state-restore: DSV4 recurrent compressor-state save/load with rollback on partial failure (PR ggml-org#25402 lineage); n_rs_seq clamped to the true 1-token direct-rollback bound. - MTP speculative decode: deepseek4mtp draft arch (loader + graph + memory), draft-mtp speculative type, frontier-stash partial-accept rewind, and the opt-in fused chained-draft graph (LLAMA_MTP_FUSED_DRAFT). ~20.8 t/s decode at n_max=2 on GB10. - Refusal-ablation steering: LLAMA_CVEC_FFN_ONLY gate for ffn-only projection. - The MTP fused chained-draft plumbing is named mtp_draft_* (llama_set_mtp_ draft_chain / llama_get_mtp_draft_meta / cparams.mtp_draft_chain).
PR closed - #25202 was the one which fixed the issue and was merged 20 hours ago - and I was using an older llama.cpp version which caused gibberish
Specifically using
--cache-type-k/v q8_0before #25202 caused garbage ieoverlayotin kinetic academyléléléléulifafter after the PR "The capital of France is Paris." (correct)