Commit d7e86430a for llama.cpp
commit d7e86430a7d5fa4a0a7ee8bfb24d413d87bb240e
Author: Aaron Teo <aaron.teo1@ibm.com>
Date: Thu Sep 10 14:49:56 2026 +0800
model: fix all granite family parameter counts (#28643)
* model: fix all granite family parameter counts
Signed-off-by: Aaron Teo <aaron.teo1@ibm.com>
* model: fix additional include, add missing `A` prefix for active experts
Signed-off-by: Aaron Teo <aaron.teo1@ibm.com>
* model: fix code alignment, rm unused 40 block case
Signed-off-by: Aaron Teo <aaron.teo1@ibm.com>
---------
Signed-off-by: Aaron Teo <aaron.teo1@ibm.com>
diff --git a/src/llama-model.cpp b/src/llama-model.cpp
index 54009b369..d10b60afd 100644
--- a/src/llama-model.cpp
+++ b/src/llama-model.cpp
@@ -936,6 +936,7 @@ const char * llm_type_name(llm_type type) {
case LLM_TYPE_17B_128E: return "17Bx128E (Maverick)";
case LLM_TYPE_A13B: return "A13B";
case LLM_TYPE_1B_A400M: return "1B.A400M";
+ case LLM_TYPE_3B_A800M: return "3B.A800M";
case LLM_TYPE_7B_A1B: return "7B.A1B";
case LLM_TYPE_8B_A1B: return "8B.A1B";
case LLM_TYPE_7_9B_A1_3B: return "7.9B.A1.3B";
@@ -946,6 +947,7 @@ const char * llm_type_name(llm_type type) {
case LLM_TYPE_26B_A4B: return "26B.A4B";
case LLM_TYPE_30B_A3B: return "30B.A3B";
case LLM_TYPE_31B_A3_5B: return "31B.A3.5B";
+ case LLM_TYPE_32B_A9B: return "32B.A9B";
case LLM_TYPE_35B_A3B: return "35B.A3B";
case LLM_TYPE_48B_A3B: return "48B.A3B";
case LLM_TYPE_75B_A9B: return "75B.A9B";
diff --git a/src/llama-model.h b/src/llama-model.h
index c0cc40655..a02b30ca7 100644
--- a/src/llama-model.h
+++ b/src/llama-model.h
@@ -117,6 +117,7 @@ enum llm_type {
LLM_TYPE_17B_128E, // llama4 Maverick
LLM_TYPE_A13B,
LLM_TYPE_1B_A400M, // Granite3 MoE
+ LLM_TYPE_3B_A800M, // Granite3 MoE
LLM_TYPE_7B_A1B,
LLM_TYPE_8B_A1B, // lfm2moe
LLM_TYPE_7_9B_A1_3B, // Ling-3.0-tiny
@@ -127,6 +128,7 @@ enum llm_type {
LLM_TYPE_26B_A4B, // Gemma4
LLM_TYPE_30B_A3B,
LLM_TYPE_31B_A3_5B,
+ LLM_TYPE_32B_A9B, // Granite4 Hybrid
LLM_TYPE_35B_A3B, // Qwen3.5
LLM_TYPE_48B_A3B, // Kimi Linear
LLM_TYPE_75B_A9B, // Nemotron 3 Puzzle
diff --git a/src/models/granite-hybrid.cpp b/src/models/granite-hybrid.cpp
index 8a8f7e19f..c177ae787 100644
--- a/src/models/granite-hybrid.cpp
+++ b/src/models/granite-hybrid.cpp
@@ -30,7 +30,7 @@ void llama_model_granite_hybrid::load_arch_hparams(llama_model_loader & ml) {
case 768: type = LLM_TYPE_350M; break;
case 1536: type = (hparams.n_ff() == 512 ? LLM_TYPE_7B_A1B : LLM_TYPE_1B); break;
case 2048: case 2560: type = LLM_TYPE_3B; break;
- case 4096: type = LLM_TYPE_32B; break;
+ case 4096: type = LLM_TYPE_32B_A9B; break;
default: type = LLM_TYPE_UNKNOWN;
}
diff --git a/src/models/granite-moe.cpp b/src/models/granite-moe.cpp
index 156553edf..febe1bfa7 100644
--- a/src/models/granite-moe.cpp
+++ b/src/models/granite-moe.cpp
@@ -9,8 +9,7 @@ void llama_model_granite_moe::load_arch_hparams(llama_model_loader & ml) {
switch (hparams.n_layer()) {
case 24: type = LLM_TYPE_1B_A400M; break;
- case 32: type = LLM_TYPE_3B; break;
- case 40: type = LLM_TYPE_3B; break;
+ case 32: type = LLM_TYPE_3B_A800M; break;
// Add additional layer/vocab/etc checks here for other model sizes
default: type = LLM_TYPE_UNKNOWN;
}
diff --git a/src/models/granite.cpp b/src/models/granite.cpp
index 9e9f97e94..60d463aed 100644
--- a/src/models/granite.cpp
+++ b/src/models/granite.cpp
@@ -38,7 +38,16 @@ void llama_model_granite::load_arch_hparams(llama_model_loader & ml) {
switch (hparams.n_layer()) {
case 32: type = LLM_TYPE_3B; break;
- case 40: type = LLM_TYPE_3B; break;
+ case 40: {
+ switch (hparams.n_embd) {
+ case 2048: type = LLM_TYPE_2B; break;
+ case 2560: type = LLM_TYPE_3B; break;
+ case 4096: type = LLM_TYPE_8B; break;
+ default: type = LLM_TYPE_UNKNOWN;
+ }
+ break;
+ }
+ case 64: type = LLM_TYPE_30B; break;
// Add additional layer/vocab/etc checks here for other model sizes
default: type = LLM_TYPE_UNKNOWN;
}