Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/models/kimi-linear.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,6 @@ llm_build_kimi_linear::llm_build_kimi_linear(const llama_model & model, const ll
cur = build_norm(inpL, layer.attn_norm, NULL, LLM_NORM_RMS, il);
cb(cur, "attn_norm", il);

ggml_build_forward_expand(gf, cur);

if (hparams.is_recurrent(il)) {
// === KDA Layer (Kimi Delta Attention) with Recurrent State ===
// Reference: vLLM kda.py
Expand Down Expand Up @@ -203,7 +201,10 @@ llm_build_kimi_linear::llm_build_kimi_linear(const llama_model & model, const ll
cur = ggml_mul_mat(ctx0, layer.wo, gated);
cb(cur, "kda_out", il);

ggml_build_forward_expand(gf, cur);
} else {
ggml_build_forward_expand(gf, cur);

// === MLA Layer (Multi-head Latent Attention) without KV Cache ===
// Reference: vLLM mla.py
// Step 1: Q projection and reshape
Expand Down
6 changes: 4 additions & 2 deletions src/models/qwen35.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,15 @@ llm_build_qwen35::llm_build_qwen35(const llama_model & model, const llm_graph_pa
cur = build_norm(inpL, model.layers[il].attn_norm, nullptr, LLM_NORM_RMS, il);
cb(cur, "attn_norm", il);

ggml_build_forward_expand(gf, cur);

// Determine layer type and build appropriate attention mechanism
if (hparams.is_recurrent(il)) {
// Linear attention layer (gated delta net)
cur = build_layer_attn_linear(inp->get_recr(), cur, il);

ggml_build_forward_expand(gf, cur);
} else {
ggml_build_forward_expand(gf, cur);

// Full attention layer
cur = build_layer_attn(inp->get_attn(), cur, inp_pos, sections, il);
}
Expand Down
6 changes: 4 additions & 2 deletions src/models/qwen35moe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,15 @@ llm_build_qwen35moe::llm_build_qwen35moe(const llama_model & model, const llm_gr
cur = build_norm(inpL, model.layers[il].attn_norm, nullptr, LLM_NORM_RMS, il);
cb(cur, "attn_norm", il);

ggml_build_forward_expand(gf, cur);

// Determine layer type and build appropriate attention mechanism
if (hparams.is_recurrent(il)) {
// Linear attention layer (gated delta net)
cur = build_layer_attn_linear(inp->get_recr(), cur, il);

ggml_build_forward_expand(gf, cur);
} else {
ggml_build_forward_expand(gf, cur);

// Full attention layer
cur = build_layer_attn(inp->get_attn(), cur, inp_pos, sections, il);
}
Expand Down
6 changes: 4 additions & 2 deletions src/models/qwen3next.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,15 @@ llm_build_qwen3next::llm_build_qwen3next(const llama_model & model, const llm_gr
cur = build_norm(inpL, model.layers[il].attn_norm, nullptr, LLM_NORM_RMS, il);
cb(cur, "attn_norm", il);

ggml_build_forward_expand(gf, cur);

// Determine layer type and build appropriate attention mechanism
if (hparams.is_recurrent(il)) {
// Linear attention layer (gated delta net)
cur = build_layer_attn_linear(inp->get_recr(), cur, il);

ggml_build_forward_expand(gf, cur);
} else {
ggml_build_forward_expand(gf, cur);

// Full attention layer
cur = build_layer_attn(inp->get_attn(), cur, inp_pos, il);
}
Expand Down