Models · Promptable segmentation

Segment Anything 3 (SAM 3), image

Segment Anything 3: masks for every object that matches a text or example prompt, as well as clicks and boxes. Meta's SAM License applies; commercially usable under it.

Commercial use: yes.

variantinputbackendtime (ms)peak memory (MiB, allocated / reserved)
sam3synthetic (1024x1024)original (fp32)
original
portable
kernels
portable + torch.compile
TensorRT fp16
695
281
179
116
168
89.5 (image encoder only)
3865 / 3934
5255 / 5334
1922 / 2004
2019 / 2264
1910 / 2004
1122 (engine)
Details
  • Original code: https://github.com/facebookresearch/sam3 at 0570b3a
  • Code licence: LicenseRef-SAM-License AND Apache-2.0 (permissive); files: LICENSE, LICENSE-transformers
  • Weights licence: LicenseRef-SAM-License
  • Licence evidence: https://huggingface.co/facebook/sam3/blob/main/LICENSE (SAM License, Nov 19 2025); the weights are gated: download them from Meta's Hugging Face repo after accepting the licence and point FASTFORKS_WEIGHTS_PATH at the local copy; fastforks never mirrors them
  • Training data: the SA-Co data engine's image and video annotations plus public and internal datasets per the paper; not released as one dataset
  • Licence note: The weights use Meta's SAM License, not Apache-2.0; its terms were not re-checked here.
  • Kernel libraries: fastbb, cudnn_hacc
  • Variants: sam3
  • Outputs: boxes, scores, masks
  • Input size: any H x W >= 1, resized inside to the fixed encoder input 1008x1008 (the default export size)
  • Tested up to (portable, fp16, RTX 5060 Ti 16 GB): sam3 1080x1920 (1.9 GiB peak allocated, 2.1 reserved)
  • sam3 1024x1024, first call: portable + torch.compile 20 s (cold Inductor cache), TensorRT fp16 54 s (ONNX + engine).
  • sam3 original 1024x1024: torch.autocast(fp16) around the forward
  • sam3 load / first call: original 1.12 s / 0.957 s (840x1297), portable 2.95 s / 0.181† s, kernels 0.7† s / 0.116† s
  • † measured in the speed sweep after the portable load (or an earlier size) in the same process: file cache and kernels are warm, so the time is lower than a fresh start.
  • Protocol, median of 5 after 3 warm-up, uint8 CUDA input (synthetic for bench_inputs sizes), card defaults; gc before each load; peak = max over the first call and the timed calls

Measured

One text prompt (the COCO class name) per class in the image; the top 100 instances go to pycocotools COCOeval. Original = the original code named under Details, same checkpoint and protocol.

variantdatasetoriginal fp32original fp16portablekernelsnote
sam3COCO val2017, every 10th image, class-name prompts, box / mask mAP52.54 / 44.5652.54 / 44.5452.79 / 45.1352.83 / 45.14original = transformers Sam3Model, the port this code follows

Measured on NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks 939adfe8, 2026-11-06.

Parity

CPU, float32: max |diff| <= 0.0005 vs the original. GPU, float16 (the default), portable and kernels: mean |diff| <= 0.35 and p99 <= 2.0 (absolute error of the output boxes).

variantkernels error vs original, mean / p99GPU, torchkernels used
sam30.13504 / 0.77076RTX 5060 Ti, torch 2.14.1+cu130cudnn_hacc@cudnn92400, fastbb@7d058322634d:sm_120