Repository navigation
docs(sam3): record why FP8 is not shipped - #2112
Merged
zhenshanx-nv merged 1 commit intoNov 10, 2026
Merged
Conversation
Add a README for the sam3 family with the FP8 self-quantization study on TensorRT 11.4 (B200, B300) and 11.1: recipe (q/k/v, out_proj, fc1 and fc2 of the 24 text encoder blocks in FP8, static per-tensor scales from ModelOpt), measurement method, speed, size and mask quality against PyTorch fp32. The text encoder is 1.4x faster and the bundle 31% smaller at the default mask quality, but the text encoder is about 8% of a request, so a request is only 1.02x faster; a plain fp16 text plan is faster than the FP8 one. FP8 of the vision plan lowers mask IoU from 0.9975 to 0.96 for at most 1.11x. FP8 is not shipped. NVFP4 was measured and is slower than FP8 with lower quality. 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 24 minutes. View limit details
|
3 of 11 tasks
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/sam3buildsfacebook/sam3(text-prompted segmentation) as a bundle of TensorRT plans: CLIP text encoder, ViT-L vision plan, detector core and video tracker plans, batch 1,fp32only (fp16 islands in the vision and core plans). No FP8 or NVFP4 checkpoint of SAM3 exists, so FP8 self-quantization (build-time FP8 weights, ModelOpt-calibrated static activation scales) was built and measured on TensorRT 11.4 (B200, B300) and 11.1. FP8 does not pay for this family: only the text encoder keeps the mask quality, and it is about 8% of a request, so a request is 1.02x faster (text encoder 1.4x, bundle 31% smaller); a plain fp16 text plan is faster than the FP8 one. FP8 of the vision plan, where the time is, lowers mask IoU against PyTorch from 0.9975 to 0.96 for at most 1.11x. This change adds a README for the family that records the study, like the sam (#1986) and yolov10 (#2093) studies, so that it does not have to be repeated. The FP8 code is not part of this change.Exit Criteria
Implementation
families/sam3/README.md(new): a short family description and the section "FP8 quantization study (not shipped)": summary and decision, recipe, method, results (speed, size, quality, kernels, vision ablation), why there is no gain, NVFP4, TensorRT note, what was not tried, when to revisit.Recipe that was measured (code kept out of the repository):
out_proj,fc1andfc2of the 24 text encoder blocks (96 modules); embeddings, norms, attention matmuls,text_projection, the vision plan, the core and the tracker plans unchanged.FP8_DEFAULT_CFG(max) on the PyTorch text encoder with 304 prompts. fp16 Dequantize inside the fp32 text plan.Why no gain: the text encoder is about 8% of a request (a free text encoder would give at most 1.08x), it is launch bound at 32 tokens, and fp16 alone (0.77 to 0.81 ms) beats FP8 (0.91 to 1.01 ms). The vision plan does not hold mask quality in FP8 with any subset of projections.
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 (batch 1, request = text + vision + core in one CUDA graph, median of 9 interleaved rounds; x is default time over FP8 time):
Text plan 1348.7 to 485.5 MiB, bundle 2769.3 to 1905.9 MiB (-31%). 361 held-out prompt and image pairs (100 COCO validation images); no NaN or Inf in any build, on 304 prompts plus the held-out phrases through the text plan, or on five stress images. Vision plan FP8 (B300, 11.4): 1.11x for that plan, mask IoU 0.9606 against 0.9975.
Hardware, Environment, and Revisions
upstream/mainat5801406c. The sam3 family code is unchanged since the study code base.facebook/sam3at3c879f39826c281e95690f02c7821c4de09afae7(manifest revision).detection-datasets/cocovalidation, 400 images at a fixed stride; 100 held-out images for evaluation; calibration used text prompts only.Sam3Model. The vision ablation and NVFP4 numbers come from an earlier B300 run on the same family code.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