From b382ebd848f758190b9aec228be8d7b6d1cf6520 Mon Sep 17 00:00:00 2001 From: mb8565 <244351746+mb8565@users.noreply.github.com> Date: Tue, 11 Aug 2026 01:17:25 -0500 Subject: [PATCH] llama: pass rope freq factors to build_std_attention (#2291) build_llama passes nullptr for the rope_factors_in argument, so rope_freqs.weight never reaches ggml_rope_ext and llama3 rope frequency scaling is not applied. The LLAMA_SPLIT_MODE_GRAPH branch inside build_std_attention falls back to model.layers[il].rope_freqs, so only the standard path is affected. --- src/graphs/build_llama.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/graphs/build_llama.cpp b/src/graphs/build_llama.cpp index 16d04ee9b..c4c428a85 100644 --- a/src/graphs/build_llama.cpp +++ b/src/graphs/build_llama.cpp @@ -46,18 +46,16 @@ ggml_cgraph * llm_build_context::build_llama() { int this_n_swa = this_KQ_mask == KQ_mask_swa ? hparams.n_swa : 0; // rope freq factors for llama3; may return nullptr for llama2 and other models - //auto rope_factors = build_rope_factors(il); + auto rope_factors = build_rope_factors(il); // self-attention if (use_rope) { cur = build_std_attention(gf, model.layers[il].attn_norm, inpL, - inp_pos, il == n_layer - 1 && n_tokens > 1 ? inp_out_ids : nullptr, nullptr, + inp_pos, il == n_layer - 1 && n_tokens > 1 ? inp_out_ids : nullptr, rope_factors, this_KQ_mask, nullptr, nullptr, kq_scale, hparams.f_attention_scale, this_n_swa, il, true, false, true); } else { - auto rope_factors = build_rope_factors(il); - // norm cur = llm_build_norm(ctx0, inpL, hparams, model.layers[il].attn_norm, NULL, LLM_NORM_RMS, cb, il); cb(cur, "attn_norm", il);