67 lines
2.5 KiB
Markdown
67 lines
2.5 KiB
Markdown
---
|
|
license: apache-2.0
|
|
base_model: Qwen/Qwen2.5-32B
|
|
tags:
|
|
- quantization
|
|
- ternary
|
|
- balanced-ternary
|
|
- tritllm
|
|
library_name: transformers
|
|
---
|
|
|
|
# Qwen2.5-32B-trit-uniform-d2
|
|
|
|
Balanced ternary quantization of [`Qwen/Qwen2.5-32B`](https://huggingface.co/Qwen/Qwen2.5-32B) at depth **d=2** (9 levels per weight, **3.47 bits per weight**) via uniform PTQ.
|
|
|
|
Produced with the codec from **"Balanced Ternary Post-Training Quantization for Large Language Models"** (Stentzel, 2026). See the [Entrit/tritllm-codec](https://huggingface.co/Entrit/tritllm-codec) repository for the codec source and the [paper](https://huggingface.co/Entrit/tritllm-paper) for full evaluation results.
|
|
|
|
## Quick load
|
|
|
|
```python
|
|
from transformers import AutoModelForCausalLM, AutoTokenizer
|
|
|
|
model = AutoModelForCausalLM.from_pretrained("Entrit/Qwen2.5-32B-trit-uniform-d2")
|
|
tokenizer = AutoTokenizer.from_pretrained("Entrit/Qwen2.5-32B-trit-uniform-d2")
|
|
```
|
|
|
|
The weights are dequantized to FP16 for stock-`transformers` compatibility. The on-disk size is therefore the same as the FP16 source. The 3.47-bpw figure refers to the *information content* of the quantized matrices and is what matters for inference on hardware that consumes the packed trit format directly (see [Entrit/tritllm-kernel](https://huggingface.co/Entrit/tritllm-kernel)).
|
|
|
|
## Quantization details
|
|
|
|
| Field | Value |
|
|
|---|---|
|
|
| Source model | [`Qwen/Qwen2.5-32B`](https://huggingface.co/Qwen/Qwen2.5-32B) |
|
|
| Depth | d=2 (9 levels) |
|
|
| Bits per weight | 3.47 |
|
|
| Group size | 16 |
|
|
| Scale codebook | 27-entry log-spaced (scale_depth=3) |
|
|
| Method | uniform PTQ |
|
|
| Quantized layers | all 2D linear matrices |
|
|
| Kept FP16 | `lm_head`, token embeddings, all `*_norm` layers |
|
|
| Codec | tritllm v2 |
|
|
|
|
## What's quantized vs kept FP16
|
|
|
|
Following standard quantization-paper convention, only the 2D linear weight matrices are ternary-quantized. The token embedding lookup and final classifier (`lm_head`) stay in FP16. The 3.47-bpw figure is computed over the quantized matrices only, consistent with how GPTQ, AWQ, and NF4 report BPW.
|
|
|
|
## Citation
|
|
|
|
```
|
|
@article{stentzel2026ternaryptq,
|
|
title = {Balanced Ternary Post-Training Quantization for Large Language Models},
|
|
author = {Stentzel, Eric},
|
|
year = 2026,
|
|
note = {Entrit Systems}
|
|
}
|
|
```
|
|
|
|
## Reproducibility
|
|
|
|
```bash
|
|
git clone https://huggingface.co/Entrit/tritllm-codec
|
|
cd tritllm-codec
|
|
python quantize_model_v2.py --model Qwen/Qwen2.5-32B --configs uniform-d2 --out ./out
|
|
```
|
|
|
|
The output at `./out/uniform-d2/model/` matches this repository.
|