bitnet-b1.58-2B-4T runs FFN with SiLU instead of relu2 - wrong logits on every backend
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 68/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Ambito
- machine-learning
Direzione di ricerca
Inizia con src/models/bitnet.cpp e src/llama-model.cpp, poi esamina la gestione delle attivazioni nascoste in src/llama-graph.cpp e in entrambi gli script di conversione di BitNet. Verifica il GGUF convertito con gguf-dump e confronta i logits o il testo generato per il modello microsoft/bitnet-b1.58-2B-4T. Il lavoro è completato quando relu2 viene registrato e utilizzato, mentre i file GGUF più vecchi mantengono il comportamento di SiLU.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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).
- Lingua principale
- C++
- Stelle
- 40.3k
- Fork
- 3.7k
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di microsoft/BitNet
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
-
i2_s SIGSEGVs at n_ubatch >= 32: BLAS backend dequantises by a row stride 4x the real packed row Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 92/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
Tutte le issue di microsoft/BitNet
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
flutter-webrtc/flutter-webrtc#2206 ·
-
litertlm-android AAR ships no consumer ProGuard rules → "mid == null" SIGABRT in minified apps Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
google-ai-edge/LiteRT-LM#3739 ·
-
Component: GLib
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
brave/brave-browser#59300 ·
-
Mute ydb/tests/functional/dstool/test_canonical_requests.py.Test.test_group_take_snapshot in main Apertaai_reviewed
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
ydb-platform/ydb#53974 · 3 commenti ·