Views
No views yet
transformers >= 5.5.0 (Gemma 4 support).1pip install turboquant-plus-vllm@git+https://github.com/varjoranta/turboquant-vllm.git
2pip install 'transformers>=5.5'1from turboquant_vllm import load_tq3_model
2
3model, tokenizer = load_tq3_model("varjosoft/gemma-4-26B-A4B-it-TQ3-native")
4
5chat = [{"role": "user", "content": "What is the capital of Finland?"}]
6text = tokenizer.apply_chat_template(chat, tokenize=False, add_generation_prompt=True)
7inputs = tokenizer(text, return_tensors="pt").to("cuda")
8
9import torch
10with torch.no_grad():
11 output = model.generate(**inputs, max_new_tokens=100, do_sample=False)
12print(tokenizer.decode(output[0], skip_special_tokens=True))load_tq3_model) creates the model skeleton on a meta device (zero memory), loads packed weights directly to GPU, and decompresses on-the-fly during each forward pass. Linear layers become compressed wrapper modules. MoE expert weights use chunked decompression (8 experts at a time) to limit GPU memory peak.AutoModelForCausalLM.from_pretrained(). You must use load_tq3_model() from the turboquant-plus-vllm library.| Metric | Value |
|---|---|
| Checkpoint size | 12 GB (vs 52 GB BF16) |
| GPU memory for weights | 13.5 GB |
| Compression ratio | 4.3x |
| Quality | Same packed weights as runtime TQ3, which scores 4.79/5 on our 20-scenario benchmark |
| Load time | ~6 seconds (H100), ~12 seconds (L40S) |
| Minimum GPU | L40S 48GB tested. 24 GB-class feasible subject to KV cache and runtime overhead |
model-00001-of-00003.safetensors through model-00003-of-00003.safetensors: packed 3-bit weight indices (.tq_packed) and per-group norms (.tq_norms) for compressed layers; FP16 tensors for embeddings, layer norms, and biasestq_config.json: compression parameters (bits=3, group_size=128, seed=42)config.json, tokenizer.json, tokenizer_config.json: standard HuggingFace model config and tokenizer1from turboquant_vllm.checkpoint import save_tq3_checkpoint
2
3save_tq3_checkpoint("google/gemma-4-26B-A4B-it", "./gemma4-tq3-native")
4# CPU only, ~60 GB RAM, ~2 minutes. No GPU needed.original_norm / reconstruction_norm per group to fix magnitude shrinkage at 3-bit.1@inproceedings{zandieh2026turboquant,
2 title={TurboQuant: Online Vector Quantization with Near-optimal Distortion Rate},
3 author={Zandieh, Amir and Daliri, Majid and Hadian, Majid and Mirrokni, Vahab},
4 booktitle={International Conference on Learning Representations},
5 year={2026}
6}