voidstream commited on
Commit
f510725
·
verified ·
1 Parent(s): a6390f5

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +24 -23
README.md CHANGED
@@ -10,6 +10,7 @@ tags:
10
  - helix-substrate
11
  - vector-quantization
12
  - 2d-vq
 
13
  library_name: transformers
14
  pipeline_tag: text-generation
15
  model-index:
@@ -28,33 +29,32 @@ model-index:
28
 
29
  # Zamba2-7B-Instruct-HXQ
30
 
31
- > **2D Vector Quantization (k=4096). 81-layer hybrid Mamba2+Transformer. Benchmarked against bitsandbytes on RTX 4090.**
32
 
33
- Zamba2-7B-Instruct compressed with HXQ 2D VQ: each pair of adjacent weights shares one codebook index. Beats bnb 4-bit NF4 on quality (+3.33% vs +4.57% PPL delta) at full inference speed.
34
 
35
- ## Benchmark: Zamba2-7B-Instruct on RTX 4090
36
 
37
- All numbers from a single session. WikiText-2 test set, MAX_LENGTH=2048, STRIDE=512.
38
 
39
- | Method | PPL | PPL Delta | VRAM (load) | VRAM (peak) | Throughput |
40
- |--------|-----|-----------|-------------|-------------|------------|
41
- | Dense BF16 | 3.7216 | -- | 14.0 GB | 16.2 GB | 4,385 tok/s |
42
- | bitsandbytes 8-bit | 3.7335 | +0.32% | 7.8 GB | 10.0 GB | 2,165 tok/s |
43
- | bitsandbytes 4-bit NF4 | 3.8916 | +4.57% | 5.1 GB | 7.2 GB | 3,468 tok/s |
44
- | **HXQ 2D VQ k=4096** | **3.8454** | **+3.33%** | **14.0 GB** | **16.2 GB** | **4,385 tok/s** |
45
 
46
- **VRAM column shows materialized form** -- weights are expanded to BF16 before GPU inference. Native compressed inference via HelixLinear (fused Triton kernel, 7.4 GB VRAM) ships in `helix-substrate >= 0.3.1` but is not reflected in this table.
47
 
48
- ### Where each method wins
49
-
50
- - **bnb 8-bit**: Best quality (+0.32%), lowest speed (2x slower), moderate VRAM
51
- - **bnb 4-bit NF4**: Smallest VRAM (5.1 GB), worst quality (+4.57%)
52
- - **HXQ 2D VQ**: Better quality than bnb-4bit, zero speed penalty, 4x disk savings
53
 
54
  ## Install and Run
55
 
56
  ```bash
57
- pip install "helix-substrate>=0.3.1"
58
  ```
59
 
60
  ```python
@@ -75,7 +75,7 @@ outputs = model.generate(**inputs, max_new_tokens=32)
75
  print(tokenizer.decode(outputs[0], skip_special_tokens=True))
76
  ```
77
 
78
- **Note:** Requires `transformers==4.49.0` for Zamba2 support. Later versions may have compatibility issues. `mamba-ssm` and `causal-conv1d` recommended for fast Mamba2 inference.
79
 
80
  ## Codec Details
81
 
@@ -84,17 +84,18 @@ print(tokenizer.decode(outputs[0], skip_special_tokens=True))
84
  | **Quantization** | 2D Vector Quantization |
85
  | **Codebook size (k)** | 4,096 |
86
  | **Vector dimension** | 2 (pairs of adjacent weights) |
87
- | **Bits per weight** | 8 effective (uint16 index / 2 weights) |
 
88
  | **Compressed modules** | 213 HelixLinear layers |
89
  | **Exact tensors** | 573 (norms, embeddings, conv1d, A_log, D, dt_bias) |
90
  | **Sidecar corrections** | Yes (sparse outlier compensation) |
91
  | **Calibration data** | None required |
92
- | **HXQ storage** | 7.0 GB (native format) |
93
  | **Dense BF16** | 14.0 GB |
94
 
95
  ### Why 2D VQ
96
 
97
- Standard scalar VQ assigns one codebook entry per weight. 2D VQ groups pairs of adjacent weights and clusters in R^2 -- the codebook captures the joint distribution. With k=4096, this matches or beats scalar k=256 on quality while using the same bits per weight.
98
 
99
  On Zamba2-7B, 2D VQ k=4096 achieves PPL 3.8454 vs the scalar baseline's higher PPL on this architecture. SSM and hybrid architectures benefit from 2D VQ more than pure Transformers.
100
 
@@ -110,9 +111,9 @@ Zamba2-7B-Instruct is a hybrid architecture:
110
 
111
  ## Verification
112
 
113
- - **Benchmark receipt:** [`zamba2_7b_comparison.json`](https://huggingface.co/EchoLabs33/zamba2-7b-instruct-hxq/blob/main/zamba2_7b_comparison.json) -- RTX 4090, 2026-04-01
114
  - **Conversion receipt:** [`conversion_receipt.json`](https://huggingface.co/EchoLabs33/zamba2-7b-instruct-hxq/blob/main/conversion_receipt.json) -- Gate 1 PASS
115
- - **helix-substrate version:** 0.3.1 (2D VQ support)
116
 
117
  ## Companion Models
118
 
 
10
  - helix-substrate
11
  - vector-quantization
12
  - 2d-vq
13
+ - 12bit-packing
14
  library_name: transformers
15
  pipeline_tag: text-generation
16
  model-index:
 
29
 
30
  # Zamba2-7B-Instruct-HXQ
31
 
32
+ > **2D Vector Quantization (k=4096) with 12-bit packed indices. 81-layer hybrid Mamba2+Transformer. Faster than dense at 60% less VRAM.**
33
 
34
+ Zamba2-7B-Instruct compressed with HXQ 2D VQ and 12-bit index packing (6 bits/weight). Beats bnb 4-bit NF4 on quality, speed, and requires no calibration data.
35
 
36
+ ## Benchmark: Native HelixLinear Inference on RTX 3090
37
 
38
+ All numbers from a single session, same GPU, same WikiText-2 test set (50 chunks x 512 tokens).
39
 
40
+ | Method | PPL | Throughput | VRAM (load) | VRAM (peak) | Bits/weight |
41
+ |--------|-----|------------|-------------|-------------|-------------|
42
+ | Dense BF16 | 4.82 | 1,446 tok/s | 14,032 MB | 14,686 MB | 16 |
43
+ | bnb 8-bit | 4.85 | 515 tok/s | 7,831 MB | 8,635 MB | 8 |
44
+ | bnb 4-bit NF4 | 5.07 | 1,579 tok/s | 5,129 MB | 5,904 MB | 4 |
45
+ | **HXQ 12-bit packed** | **5.02** | **1,764 tok/s** | **5,657 MB** | **6,511 MB** | **6** |
46
 
47
+ ### Why HXQ wins
48
 
49
+ - **Faster than dense** (1,764 vs 1,446 tok/s) -- fused Triton gather kernel eliminates memory bottleneck
50
+ - **60% less VRAM** than dense (5.7 GB vs 14.0 GB)
51
+ - **Better quality than bnb 4-bit** (5.02 vs 5.07 PPL) at comparable VRAM
52
+ - **No calibration data required** -- unlike GPTQ, AWQ, or bnb, HXQ compresses from weights alone
 
53
 
54
  ## Install and Run
55
 
56
  ```bash
57
+ pip install "helix-substrate>=0.3.3"
58
  ```
59
 
60
  ```python
 
75
  print(tokenizer.decode(outputs[0], skip_special_tokens=True))
76
  ```
77
 
78
+ **Note:** Tested with `transformers>=4.49`. `mamba-ssm` and `causal-conv1d` recommended for fast Mamba2 inference.
79
 
80
  ## Codec Details
81
 
 
84
  | **Quantization** | 2D Vector Quantization |
85
  | **Codebook size (k)** | 4,096 |
86
  | **Vector dimension** | 2 (pairs of adjacent weights) |
87
+ | **Bits per weight** | 6 effective (12-bit packed index / 2 weights) |
88
+ | **Index packing** | 12-bit (3 bytes per 2 indices, lossless) |
89
  | **Compressed modules** | 213 HelixLinear layers |
90
  | **Exact tensors** | 573 (norms, embeddings, conv1d, A_log, D, dt_bias) |
91
  | **Sidecar corrections** | Yes (sparse outlier compensation) |
92
  | **Calibration data** | None required |
93
+ | **HXQ storage** | 5.7 GB (12-bit packed) |
94
  | **Dense BF16** | 14.0 GB |
95
 
96
  ### Why 2D VQ
97
 
98
+ Standard scalar VQ assigns one codebook entry per weight. 2D VQ groups pairs of adjacent weights and clusters in R^2 -- the codebook captures the joint distribution. With k=4096 and 12-bit index packing, each pair of weights costs 12 bits = 6 bits per weight. This beats scalar k=256 (8 bits/weight) on both quality and compression.
99
 
100
  On Zamba2-7B, 2D VQ k=4096 achieves PPL 3.8454 vs the scalar baseline's higher PPL on this architecture. SSM and hybrid architectures benefit from 2D VQ more than pure Transformers.
101
 
 
111
 
112
  ## Verification
113
 
114
+ - **Benchmark receipt:** [`zamba2_7b_comparison.json`](https://huggingface.co/EchoLabs33/zamba2-7b-instruct-hxq/blob/main/zamba2_7b_comparison.json) -- RTX 3090, 2026-04-02
115
  - **Conversion receipt:** [`conversion_receipt.json`](https://huggingface.co/EchoLabs33/zamba2-7b-instruct-hxq/blob/main/conversion_receipt.json) -- Gate 1 PASS
116
+ - **helix-substrate version:** 0.3.3 (12-bit packing, fused Triton gather)
117
 
118
  ## Companion Models
119