Repository navigation
docs(timm_senet): record why FP8 is not shipped - #2148
Conversation
Add a README to the timm_senet family with the FP8 self-quantization study of senet154 on TensorRT 11.4 (B200, B300) and 11.1: recipe (per-channel FP8 weights, static per-tensor activation scales, the timm_resnet FP8 recipe), measurement method, speed, plan size, build time, ImageNet top-1 against PyTorch fp32 and the kernel counts that explain the result. FP8 is slower than fp16 in every layout: 0.73x to 0.79x at batch 1 with the family's builder optimization level 3, and 0.53x to 0.79x at level 1 (batch 1 and 32). TensorRT 11.4 runs each grouped 3x3 convolution (64 groups) as one kernel per group (3343 to 3859 kernels per image in fp16); FP8 keeps that split and adds a concatenation kernel per group (about 6600 kernels). At level 3 most FP8 grouped convolutions run with fp16 kernels and the FP8 plan is not smaller. Top-1 stays within 0.2 points. The README also records that fp16 batch 1 is 2.5x slower than PyTorch fp16 on B300 for the same reason. FP8 is not shipped. NVFP4 was not tried (no NVFP4 convolution in TensorRT). Documentation only; no code change. Signed-off-by: Zhenshan Xie <zhenshanx@nvidia.com>
|
No actionable comments were generated in the recent review. Summary
Merge Risk:
|
Background
families/timm_senetbuildstimm/senet154.gluon_in1kas one image classification engine (batch 1, 224 x 224, fp16 in the manifest, builder optimization level 3 since #2123) and has no quantized build. No FP8 or NVFP4 checkpoint of this model exists on the Hub, so FP8 self-quantization of the convolutions (build-time per-channel FP8 weights, static per-tensor activation scales from max calibration, the recipe of the shippedtimm_resnetFP8 build) was built and measured on TensorRT 11.4 (B200, B300) and 11.1 (B200). FP8 does not pay for this family: it is slower than fp16 in every layout, 0.73x to 0.79x at batch 1 with the family's level 3, and 0.53x to 0.79x at level 1 (batch 1 and 32). Quality is fine (top-1 within 0.2 points of PyTorch fp32). This change adds a README to the family with the study, like the yolov10 (#2093) and timm_efficientnet (#2102) studies, so that it does not have to be repeated. The FP8 code is not part of this change. NVFP4 was not tried: TensorRT does not support NVFP4 on convolutions.The study also records a TensorRT 11.4 behavior that is independent of FP8: each grouped 3x3 convolution (64 groups) runs as one kernel per group (3343 to 3859 kernels per image in fp16), so fp16 batch 1 takes 10.3 to 12.6 ms, while PyTorch fp16 takes 4.36 ms on B300. Builder optimization level 3 does not change the kernel count.
Exit Criteria
Implementation
families/timm_senet/README.md(new): a short family description and the section "FP8 quantization study (not shipped)": summary and decision, recipe, method, results (level 3 and level 1 speed and size, quality, kernels per call), fp16 grouped convolutions, NVFP4, what was not tried, when to revisit.Recipe that was measured (code kept out of the repository):
layer1("no SE, no layer1", 144, the shippedtimm_resnetlayout). Stem and classifier stay fp16.Why no gain: the fp16 engine is already limited by the per-group kernels of the grouped 3x3 convolutions. In FP8, TensorRT keeps the per-group split and adds a concatenation kernel per group (about 6200 to 6630 kernels per image). At level 3, TensorRT runs most FP8 grouped convolutions with fp16 kernels, so the FP8 plan is not smaller (237 vs 230 MiB on B300) and the build takes 3.3x to 4.4x longer.
Change categories
Validation
Commands and Results
python3 -m tools.model_ci validatepytest tools/tests/test_architecture.py tools/tests/test_public_source_hygiene.py(CPU)pytest families/timm_senet/tests(TensorRT 11.4 B200 and B300, 11.1 B200)senet154-gluon-in1k(TensorRT 11.4)git diff --checkpython3 tools/pr_metadata.py validateon this descriptionThe family tests ran on the base commit; this change edits only the README.
The numbers in the README come from the local study (batch 1, best FP8 layout "no SE, no layer1"; x is fp16 time over FP8 time):
Top-1 on 1500 held-out images: PyTorch fp32 82.67%, fp16 engine 82.67%, FP8 engine 82.60% to 82.80% (98.67% to 99.00% agreement with PyTorch top-1, KL 0.0027 to 0.0028). No NaN or Inf on 2000 images and 29 stress inputs in any engine.
Hardware, Environment, and Revisions
upstream/mainatf8800ce3.timm/senet154.gluon_in1kat86f6d239ed30acbe3aca0cbb5769da2621a4e02c(manifest revision).clip-benchmark/wds_imagenet1kvalidation (fixed stride of 25): 500 for calibration, 1500 held out.upstream/mainatf8800ce3; level-1 rows (batch 1 and 32) from an earlier run onupstream/mainatf8800ce3, when the family built at level 1. Reference: the timm PyTorch model in fp32 with the family preprocessing.Not Run / Remaining Gaps
Contributor Self-Review
Notes For Future Readers
Risk level
Risk rationale: documentation only; one README added, no code, build, bundle or test change.
🤖 Generated with Claude Code