IST-DASLab/GSQ
Gumbel-Softmax scalar quantization for low-bit LLMs on existing INT and GGUF stacks
Automated SPDX check for reference only — not legal advice. Disclaimer
GitHub Star History
Full-history star trajectory from GitHub official history. Switch ranges or hover any point for exact counts.
Evidence-Backed Technical Brief
AI Deep ReviewArchitecture & Core Mechanics
GSQ is a layer-wise PyTorch post-training quantizer, not an inference engine. main.py uses calibration activations to initialize each layer with GPTQ; round-to-nearest is available as an alternative. It then minimizes layer-output reconstruction error by learning a discrete grid assignment for each weight and a scale for each group. Gumbel-Softmax makes the assignments differentiable during refinement: temperature falls and logit scale rises before the final hard selection. The Lion optimizer runs with a cosine learning-rate schedule, and custom autograd replays the sampling RNG state in the backward pass.
Completed layers are serialized as .safetensors shards and moved to meta so they no longer occupy device memory. save_model.py assembles the shards into a Hugging Face-compatible checkpoint with compressed-tensors metadata for vLLM. Model-family wrappers handle dense and expert-parallel MoE variants. Strict YAML validation in src.config.load_config rejects unknown keys, while shell entrypoints expose the quantize, save, serve and evaluate stages separately.
Key Capabilities & Differentiators
The supplied recipes cover ternary, 2-bit and 3-bit weights. The default 2-bit grid uses four integer levels with a learned group scale; the ternary quantizer learns separate sign and mask logits. Model wrappers cover dense LLaMA, Qwen3 and Qwen3.5/3.6, and Gemma-4-35B, alongside Qwen and Kimi K2/K2.5 MoE variants. The GGUF path can refine a public K-Quant checkpoint and write it back in the same format for llama.cpp or Ollama.
At 2.13 bits per parameter, Llama-3.1-Instruct scored 68.55 for 8B and 75.57 for 70B on the zero-shot average across ARC-C/E, HellaSwag, PIQA and Winogrande; the FP16 scores were 73.71 and 78.99. In a separate Qwen3-8B GGUF experiment, the Q2_K average rose from 50.03 to 56.28 without changing the K-Quant format. These results measure quality at specific footprints; they do not establish serving latency or throughput.
Trade-offs & Limitations
GSQ is useful when a scalar checkpoint is a deployment requirement and initialization alone loses too much quality. In the Llama-3.1-70B comparison at 2.13 bpp, GSQ scored 75.57 versus 71.43 for EfficientQAT and 57.38 for GPTQ, but trailed vector-quantized QTIP at 77.25. The trade is additional calibration-driven optimization in exchange for better quality than those scalar baselines in this test, without adopting a vector codebook. Layer offloading reduces GPU residency; it does not eliminate optimization time, activation storage or checkpoint I/O.
A compatible weight format is not a guarantee that a fast kernel will run. On Ada, vLLM's compressed-tensors WNA16 fused MoE path lacks the needed Marlin kernel and falls back to a Triton path that crashes during profiling. An incompatible tensor-parallel shape can trigger that fallback as well. Qwen3.5-MoE requires transformers >= 5.3, which conflicts with the Kimi-K2.5 setup; plan separate environments if both are needed. Treat the benchmark figures as model- and evaluation-specific, not as a reason to skip workload validation.
Hardware & Deployment Guide
GSQ is an Apache-2.0 Python CLI project requiring Python 3.10 or later. scripts/setup_env.sh uses uv.lock to provision the environment, installs flash-attn on top by default and checks imports. The manifest pins PyTorch 2.11.0, torchvision 0.26.0 and vLLM 0.20.2; the default CUDA wheel target is cu128. Start with SMOKE_TEST=1 bash scripts/run.sh for a two-layer check. The scripts use torchrun for local multi-GPU runs. Quantization is self-hosted, but gated weights such as Kimi-K2.5 require Hugging Face access.
Treat quantization and serving as separate hardware checks: H100 is the tested platform, L40S has been used for quantization, and the vLLM serving path targets Hopper or Ampere. MoE tensor parallelism must satisfy attention-head divisibility, KV-head divisibility for GQA, and Marlin alignment of the sharded expert width. At group size 128, the listed valid TP maxima on eight GPUs are 2 for Qwen3-30B-A3B, 4 for Qwen3-235B-A22B and 8 for Kimi K2/K2.5. The serving script clamps TP to a valid value by default. The package manifest is version 0.1.0, with no GitHub release listed.
.safetensors and offloaded to meta before checkpoint assembly.compressed-tensors checkpoints for vLLM and in-format GGUF K-Quant refinement for llama.cpp or Ollama.scripts/serve_model.sh adjusts the requested MoE tensor-parallel size to satisfy attention-head and Marlin shape constraints.Teams evaluating 2–3-bit or ternary LLM weights on CUDA GPUs that can budget for calibration and refinement and need to retain an INT scalar or GGUF K-Quant deployment format.
A ready-made checkpoint or GPTQ alone already meets your quality target, you need CPU-only quantization, or Ada-based vLLM fused MoE serving is a hard requirement.
Quick Start & Installation
curl -LsSf https://astral.sh/uv/install.sh | sh
Comparison vs. Top LLMs & Inference Alternatives
Full comparison →| Repository | Stars | 7d Trend | Stack | License | Core Positioning |
|---|---|---|---|---|---|
| GSQ ★ | 160 | +5 | Python | Apache-2.0 | Gumbel-Softmax scalar quantization for low-bit LLMs on existing INT and GGUF sta |
| minimind | 75.4k | +3.1k | Python | Apache-2.0 | Native PyTorch dense and MoE models for end-to-end LLM training on local GPUs |
| autoresearch | 101k | +342 | Python | — | Single-GPU nanochat harness for agent-led, five-minute training experiments |
| LlamaFactory | 76.4k | +86 | Python | Apache-2.0 | A unified Python framework for LLM and VLM fine-tuning with pluggable inference |
AI Context Briefing (for Claude / Cursor / Windsurf)
Standardized architecture summary & quickstart commands ready to paste into coding agents.
curl -sL https://repoforai.com/repo/IST-DASLab/GSQ.md
Active README embeds unlock Hot-Tier 6h Telemetry Refresh automatically (zero pay-to-rank).
Frequently Asked Questions about GSQ
How do I get a GSQ-optimized model into an inference engine?
main.py, then use save_model.py to assemble the per-layer .safetensors shards into a Hugging Face-compatible checkpoint with compressed-tensors metadata. The GGUF workflow is distinct: GSQ refines an existing K-Quant checkpoint and projects the result back into the same format, so llama.cpp or Ollama can load it without a GSQ-specific runtime.How should I size GPUs and storage for a run?
Can we use GSQ commercially and run it on our own infrastructure?
When should I choose GSQ over GPTQ or a vector quantizer such as QTIP?
Upstream README & Documentation
This profile focuses on independent engineering analysis and live telemetry. Read the full upstream README, changelog, and examples directly on GitHub.
Top 10 Breakout Open-Source AI Repos, Every Thursday
Signal-only digest of fast-growing AI repos, SPDX license alerts, and architecture picks. Zero spam.
Zero spam · 1-click unsubscribe · Privacy Policy