bitnet-b1.58-2B-4T runs FFN with SiLU instead of relu2 - wrong logits on every backend
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Accessibilité débutants
- 68/100
- Type d'issue
- Bug
- Clarté
- Clairement spécifiée
- Activité
- Active
- Domaine
- machine-learning
Piste de recherche
Commencez par src/models/bitnet.cpp et src/llama-model.cpp, puis examinez la gestion des activations cachées dans src/llama-graph.cpp et dans les deux scripts de conversion BitNet. Vérifiez le GGUF converti avec gguf-dump et comparez les logits ou le texte généré pour le modèle microsoft/bitnet-b1.58-2B-4T. Le travail est terminé lorsque relu2 est enregistré et utilisé, tandis que les anciens fichiers GGUF conservent le comportement de SiLU.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
bitnet-b1.58-2B-4T runs the FFN with SiLU instead of relu² — wrong logits on every backend
Summary
The official microsoft/bitnet-b1.58-2B-4T model declares "hidden_act": "relu2" in its config.json, but the BitNet.cpp runtime never reads it: the FFN graph is built with a hardcoded LLM_FFN_SILU. The model therefore runs with the wrong activation function on every backend (CPU and GPU), producing wrong-but-finite output — the same failure class as #586.
Root cause
src/models/bitnet.cpp:133—build_ffn(...)is called with a hardcodedLLM_FFN_SILU.src/llama-model.cpp— theLLM_FFN_OP_TYPES_FROM_STRINGmap has"relu"but no"relu2", andllm_ffn_op_type_from_string()is never wired into the bitnet arch.utils/convert-hf-to-gguf-bitnet.py/utils/convert-ms-to-gguf-bitnet.py— neither converter writes<arch>.hidden_activation, so the existing plumbing (llama_hparams::llm_ffn_op,LLM_KV_HIDDEN_ACT,LLM_FFN_RELU_SQRinsrc/llama-graph.cpp) is never exercised for bitnet models.
The graph builder already implements LLM_FFN_RELU_SQR (relu → sqr, src/llama-graph.cpp:1690); with LLM_FFN_PAR gating it produces exactly relu²(gate) * up, matching the HF BitnetMLP (act_fn(gate) * up).
Fix (attached patches)
src/llama-model.cpp: add{ "relu2", LLM_FFN_RELU_SQR }toLLM_FFN_OP_TYPES_FROM_STRING.src/models/bitnet.cpp: read<arch>.hidden_activationinload_arch_hparams(mirroringllama_model_modern_bert), defaulting toLLM_FFN_SILUfor backward compatibility with existing GGUF files; usehparams.llm_ffn_opin the graph.- Converters: write
add_hidden_act("relu2").
Verification
- Convert
microsoft/bitnet-b1.58-2B-4Twith the patched converter;gguf-dumpshould showbitnet_b158.hidden_activation = "relu2". - Compare logits before/after: with the fix the model produces coherent text; without it, output is wrong-but-finite.
- Old GGUF files (no key) keep the previous SiLU behavior — no regression.
Related
- #586 — same wrong-but-finite class (ARM i2_s layout).
- Langage dominant
- C++
- Étoiles
- 40.3k
- Forks
- 3.7k
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Guide de contribution
Aucun guide de contribution indexé pour ce dépôt
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de microsoft/BitNet
-
Difficulté 2/5 1-3 heures Accessibilité débutants 86/100
-
i2_s SIGSEGVs at n_ubatch >= 32: BLAS backend dequantises by a row stride 4x the real packed row Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
-
Difficulté 2/5 1-3 heures Accessibilité débutants 86/100
-
Difficulté 1/5 Moins d'une heure Accessibilité débutants 92/100
-
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
Toutes les issues de microsoft/BitNet
Issues similaires
-
prio:medium status:idea type:feat
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
-
tests
Difficulté 2/5 1-3 heures Accessibilité débutants 88/100
-
kind/bug needs-sig needs-triage
Difficulté 2/5 1-3 heures Accessibilité débutants 84/100
-
Code path without return value Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
drogonframework/drogon#2605 ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 86/100
ArthurSonzogni/FTXUI#1363 ·