Repository navigation
feat(kernels): Fisher-guided sparse CSR epilogues & multi-colimit functorial TL1/TL2 AVX2 kernels - #689
Open
Gemirson (gemirson) wants to merge 3 commits into
Conversation
added 3 commits
November 20, 2026 14:44
…ial TL1/TL2 AVX2 header
…converter & AVX2 benchmarks
… (704.4x PPL reduction)
Author
|
Aceito |
Author
|
@microsoft-github-policy-service agree |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
RFC & Reference Implementation: Fisher-Guided Sparse CSR Epilogues, Multi-Colimit Layer Group Sharing ($K \ll L$ ), and Q16.16 Functorial Morphisms for
TL1/TL2mpGEMM1. Motivation
bitnet.cppachieves remarkable CPU inference speedups via its zero-multiplicationTL1(2-trits-in-4-bits) andTL2(3-trits-in-5-bits,vpshufb) kernels andSubLNactivation stabilization. However, two structural barriers remain for wider adoption across the open-source ecosystem:Quantizing standard pretrained FP16/BF16 models (e.g.,
Qwen2.5-Coder,Llama-3,Mistral) directly onto the ternary gridLoading
gate_proj,up_proj,down_proj) from DRAM evicts L3 cache at every layer on desktop and edge CPUs.2. What This PR Adds (100% Opt-In & Zero Breaking Changes)
include/ggml-bitnet-kinecat.hggml_bitnet_subln_and_quantize_i8,ggml_bitnet_tl1_fisher_csr_q16_matvec(vpshufb),ggml_bitnet_tl2_fisher_csr_q16_matvec(5-bit/3-trit half-space LUT),ggml_bitnet_apply_fisher_csr_epilogue, andggml_bitnet_caputo_q16_depth_step.include/ggml-bitnet.h&src/ggml-bitnet-lut.cpp#ifdef GGML_BITNET_FISHER_CSRhook attachingfisher_csr_morphtobitnet_tensor_extraand invokingggml_bitnet_apply_fisher_csr_epilogueinsideggml_bitnet_mul_matwith zero ABI or runtime impact when disabled.utils/convert-hf-to-bitnet-fisher-csr.pyTL2(2.151 bpwtotal atutils/test-bitnet-kinecat-fusion.cpp-Wall -Wextra -Werror) verifyingTL1(vpshufb) andTL2(5-bit/3-trit) exactness against scalar reference.utils/bench-bitnet-kinecat-fusion.cppTL2vs.TL2 + 2% Fisher CSRquality and3. Mathematical Formulation
bitnet.cpp's zero-multiplicationvpshufbLUT inner loop (TL2).4. Measured Benchmarks & Verification (x86_64 AVX2,
g++ -O3 -mavx2 -mfma)1536 x 1536, heavy-tailed pretrained distribution,TL2(TL2 + 2.0% Fisher CSR(This PR)0.664390.95559+0.291200.769230.30133-60.8%error13,404.3647.3699.65%curvature recoveredTL2core + 2% CSR)1.667 bpw2.151 bpw+0.484 bpwL=24indep. vs.K=4Multi-Colimit)14.52 MiB5.14 MiB2.82xsmaller (L3-resident)test-bitnet-kinecat-fusion.cpp)max_diff = 1.48e-06TL1&TL2Real Pretrained Model Evaluation: Zero-Shot PTQ on$L=24$ , 168 Linear Layers)
Qwen/Qwen2.5-Coder-0.5B-Instruct(Calibrating diagonal Fisher/Hessian curvature$H_{jj} = \mathbb{E}[x_j^2]$ on a disjoint calibration split and evaluating held-out Perplexity (PPL) and Teacher KL Divergence (zero fine-tuning steps):
TL2Qwen2.5-Coder-0.5B-Instruct)16.0003.950.00TL2(0.0%Fisher CSR)1.667214,582.94785.91TL2+1.35%Fisher CSR Int81.98922,307.92613.499.62xlower PPLTL2+2.00%Fisher CSR Int82.1492,174.26447.5998.69xlower PPLTL2+2.80%Fisher CSR Int82.337304.63312.10704.41xlower PPL (-60.3%KL)Reproduce Locally