Repository navigation
docs(timm_xcit): record why FP8 is not shipped - #2138
Merged
zhenshanx-nv merged 1 commit intoNov 10, 2026
Merged
Conversation
Add the FP8 self-quantization study of timm XCiT to the family README: recipe (FP8 for the attention and MLP linears, per-tensor weight scales, ModelOpt-calibrated static activation scales, fp16 Dequantize), method, speed, plan size and ImageNet quality against PyTorch fp32 on TensorRT 11.4 (B200, B300) and 11.1. At batch 1 the FP8 engine is 0.94x to 0.95x of fp16 for xcit-nano and xcit-tiny at the family's builder optimization level 1 and 1.01x to 1.03x at level 3; the plan is 19% to 31% smaller and FP8 changes the top class of 2% to 5% of the images. The engine is launch bound at batch 1. Larger configs reach at most 1.07x at batch 1. FP8 is not shipped. NVFP4 was not tried. No problem on main was found. 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 57 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_xcitbuilds timm XCiT classifiers (manifests: xcit-nano-12-p16-224-fb-in1k and xcit-tiny-12-p16-224-fb-in1k, fp16, batch 1) and has no quantized build. No FP8 or NVFP4 checkpoint of any XCiT classifier exists on the Hub, so FP8 self-quantization of the attention and MLP linears (build-time FP8 weights, ModelOpt-calibrated static activation scales, thetimm_vitflow) was built and measured on TensorRT 11.4 and 11.1, on B200 and B300. FP8 does not pay for this family: at batch 1 the FP8 engine is 0.94x to 0.95x of the fp16 engine at the family's builder optimization level 1, and 1.01x to 1.03x at level 3 (the pending level change in #2123). The engine is launch bound at batch 1; the only clear gain is a 19% to 31% smaller plan (2 to 5 MiB for the manifest checkpoints). This change adds the study to the family README, 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_xcit/README.md: new section "FP8 quantization study (not shipped)": summary and decision, recipe, method, results (two studies), NVFP4, what was not tried, when to revisit. Only this section is added; the existing text is unchanged, so this does not conflict with perf(timm): build 21 timm families with TensorRT optimization level 3 #2123 (which changesmodel.pyonly).Recipe that was measured (code kept out of the repository):
attn.qkv,attn.proj,mlp.fc1,mlp.fc2of every block and the class-attentionattn.kv; stem, depthwise convolutions, layer norms, channel-attention matmuls, one-token class-attention GEMVs and the head stay fp16.FP8_DEFAULT_CFG(max) on the timm PyTorch model, 500 ImageNet validation images. fp16 Dequantize.Why no gain: at batch 1 each GEMM takes about 10 microseconds at either precision (196 tokens, 128 to 768 wide). At level 1 the 12 extra Quantize layers are not fused and make FP8 slower; at level 3 they are fused and FP8 gains 1% to 3%.
Change categories
Validation
Commands and Results
Documentation only.
python3 -m tools.model_ci validatepytest tools/tests/test_architecture.py tools/tests/test_public_source_hygiene.py(CPU)git diff --checkpython3 tools/pr_metadata.py validateon this descriptionThe numbers in the README come from the local study and are not re-run by this change (manifest checkpoints, batch 1, x is fp16 time over FP8 time at the same builder optimization level, all variants of a model built and timed in one job, median of 21 interleaved rounds):
The fp16 engine agrees with PyTorch on 99.6% to 99.8% of the images. Five larger configs (small_12_p8 to large_24_p8, earlier study, TensorRT 11.4, level 1) reach 0.97x to 1.07x at batch 1 and up to 1.15x at batch 32 (scratch build). No NaN or Inf on 500 to 1500 held-out images and 17 to 26 stress inputs, any variant.
Hardware, Environment, and Revisions
upstream/mainatf6550736.timm/xcit_nano_12_p16_224.fb_in1katb181b4623913d78fd0927601c36e40b9d8bc74ce,timm/xcit_tiny_12_p16_224.fb_in1kat060449891838eaf301bdb3673e3daaf58e0370de(manifest revisions); larger configstimm/xcit_<config>_224.fb_in1k.clip-benchmark/wds_imagenet1k(500 for calibration; 500 and 1500 held out).Not Run / Remaining Gaps
Contributor Self-Review
Notes For Future Readers
Risk level
Risk rationale: documentation only; one README section added, no code, build, bundle or test change.
🤖 Generated with Claude Code