Skip to content

Back to the catalog

TR-PTQ: High-Accuracy Integer-Only Transformer Post Training Quantization via Taylor Region Reformulation
arxiv.orgpaper

TR-PTQ: High-Accuracy Integer-Only Transformer Post Training Quantization via Taylor Region Reformulation

TR-PTQ is a post-training quantization method for transformers that identifies learned LayerNorm scale parameters and GELU's compounded approximations (not SoftMax) as the main sources of accuracy loss when quantizing, contrary to common assumptions about numerical precision. It introduces a unified integer-only formulation using shared Taylor Region exponential/logarithm primitives so division and square roots can run entirely in the log-domain with standard integer arithmetic, paired with a calibration-free, outlier-aware LayerNorm optimization, eliminating the need for floating-point hardware for nonlinearities while keeping accuracy degradation under 1.5% across vision and language benchmarks.

TL;DR A new integer-only PTQ method for transformers pinpoints LayerNorm and GELU as the real accuracy-loss culprits and fixes them with log-domain Taylor Region arithmetic, dropping floating-point hardware needs entirely.
Document

What it claims

Under aggressive per-tensor PTQ, the paper argues that accuracy loss in transformer nonlinearities comes from two specific sources, not from a general lack of precision:

  • LayerNorm's learned scale γ. Its heavy-tailed distribution interacts badly with standard min-max and histogram observers. This costs more accuracy than errors in mean or RMS estimation.
  • GELU's "approximation-on-approximation" effect. A surrogate GELU combined with quantization compounds the error.

SoftMax, by contrast, is robust. If intermediate activations are rounded before exponentiation, it works with an 8-entry lookup table, against the common 256-entry designs.

The positioning against prior work matters for adoption:

  • FQ-ViT, I-BERT, I-ViT and Sun et al. still need dividers, square-root units or high-precision arithmetic.
  • SOLE, ALDivision and E2Softmax are divider- and multiplier-free, but trade away accuracy.
  • QUARK and FQ-ViT's power-of-two factor rely on group-wise or per-channel handling, which the authors say adds hardware and control-path complexity.

TR-PTQ aims for per-tensor quantization with no float units, dividers or square-root units.

How it works

TR-exp (second-order Taylor series around LUT anchors, using only shifts and multiplies):

  1. Subtract the row max: x̂ = x − x_max ≤ 0, so the output lies in (0, 1].
  2. Read the b-bit quantized input as fields: an implicit sign, an l-bit evaluation-point index (evp), and a k-bit fraction. Clamp inputs at −2^b.
  3. A LUT holds 2^l values of exp(a_i). exp(0)=1 is handled through the sign bit, so it needs no LUT slot.
  4. Compute exp ≈ LUT[evp]·((1≪k) + Δ + (Δ²≫(k+1))) ≫ k, where Δ is the offset from the anchor.

Δ needs only k bits and can be pipelined across Taylor orders. The Taylor order and bit split are tunable for accuracy.

TR-ln (piecewise-linear between powers of two):

  • The segment is selected by the leading-one bit and the next bit.
  • ln x ≈ ln2·(2^−a·x + a − 1).
  • ln2 is approximated as 0.5 + 0.125 + 0.0625, so the multiply becomes (k≫1)+(k≫3)+(k≫4).

TR-SoftMax reuses both primitives so that no divider is needed:

  1. The row max contributes exp(0)=1, so the sum S ≥ 1 and ln S ≥ 0.
  2. The reciprocal is computed as S⁻¹ = exp(−ln S).
  3. The scale factor sf is computed once per vector. Each output is sf·TR-exp(x̂_i) ≫ k.
  4. The block diagram shows int8/int6 exponent paths, an int16 sum buffer and int3 LUT indices.
flowchart LR
  X[x - x_max] --> E[TR-exp per element]
  E --> S[Sum S, int16]
  S --> L[TR-ln]
  L --> R["TR-exp(-ln S) = sf"]
  E --> M[sf × exp ≫ k]
  R --> M

According to the paper, the same exp and ln primitives are shared across attention, GELU and LayerNorm. LayerNorm uses them to do its division and square root in the log domain. Nonlinearities need no calibration data. LayerNorm γ gets a "calibration-free, outlier-aware" optimization.

Limits

  • No results in the fetched text. It stops at the start of the GELU section (§4.2), so the TR-GELU and LayerNorm formulations, the γ optimization, and all experiments are missing. The only accuracy figure is the abstract's "<1.5% absolute degradation across vision and language benchmarks." It comes with no models, bit-widths, baselines or hardware cost numbers. Check the full paper before relying on it.
  • Approximation error. ln2 is approximated as 0.6875, against a true value of about 0.693. TR-ln is first-order within each power-of-two segment.
  • Unknown availability. The text mentions no code, weights or licence.
  • Preprint. This is v1, dated October 2026.

Technologies named here

  • Transformer

Techniques named here

  • TR-PTQ