Updated October 2026: V-JEPA 2.1 (March 2026), SAM 3 and SAM 3.1, a code-vs-weights licence table (Hiera weights are CC BY-NC; DINOv3 has its own licence), and corrected attention maths and benchmark figures.

What Is A Vision Transformer? The Short Answer

A Vision Transformer (ViT) is an image model that cuts a picture into fixed-size patches, usually 16×16 pixels, turns each patch into a token, and runs the same Transformer encoder that language models use over that token sequence. Google Research introduced it in 2020 in the paper "An Image is Worth 16×16 Words", and in 2026 it is the backbone inside most detectors, segmenters and vision-language models.

A video vision transformer applies the same idea to space and time. ViViT (Google, 2021) is the pure-attention reference design: it turns 3-D "tubelets" spanning several frames into tokens. TimeSformer, Video Swin and Hiera make that affordable, and V-JEPA 2 (Meta, June 2025) and V-JEPA 2.1 (March 2026) are the newest self-supervised video ViTs. For a product, the practical choice is a pre-trained checkpoint picked by task, latency budget and licence, not a model trained from scratch.

Why This Matters

Almost every modern computer-vision model your team will deploy has a Vision Transformer somewhere inside it. The detector you picked from the YOLO production lineage lesson has a Transformer-style backbone or neck. The open-vocabulary detector from the Grounding DINO lesson is a ViT through and through. The segmentation model from the SAM 2 lesson uses a Hiera backbone. The video VLMs that classify scenes, describe clips, and answer questions about a stream all start with a ViT image encoder. If you do not understand the architecture, you cannot reason about why one model is fast and another is slow, why one needs a billion examples to train and another works with a thousand, or why the engineering team keeps debating patch size, image resolution, and embedding dimension as if those were knobs that mattered. They are knobs that matter. This primer is the foundation under every Phase 2 lesson, every Phase 4 multimodal lesson, and every Phase 5 generative-video lesson. It is also the cleanest mental model we know for explaining what a "foundation model for vision" actually is, in language a product manager or founder can follow.

The Mental Model — An Image Is A Sequence Of Patches

Before ViT, every serious image model was a convolutional neural network — a CNN. CNNs sweep small filters across the image, pooling features into smaller and smaller grids until the whole image has been summarised into a single vector. The architecture has two strong inductive biases baked in: locality, the assumption that nearby pixels are related to each other, and translation equivariance, the assumption that an object is the same object whether it appears in the top-left of the image or the bottom-right. Those biases are good. They are also a ceiling — they constrain what the model is allowed to learn.

The Vision Transformer paper, published by Alexey Dosovitskiy and colleagues at Google Research in 2020 under the title "An Image is Worth 16×16 Words", asked what happens if you take those biases out and let the model learn from scratch. The recipe is almost embarrassingly simple. Take an image, say 224×224 pixels. Cut it into a grid of 16×16 patches — that gives you 14 patches across and 14 patches down, or 196 patches total. Flatten each patch into a vector of 768 numbers (16 × 16 × 3 channels). Multiply each vector by a learned matrix to project it into the embedding space — usually a 768-dimensional vector. Add a learned position embedding to each patch so the model knows where in the image the patch came from. Prepend a special learnable "class token" to the start of the sequence — its final output will be the image's overall representation. Feed all 197 tokens through a standard Transformer encoder, exactly the kind used in language models. Out the other end, take the class token's vector and pass it through a small classification head.

That is the whole architecture. There are no convolutions. There is no pooling. There is no special vision machinery. An image is being treated as a sequence of 196 tokens, and the same Transformer encoder that processes a sentence of 196 words can process this sequence. What engineers call a "patch embedding" is, in plain language, just a 768-number summary of one 16×16 patch of the picture.

Diagram titled The Vision Transformer Pipeline: cut the image into patches, turn patches into tokens, run a Transformer. Three columns joined by arrows left to right. 1, image: a 224 by 224 pixel picture drawn as a 14 by 14 grid, 196 patches of 16 by 16 pixels, one patch highlighted in blue. 2, patch tokens: boxes for patch 1, patch 2 and, after an ellipsis, patch 196, each a 768-dimensional vector; then plus one CLS token and plus position embeddings, which equals 197 tokens of 768. 3, encoder repeated 12 times: self-attention with 12 heads of 64 dimensions, add and LayerNorm, feed-forward with 3072 hidden units, add and LayerNorm. An arrow leads down from the encoder to 4, the CLS token out, one 768-dimensional summary, and then to 5, the MLP head, which gives class probabilities. A grey panel to the left, ViT-Base in numbers: 12 encoder blocks and 12 attention heads, 768-dimensional tokens and a 3072-dimensional feed-forward, 86 million parameters, about 17 GFLOPs per 224 by 224 image. Figure 1. The Vision Transformer recipe: image is cut into patches, patches become tokens, tokens go through a vanilla Transformer encoder, and the class token's final embedding represents the whole image.

The numbers worked. ViT-Base — 12 layers, 768 embedding dim, 12 attention heads, 86 million parameters — matched the best CNN baselines on ImageNet when both were trained from scratch. ViT-Large — 24 layers, 1024 dim, 16 heads, 307M parameters — pulled ahead. ViT-Huge — 32 layers, 1280 dim, 16 heads, 632M parameters — beat the state of the art set by EfficientNet on ImageNet by a clear margin, set new top results on CIFAR-100 and the VTAB benchmark, and required fewer compute resources to train than the CNN it dethroned. The catch, and the only catch, was data: ViT had to see roughly 300 million labelled images (the JFT-300M dataset that Google had internally) to beat the CNN. When trained on plain ImageNet's 1.3 million images, ViT lost to a comparable ResNet. CNNs were better at small data; ViT was better at scale.

Why The Attention Mechanism Is The Whole Point

The reason ViT beats CNNs at scale is the attention mechanism. A 16×16 convolution can only see 16 pixels at a time; to mix information from one side of the image to the other, the CNN has to stack many layers, with each layer mixing slightly further-apart patches. Information from corner to corner propagates slowly. The self-attention layer at the heart of every Transformer block does something different: every patch can directly attend to every other patch in a single layer. Patch number 1 — top-left corner — can in one step ask "how related am I to patch number 196 — bottom-right corner?" and get a learned weight back. Long-range relationships that take a CNN twelve layers to construct are available to a Transformer in layer one.

The mechanism itself is a weighted average. Each token gets three vectors — a query, a key, and a value — and the attention score from token A to token B is the dot product of A's query and B's key, divided by the square root of the per-head dimension (64 in ViT-Base), passed through a softmax. The result is a probability distribution that says "where should I look when constructing my next representation?" The new representation of token A is the softmax-weighted sum of every other token's value vector. Stack that operation a dozen times and the model has built a rich global representation of the image.

The trade-off is cost. Self-attention scales quadratically with the number of tokens: a 224×224 image at patch size 16 gives 196 tokens, which is comfortable; a 1024×1024 image at patch size 16 gives 4,096 tokens, and the attention matrix has 16.7 million entries. That is the wall that motivated every architectural variant we discuss next.

Why ViT Beat The CNN — And Where The CNN Still Wins

Two effects let ViT pull ahead. First, the absence of inductive bias becomes an asset at scale. When the data set is small, baked-in assumptions help — the CNN does not have to learn locality from scratch. When the data set is huge, those baked-in assumptions are a ceiling — the model would learn locality on its own and then learn shapes the CNN cannot see, but only if there is enough data to learn them from. The 2020 ViT paper put it plainly: with enough data, large-scale training trumps inductive bias. Second, the attention mechanism's global receptive field gives every layer access to the whole image. A CNN's effective receptive field grows layer by layer; ViT's is the whole image from layer one.

Where CNNs still win in 2026: on small data sets, on small models, on edge devices with tight latency budgets, and on tasks where translation equivariance is a genuine constraint (medical imaging tasks where the model must respond identically to a feature regardless of its location, for example). EfficientNet and ConvNeXt remain strong baselines below the 100-million-parameter mark. The right framing today is not "Transformers replaced CNNs"; it is "Transformers replaced CNNs at scale". For a deployment that runs on a phone with a 50 ms inference budget, a small CNN often still wins. For a deployment that runs in a cloud GPU with a 200 ms budget and benefits from pre-training on hundreds of millions of images, ViT wins.

Property CNN (e.g., ResNet, EfficientNet) ViT
Inductive bias Locality + translation equivariance None — learned from data
Receptive field per layer Local (3×3, 5×5, 7×7 kernels) Global (every token attends to every token)
Small-data behaviour Excellent — biases help Poor — needs millions of examples
Large-data behaviour Plateaus Keeps improving
Throughput on edge Strong (mature kernels) Improving but historically slower
Memory at high resolution Manageable Quadratic in token count — expensive

The Token Maths — Worked Out Loud

Let us walk through the numbers for ViT-Base on a 224×224 image, because the arithmetic is the cleanest way to internalise what is happening.

A 224×224 RGB image is a tensor of shape (224, 224, 3) — 150,528 numbers in total. The patch size is 16×16. The grid is 224 / 16 = 14 patches across and 14 patches down, for 14 × 14 = 196 patches in total. Each patch flattens into a vector of 16 × 16 × 3 = 768 numbers.

The patch embedding is a single linear projection — a learned matrix of shape (768, 768) — that maps each patch vector to a 768-dimensional embedding. That is 196 × 768 = 150,528 numbers entering the Transformer. The model also prepends a learned [CLS] token (a single 768-dim vector) and adds learned position embeddings of shape (197, 768). The Transformer encoder is fed a tensor of shape (197, 768).

ViT-Base has 12 Transformer encoder blocks. Each block has multi-head self-attention with 12 heads of dimension 64 (because 768 / 12 = 64), and a feed-forward layer with hidden dimension 3072 (the standard 4× expansion). The total parameter count is roughly 86 million.

Self-attention over the 197 tokens is two matrix products. Queries times keys costs 197 × 197 × 768 ≈ 30 million multiply-adds per layer, summed over all 12 heads of 64 dimensions each, and attention weights times values costs another 30 million. The linear layers around attention are much bigger at this size: the query, key, value and output projections cost 4 × 197 × 768² ≈ 465 million, and the feed-forward layer 8 × 197 × 768² ≈ 930 million. Per block that is about 1.45 billion multiply-adds; across 12 blocks, about 17.5 billion. That is the roughly 17.6 GFLOPs usually quoted for ViT-Base/16 at 224×224, counting one multiply-add as one operation.

Now scale to a 1024×1024 image at the same patch size. The grid becomes 64 × 64 = 4,096 patches. The query-key product alone becomes 4,096 × 4,096 × 768 ≈ 12.9 billion multiply-adds per layer, about 430× the 224×224 case, while the token count grew only 21×. At this size the two attention products (about 26 billion multiply-adds per layer) cost about as much as all the linear layers combined (about 29 billion), against roughly 4% of the bill at 224×224. That is the quadratic wall we keep mentioning. Almost every architecture below was invented to climb around it.

Patch Size, Resolution, And The Knobs That Actually Matter

Three engineering knobs dominate every ViT deployment decision: patch size, input resolution, and embedding dimension. They look small. They are the three numbers that decide whether your feature ships at 60 FPS or 6 FPS.

Patch size controls how aggressively the model down-samples. ViT-Base/16 uses 16×16 patches and produces 196 tokens from a 224×224 image. ViT-Base/14 uses 14×14 patches and produces 256 tokens. Smaller patches mean more tokens, more fine-grained features, quadratically more attention cost, and usually better accuracy on dense tasks like segmentation. Larger patches (32×32) cut token count by 4× and inference cost by 16× for the attention layers, at the cost of detail.

Input resolution matters because token count scales with the resolution squared. Going from 224×224 to 384×384 — a routine upgrade for accuracy — triples token count from 196 to 576 and increases attention cost by 9×. Going to 1024×1024 takes you to the wall.

Embedding dimension controls model capacity. ViT-Tiny uses 192, ViT-Small uses 384, ViT-Base uses 768, ViT-Large uses 1024, ViT-Huge uses 1280, ViT-g (giant) uses 1408, and the 1.8-billion-parameter ViT-G uses 1664. Doubling the embedding dimension roughly quadruples the parameters of the feed-forward layers and doubles the cost of attention per head.

In practice, the right combination depends on what you are doing. For real-time inference on edge: ViT-Tiny/16 or ViT-Small/16 at 224×224 resolution. For maximum cloud accuracy on small images: ViT-Large/14 at 384×384. For dense prediction (segmentation, detection backbones): ViT-Base/16 at 512×512 or higher, with the hierarchical extensions we describe below. The temptation to pick a huge model at high resolution is what drove most teams toward the hierarchical and windowed variants.

From Image To Video — Why Plain ViT Is Not Enough

A video is a stack of images, plus the dimension of time. Multiplying token count by 16 frames per clip — the typical input length for an action-recognition model — turns 196 tokens into 3,136 tokens. The attention matrix grows by 256×. Throw a 1-minute clip at 30 frames per second at the model and you are far past where any GPU can hold the attention matrix in memory.

Two things have to happen for video. First, the model has to understand temporal relationships — the patch at position (10, 20) in frame 5 has to be linked to the patch at position (10, 20) in frame 6, even though they are at completely different positions in the flattened token sequence. Second, the cost of attention over space × time has to come down by orders of magnitude.

The video-Transformer literature is essentially a list of factorisations and locality tricks that solve those two problems. The four we cover below are the four you actually meet in production.

ViViT — The Pure-Transformer Video Recipe

ViViT was published by Anurag Arnab and colleagues at Google in March 2021, six months after the original ViT. The paper presents four model variants. Variant 1 — Spatio-temporal attention — is the brute-force baseline: tubelet patches (3-D blocks of, say, 16 × 16 × 2 voxels) become tokens, and the encoder attends over all of them jointly. It is the most accurate, but the most expensive. Variant 2 — Factorised encoder — first runs a spatial Transformer per frame, then a small temporal Transformer that takes the per-frame [CLS] tokens as its input. Variant 3 — Factorised self-attention — interleaves spatial and temporal attention layers in the same block. Variant 4 — Factorised dot-product attention — splits the attention heads themselves into spatial heads and temporal heads.

The two practical wins were Variant 2 and the use of tubelet patches. Tubelet patches replace the per-frame 2-D patches with 3-D blocks that span multiple frames, which means the model sees a small slice of temporal context inside every token. Variant 2's factorisation cuts the cost of full spatio-temporal attention by an order of magnitude on long clips while losing only a small amount of accuracy.

On Kinetics-400 — 400 action classes, about 240,000 training clips — ViViT-L/16x2 with the factorised encoder reaches 80.6% top-1 when initialised from ImageNet-21k (81.7% with three-crop testing). Initialised from Google's internal JFT data, the larger ViViT-H/14x2 reaches 84.9% on Kinetics-400 and 85.8% on Kinetics-600. On Something-Something v2, a benchmark designed specifically to test temporal reasoning, ViViT-L reaches 65.9%. Those were state-of-the-art numbers in 2021 and are still the reference for the "pure attention for video" approach. The code lives in Google's Scenic library under Apache 2.0.

TimeSformer — Divided Attention

TimeSformer was published in February 2021, seven weeks before ViViT, by Gedas Bertasius, Heng Wang, and Lorenzo Torresani at Facebook AI Research. The contribution is divided attention: instead of attending over space and time jointly, the model alternates layers — one layer attends only along the time axis (linking the same spatial position across frames), the next attends only along the spatial axes (linking different positions within a frame). The two attention layers stack, and the result is global spatio-temporal coverage at one-quarter to one-tenth of the cost of joint attention.

TimeSformer's headline numbers, for the long-clip TimeSformer-L (96 frames), are 80.7% top-1 on Kinetics-400 and 82.2% on Kinetics-600. The model came in three versions — base (8 frames), HR (high resolution, 448 px) and L (96 frames) — and TimeSformer-L set the state of the art on Kinetics-600 at the time. The reference implementation is at github.com/facebookresearch/TimeSformer under a CC BY-NC 4.0 license (note: non-commercial — read it before you ship). The divided-attention pattern was widely copied; you will see it inside more recent models too.

Video Swin Transformer — Hierarchical Window Attention

Swin Transformer — the Shifted Window image model — was published by Ze Liu and colleagues at Microsoft in 2021. The contribution that mattered most for production was window-based attention with shifted windows. Instead of letting every token attend to every other token, Swin partitions the token grid into non-overlapping windows of, say, 7×7 tokens, and applies attention inside each window. Information leaks between windows by shifting the window partitioning by half a window every other layer. The cost of attention drops from quadratic in the number of tokens to linear, because the per-window attention is constant-cost and the number of windows scales linearly. The model is also hierarchical: it merges tokens between stages to produce a feature pyramid, the same way a CNN does, making Swin a drop-in backbone for dense-prediction tasks like detection and segmentation.

Video Swin Transformer, published shortly after by the same team, extends the recipe to time: windows become 3-D blocks of, say, 8 × 7 × 7 tokens (8 frames × 7 × 7 spatial), and the shifted-window trick applies in both space and time. On Kinetics-400, Video Swin-L reaches 84.9% top-1; on Something-Something v2, Video Swin-B reaches 69.6%. The dominant practical fact is the hierarchical feature pyramid: Video Swin slots in wherever an FPN-style backbone would, which is why it became the default video backbone for downstream tasks like temporal localisation and dense video segmentation for several years. Swin V2 followed in 2022 with scaling tweaks that pushed total parameter count to 3 billion and supported very high-resolution inputs.

Hiera — Cutting The Bells And Whistles

By 2023, the field had stacked vision-specific tweaks on top of plain ViT for years — hierarchical pyramids, shifted windows, relative positional biases, convolutional stems, learned downsampling. Each piece improved a benchmark. Together they made the models slower than they had any right to be. Hiera, published at ICML 2023 (Oral) by Chaitanya Ryali and colleagues at Meta FAIR with collaborators from Georgia Tech and Johns Hopkins, asked the obvious question: what happens if you take all of those tweaks back out, and let the model learn what it needs from a Masked Autoencoder (MAE) pre-training objective?

The recipe: start from a hierarchical ViT (so you keep the multi-scale feature pyramid that downstream tasks need), remove every vision-specific addition — no shifted windows, no relative positional biases, no convolutional kernels in the patch embedding — and pre-train with MAE, where the model has to reconstruct masked patches of the image. MAE pre-training gives the model implicit locality and translation-equivariance priors from the data, instead of having those priors baked into the architecture. The result is an architecture that is simpler and faster than every prior hierarchical ViT, and more accurate.

The numbers are striking. Hiera is 2.4× faster than MViTv2 on images and 5.1× faster on video. On Kinetics-400, Hiera-L beats every prior model in its class; on Kinetics-600 and Kinetics-700 it sets new state-of-the-art numbers. The reference implementation is at github.com/facebookresearch/hiera. Read its licence twice: the code is Apache 2.0, but the released Hiera checkpoints are CC BY-NC 4.0, so they are research-only unless you pre-train your own weights. The SAM 2 checkpoints, which contain a Hiera image encoder, are Apache 2.0. Hiera is also the visual backbone that powers SAM 2 (the segmentation model from the SAM 2 lesson), which is the strongest production endorsement an architecture can get.

Table titled Four Video Vision Transformer Families, comparing year, key idea, Kinetics-400 accuracy and licence for ViViT, TimeSformer, Video Swin and Hiera. Released: 2021 Google; 2021 Meta FAIR; 2021 Microsoft; 2023 Meta FAIR. Kinetics-400 top-1 for the Large models: 80.6, 80.7, 84.9 and 87.3 percent, Hiera highest. Licence: Apache 2.0; CC BY-NC research only; Apache 2.0; Apache code with non-commercial weights. Notes say SAM 2 checkpoints are Apache 2.0 Figure 2. The four classic video Vision Transformer families. Hiera is the fastest and most accurate of the four, but its released weights are non-commercial; Video Swin remains a default in many downstream-task backbones; ViViT and TimeSformer are the canonical reference papers. The 2025–2026 additions are covered below.

VideoMAE And The Pre-Training Question

Vision Transformers are data-hungry, and there is never enough labelled video to train one from scratch. The field's answer is self-supervised pre-training on huge unlabelled video corpora. The dominant recipe is Masked Autoencoders for Video — VideoMAE — published at NeurIPS 2022 by Zhan Tong and colleagues at Nanjing University and Tencent AI Lab. The idea is simple. Take a clip of 16 frames, divide each frame into 16×16 patches, randomly mask out 90–95% of the patches across space and time, feed the surviving 5–10% of patches into a ViT encoder, and ask a small decoder to reconstruct the masked pixels. The encoder has to learn what video looks like to do that.

The masking ratio matters. Image MAE works well at 75% masking; video MAE works better at 90–95% masking, because consecutive frames are largely redundant. The model is forced to predict masked patches from temporally distant context, which is exactly the learning signal you want.

VideoMAE's numbers on a ViT-Base backbone: 81.5% top-1 on Kinetics-400 after self-supervised pre-training on Kinetics-400 itself (no external labelled data). VideoMAE-V2, published in 2023, scales to a 1-billion-parameter ViT with a dual masking strategy and reaches 90.0% top-1 on Kinetics-400, 89.9% on Kinetics-600, 68.7% on Something-Something v1, and 77.0% on v2. Those are foundation-model numbers — they sit at or near the top of every public leaderboard, and they were reached with self-supervised pre-training on about 1.35 million unlabelled clips, followed by supervised fine-tuning on a labelled Kinetics-710 mix before each benchmark.

The practical implication: if you are training a video-understanding model in 2026 on your own data, you almost certainly start from a publicly released VideoMAE-V2 checkpoint or a V-JEPA 2 checkpoint (Hiera-MAE weights are research-only), then fine-tune on whatever labels you have. Starting from random initialisation on a domain video dataset of, say, 50,000 clips is essentially never the right move.

DINO, DINOv2, And DINOv3 — Self-Supervision Without Reconstruction

The other big self-supervised family is DINO — self-DIstillation with NO labels — published by Mathilde Caron and colleagues at Meta FAIR in 2021. Instead of reconstructing masked patches, DINO trains a student network to match the output of a teacher network that is an exponential moving average of past students. Both networks see different augmented views of the same image and have to produce the same embedding. The model learns a representation without any labels, just from the constraint that two augmented views of the same image should be embedded near each other.

DINOv2 (2023, Maxime Oquab and colleagues at Meta) scaled the recipe to 142 million curated images and produced the strongest open-weights image encoder of its era. DINOv3 (August 2025, Oriane Siméoni and colleagues at Meta) scaled it further: a 6.7-billion-parameter ViT-7B teacher trained on 1.7 billion curated images, a new Gram Anchoring loss to stabilise the dense feature maps that degrade in long training runs, and a family of distilled students — ViT-S, B, L and H+ (21 to 840 million parameters) plus ConvNeXt variants for edge devices. On ImageNet linear-probe classification, DINOv3 reaches 88.4% top-1; on ADE20k semantic segmentation with a frozen backbone, the ViT-7B reaches 55.9 mIoU (Meta model card, 2025).

Why this matters for video: DINO-family features are exceptionally good at dense tasks — segmentation, depth, tracking, anything that needs a useful representation per pixel — and they transfer to video by extracting features per frame and then training a small temporal head on top. DINOv2 code and weights are Apache 2.0 (Meta moved them from CC BY-NC in 2023). DINOv3 ships under its own DINOv3 License: commercial use is royalty-free, but you must display "Built with DINOv3", pass the licence on with any redistribution, and stay out of military, ITAR and weapons uses. Licences aside, the two are the strongest off-the-shelf vision backbones available when you have no labelled data in your domain.

What Changed In 2025–2026: V-JEPA 2, SAM 3 And Perception Encoder

The short answer: the newest video ViTs learn by predicting in feature space instead of reconstructing pixels, and Meta's flagship segmenter moved off Hiera. Five releases matter if you are picking a backbone now.

  • V-JEPA 2 (Meta, June 2025). A self-supervised video ViT, up to ViT-g with 1 billion parameters, trained on internet-scale video to predict masked regions in representation space rather than pixels. With a frozen encoder and an attentive probe it reaches 77.3% on Something-Something v2 and 39.7 recall@5 on Epic-Kitchens-100 action anticipation. The repository is MIT-licensed.
  • V-JEPA 2.1 (Meta, 16 March 2026). A revised training recipe aimed at high-quality, temporally consistent dense features, released at 384 px from ViT-B (80 million parameters) to ViT-G (2 billion). It targets per-pixel feature extraction for tracking and segmentation heads, the job DINO-family features did per frame.
  • Perception Encoder (Meta, April 2025). A CLIP-style ViT family (PE-Core, PE-Lang, PE-Spatial) released under Apache 2.0. It is the vision backbone of SAM 3.
  • SAM 3 (19 November 2025) and SAM 3.1 (27 March 2026). SAM 3 segments and tracks every instance of a concept named in text ("red car", "hard hat") on a shared Perception Encoder backbone; on the SA-Co/Gold benchmark it scores 65.0 cgF1 against 34.3 for OWLv2. SAM 3.1 adds Object Multiplex, about 7× faster at 128 tracked objects on one H100. Both ship under Meta's SAM License: commercial use is allowed, with redistribution and military-use restrictions.
  • ViT-5 (February 2026). An academic refresh of the plain ViT block — normalisation, activations, positional encoding, gating and learnable tokens — that lifts ViT-Base to 84.2% ImageNet-1k top-1 against 83.8% for DeiT-III-Base at comparable compute. The plain ViT recipe is still being tuned, not replaced.

What this means in practice: for video classification and action understanding, test V-JEPA 2 next to VideoMAE-V2 before defaulting to Hiera, whose released weights are non-commercial. For text-prompted segmentation and tracking, SAM 3 replaces the "open-vocabulary detector plus SAM 2" chain; for click-prompted masks on a tight GPU budget, SAM 2 is still the lighter choice.

Where Vision Transformers Live In A 2026 Production System

Vision Transformers are everywhere in a modern video AI stack, almost always as a backbone — the first network in the pipeline that turns pixels into features — rather than as a standalone model. Here is the map.

In object detection, the trend has been to add Transformer encoders and decoders on top of CNN or ViT backbones in the higher-accuracy tier. RT-DETR (covered in the open-vocabulary detection lesson) is a real-time DETR: a CNN backbone feeds a Transformer encoder and decoder, with no anchor boxes and no non-maximum suppression. YOLO-style detectors increasingly use Transformer-style modules in their necks. Grounding DINO and OWLv2, the open-vocabulary detectors, are Transformer backbones with a text encoder bolted on top.

In segmentation, SAM 2 (the segmentation model from the SAM 2 lesson) uses a Hiera backbone — a hierarchical Vision Transformer — as its image encoder. The memory module that lets it track objects through occlusion is itself a Transformer. SAM 3 (November 2025) moved to Meta's Perception Encoder ViT and added text prompts.

In image and video classification, the entire foundation-model layer is ViT. EVA-02, SigLIP 2 and Perception Encoder are ViT image encoders, and SigLIP-family encoders sit inside many recent open vision-language models. DINOv2 and DINOv3 are the default ViT feature extractors for dense-prediction tasks.

In vision-language models — the multimodal models from Phase 4 — the vision encoder is almost always a ViT, usually with a specific patch size that aligns with the language model's token budget. LLaVA, Qwen-VL, Pixtral, InternVL, Florence-2, and every frontier-grade VLM uses a ViT image tokeniser to convert pixels into the tokens the language model can read.

In generative video — Phase 5 — the models behind Sora, Veo, Kling, Runway, Pika and Luma are diffusion models whose denoisers are largely diffusion transformers (DiT): ViT-style blocks over spacetime patches of a compressed video latent. The open-weights generative video models (HunyuanVideo, CogVideoX, Mochi, LTX-Video, Wan) are built the same way.

In real-time video calls — Phase 6 — background blur and replacement still run mostly on compact CNN segmenters such as MediaPipe Selfie Segmentation (covered in the MediaPipe Selfie Segmentation lesson), because they fit a per-frame budget of a few milliseconds in the browser. Lightweight ViT and hybrid models are starting to appear in WebGPU pipelines, but on a laptop GPU the CNN is still the safer default.

Pitfalls When Shipping ViT Backbones In Video Products

We have shipped or evaluated Vision Transformer backbones into roughly twenty production video features at Fora Soft, mostly in video surveillance, telemedicine, conferencing, and OTT. The four pitfalls below come up over and over.

Pitfall 1: Quadratic attention bites at high resolution. The most common surprise in a ViT deployment is that the model's inference cost balloons when the team decides to "just run it at 4K". A 4K UHD frame (3840×2160) is about 8.3 million pixels; at patch size 16 that gives 32,400 tokens per frame, and a single attention map has about 1.05 billion entries, per head and per layer. The model that ran at 30 FPS on 224×224 input runs at less than 1 FPS. The fix is to use a hierarchical model (Swin, Hiera) that does not attend globally, or to run the model on a downsampled image and project the result back up.

Pitfall 2: Position embeddings are tied to the input resolution. The original ViT learns a fixed grid of position embeddings — say, 14×14 for a 224×224 image. When you change the input resolution, those embeddings have to be interpolated, which usually works but sometimes degrades performance. Modern variants (RoPE, sinusoidal, relative) handle resolution changes more gracefully. Read the model's documentation before changing the input resolution.

Pitfall 3: Small data + plain ViT = no transfer. If you train a plain ViT-Base on your domain video data of 10,000 clips from scratch, you will get worse results than a ResNet-50. ViT needs scale. The way out is to start from a pre-trained checkpoint — DINOv2, DINOv3, VideoMAE-V2, V-JEPA 2, SigLIP 2 — and fine-tune. We have not seen a project where training a ViT from scratch was the right call.

Pitfall 4: Edge deployment is harder than CNN edge deployment. Vision Transformers have historically lagged CNNs on edge devices because the kernels for attention are less mature in TensorRT, CoreML, and TensorFlow Lite than the kernels for convolution. The gap is closing fast — TensorRT now has good ViT support, Apple's CoreML has explicit ViT optimisations, and architectures like EfficientFormer were designed specifically for edge. But "I will deploy a ViT-L on a phone" is still a much riskier engineering bet than "I will deploy a MobileNet on a phone". Test the export path early.

Diagram titled Four Pitfalls When Shipping ViT Backbones: the mistakes we keep rediscovering in production video AI. Four stacked orange-framed panels, each with its fix in green. 1, attention is quadratic: 30 FPS at 224 by 224 becomes under 1 FPS on a 4K frame, shown as a long green bar against a sliver of orange, because tokens per frame grow from 196 to 32,400; fix, Swin or Hiera, or downsample. 2, positions tied to size: a learned 14 by 14 grid of position embeddings, drawn in blue, must be interpolated, purple arrow, to a 32 by 32 grid, drawn in orange; fix, RoPE, sinusoidal or relative embeddings. 3, small data and a scratch ViT: on 10,000 domain clips a ViT trained from scratch loses to ResNet; illustrative top-1 bars, ResNet-50 68 percent, ViT from scratch 52 percent, pretrained ViT 81 percent; fix, fine-tune a pre-trained model. 4, edge export is harder: attention kernels lag convolution in TensorRT, CoreML and TF Lite; a chain PyTorch to ONNX to TensorRT where attention ops can break at each step; fix, test the export path early. Figure 3. The four pitfalls we keep rediscovering when shipping ViT backbones into video products.

Picking The Right Backbone — A Decision Walkthrough

The decision tree we use at Fora Soft has four questions.

The first question is: what task are you doing? For image classification on a fixed taxonomy: a small ViT (Tiny or Small) pre-trained with DINOv2 or DINOv3, fine-tuned on your labels. For segmentation: SAM 2 (Hiera backbone) for click- or box-prompted masks, SAM 3 when you want to prompt with text and track every instance, and DINOv3 + a small head when you need a single-model pipeline. For detection: RT-DETR or a YOLO with a Transformer neck, depending on whether you need open-vocabulary (Grounding DINO) or fixed-vocabulary (YOLO). For video classification: VideoMAE-V2 or V-JEPA 2 pre-trained, fine-tuned or probed on your action labels; Hiera-MAE if its non-commercial weights fit your use. For vision-language: pick the VLM, not the backbone — the VLM ships with its own visual encoder.

The second question is: what is your latency budget? Sub-50 ms on edge: ViT-Tiny or ViT-Small at 224×224, with TensorRT or CoreML export tested. 50–200 ms in cloud: ViT-Base or ViT-Large at 224×224 or 384×384. 200 ms+ for batch processing: anything up to ViT-Huge at 384×384 or higher.

The third question is: how much labelled data do you have? Under 10,000 examples: start from a pre-trained DINOv3 / VideoMAE-V2 / V-JEPA 2 checkpoint and fine-tune the head only, freezing the backbone. 10,000 to 100,000: fine-tune the head and the last few backbone layers. Over 100,000: full fine-tuning of the backbone with a low learning rate. Never train ViT from scratch on a domain dataset unless you have at least a million examples and a research-grade compute budget.

The fourth question is: what licence do you need? Check code and weights separately: several popular repositories ship Apache or MIT code with non-commercial weights. As of October 2026:

ModelCodeWeightsCommercial use
DINOv2Apache 2.0Apache 2.0Yes
DINOv3DINOv3 LicenseDINOv3 LicenseYes, with "Built with DINOv3" attribution; no military or ITAR use
Video SwinApache 2.0Apache 2.0Yes
SAM 2 (Hiera encoder)Apache 2.0Apache 2.0Yes
Hiera (standalone)Apache 2.0CC BY-NC 4.0No, unless you pre-train your own weights
TimeSformerCC BY-NC 4.0 (mostly)CC BY-NC 4.0No
SAM 3 / SAM 3.1SAM LicenseSAM License (gated)Yes, with redistribution and military-use limits
Perception EncoderApache 2.0Apache 2.0Yes
VideoMAE-V2MITLinked from the MIT repositoryConfirm on the model card
V-JEPA 2 / 2.1MIT (most files)Released in the MIT repositoryConfirm on the model card

Which vision transformer models are MIT-licensed? Among the backbones in this lesson, the Swin image models, EVA-02 and the V-JEPA 2 code are MIT; DINOv2, Perception Encoder, SigLIP 2, Video Swin and SAM 2 are Apache 2.0, which is just as safe for commercial use. ImageBind and some Meta data sets are more restrictive. This is engineering guidance, not legal advice: have counsel read the licence before you ship.

Vision Transformer FAQ

What is a vision transformer (ViT)?

A vision transformer is an image model that splits a picture into patches (typically 16×16 pixels), embeds each patch as a token and processes the sequence with a standard Transformer encoder. ViT-Base has 12 layers, 768-dimensional embeddings and about 86 million parameters.

What is ViViT?

ViViT (Video Vision Transformer) is Google's 2021 extension of ViT to video. It turns 3-D tubelets spanning several frames into tokens and offers four ways to factorise attention across space and time; ViViT-H/14x2 reached 84.9% top-1 on Kinetics-400.

What is the difference between a ViT and a CNN?

A CNN builds in locality and translation equivariance and sees the whole image only after many layers; a ViT has no such built-in assumptions and lets every patch attend to every other patch from layer one. CNNs win on small data and tight edge budgets; ViTs win at scale.

What is Hiera?

Hiera is Meta's 2023 hierarchical vision transformer that drops vision-specific add-ons and relies on MAE pre-training; it is 2.4× faster than MViTv2 on images and 5.1× faster on video, and it is the image encoder inside SAM 2. Its code is Apache 2.0, but its standalone weights are CC BY-NC 4.0.

What is the best vision transformer for video in 2026?

There is no single winner: VideoMAE-V2 and V-JEPA 2 are the strongest open pre-trained video encoders for classification and action understanding, SAM 2 and SAM 3 for segmentation and tracking, and DINOv3 for per-frame dense features. Pick by task, latency budget and licence.

Should I train a vision transformer from scratch?

Almost never. A plain ViT trained from scratch on 10,000 domain clips loses to a ResNet-50; start from a public checkpoint and fine-tune, and train from scratch only with a million-plus examples and a research-grade compute budget.

↓ Free download: Vision Transformer Decision WorksheetOne printable page with the four-question backbone decision tree, the patch-size, resolution and embedding-dim cheat sheet, and the four-pitfall checklist — for the kickoff meeting where you pick the backbone.

Where Fora Soft Fits In

Most of the video features we ship at Fora Soft start with a pre-trained Vision Transformer as the backbone. In video surveillance we use ViT-based open-vocabulary detectors and SAM 2 for segmentation; in telemedicine, where our AI medical imaging development work sits, we use DINOv3 for symptom-area localisation and VideoMAE-V2 for action classification when the camera sees a procedure; in video conferencing we use compact segmenters on the WebGPU pipeline for background segmentation and are evaluating lightweight ViT variants there; in OTT we use Video Swin and VideoMAE-V2 for content-aware encoding decisions and scene classification on archive footage. We do not train ViTs from scratch — we fine-tune from public checkpoints and check the weights licence first, not only the code licence. The architecture choice is rarely the bottleneck; the data pipeline, the labelling strategy, and the export path to the deployment runtime are where projects live or die. Our computer vision development services take that fine-tune-and-export path to production on live video, and our AI video recognition team deploys the resulting models at the edge on NVIDIA Jetson.

AI for Video: From Models and Inference to Computer Vision, Speech, Search, and Generative Video - book cover

The book

AI for Video: A Complete Guide to Intelligence in Video Products: From Models and Inference to Computer Vision, Speech, Search, and Generative Video

Patches, tokens and attention are where every modern vision model starts. Volume 6 of the Fora Soft Video Engineering Handbook takes the ViT family from the backbone up — detection, segmentation, tracking, CLIP-style encoders and video VLMs — so you can pick a backbone by patch size, token count and licence instead of by leaderboard. Volume 7 picks up where the backbone meets production: export to TensorRT, serving, the frame budget and cost per stream-hour. Written by Nikolay Sapunov, CEO at Fora Soft.

Read it on Amazon →Kindle & paperback · Fora Soft Video Engineering Handbook

Choosing a vision backbone for your video product?

Tell us your latency budget, where the model runs and how much labelled video you have. We will shortlist the ViT family, the pre-trained checkpoint and the licence, and test the export path to your runtime before you commit to it. 250+ video products shipped since 2005.

Book a 30-min call →WhatsApp →Email us →

See our case studies

References

  1. Dosovitskiy, A., Beyer, L., Kolesnikov, A., et al. "An Image is Worth 16×16 Words: Transformers for Image Recognition at Scale." ICLR 2021. arXiv:2010.11929. Accessed 2026-05-27. Original ViT paper. Source of the patch-as-token recipe, the 86 / 307 / 632 million parameter Base / Large / Huge configurations, and the JFT-300M-scale data-efficiency results.

  2. Vaswani, A., Shazeer, N., Parmar, N., et al. "Attention Is All You Need." NeurIPS 2017. arXiv:1706.03762. Accessed 2026-05-27. The Transformer encoder that ViT borrows wholesale. Source for the multi-head self-attention formulation and the 4× feed-forward expansion.

  3. Arnab, A., Dehghani, M., Heigold, G., Sun, C., Lučić, M., Schmid, C. "ViViT: A Video Vision Transformer." ICCV 2021. arXiv:2103.15691. Accessed 2026-05-27. Four-variant ViViT and tubelet patches; ViViT-L/16x2 FE Kinetics-400 80.6% (ImageNet-21k init), ViViT-H/14x2 (JFT) Kinetics-400 84.9% / Kinetics-600 85.8%, Something-Something v2 65.9%. Re-checked 2026-10-29.

  4. Bertasius, G., Wang, H., Torresani, L. "Is Space-Time Attention All You Need for Video Understanding?" ICML 2021. arXiv:2102.05095. Accessed 2026-05-27. TimeSformer with divided attention; TimeSformer-L Kinetics-400 80.7% / Kinetics-600 82.2%. Re-checked 2026-10-29. Reference implementation: github.com/facebookresearch/TimeSformer, CC BY-NC.

  5. Liu, Z., Lin, Y., Cao, Y., et al. "Swin Transformer: Hierarchical Vision Transformer using Shifted Windows." ICCV 2021. arXiv:2103.14030. Accessed 2026-05-27. Shifted-window attention; hierarchical feature pyramid; MIT-licensed reference.

  6. Liu, Z., Ning, J., Cao, Y., et al. "Video Swin Transformer." CVPR 2022. arXiv:2106.13230. Accessed 2026-05-27. 3-D shifted windows; Kinetics-400 84.9% (Swin-L), Something-Something v2 69.6% (Swin-B). Reference code: github.com/SwinTransformer/Video-Swin-Transformer, Apache 2.0.

  7. Liu, Z., Hu, H., Lin, Y., et al. "Swin Transformer V2: Scaling Up Capacity and Resolution." CVPR 2022. arXiv:2111.09883. Accessed 2026-05-27. Swin scaling tweaks; 3-billion-parameter variant; high-resolution support.

  8. Ryali, C., Hu, Y.-T., Bolya, D., et al. "Hiera: A Hierarchical Vision Transformer without the Bells-and-Whistles." ICML 2023 Oral. arXiv:2306.00989. Accessed 2026-05-27. Strip-down hierarchical ViT pre-trained with MAE; 2.4× faster on images, 5.1× faster on video than MViTv2; new state-of-the-art on Kinetics-400/600/700. Reference: github.com/facebookresearch/hiera: code Apache 2.0, model weights CC BY-NC 4.0 (re-checked 2026-10-29).

  9. Tong, Z., Song, Y., Wang, J., Wang, L. "VideoMAE: Masked Autoencoders are Data-Efficient Learners for Self-Supervised Video Pre-Training." NeurIPS 2022. arXiv:2203.12602. Accessed 2026-05-27. 90–95% masking ratio; ViT-Base Kinetics-400 81.5% top-1 with no external labels.

  10. Wang, L., Huang, B., Zhao, Z., et al. "VideoMAE V2: Scaling Video Masked Autoencoders with Dual Masking." CVPR 2023. arXiv:2303.16727. Accessed 2026-05-27. Billion-parameter video ViT; Kinetics-400 90.0%, Kinetics-600 89.9%, Something-Something v1 68.7%, v2 77.0%.

  11. Caron, M., Touvron, H., Misra, I., et al. "Emerging Properties in Self-Supervised Vision Transformers (DINO)." ICCV 2021. arXiv:2104.14294. Accessed 2026-05-27. Self-distillation without labels; the foundation of the DINO family.

  12. Oquab, M., Darcet, T., Moutakanni, T., et al. "DINOv2: Learning Robust Visual Features without Supervision." TMLR 2024. arXiv:2304.07193. Accessed 2026-05-27. 142M curated images; ImageNet linear probe 86.5% (ViT-g/14). Code and weights Apache 2.0.

  13. Siméoni, O., Vo, H. V., Seitzer, M., et al. "DINOv3." Meta AI, August 2025. arXiv:2508.10104 and ai.meta.com/blog/dinov3-self-supervised-vision-model. Accessed 2026-10-29. 1.7B images, 6.7B-parameter ViT-7B teacher distilled to ViT-S/B/L/H+ and ConvNeXt, Gram Anchoring; ImageNet linear probe 88.4%, ADE20k 55.9 mIoU (model card). Licence: DINOv3 License (August 2025).

  14. Fang, Y., Wang, W., Xie, B., et al. "EVA-02: A Visual Representation for Neon Genesis." Image and Vision Computing 149 (2024). arXiv:2303.11331. Accessed 2026-05-27. CLIP-distilled, MIM-pre-trained ViT image encoder.

  15. Tschannen, M., Gritsenko, A., Wang, X., et al. "SigLIP 2: Multilingual Vision-Language Encoders with Improved Semantic Understanding." 2025. Hugging Face SigLIP 2 model card. Accessed 2026-05-27. Dual-tower SigLIP-family encoders at B/L/So400m/G scales.

  16. He, K., Chen, X., Xie, S., Li, Y., Dollár, P., Girshick, R. "Masked Autoencoders Are Scalable Vision Learners (MAE)." CVPR 2022. arXiv:2111.06377. Accessed 2026-05-27. The image MAE recipe that VideoMAE and Hiera extend.

  17. Assran, M., Bardes, A., Fan, D., et al. "V-JEPA 2: Self-Supervised Video Models Enable Understanding, Prediction and Planning." Meta FAIR, June 2025. arXiv:2506.09985; code at github.com/facebookresearch/vjepa2 (MIT). Accessed 2026-10-29. ViT-L to ViT-g encoders; Something-Something v2 77.3% and Epic-Kitchens-100 39.7 recall@5 with frozen encoder. V-JEPA 2.1 (16 March 2026, arXiv:2603.14482): ViT-B to ViT-G (2B) at 384 px, dense-feature recipe.

  18. Carion, N., Gustafson, L., Hu, Y.-T., et al. "SAM 3: Segment Anything with Concepts." Meta, November 2025. arXiv:2511.16719. Accessed 2026-10-29. Perception Encoder backbone; SA-Co/Gold 65.0 cgF1 vs 34.3 for OWLv2; SAM License. SAM 3.1 (27 March 2026) adds Object Multiplex, about 7× faster at 128 objects on one H100.

  19. Bolya, D., Huang, P.-Y., Sun, P., et al. "Perception Encoder: The best visual embeddings are not at the output of the network." Meta FAIR, April 2025. arXiv:2504.13181. Accessed 2026-10-29. PE-Core, PE-Lang and PE-Spatial ViT encoders; Apache 2.0.

  20. Wang, F., Ren, S., Zhang, T., et al. "ViT-5: Vision Transformers for The Mid-2020s." February 2026. arXiv:2602.08071. Accessed 2026-10-29. ViT-5-Base 84.2% ImageNet-1k top-1 vs 83.8% for DeiT-III-Base at comparable compute.