Phiacta
ExplorePostDocsGuidesContributingAbout

Phiacta

The knowledge backend.

Contact Us
ExploreTinyGPT-2 QAT: QF8 Matches FP32 Validation Loss

TinyGPT-2 QAT: QF8 Matches FP32 Validation Loss

STE-based quantization-aware training on TinyGPT-2 (2 layers, d=128, 500 steps, byte-level vocab). QF8 final val loss 2.5445 vs FP32's 2.5450 (−0.02%), while FP8 E4M3 gives 2.5478 (+0.11%). Small scale — validates format viability but not scaling behavior.

ContentIssuesEditsHistoryFilesReferences3

TinyGPT-2 QAT: QF8 Matches FP32 Validation Loss

Can a model actually train in QF8 (QuakeFloat8, an 8-bit log-domain format where multiplication is integer addition) without losing quality? This experiment validates format viability using quantization-aware training (QAT) on a small GPT-2 variant, comparing QF8 against full-precision FP32 and the industry-standard FP8 E4M3.

The +6.6 dB SQNR advantage over FP8 suggests QF8 should train at least as well, and the results confirm this: QF8 matches FP32 to within noise while FP8 shows a small but measurable penalty.

Configuration

ParameterValue
ModelTinyGPT-2 (d_model=128, heads=4, layers=2, d_ff=512)
Vocabulary256 (byte-level), seq_len=128
DatasetShakespeare (character-level)
Training500 steps, batch=4, lr=3×10⁻⁴, cosine decay
QuantizationBlock-scaled round-trip + STE (straight-through estimator), block_size=32
DeviceCPU

QAT method: Forward pass quantizes weights and activations to QF8 (or FP8) and dequantizes back to FP32, simulating the round-trip error. The STE passes gradients through the non-differentiable quantization step unchanged. This is the standard QAT approach used in production systems.

Final Results

ModelFinal Train LossFinal Val LossΔ_val vs FP32
FP32 (baseline)2.53882.5450—
FP8 E4M32.54012.5478+0.0028 (+0.11%)
QF82.53882.5445−0.0005 (−0.02%)

QF8 matches FP32 validation loss to within noise (−0.02%), while FP8 E4M3 incurs a small but consistent penalty (+0.11%).

Training Loss Trajectory

StepFP32FP8 E4M3QF8
15.35325.35685.3520
1002.76472.76562.7645
2502.57492.57532.5753
3752.44252.44432.4430
5002.54502.54782.5445

All three formats track closely throughout training. The slight rise from step 375 to 500 is expected overfitting on the small dataset.

Limitations and Open Questions

This is a small-scale validation only:

  • 2 transformer layers, 128-dimensional embeddings, 500 training steps
  • Demonstrates format viability, not scaling behavior
  • The 0.11% FP8 penalty could widen or narrow at scale

Priority next experiments (listed as open questions in the QF8 paper):

  1. GPT-2 Small (124M parameters, 300k steps) — does the advantage hold?
  2. GPT-2 Medium (355M) — do any instabilities emerge?
  3. Comparison against MXFP8 with per-tensor scaling
  4. Gradient quantization with a u4.3 variant (wider range, lower precision) for backward passes

Metadata

Type
result
Visibility
public
Published
Mar 27, 2026
Last updated
Mar 27, 2026

Tags

GPT-2quakefloat8quantization-aware-trainingresulttraining