Skip to content

Training, adaptation, compression, and systems techniques · Training, fine-tuning, adaptation, compression, and systems techniques · TRN017 · Training method

GPTQ post-training weight quantization

Quantizes pretrained weights using approximate second-order information to limit layer-output distortion.

Explained here Component demo, not a trained model CodeSplash's run and the reference's record

In CodeSplash

Documented in the Academy only. There's no Set up button.

Availability
Explained here
Code example
Component demo, not a trained model
Who ran it
CodeSplash's run and the reference's record
CodeSplash's run
The reference's example ran in Python and R here, and they agree.
The reference's record
Python: Ran in the reference's review. The report doesn't record which version of the code ran. R: Reviewed but not run: R wasn't available to the reference's authors.

Purpose

Quantizes pretrained weights using approximate second-order information to limit layer-output distortion.

Question / hypotheses

Does this intervention improve the intended quality, adaptation, resource, or reliability objective under a controlled comparison? It defines a method, not an intrinsic null-hypothesis test.

Architecture / computational structure

A layer-wise calibration pass estimates input correlations; sequential quantization compensates remaining weights using curvature information.

Assumptions

Representative calibration activations and numerically stable damped curvature estimates are required. Target kernels must support the chosen bit width and grouping.

Formula / computational definition

min⁡W^∈Q∥WX−W^X∥F2,H≈2XXT.\min_{\hat W\in\mathcal Q}\|WX-\hat WX\|_F^2,\quad H\approx 2XX^T.

Parameters and notation

Learned model weights are not conventionally gradient-fine-tuned in one-shot GPTQ. Estimated state includes calibration statistics. Hyperparameters: bit width, group size, damping, calibration set, activation ordering.

Fitting, fine-tuning, and adaptation

Start from a validated checkpoint, quantize with calibration data separate from evaluation, then compare task metrics. Subsequent adapter training is a distinct procedure and must support the quantized backend.

How to use and calibrate

Report actual memory, throughput, context length, and degradation across tasks. Example: deploy a language model with reduced weight storage.

Example application

deploy a language model with reduced weight storage.

Interpretation / pitfalls

Watch out

The code below evaluates layer reconstruction error, not the full GPTQ solver. A low average layer error does not guarantee preserved reasoning or rare-token behavior.

Python and R code examples

Scope: numerical mechanism demonstration. Validation: Python executed successfully on the supplied synthetic inputs; R reviewed but not executed (Rscript unavailable).

Python and R

The reference's own programs, shown as written. A component demo shows one central piece of the method; it doesn't train a full model.

Python

Component demo, not a trained model — numerical mechanism demonstration. · needs numpy

import numpy as np
W=np.array([[.12,.47],[-.31,.82]]); X=np.array([[1.,2.],[.5,-1.]])
Q=np.round(W/.1)*.1; print(np.sum((W@X-Q@X)**2))
R

Component demo, not a trained model — numerical mechanism demonstration.

W <- rbind(c(.12,.47),c(-.31,.82)); X <- rbind(c(1,2),c(.5,-1)); Q <- round(W/.1)*.1
print(sum((W%*%X-Q%*%X)^2))

Sources

From the CodeSplash reference, entry TRN017.