Commit 78c9ca4b0 for llama.cpp

commit 78c9ca4b064e44f27c4c07f0b3bf51c90832ed9e
Author: Luc Pommeret <135142064+l-pommeret@users.noreply.github.com>
Date:   Mon Nov 30 23:58:38 2026 +0100

    llama : allow prism.hadamard folded weights for LFM3 (#33387)

    * llama : allow prism.hadamard folded weights for LFM3

    Add LLM_ARCH_LFM3 to the architectures that may load Hadamard-folded
    weights, and accept the LFM3 short-convolution projections
    (shortconv.in_proj, shortconv.out_proj) as foldable. Both are built
    through build_lora_mm in lfm-base.cpp, so the input transform is applied.
    The Python converter filter is aligned with the loader.

    Assisted-by: Claude Opus 5.5

    * llama : accept shortconv projections as Hadamard-foldable kinds

    Drop the LFM3-only condition: shortconv.in_proj and shortconv.out_proj
    are built through build_lora_mm, so list them with the other foldable
    kinds in the loader and the converter.

    Assisted-by: Claude Opus 5.5

    ---------

    Co-authored-by: Luc Pommeret <zlucpommeret@gmail.com>

diff --git a/conversion/base.py b/conversion/base.py
index 3d6fdb207..89e7c32bf 100644
--- a/conversion/base.py
+++ b/conversion/base.py
@@ -1071,6 +1071,7 @@ class ModelBase:
             gguf.MODEL_ARCH.QWEN35,
             gguf.MODEL_ARCH.QWEN35MOE,
             gguf.MODEL_ARCH.QWEN3NEXT,
+            gguf.MODEL_ARCH.LFM3,
         }
         if self.model_arch not in _HADAMARD_ARCHS:
             raise ValueError(
@@ -1085,6 +1086,7 @@ class ModelBase:
             r"|ffn_gate_exps|ffn_up_exps|ffn_down_exps|ffn_gate_up_exps"
             r"|ffn_gate_shexp|ffn_up_shexp|ffn_down_shexp"
             r"|ssm_out"
+            r"|shortconv\.in_proj|shortconv\.out_proj"
             r")\.weight"
         )
         weight_names: list[str] = []
diff --git a/src/llama-model.cpp b/src/llama-model.cpp
index 3d133d19c..225aeb6f9 100644
--- a/src/llama-model.cpp
+++ b/src/llama-model.cpp
@@ -2249,6 +2249,7 @@ void llama_model_base::load_hparams_hadamard(llama_model_loader & ml) {

         // only build_lora_mm/build_lora_mm_id apply the transform: refuse archs and tensor kinds that can skip them
         switch (arch) {
+            case LLM_ARCH_LFM3:
             case LLM_ARCH_LLAMA:
             case LLM_ARCH_QWEN3:
             case LLM_ARCH_QWEN3MOE:
@@ -2271,6 +2272,7 @@ void llama_model_base::load_hparams_hadamard(llama_model_loader & ml) {
                 "ffn_gate_exps", "ffn_up_exps", "ffn_down_exps", "ffn_gate_up_exps",
                 "ffn_gate_shexp", "ffn_up_shexp", "ffn_down_shexp",
                 "ssm_out",
+                "shortconv.in_proj", "shortconv.out_proj",
             };
             if (name == "output.weight") {
                 return true; // the output head is built through build_lora_mm in every arch