koboldcpp/src
Aman Gupta 8c146a8366
DeepSeek V4 (#24162)
* convert: add dsv4 conversion

* add basic setup

* add llm_graph_input_dsv4

* add save-load state

* add sinkhorn eps - correction by @fairydreaming

* add rope fix

* cleanup dead code

* fix bugs

* support pro model: added by @fairydreaming

* remove redundant V cache

* Chat template

* remove debugging leftovers

* Add mechanism for inlining templates based on architecture

* s/deepseek-v4-flash/deepseek4/g

* s/deepseek-v4-flash/deepseek4/g continued

* enable graph reuse

* enable FA

* fix test llama archs

* rename

* compatibility with antirez ds4 GGUFs

* simplified set_gguf_parameters() by calling super class method, replaced moe.score_func with expert_gating_func.

* reserve worst-case kv-cache

* revert max split inputs

* address review comments

* add padding to enable FA

* pad only the final value of plan.n_kv to 256

* remove built-in cpp chat template

* cont: remove cpp built-in template

* rm outdated test

* replace ggml_view_3d() with ggml_reshape_3d()

Co-authored-by: Georgi Gerganov <ggerganov@gmail.com>

* only support n_seq=1 for now

* remove unused var

* cont: remove unused var

* use scale bias

* use correct ptr for can_reuse

* remove gen-chat-inline-templates.py

* simplify graph reuse

* cont: cleanup

* remove unused inputs

* enable partial checkpointing

* add correct shape for kq_mask + set llama_model_n_swa to 0 for dsv4

* precompute source_idx + add comment about dummy write

* support multi-seq

* remove restored_trim_pos

* use split_equal when possible

* fix indent

* address review comments

* use LLM_KV

* fix ci

---------

Co-authored-by: Piotr Wilkin <piotr.wilkin@syndatis.com>
Co-authored-by: Stanisław Szymczyk <sszymczy@gmail.com>
Co-authored-by: Xuan Son Nguyen <son@huggingface.co>
Co-authored-by: fairydreaming <166155368+fairydreaming@users.noreply.github.com>
Co-authored-by: Georgi Gerganov <ggerganov@gmail.com>
2026-06-29 16:58:51 +08:00
..
models DeepSeek V4 (#24162) 2026-06-29 16:58:51 +08:00
CMakeLists.txt DeepSeek V4 (#24162) 2026-06-29 16:58:51 +08:00
llama-adapter.cpp hparams : refactor hparams.n_layer (#24060) 2026-06-05 11:09:36 +03:00
llama-adapter.h llama : re-enable manual LoRA adapter free (#19983) 2026-03-18 12:03:26 +02:00
llama-arch.cpp DeepSeek V4 (#24162) 2026-06-29 16:58:51 +08:00
llama-arch.h DeepSeek V4 (#24162) 2026-06-29 16:58:51 +08:00
llama-batch.cpp kv-cache : fix M-RoPE checkpoints (#20132) 2026-03-06 08:46:51 +02:00
llama-batch.h fix: correct misspellings in code comments (#21217) 2026-03-31 13:50:51 +02:00
llama-chat.cpp chat : add Granite 4.1 chat template (#23518) 2026-05-28 13:13:33 +02:00
llama-chat.h chat : add Granite 4.1 chat template (#23518) 2026-05-28 13:13:33 +02:00
llama-context.cpp DeepSeek V4 (#24162) 2026-06-29 16:58:51 +08:00
llama-context.h spec : Support Step3.5/3.7 flash mtp3 (#24340) 2026-06-21 11:33:18 +03:00
llama-cparams.cpp
llama-cparams.h spec : Support Step3.5/3.7 flash mtp3 (#24340) 2026-06-21 11:33:18 +03:00
llama-ext.h spec : Support Step3.5/3.7 flash mtp3 (#24340) 2026-06-21 11:33:18 +03:00
llama-grammar.cpp common/grammar: fix grammar parsing issues to prevent stack overflow and hangs (#18604) 2026-03-21 18:43:35 +01:00
llama-grammar.h common/grammar : replace problematic backtracking regex [\s\S]* (#18342) 2026-01-03 16:02:43 -06:00
llama-graph.cpp DeepSeek V4 (#24162) 2026-06-29 16:58:51 +08:00
llama-graph.h DeepSeek V4 (#24162) 2026-06-29 16:58:51 +08:00
llama-hparams.cpp spec: fix segfault error on long prompts for eagle3 (#24707) 2026-06-17 17:29:49 +03:00
llama-hparams.h DeepSeek V4 (#24162) 2026-06-29 16:58:51 +08:00
llama-impl.cpp llama : correct platform-independent loading of BOOL metadata (#21428) 2026-04-06 01:40:38 +02:00
llama-impl.h llama: use f16 mask for FA to save VRAM (#23764) 2026-05-29 15:44:43 +08:00
llama-io.cpp server : avoid checkpoint data host copies (#22558) 2026-05-02 18:03:25 +03:00
llama-io.h llama : add option to save memory in device buffers (#22679) 2026-05-05 06:35:07 +03:00
llama-kv-cache-dsa.cpp llama : add Gemma4 MTP (#23398) 2026-06-07 20:50:54 +08:00
llama-kv-cache-dsa.h model : support for DeepseekV32ForCausalLM with generic DeepSeek Sparse Attention (DSA) implementation (#23346) 2026-05-29 10:15:17 +02:00
llama-kv-cache-dsv4.cpp DeepSeek V4 (#24162) 2026-06-29 16:58:51 +08:00
llama-kv-cache-dsv4.h DeepSeek V4 (#24162) 2026-06-29 16:58:51 +08:00
llama-kv-cache-iswa.cpp DeepSeek V4 (#24162) 2026-06-29 16:58:51 +08:00
llama-kv-cache-iswa.h DeepSeek V4 (#24162) 2026-06-29 16:58:51 +08:00
llama-kv-cache.cpp DeepSeek V4 (#24162) 2026-06-29 16:58:51 +08:00
llama-kv-cache.h DeepSeek V4 (#24162) 2026-06-29 16:58:51 +08:00
llama-kv-cells.h kv-cache : avoid kv cells copies (#24277) 2026-06-07 21:42:54 +03:00
llama-memory-hybrid-iswa.cpp llama : add Gemma4 MTP (#23398) 2026-06-07 20:50:54 +08:00
llama-memory-hybrid-iswa.h llama + spec: MTP Support (#22673) 2026-05-16 20:06:23 +08:00
llama-memory-hybrid.cpp llama : add Gemma4 MTP (#23398) 2026-06-07 20:50:54 +08:00
llama-memory-hybrid.h llama + spec: MTP Support (#22673) 2026-05-16 20:06:23 +08:00
llama-memory-recurrent.cpp hparams : refactor hparams.n_layer (#24060) 2026-06-05 11:09:36 +03:00
llama-memory-recurrent.h llama : MTP clean-up (#23269) 2026-05-19 15:32:58 +03:00
llama-memory.cpp memory : correctly handle failure in apply() (#14438) 2025-06-30 18:03:03 +03:00
llama-memory.h llama : add Gemma4 MTP (#23398) 2026-06-07 20:50:54 +08:00
llama-mmap.cpp Update llama-mmap to use ftello/fseeko (#22497) 2026-04-30 14:17:52 -07:00
llama-mmap.h llama: fix llama-model-saver (#20503) 2026-03-25 12:53:16 +02:00
llama-model-loader.cpp DeepSeek V4 (#24162) 2026-06-29 16:58:51 +08:00
llama-model-loader.h llama + spec: MTP Support (#22673) 2026-05-16 20:06:23 +08:00
llama-model-saver.cpp Add arch support for cohere2-MoE (#24260) 2026-06-13 19:49:00 +02:00
llama-model-saver.h llama: fix llama-model-saver (#20503) 2026-03-25 12:53:16 +02:00
llama-model.cpp DeepSeek V4 (#24162) 2026-06-29 16:58:51 +08:00
llama-model.h DeepSeek V4 (#24162) 2026-06-29 16:58:51 +08:00
llama-quant.cpp quant : fix quantizing moe with mtp (#24986) 2026-06-25 08:36:49 +03:00
llama-quant.h
llama-sampler.cpp sampling : remove unconditional softmax+sort in top-n-sigma sampler (#22645) 2026-06-22 14:08:32 +03:00
llama-sampler.h llama : rename llama-sampling to llama-sampler (#19363) 2026-02-06 07:26:54 +01:00
llama-vocab.cpp Add cohere2moe to llama-vocab for TINY_AYA (#24601) 2026-06-14 09:04:46 +02:00
llama-vocab.h vocab : refactor normalizer flags into options struct, add strip_accents (#24371) 2026-06-11 10:36:50 +03:00
llama.cpp llama : skip main_gpu validation when no devices are available (#23405) 2026-06-17 17:30:26 +03:00
unicode-data.cpp
unicode-data.h
unicode.cpp unicode,test: add Qwen3.5 non-backtracking tokenizer handler and regr… (#22110) 2026-05-14 11:03:40 +02:00
unicode.h vocab: fix Gemma4 tokenizer (#21343) 2026-04-03 10:33:03 +02:00