Views
No views yet
count_total_size (numel * itemsize
over the state dict), which eval_submission.py documents as the graded
quantity.Qwen/Qwen3.5-4B. Domain: math.artifact.pt, 1.83 GB) is in the HuggingFace repo, not
here — GitHub caps files at 100 MB. code.py loads it from its own directory.https://huggingface.co/trunpreonx/24B0978-Week01-Track2_20-Submission01code.py refuses to run without it rather than silently recompressing: this
recipe is trained, and recompressing from the recipe alone reproduces the
untrained model, which scores lower.| stage | modules | format |
|---|---|---|
| 1 | down_proj, gate_proj, up_proj, in_proj_qkv, in_proj_z, out_proj | RHT + GPTQ, 3-bit, group 128 |
| 2 | q_proj, k_proj, v_proj, o_proj | RHT + GPTQ, 4-bit, group 128 |
| 3 | embed_tokens (tied to lm_head) | RTN, 4-bit, group 128 |
| 4 | all quantised linears | end-to-end training of the quantisation parameters |
int3/int4 codes plus one fp16 scale and zero point per group of 128
along the reduction dimension. This is the layout that W4A16 kernels already
consume — Marlin, Machete, and GPTQModel's exllama path all take exactly
this. The speedup is memory-bandwidth: at batch 1 decoding, a transformer
linear layer is bound by reading its weights, and reading 3–4 bits per weight
instead of 16 cuts that traffic by roughly 4–5x. Dequantisation happens in
registers inside the kernel, fused into the matmul, so the fp16 weight is never
materialised in global memory. Grouping along the reduction dimension is what
makes this possible: all 128 weights sharing a scale are consumed by the same
dot product, so the scale is applied once to the accumulator rather than
per-element.log2(block) stages of
adds and subtracts, no multiplies, O(n log n) and entirely in shared memory.
It is applied to the activations at runtime (the weight side is folded in
offline), so the cost is one cheap elementwise pass per linear layer against a
matmul that has just become 4–5x cheaper to feed. This is the QuaRot / QuIP#
construction and is the standard way to make low-bit weights viable.1pip install -e .
2python -c "
3import code as c
4c.convert_from_hf_checkpoint('Qwen/Qwen3.5-4B', 'compressed.pt')
5c.convert_to_hf_checkpoint('Qwen/Qwen3.5-4B', 'compressed.pt', 'restored/')
6"code.py imports with no
dependency on anything outside this directory, emits a 1.833 GB checkpoint at
ratio 0.1893, restores to a loadable bf16 HF model, and generates correctly.