EvanOLeary/laguna-xs2-dense-k8-cuda-sft-int4-hqq
010
Laguna-XS.2 → Dense (K=8) · CUDA-SFT · HQQ 4-bit
Quantized variant of `EvanOLeary/laguna-xs2-dense-k8-cuda-sft`. 4-bit weight quantization via HQQ (Half-Quadratic Quantization). Pure-PyTorch, data-free, no calibration set required.
Size & quality
ReLU CUDA kernel smoke test (greedy decode, 400 maxnewtokens)
302 tokens generated in 51.7s = 5.8 tok/s.
Prompt: "Write a CUDA kernel that computes ReLU (max(x, 0)) on a float array in-place. Include the kernel and a host-side launcher."
The model produced a complete torch::extension-style CUDA kernel with templated relu_kernel, AT_DISPATCH_FLOATING_TYPES dispatch, a relu_forward host launcher, and a PYBIND11_MODULE entrypoint suitable for torch.utils.cpp_extension.load_inline.
How to load
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
repo = "EvanOLeary/laguna-xs2-dense-k8-cuda-sft-int4-hqq"
tok = AutoTokenizer.from_pretrained(repo, trust_remote_code=True)
from hqq.models.hf.base import AutoHQQHFModel
model = AutoHQQHFModel.from_quantized(repo, compute_dtype=torch.bfloat16, device="cuda")
msgs = [{"role":"user","content":"Write a CUDA kernel for elementwise sigmoid on a float array."}]
text = tok.apply_chat_template(msgs, add_generation_prompt=True, tokenize=False)
ids = tok(text, return_tensors="pt", add_special_tokens=False).input_ids.to(model.device)
out = model.generate(ids, max_new_tokens=400, do_sample=False, pad_token_id=tok.pad_token_id)
print(tok.decode(out[0][ids.shape[-1]:], skip_special_tokens=True))Provenance & roadmap
Quantization details
- Library: hqq 0.2.8 Half-Quadratic Quantization
- Scheme: 4-bit weight-only, group_size=64, axis=1
- Calibration: none (data-free; HQQ optimizes per-tensor quantization params analytically)
- Verification: smoke test produces valid CUDA kernel code on the ReLU prompt (see snapshot in this card)
