Contact, if you are interested in this website/domain name/Sponsorship/Advertisement/Partnership

Quantization cheat sheet

Every formula and rule of thumb from the site on one page. Print it or save it as a PDF from your browser.

Core quantization

q = clamp(round(x ÷ s) + z, qmin, qmax)
x̂ = s · (q − z)

Symmetric: s = max|x| ÷ (2b−1 − 1), z = 0. Asymmetric: s = (max − min) ÷ (2b − 1), z = round(−min ÷ s).

error variance ≈ Δ² ÷ 12  ·  rms ≈ 0.29 Δ

LLM memory

weights (bytes) = parameters × bits per weight ÷ 8
KV cache = 2 × layers × KV heads × head_dim × tokens × sequences × bytes

Add about 1 GB plus 5% of weights for runtime overhead. Llama 3.1 8B: 128 KiB of FP16 KV cache per token, so 1 GiB per 8K tokens.

Format≈ bits/weight8B model70B model
BF161615.0 GB131 GB
Q8_0 / FP88–8.57.5–8.0 GB66–70 GB
Q6_K6.566.1 GB54 GB
Q5_K_M5.705.3 GB47 GB
Q4_K_M4.894.6 GB40 GB
GPTQ/AWQ 4-bit≈4.254.0 GB35 GB
Q3_K_M4.003.7 GB33 GB
Q2_K3.163.0 GB26 GB

Sizes in GiB, weights only, computed from 8.03B and 70.6B parameters. Effective GGUF bits per weight from the llama.cpp quantize README.

decode speed ceiling ≈ memory bandwidth ÷ bytes read per token

Choosing a format, fast

  • Near-lossless: 8-bit (Q8_0, FP8, INT8 W8A8).
  • Best balance for local use: Q4_K_M to Q6_K.
  • GPU serving at scale: FP8 on newer GPUs; AWQ or GPTQ 4-bit when memory is the limit.
  • Below about 3 bits per weight, quality drops faster; use importance-matrix (imatrix) i-quants and test carefully.

Signals and ADCs

LSB = full-scale range ÷ 2N
SQNR ≈ 6.02 N + 1.76 dB  (full-scale sine)
ENOB = (SINAD − 1.76) ÷ 6.02
oversampling gain = 10 · log10(fs ÷ 2BW) dB

Each doubling of sample rate adds ≈ 3 dB (½ bit) without noise shaping.

Audio

Bit depthTheoretical dynamic range
16-bit≈ 96 dB
24-bit≈ 144 dB
32-bit floathuge headroom; practical limit set by analog stages

Dither once, at the final word-length reduction (e.g. 24 → 16-bit). TPDF dither spans ±1 LSB.

bytes = sample rate × bit depth × channels × seconds ÷ 8

Music timing

beat (ms) = 60,000 ÷ BPM  ·  1/16 note = beat ÷ 4
new time = old + strength × (grid − old)

Swing (drum-machine convention): 50% straight, ≈ 66.7% triplet. Second note of each pair sits at swing × pair length.

Physics

E = h f = h c ÷ λ  ·  λ(nm) ≈ 1239.84 ÷ E(eV)
hydrogen: En = −13.6 eV ÷ n²
particle in a box: En = n² h² ÷ (8 m L²)
harmonic oscillator: En = (n + ½) ħω

h = 6.62607015 × 10⁻³⁴ J·s (exact). Balmer lines: 656, 486, 434, 410 nm.

One clear explainer a week

New tools, guides and formats across AI, signals, audio and physics. No spam; unsubscribe any time.

VRAM calculatorFree plan