CoolFace
Modelpublic

EvanOLeary/laguna-xs2-dense-k8-cuda-sft-int8

sourceHugging Faceapache-2.0updated 4mo agoView on Hugging Face
0likes19downloads
Model Card

Laguna-XS.2 → Dense (K=8) · CUDA-SFT · torchao Int8 weight-only

Quantized variant of `EvanOLeary/laguna-xs2-dense-k8-cuda-sft`. Pure-PyTorch int8 weight-only quantization via torchao. Bf16 activations / compute, int8 storage. Quantization is lossless on greedy decode for the ReLU smoke prompt (byte-identical to bf16).

Size & quality

bf16 (base)**torchao Int8 weight-only**
Weight file5.99 GB3.21 GB (54% of bf16)
VRAM (loaded)6.00 GB3.22 GB
Bits/param (effective)16~8.6 (incl. scale/zero overhead)

ReLU CUDA kernel smoke test (greedy decode, 400 maxnewtokens)

Quantization is functionally lossless on this prompt — int8 output is byte-identical to bf16 (1046 chars, 303 tokens, both greedy).

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

python
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM

repo = "EvanOLeary/laguna-xs2-dense-k8-cuda-sft-int8"
tok = AutoTokenizer.from_pretrained(repo, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(repo, trust_remote_code=True,
    dtype=torch.bfloat16, device_map="cuda")
# torchao quant is baked into the saved weights — no further setup needed.

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

StageRepo
Teacher MoEpoolside/Laguna-XS.2
Dense recon (V1)EvanOLeary/laguna-xs2-dense-k8-recon
CUDA-SFT (bf16 base for this quant)EvanOLeary/laguna-xs2-dense-k8-cuda-sft
This: torchao Int8 weight-onlyEvanOLeary/laguna-xs2-dense-k8-cuda-sft-int8

Quantization details

  • —Library: torchao 0.17.0 Int8WeightOnlyConfig
  • —Scheme: symmetric per-channel int8 weight quantization, bf16 activations & computation
  • —Calibration: none (PTQ on weights only)
  • —Quantize time: 0.4 s after model load
  • —Verification: bf16 vs int8 produce byte-identical 1046-char output on the ReLU prompt (greedy decode)
  • —Inference cost: dequantize-on-the-fly to bf16 per matmul → ~1.34× slower wall-clock than bf16 on A100 (14.8 → 9.8 tok/s). torch.compile should close this gap.