Models · Classification

EfficientViT (MIT)

EfficientViT (Cai et al. 2023, MIT Han lab): a classifier with multi-scale linear attention.

stable Fork of huggingface/pytorch-image-models@0df212b · backends: portable, kernels

Checkpoint efficientvit_b2.r288_in1k

Paper 2022 Added in 0.1.0 Evaluated with 0.2.0

Kernels, RTX 5060 Ti 16 GB 1.12 ms 224x224, fp16
vs the faster original 9.5× original fp32: 10.7 ms
Peak memory 88 MiB original: 144 MiB
Accuracy vs original fp32 ±0.00 kernels top-1 %, ImageNet-1k val (84.28 original)

Use it

pip install fastforks

Lean install with only what this model needs: pip install "fastforks-core[timm]"

from fastforks import classification

model = classification.load("efficientvit_b2.r288_in1k")  # kernels on a supported GPU, else portable PyTorch
result = model(image)
result.logits
result.backend  # what ran: mode, device, dtype, kernels
fastforks bench efficientvit_b2.r288_in1k

Times the model on this machine. load(…, mode="portable") or mode="kernels" picks a backend; usage guide.

Speed and memory

Every backend on one GPU (RTX 5060 Ti 16 GB) and the same input, the authors’ code included. Kernels runs fp16. Portable runs fp16 on CUDA.

Input: synthetic, 224x224 (the task’s standard size)

BackenddtypeTime per call (ms)vs original fp32Peak memory
allocated / reserved
Load (s)First call (s)
Original fp32fp32 10.7–144 MiB/160 MiB0.20.04
Original fp16torch.autocast(fp16) around the forwardfp16 14.70.73×173 MiB/194 MiB1.81.89
Portable fp32fp32not measured ––––
Portablefp16 12.90.82×85 MiB/144 MiB2.30.73
Kernelsfp16 1.129.5×88 MiB/170 MiB2.60.11
Portable + torch.compile 6.911.5×120 MiB/164 MiB11 (build)–
TensorRT fp16fp16 0.79014×74 MiBenginenot comparable35 (build)–

Measured on RTX 5060 Ti 16 GB, torch 2.14.1+cu130, 2026-11-03 to 2026-11-15. First call, 3 warm-up, peak reset, median of 3 rounds x median of 5. Ratios divide two times of this table (same GPU, same input). Original fp16 is the authors’ own precision option, else torch.autocast. torch.compile and TensorRT: build time instead of load time. TensorRT memory (engine, not comparable) is the GPU memory the engine took, read from the driver because TensorRT allocates outside PyTorch, so it can't be compared with the PyTorch peaks of the other rows.

Other devices

DeviceBackenddtypems / callPeak memoryOutput vs referenceInput
Apple M1 Pro 16 GB MPS, torch 2.14.1, 2026-11-14Originalfp3225.7 1,695 MiB processmatches224x224
Portablefp1620.6 1,724 MiB processmatches224x224
Portablefp3218.6 1,698 MiB processmatches224x224
Kernelsfp16not implemented–224x224
NVIDIA L4 CUDA, torch 2.14.1+cu130, 2026-11-07Portablefp1620.4 61 MiB/124 MiB–224x224
Kernelsfp161.55 72 MiB/170 MiB–224x224
NVIDIA L40S CUDA, torch 2.14.1+cu130, 2026-11-07Portablefp1613.3 61 MiB/124 MiB–224x224
Kernelsfp161.01 72 MiB/170 MiB–224x224
NVIDIA A10 CUDA, torch 2.14.1+cu130, 2026-11-07Portablefp168.93 61 MiB/124 MiB–224x224
Kernelsfp161.40 72 MiB/170 MiB–224x224
NVIDIA A100-SXM4-40GB CUDA, torch 2.14.1+cu130, 2026-11-07Portablefp1612.2 61 MiB/124 MiB–224x224
Kernelsfp161.89 72 MiB/170 MiB–224x224
NVIDIA RTX PRO 6000 CUDA, torch 2.14.1+cu130, 2026-11-08Portablefp165.37 85 MiB/144 MiB–224x224
Kernelsfp160.926 120 MiB/210 MiB–224x224

CUDA memory is torch’s peak allocated / reserved; Apple has no such counter, so the Mac rows show the process footprint (weights, Python and torch included). “Output vs reference” compares the device’s output with the stored golden output under the card’s tolerance; – = not checked on that device. Kernels “not implemented” = no kernels for this model on that backend yet: it runs portable there.

Licence and weights

Commercial use allowed

Code
Apache-2.0
Weights
Apache-2.0 source
Training data

Our reading of the licences, not legal advice.

Weights

efficientvit_b2.r288_in1k.safetensors 97.5 MB· hosted on Hugging Face

fastforks downloads and checks these files on first use (fastforks download efficientvit_b2.r288_in1k).

Accuracy

The test set through the authors’ code and through ours: same checkpoint, same protocol. The distance between the original’s fp32 and fp16 runs is what half precision alone costs; our runs should stay within it.

ImageNet-1k val

5000 random images, top-1 / top-5 %

Rundtypetop-1 % ↑top-5 % ↑Δ top-1 % vs fp32 originalimagesms / image
Original fp32fp3284.2896.64 reference 5000 2.18
Original fp16fp1684.2696.64 −0.02 5000 1.52
Portable fp32fp3284.2696.62 −0.02 5000 2.88
Portablefp1684.2296.64 −0.06 5000 1.22
Kernelsfp1684.2896.60 ±0.00 5000 0.568

fastforks: the model's own resize / crop on the GPU; original: the library's pretrained loader and its PIL eval transform. Original = the authors’ code, same checkpoint and protocol. Measured on original fp32, original fp16: RTX 5060 Ti, torch 2.14.1+cu130, 2026-11-06; portable fp32: RTX 5060 Ti, torch 2.14.1+cu130, fastforks 7c91993, 2026-10-31; portable, kernels: RTX 5060 Ti, torch 2.14.1+cu130, fastforks 939adfe8, 2026-11-06.

Closeness to the original

Beyond the test-set scores: the raw output of ours against the original’s fp32 output on the same input, pixel by pixel. CPU, float32: max |diff| <= 0.002 vs the original. GPU, float16 (the default), portable and kernels: mean |diff| <= 0.05 and p99 <= 0.2 (absolute error of the output logits).

CheckToleranceMeasured
CPU fp32, max |diff|≤ 0.002 not recorded
GPU default dtypes, mean |diff|≤ 0.05 0.01737
GPU default dtypes, p99 |diff|≤ 0.2 0.06142

Recorded for efficientvit_b2.r288_in1k on RTX 5060 Ti, torch 2.14.1+cu130, 2026-11-04, with these kernels: cudnn_haccfvm_convfvm_extrafvm_mbfvm_r3

Details

EfficientViT (Cai et al. 2023, MIT Han lab): MBConv stages with multi-scale ReLU linear attention.

Input / output
Input: one RGB image. Output: ImageNet-1k class logits.
Input size
fixed 288x288: the input is resized (short side 288) and centre-cropped to it; tested up to 288x288 (90 MiB allocated)
Outputs
logits
Checkpoint
arch="efficientvit_b2.r288_in1k"
CUDA kernels
  • cudnn_haccconvolutions with fp16 accumulation (cuDNN)
  • fvm_convfused convolutions for image classifiers
  • fvm_extrafused transformer row operations (rotary split, SwiGLU with LayerNorm)
  • fvm_mbfused MBConv blocks (MobileNet and EfficientNet families)
  • fvm_r3further fused classifier blocks
Apple (MPS)
fp32, fp16

Limitations

  • Portable float16 at batch 1 is launch-bound: timm's linear attention casts q, k, v to float32 and back in every LiteMLA block (needed for a stable division), so 224x224 runs 12-13 ms against 10.7 ms for the float32 original and 14.7 ms for the fp16-autocast original; the kernels mode runs 1.1 ms.
Full reference, generated from the repository

EfficientViT (Cai et al. 2023, MIT Han lab): a classifier with multi-scale linear attention.

Commercial use: yes.

variantinputbackendtime (ms)peak memory (MiB, allocated / reserved)
efficientvit_b2.r288_in1ksynthetic (224x224)original (fp32)
original
portable
kernels
portable + torch.compile
TensorRT fp16
10.7
14.7
12.9
1.12
6.91
0.790
144 / 160
173 / 194
85 / 144
88 / 170
120 / 164
154 / 216
Details
  • Original code: https://github.com/huggingface/pytorch-image-models at 0df212b369a5
  • Code licence: Apache-2.0 (permissive); files:
  • Weights licence: Apache-2.0
  • Licence evidence: https://huggingface.co/timm/efficientvit_b2.r288_in1k/blob/891530d0c5a400dd2d4549c81d433661b192abe1/README.md
  • Training data: ImageNet-1k (ILSVRC 2012 classification)
  • Kernel libraries: cudnn_hacc, fvm_conv, fvm_extra, fvm_mb, fvm_r3
  • Variants: efficientvit_b2.r288_in1k (default of efficientvit_b2)
  • Outputs: logits; label_set: imagenet-1k
  • Input size: fixed 288x288: the input is resized (short side 288) and centre-cropped to it
  • Tested up to (portable, fp16, RTX 5060 Ti 16 GB): efficientvit_b2.r288_in1k 288x288 (0.1 GiB peak allocated, 0.1 reserved)
  • efficientvit_b2.r288_in1k 224x224, first call: portable + torch.compile 11 s (cold Inductor cache), TensorRT fp16 35 s (ONNX + engine).
  • efficientvit_b2.r288_in1k original 224x224: torch.autocast(fp16) around the forward
  • efficientvit_b2.r288_in1k load / first call: original 1.84 s / 1.888 s, portable 2.31 s / 0.726 s, kernels 2.43 s / 0.072 s
  • Protocol, first call, 3 warm-up, peak reset, median of 3 rounds x median of 5

Measured

fastforks: the model's own resize / crop on the GPU; original: the library's pretrained loader and its PIL eval transform. Original = the original code named under Details, same checkpoint and protocol.

variantdatasetoriginal fp32original fp16portableportable fp32kernelsnote
efficientvit_b2.r288_in1kImageNet-1k val, 5000 random images, top-1 / top-5 %84.28 / 96.6484.26 / 96.6484.22 / 96.6484.26 / 96.6284.28 / 96.60

Measured on portable: NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks 939adfe8, 2026-11-06; portable32: NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks 7c91993, 2026-10-31; kernels: NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks 939adfe8, 2026-11-06.

Parity

CPU, float32: max |diff| <= 0.002 vs the original. GPU, float16 (the default), portable and kernels: mean |diff| <= 0.05 and p99 <= 0.2 (absolute error of the output logits).

variantkernels error vs original, mean / p99GPU, torchkernels used
efficientvit_b2.r288_in1k0.01737 / 0.06142RTX 5060 Ti, torch 2.14.1+cu130cudnn_hacc@cudnn92400, fvm_conv@f1d064e539e1:sm_120, fvm_extra@3208ce525a91:sm_120, fvm_mb@720dd3f29bf7:sm_120, fvm_r3@f54eb890e23c:sm_120

Limitations

  • Portable float16 at batch 1 is launch-bound: timm's linear attention casts q, k, v to float32 and back in every LiteMLA block (needed for a stable division), so 224x224 runs 12-13 ms against 10.7 ms for the float32 original and 14.7 ms for the fp16-autocast original; the kernels mode runs 1.1 ms.

Example output

One fixed input through this checkpoint, the same for every model of the task (kernels · float16 · NVIDIA GeForce RTX 5060 Ti).

Input

Top 5

  1. Egyptian cat 89%
  2. tiger cat 5.0%
  3. tabby 2.4%
  4. lynx 0.1%
  5. guacamole <0.1%
Chelsea the cat, input
Input · 100%

Input: Chelsea the cat, Stéfan van der Walt (CC0).