CoolFace
Modelpublic

EchoLabs33/zamba2-2.7b-instruct-hxq

sourceHugging Faceapache-2.0updated 5mo agoView on Hugging Face
0likes208downloads
Model Card

Zamba2-2.7B-Instruct-HXQ

Zamba2-2.7B-Instruct compressed with HXQ (HelixCode vector quantization). Available as both HuggingFace safetensors (via helix-substrate) and native GGUF (via llama.cpp HXQ fork). First hybrid Mamba2+Transformer architecture with HXQ runtime benchmarks.

GGUF Runtime Benchmark (RTX 3090)

Benchmarked against standard GGUF K-quants on RTX 3090, full GPU offload (-ngl 99), using the `hxq-affine-type` branch at commit 580e9a2.

Decode Speed (tg128, 3 runs)

FormatSizebpwtok/svs Q4vs Q6
Q4KM2.11 GB4.547.30100%105.2%
HXQ_AF62.79 GB6.2745.8797.0%102.0%
Q6_K2.93 GB6.5844.9895.1%100%
Q5KM2.51 GB5.6243.3891.7%96.4%

Perplexity (WikiText-2, 654 chunks, ctx=512)

FormatbpwPPLvs Q4
Q6_K6.5822.573-0.705 (best)
HXQ_AF66.2722.653-0.626 (2nd)
Q5KM5.6222.743-0.535
Q4KM4.523.278baseline

Prefill (pp512, 3 runs)

Formattok/svs Q4
Q4KM325.24100%
Q6_K322.1999.1%
Q5KM321.3298.8%
HXQ_AF6318.5597.9%

Summary: HXQAF6 decodes faster than both Q6K (+2.0%) and Q5KM (+5.7%) while being smaller than Q6K (2.79 vs 2.93 GB). PPL is second-best, only 0.080 behind Q6K. Prefill is within 2% across all formats (SSM-dominated, not matmul-dominated). This is the first HXQ runtime benchmark on a hybrid Mamba2+Transformer architecture.

Reproducibility

All claims are within-run comparisons using the same dataset, llama.cpp commit, and hardware. Do not compare these PPL numbers with numbers from other runs using different model variants, dataset files, or build configurations.

Note: Zamba2 absolute PPL (~22) is higher than Qwen (~8-10) on this dataset due to different tokenizer and training distribution. The important metric is relative ranking within this run.

Receipt with SHA256 artifact hashes, exact commands, and dataset provenance: hxq_runtime_3090_zamba2_2.7b_20260509

Install and Run

Option 1: Native GGUF (llama.cpp)

bash
# Build llama.cpp with HXQ + Zamba2 support
git clone -b hxq-affine-type https://github.com/echo313unfolding/llama.cpp.git
cd llama.cpp && mkdir build && cd build
cmake .. -DGGML_CUDA=ON && make -j$(nproc) llama-cli

# Run
./bin/llama-cli -m zamba2-2.7b-instruct-hxq-affine6.gguf \
  -ngl 99 -p "Explain the theory of relativity in simple terms:" -n 128

Option 2: HuggingFace (Python)

bash
pip install "helix-substrate[hf]"
python
import helix_substrate  # registers the HXQ quantizer with HuggingFace
from transformers import AutoModelForCausalLM, AutoTokenizer

model = AutoModelForCausalLM.from_pretrained("EchoLabs33/zamba2-2.7b-instruct-hxq")
tokenizer = AutoTokenizer.from_pretrained("EchoLabs33/zamba2-2.7b-instruct-hxq")

inputs = tokenizer("The capital of France is", return_tensors="pt")
outputs = model.generate(**inputs, max_new_tokens=20)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))

Safetensors Benchmark

Dense (BF16)HXQ (safetensors)
Size5.1 GB2.8 GB
Perplexity (WikiText-2, 2048 ctx)5.335.68 (+6.59%)
Compression ratio1x1.83x
Compressed modules0147 HelixLinear layers

Note: The safetensors PPL (5.68) and GGUF PPL (22.653) use different evaluation configurations (ctx=2048/stride=512 vs ctx=512/654 chunks) and different tokenization. They are not directly comparable.

Good to Know

  • GPU and CPU supported — runs on any CUDA GPU or CPU via standard PyTorch. Native GGUF runs via llama.cpp.
  • Hybrid architecture — 45 Mamba2 layers + 9 shared Transformer layers. SSM tensors (ssmin, ssmout, ssm_mix) and shared FFN all compressed.
  • Fine-tunable via LoRA — compressed weights remain frozen, but LoRA adapters attach to each HelixLinear layer via HelixLinearSTE. See helix-substrate for training infrastructure.
  • Requires `helix-substrate` for safetensors path — the quantizer is not built into transformers.
  • Requires llama.cpp HXQ fork for GGUF path — standard llama.cpp does not have HXQ type support yet. The hxq-affine-type branch also includes Zamba2 architecture support.

What is HXQ?

HXQ is a weight compression codec based on vector quantization with per-group affine correction:

  • Each weight matrix is replaced by a 256-entry codebook + uint8 index matrix + per-group affine scale/offset
  • The compressed form is the executable — codebook[indices] * scale + offset during matmul, no decompression step
  • Works on any nn.Linear regardless of architecture (Transformer, Mamba, MLP)
  • No calibration data required — codebooks are fit from the weights alone via k-means
  • 6.27 bits per weight in the GGUF affine-6 format

Companion Models

Same codec, multiple architectures:

ModelArchitectureGGUFSafetensors
qwen2.5-7b-instruct-hxqTransformerYesYes
qwen2.5-coder-3b-hxqTransformer (code)YesYes
qwen2.5-3b-instruct-hxqTransformerYesYes
qwen2.5-coder-1.5b-hxqTransformer (code)YesYes
qwen2.5-14b-instruct-hxqTransformerYesYes
qwen2.5-sentinel-3b-hxqTransformer (security)--Yes

Citation

bibtex
@software{hxq_2026,
  title={HXQ: Vector Quantization with Per-Group Affine Correction for Neural Network Weight Compression},
  author={Echo Labs},
  year={2026},
  url={https://github.com/echo313unfolding/helix-substrate}
}

License

Apache 2.0 (inherited from Zyphra/Zamba2-2.7B-instruct).