Hacktoberfest 2026:維護者為十月標記出來的 issue,仍然開放、適合新手。 瀏覽 Hacktoberfest issue

I2_S produces incorrect output on aarch64

未關閉
#598 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

評估

難度
4/5
預估耗時
3-5 天
新手友好度
25/100
Issue 類型
缺陷
描述清晰度
描述清楚
活躍度
停滯
技術堆疊
cpp

研究方向

從釘選的 3rdparty/llama.cpp 子模組開始,重點查看 quants.c、ggml-cpu-i2s.c、ggml_gemm_i2_i8_s 和 ggml_vec_dot_i2_i8_s。在 aarch64 上使用列出的 llama-cli 命令重現,然後將 perplexity 和 GEMV/GEMM 核心輸出與 x86 進行比較。跨架構的輸出和 perplexity 相符即表示完成。

由索引模型根據 Issue 內容生成。

描述

I2_S inference is broken on aarch64. The model loads and runs, but output is nonsense — it does not crash, so it looks like a bad model rather than a broken kernel.

On an Orange Pi 5 Plus (RK3588, Debian 12, GCC 12.2) with microsoft/BitNet-b1.58-2B-4T's official ggml-model-i2_s.gguf:

$ llama-cli -m ggml-model-i2_s.gguf -p "The capital of France is" -n 12 --temp 0
> The capital of France is  ????????????????
[ Prompt: 0.7 t/s | Generation: 0.7 t/s ]

The same file on x86-64 gives The capital of France is Paris. at ~40 t/s. Model md5 verified identical on both machines.

Three separate bugs, all in 3rdparty/llama.cpp code paths that x86 never compiles:

  1. QK_I2_S is 128 under AVX2 but 64 under __ARM_NEON, in both quants.c and ggml-cpu-i2s.c. It is the on-disk block size, so it must match the file format on every architecture.
  2. The scalar vec_dot fallback decodes the block-interleaved weight layout sequentially.
  3. ggml_gemm_i2_i8_s's ACT_PARALLEL branch inverts ggml_vec_dot_i2_i8_s's nrc semantics, corrupting prefill.

There is also no NEON path for I2_S at all — aarch64 unpacks one 2-bit weight at a time.

Fixes in https://github.com/isHuangXin/llama.cpp/pull/2, against the pinned 3rdparty/llama.cpp submodule. After them, perplexity on aarch64 matches x86 to 0.161% (74.0952 vs 73.9758, same model and corpus), and kernel output is bit-identical for both GEMV and GEMM.

This may be the same root cause as #55.

主要語言
C++
星號
40.3k
分支
3.7k
PR 合併指標
30 天內沒有已合併 PR

環境準備

這個專案沒有提供開發容器、Dockerfile 或貢獻指南,環境需要你自己搭建:先看它的 README,通用步驟見我們的新手貢獻指南。

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

microsoft/BitNet 的其他 Issue

查看 microsoft/BitNet 的全部 Issue

相似的 Issue

更多 C++ Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。