Repository navigation
docs(timm_mobilevit): record why FP8 is not shipped - #2140
Merged
zhenshanx-nv merged 1 commit intoNov 10, 2026
Merged
zhenshanx-nv merged 1 commit into
zhenshanx-nv merged 1 commit into
Conversation
Add a README for the timm_mobilevit family with the FP8 self-quantization study of mobilevit_xxs, mobilevit_xs and mobilevit_s on TensorRT 11.4 (B200, B300) and 11.1: recipe (per-tensor FP8 weights and static activation scales on attn.qkv, mlp.fc1 and mlp.fc2 of the 9 transformer layers; convolutions and attn.proj kept fp16), measurement method, speed and plan size at builder optimization levels 1 and 3, ImageNet top-1 against PyTorch fp32 and the fp16 engine. FP8 is slower than fp16 (0.89x to 0.96x at level 1, 0.94x to 0.97x at level 3) and top-1 agreement with fp16 drops to 95.7% to 98.7%; the plan is 4% to 19% smaller. The transformer GEMMs are tiny and the extra Quantize and Dequantize layers cost more than they save. FP8 is not shipped. NVFP4 was not tried. Documentation only; no code change. Signed-off-by: Zhenshan Xie <zhenshanx@nvidia.com>
|
Warning Review limit reachedEnable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. Next included review available in 37 minutes. View limit details
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Background
families/timm_mobilevitbuildstimm/mobilevit_xxs,mobilevit_xsandmobilevit_s(cvnets_in1k) as one classifier engine (256 x 256, batch 1, fp16 in the manifests) and has no quantized build. No FP8 or NVFP4 checkpoint of these models exists on the Hub, so FP8 self-quantization of the transformer linears (attn.qkv,mlp.fc1,mlp.fc2; build-time FP8 weights, ModelOpt-calibrated static activation scales, the ModelOpt ViT recipe) was built and measured for all three checkpoints on TensorRT 11.4 and 11.1. FP8 does not pay for this family: it is slower than fp16 on B200 and B300 (0.89x to 0.96x at the family's builder optimization level 1, 0.94x to 0.97x at level 3), top-1 agreement with the fp16 engine drops to 95.7% to 98.7%, and the plan is only 4% to 19% smaller. This change adds a README for the family that records 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.Exit Criteria
Implementation
families/timm_mobilevit/README.md(new): a short family description and the section "FP8 quantization study (not shipped)": summary and decision, recipe, method, results (speed and size at levels 1 and 3, layers, quality, non-finite scan), NVFP4, what was not tried, when to revisit.Recipe that was measured (code kept out of the repository):
attn.qkv,mlp.fc1andmlp.fc2of the 9 transformer layers of each model; convolutions, attention matmuls, layer norms, classifier andattn.projstay fp16 (a Quantize beforeattn.projmakes the TensorRT 11.4 attention fusion fail to build).FP8_DEFAULT_CFG(max) on the timm PyTorch model, 500 ImageNet validation images. fp16 Dequantize.Why no gain: the transformer GEMMs are tiny (token width 64 to 240) and the batch-1 engine is dominated by convolutions and per-layer launch time; FP8 adds 9 to 12 Quantize/Dequantize layers that cost more than the FP8 GEMMs save.
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_mobilevit/tests(B200, TensorRT 11.4 / 11.1)git diff --checkpython3 tools/pr_metadata.py validateon this descriptionThe numbers in the README come from the local study (TensorRT 11.4 re-measured on the current
mainbuild code; the FP8 build is the held code) and are not re-run by this change. Batch 1, ms per engine call, x is fp16 time over FP8 time, L1 and L3 are builder optimization levels:Quality (1500 held-out ImageNet images, TensorRT 11.4, level 1, B200): FP8 top-1 agreement with the fp16 engine 98.5% (s), 97.7% (xs), 95.8% (xxs); top-1 against labels 78.07% / 74.20% / 68.40% (fp16 78.00% / 74.47% / 68.73%, PyTorch fp32 78.00% / 74.33% / 68.87%). No non-finite logits on the images. One of 8 synthetic stress inputs gives non-finite logits on mobilevit_xxs in fp16 and FP8 alike (PyTorch fp32 is finite); this is fp16 behavior of the existing build.
Hardware, Environment, and Revisions
upstream/mainat012df437.timm/mobilevit_s.cvnets_in1katb531fe564ef88515b1aa1743ad4c40452b9f80ee,timm/mobilevit_xxs.cvnets_in1kat2c62d71504c6fbba9bb322f728586c4a235e5fa4(manifest revisions),timm/mobilevit_xs.cvnets_in1kat7a989ba56f36ed9f230044306e1e31563132c35e.clip-benchmark/wds_imagenet1kvalidation images, every 25th of the class-sorted set (2000): 500 for calibration, 1500 held out.Not Run / Remaining Gaps
attn.projin FP8 was only tried on TensorRT 11.4 (build fails).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