Text Generation
Transformers
Safetensors
English
zamba2
mamba
hybrid
compressed
hxq
helix-substrate
vector-quantization
helixcode
conversational
Instructions to use EchoLabs33/zamba2-7b-instruct-hxq with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use EchoLabs33/zamba2-7b-instruct-hxq with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="EchoLabs33/zamba2-7b-instruct-hxq") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("EchoLabs33/zamba2-7b-instruct-hxq") model = AutoModelForCausalLM.from_pretrained("EchoLabs33/zamba2-7b-instruct-hxq", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use EchoLabs33/zamba2-7b-instruct-hxq with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "EchoLabs33/zamba2-7b-instruct-hxq" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "EchoLabs33/zamba2-7b-instruct-hxq", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/EchoLabs33/zamba2-7b-instruct-hxq
- SGLang
How to use EchoLabs33/zamba2-7b-instruct-hxq with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "EchoLabs33/zamba2-7b-instruct-hxq" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "EchoLabs33/zamba2-7b-instruct-hxq", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "EchoLabs33/zamba2-7b-instruct-hxq" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "EchoLabs33/zamba2-7b-instruct-hxq", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use EchoLabs33/zamba2-7b-instruct-hxq with Docker Model Runner:
docker model run hf.co/EchoLabs33/zamba2-7b-instruct-hxq
Upload README.md with huggingface_hub
Browse files
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.
|
| 32 |
|
| 33 |
-
Zamba2-7B-Instruct compressed with HXQ 2D VQ
|
| 34 |
|
| 35 |
-
## Benchmark:
|
| 36 |
|
| 37 |
-
All numbers from a single session
|
| 38 |
|
| 39 |
-
| Method | PPL |
|
| 40 |
-
|--------|-----|-----------|-------------|-------------|------------|
|
| 41 |
-
| Dense BF16 |
|
| 42 |
-
|
|
| 43 |
-
|
|
| 44 |
-
| **HXQ
|
| 45 |
|
| 46 |
-
|
| 47 |
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
- **bnb
|
| 51 |
-
- **
|
| 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.
|
| 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:**
|
| 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** |
|
|
|
|
| 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** |
|
| 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,
|
| 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
|
| 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.
|
| 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 |
|