From 58137f0f479970d589091f37cb15c2b41eeea905 Mon Sep 17 00:00:00 2001 From: Georgi Gerganov Date: Tue, 4 Aug 2026 18:11:42 +0300 Subject: [PATCH] quant : allow quantization of ffn_gate_inp tensors --- src/llama-quant.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/llama-quant.cpp b/src/llama-quant.cpp index fd6e787bd7..39d2f66fd0 100644 --- a/src/llama-quant.cpp +++ b/src/llama-quant.cpp @@ -141,7 +141,7 @@ static tensor_category tensor_get_category(const std::string & tensor_name) { if (tensor_name.find("ffn_up") != std::string::npos) { return tensor_category::FFN_UP; } - if (tensor_name.find("ffn_gate") != std::string::npos) { + if (tensor_name.find("ffn_gate") != std::string::npos && tensor_name.find("ffn_gate_inp") == std::string::npos) { return tensor_category::FFN_GATE; } if (tensor_name.find("ffn_down") != std::string::npos) { @@ -303,10 +303,6 @@ static bool tensor_allows_quantization(const llama_model_quantize_params * param quantize &= params->quantize_output_tensor || name != "output.weight"; - // do not quantize expert gating tensors - // NOTE: can't use LLM_TN here because the layer number is not known - quantize &= name.find("ffn_gate_inp.weight") == std::string::npos; - // do not quantize the i32 token-id -> expert-id routing table (DeepSeek-V4) quantize &= name.find("ffn_gate_tid2eid.weight") == std::string::npos;