chiaraboretti commited on
Commit
b7bbd3b
Β·
verified Β·
1 Parent(s): 702702a

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +56 -83
README.md CHANGED
@@ -9,7 +9,6 @@ arxiv: 2509.22944
9
  tags:
10
  - quantized
11
  - sinq
12
- - int3
13
  - efficient-inference
14
  - qwen
15
  - llm
@@ -24,107 +23,82 @@ base_model_relation: quantized
24
  <p align="center">πŸ™ <a href="https://github.com/huawei-csl/SINQ">Github</a>&nbsp;&nbsp; | &nbsp;&nbsp;πŸ“„ <a href="http://arxiv.org/abs/2509.22944">Paper</a></p>
25
 
26
 
27
- # SINQ 3-bit Quantized Qwen3-1.7B model
28
 
29
- This repository contains the official **3-bit quantized** version of the [`Qwen3-1.7B`](https://huggingface.co/Qwen/Qwen3-1.7B) model using the **SINQ (Sinkhorn-Normalized Quantization)** method.
30
- SINQ is a novel, fast and high-quality quantization method designed to make any Large Language Models smaller while keeping their accuracy almost intact.
31
 
32
- To support the project please put a star ⭐ in the official [SINQ](https://github.com/huawei-csl/SINQ) github repository.
 
 
33
 
34
  ## Model Details
35
- - **Model Name:** `Qwen3-1.7B-3bit-SINQ `
 
36
  - **Base Model:** [`Qwen/Qwen3-1.7B`](https://huggingface.co/Qwen/Qwen3-1.7B)
37
  - **Task:** Text Generation
38
  - **Framework:** PyTorch / Transformers
39
  - **License:** [Apache-2.0](https://www.apache.org/licenses/LICENSE-2.0)
40
- - **Quantized By:** *Huawei - Computing Systems Lab*
 
 
 
 
 
 
41
 
 
42
 
43
- ## Quantization Details
44
 
45
- - **Quantization Method:** SINQ (Sinkhorn-Normalized Quantization)
46
- - **Precision:** INT3
47
- - **Group Size:** 64
48
- - **Framework:** PyTorch
49
- - **Quantization Library:** `sinq`
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
50
 
51
  ---
52
 
53
  # πŸš€ Usage
54
 
55
- ## Prerequisite
56
- Before running the quantization script, make sure the **SINQ** library is installed.
57
- Installation instructions and setup details are available in the [SINQ official github repository](https://github.com/huawei-csl/SINQ).
58
-
59
- ## Usage example
60
- You can load and use the model with our wrapper based on the πŸ€— Transformers library:
61
-
62
- ```python
63
- import torch
64
- from transformers import AutoTokenizer
65
- from sinq.patch_model import AutoSINQHFModel
66
-
67
- model_name = "huawei-csl/Qwen3-1.7B-3bit-SINQ"
68
- tokenizer = AutoTokenizer.from_pretrained(model_name)
69
- sinq_model = AutoSINQHFModel.from_quantized_safetensors(
70
- model_name,
71
- device="cuda:0",
72
- compute_dtype=torch.bfloat16
73
- )
74
-
75
- prompt = "Explain neural network quantization in one sentence."
76
- inputs = tokenizer(prompt, return_tensors="pt").to("cuda:0")
77
- with torch.inference_mode():
78
- out_ids = sinq_model.generate(**inputs, max_new_tokens=32, do_sample=False)
79
- print(tokenizer.decode(out_ids[0], skip_special_tokens=True))
80
-
81
- ```
82
-
83
- <details>
84
- <summary><span style="font-size:1.1em; font-weight:bold;">🧩 Quantization Process</span></summary>
85
-
86
- The quantized model was obtained using the **SINQ** quantization library, following the steps below:
87
-
88
- ```python
89
- import torch
90
- from transformers import AutoModelForCausalLM, AutoTokenizer
91
- from sinq.patch_model import AutoSINQHFModel
92
- from sinq.sinqlinear import BaseQuantizeConfig
93
-
94
- # Load base model
95
- base_model_name = "Qwen/Qwen3-1.7B"
96
- model = AutoModelForCausalLM.from_pretrained(base_model_name, torch_dtype="float16")
97
- tokenizer = AutoTokenizer.from_pretrained(base_model_name)
98
-
99
- # Apply 3-bit SINQ quantization
100
- quant_cfg = BaseQuantizeConfig(
101
- nbits=3, # quantization bit-width
102
- group_size=64, # group size
103
- tiling_mode="1D", # tiling strategy
104
- method="sinq" # quantization method ("asinq" for the calibrated version)
105
- )
106
-
107
- qmodel = AutoSINQHFModel.quantize_model(
108
- model,
109
- tokenizer=tokenizer,
110
- quant_config=quant_cfg,
111
- compute_dtype=torch.bfloat16,
112
- device="cuda:0"
113
- )
114
- ```
115
-
116
- > **Reproducibility Note**: This model was quantized using the SINQ implementation from commit [`14ad847`](https://github.com/huawei-csl/SINQ/commit/14ad847d0ab25f1794b8820506f59b5c9c1fc979) of the [SINQ](https://github.com/huawei-csl/SINQ) repository.
117
-
118
- </details>
119
-
120
- </br>
121
 
122
  ---
123
 
124
  # 🧾 How to Cite This Work
125
 
126
- If you find **SINQ** useful in your research or applications, please
127
- - Put a star ⭐ in the official [SINQ](https://github.com/huawei-csl/SINQ) github repository.
 
128
  - Cite our <a href="http://arxiv.org/abs/2509.22944" target="_blank"><strong>paper</strong></a>:
129
 
130
  ```bibtex
@@ -136,5 +110,4 @@ If you find **SINQ** useful in your research or applications, please
136
  archivePrefix={arXiv},
137
  primaryClass={cs.LG},
138
  url={http://arxiv.org/abs/2509.22944}
139
- }
140
- ```
 
9
  tags:
10
  - quantized
11
  - sinq
 
12
  - efficient-inference
13
  - qwen
14
  - llm
 
23
  <p align="center">πŸ™ <a href="https://github.com/huawei-csl/SINQ">Github</a>&nbsp;&nbsp; | &nbsp;&nbsp;πŸ“„ <a href="http://arxiv.org/abs/2509.22944">Paper</a></p>
24
 
25
 
26
+ # PreSINQ GGUF Quantized Qwen3-1.7B Model
27
 
28
+ This repository contains the official PreSINQ **GGUF-quantized** versions of the [`Qwen3-1.7B`](https://huggingface.co/Qwen/Qwen3-1.7B) model. For a detailed explanation of PreSINQ strategy please refer to the the official [SINQ](https://github.com/huawei-csl/SINQ) repository.
29
+ SINQ is a fast and high-quality quantization technique designed to significantly reduce Large Language Model size while preserving accuracy.
30
 
31
+ If you find this project useful, please consider giving a ⭐ to the official [SINQ](https://github.com/huawei-csl/SINQ) repository.
32
+
33
+ ---
34
 
35
  ## Model Details
36
+
37
+ - **Model Name:** `Qwen3-1.7B-PreSINQ-GGUF`
38
  - **Base Model:** [`Qwen/Qwen3-1.7B`](https://huggingface.co/Qwen/Qwen3-1.7B)
39
  - **Task:** Text Generation
40
  - **Framework:** PyTorch / Transformers
41
  - **License:** [Apache-2.0](https://www.apache.org/licenses/LICENSE-2.0)
42
+ - **Quantized By:** *Huawei – Computing Systems Lab*
43
+
44
+ ---
45
+
46
+ # How to Obtain the PreSINQ Model
47
+
48
+ The PreSINQ Qwen3-1.7B models are produced using the **PreSINQ GGUF script** available in the official [SINQ](https://github.com/huawei-csl/SINQ) repository.
49
 
50
+ The models provided here correspond to the best-performing configurations for each quantization type.
51
 
52
+ ## πŸ“Š Best PreSINQ Quantization Results (Qwen3-1.7B)
53
 
54
+ Results below are measured on the **WikiText-2 test set**.
55
+
56
+ | Method | Bits | Size (GB) | Perplexity ↓ |
57
+ |----------|--------|------------|----------------|
58
+ | Baseline (FP16) | FP16 | 1.41 | 17.1294 |
59
+ | Baseline + Q4_K_S | 4-bit | 0.45 | 19.5454 |
60
+ | **PreSINQ + Q4_K_S** | 4-bit | 0.37 | **17.4544** |
61
+ | Baseline + Q3_K_S | 3-bit | 0.37 | 24.0242 |
62
+ | **PreSINQ + Q3_K_S** | 3-bit | 0.31 | **18.8032** |
63
+
64
+ However, you can generate good PreSINQ models (not the best one) faster by reducing the number of configurations explored during the PreSINQ script execution.
65
+ The table below shows perplexity for different PreSINQ parameter configurations using **Q4_K_S quantization**.
66
+ Evaluation is performed on a 5k-line subset of the **Pile validation dataset**.
67
+
68
+ | Group Size | Iterations | Repetitions | Perplexity |
69
+ |-------------|-------------|-------------|-------------|
70
+ | 32 | 2 | 1 | 11.7196 |
71
+ | 32 | 4 | 1 | 11.7238 |
72
+ | 32 | 8 | 1 | **11.6885** |
73
+ | 32 | 16 | 1 | 11.6909 |
74
+ | 64 | 2 | 1 | 11.7421 |
75
+ | 64 | 4 | 1 | 11.7240 |
76
+ | 64 | 8 | 1 | 11.6975 |
77
+ | 64 | 16 | 1 | 11.7001 |
78
+ | 128 | 2 | 1 | 11.7129 |
79
+ | 128 | 4 | 1 | 11.7118 |
80
+ | 128 | 8 | 1 | 11.7149 |
81
+ | 128 | 16 | 1 | 11.7208 |
82
 
83
  ---
84
 
85
  # πŸš€ Usage
86
 
87
+ ## Usage Example
88
+
89
+ You can load and run the PreSINQ GGUF models using:
90
+
91
+ - πŸ€— Transformers
92
+ - llama.cpp
93
+ - Any GGUF-compatible inference framework
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
94
 
95
  ---
96
 
97
  # 🧾 How to Cite This Work
98
 
99
+ If you find **SINQ** useful in your research or applications:
100
+
101
+ - Please give a ⭐ to the official [SINQ](https://github.com/huawei-csl/SINQ) repository
102
  - Cite our <a href="http://arxiv.org/abs/2509.22944" target="_blank"><strong>paper</strong></a>:
103
 
104
  ```bibtex
 
110
  archivePrefix={arXiv},
111
  primaryClass={cs.LG},
112
  url={http://arxiv.org/abs/2509.22944}
113
+ }