Text Generation
Transformers
GGUF
English
quantized
sinq
efficient-inference
qwen
llm
compression
conversational
Instructions to use huawei-csl/Qwen3-1.7B-PreSINQ-GGUF with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use huawei-csl/Qwen3-1.7B-PreSINQ-GGUF with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="huawei-csl/Qwen3-1.7B-PreSINQ-GGUF") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("huawei-csl/Qwen3-1.7B-PreSINQ-GGUF", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use huawei-csl/Qwen3-1.7B-PreSINQ-GGUF with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf huawei-csl/Qwen3-1.7B-PreSINQ-GGUF:Q3_K_S # Run inference directly in the terminal: llama cli -hf huawei-csl/Qwen3-1.7B-PreSINQ-GGUF:Q3_K_S
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf huawei-csl/Qwen3-1.7B-PreSINQ-GGUF:Q3_K_S # Run inference directly in the terminal: llama cli -hf huawei-csl/Qwen3-1.7B-PreSINQ-GGUF:Q3_K_S
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf huawei-csl/Qwen3-1.7B-PreSINQ-GGUF:Q3_K_S # Run inference directly in the terminal: ./llama-cli -hf huawei-csl/Qwen3-1.7B-PreSINQ-GGUF:Q3_K_S
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf huawei-csl/Qwen3-1.7B-PreSINQ-GGUF:Q3_K_S # Run inference directly in the terminal: ./build/bin/llama-cli -hf huawei-csl/Qwen3-1.7B-PreSINQ-GGUF:Q3_K_S
Use Docker
docker model run hf.co/huawei-csl/Qwen3-1.7B-PreSINQ-GGUF:Q3_K_S
- LM Studio
- Jan
- vLLM
How to use huawei-csl/Qwen3-1.7B-PreSINQ-GGUF with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "huawei-csl/Qwen3-1.7B-PreSINQ-GGUF" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "huawei-csl/Qwen3-1.7B-PreSINQ-GGUF", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/huawei-csl/Qwen3-1.7B-PreSINQ-GGUF:Q3_K_S
- SGLang
How to use huawei-csl/Qwen3-1.7B-PreSINQ-GGUF 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 "huawei-csl/Qwen3-1.7B-PreSINQ-GGUF" \ --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": "huawei-csl/Qwen3-1.7B-PreSINQ-GGUF", "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 "huawei-csl/Qwen3-1.7B-PreSINQ-GGUF" \ --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": "huawei-csl/Qwen3-1.7B-PreSINQ-GGUF", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use huawei-csl/Qwen3-1.7B-PreSINQ-GGUF with Ollama:
ollama run hf.co/huawei-csl/Qwen3-1.7B-PreSINQ-GGUF:Q3_K_S
- Unsloth Desktop
- Pi
How to use huawei-csl/Qwen3-1.7B-PreSINQ-GGUF with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf huawei-csl/Qwen3-1.7B-PreSINQ-GGUF:Q3_K_S
Configure the model in Pi
# Install Pi: npm install -g @earendil-works/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "huawei-csl/Qwen3-1.7B-PreSINQ-GGUF:Q3_K_S" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Docker Model Runner
How to use huawei-csl/Qwen3-1.7B-PreSINQ-GGUF with Docker Model Runner:
docker model run hf.co/huawei-csl/Qwen3-1.7B-PreSINQ-GGUF:Q3_K_S
- Lemonade
How to use huawei-csl/Qwen3-1.7B-PreSINQ-GGUF with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull huawei-csl/Qwen3-1.7B-PreSINQ-GGUF:Q3_K_S
Run and chat with the model
lemonade run user.Qwen3-1.7B-PreSINQ-GGUF-Q3_K_S
List all available models
lemonade list
- Hermes Agent
How to use huawei-csl/Qwen3-1.7B-PreSINQ-GGUF with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf huawei-csl/Qwen3-1.7B-PreSINQ-GGUF:Q3_K_S
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default huawei-csl/Qwen3-1.7B-PreSINQ-GGUF:Q3_K_S
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use huawei-csl/Qwen3-1.7B-PreSINQ-GGUF with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf huawei-csl/Qwen3-1.7B-PreSINQ-GGUF:Q3_K_S
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:8080/v1 \ --custom-model-id "huawei-csl/Qwen3-1.7B-PreSINQ-GGUF:Q3_K_S" \ --custom-provider-id llama-cpp \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
Update README.md
Browse files
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> | π <a href="http://arxiv.org/abs/2509.22944">Paper</a></p>
|
| 25 |
|
| 26 |
|
| 27 |
-
#
|
| 28 |
|
| 29 |
-
This repository contains the official **
|
| 30 |
-
SINQ is a
|
| 31 |
|
| 32 |
-
|
|
|
|
|
|
|
| 33 |
|
| 34 |
## Model Details
|
| 35 |
-
|
|
|
|
| 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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
|
|
|
|
| 42 |
|
| 43 |
-
## Quantization
|
| 44 |
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
-
|
| 49 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
|
| 51 |
---
|
| 52 |
|
| 53 |
# π Usage
|
| 54 |
|
| 55 |
-
##
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 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
|
| 127 |
-
|
|
|
|
| 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> | π <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 |
+
}
|
|
|