gemm block quantization infrastructure for llm decoder style#6439
gemm block quantization infrastructure for llm decoder style#6439nihui wants to merge 33 commits into
Conversation
|
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #6439 +/- ##
==========================================
- Coverage 94.70% 94.67% -0.04%
==========================================
Files 947 947
Lines 415846 416607 +761
==========================================
+ Hits 393844 394437 +593
- Misses 22002 22170 +168 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
The binary size change of libncnn.so (bytes)
|
There was a problem hiding this comment.
Pull request overview
This WIP pull request implements block quantization for GEMM layers to support 4-bit, 6-bit, and 8-bit quantization for LLM decoder-style models. The changes introduce a new quantization tool and corresponding dequantization logic in the GEMM layer implementation.
Key changes:
- New
ncnnllm2int468tool for quantizing GEMM weight matrices with configurable block sizes and bit widths - Block-based quantization scheme using per-block scaling factors stored in
B_data_quantize_scales - Dequantization logic in
gemm.cppthat converts quantized weights back to fp32 during model loading
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 15 comments.
Show a summary per file
| File | Description |
|---|---|
| tools/quantize/ncnnllm2int468.cpp | New quantization tool implementing 4/6/8-bit block quantization with custom bit-packed storage formats |
| tools/quantize/CMakeLists.txt | Build configuration adding the new ncnnllm2int468 executable |
| tools/modelwriter.h | Extended serialization to save block quantization scales for int8_scale_term values 4/5/6 |
| src/layer/gemm.h | Added B_data_quantize_scales member to store per-block scaling factors |
| src/layer/gemm.cpp | Implemented loading and dequantization logic for 4/6/8-bit block-quantized weights |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
40b677c to
a1f6e8f
Compare
Uh oh!
There was an error while loading. Please reload this page.