EdgeTAM: On-Device Track Anything Model
- Publication
- CVPR 2025Conference
- First submitted to arXiv
- arXiv:2501.07256
Cite this paper · BibTeX
The citation identifies the linked source version. It cites the original paper and its authors.
@misc{segmentationedgetam2025,
title = {{EdgeTAM: On-Device Track Anything Model}},
author = {Chong Zhou and Chenchen Zhu and Yunyang Xiong and Saksham Suri and Fanyi Xiao and Lemeng Wu and Raghuraman Krishnamoorthi and Bo Dai and Chen Change Loy and Vikas Chandra and Bilge Soran},
year = {2025},
eprint = {2501.07256},
archivePrefix = {arXiv},
url = {https://arxiv.org/abs/2501.07256}
}
SAM 2 brought SAM from images into video. Click once on any frame and the model follows that object all the way through, picking it back up after occlusions or when it disappears and reappears. It relies on a memory bank that stores features from the past few frames and consults them when processing each new frame.
The mechanism works well, but it's expensive. The authors converted the smallest SAM 2 to CoreML and ran it on an iPhone 15 Pro Max, where it could process only about 1 frame per second.
The acceleration methods of the SAM generation, such as MobileSAM, EfficientSAM and EdgeSAM, all worked in roughly the same way, replacing the heavy image encoder with a small model, since SAM's decoder was light to begin with. This time Chong Zhou, the author of EdgeSAM, was interning at Meta Reality Labs and looked at SAM 2 together with Yunyang Xiong of EfficientSAM and others, and they found that the same trick no longer works so well on video.
Defining the Problem

This figure shows why swapping the encoder alone isn't enough. On the left, SAM 2's Hiera-B+ encoder is replaced with ever smaller backbones. By RepViT-M1 the backbone takes only a dozen or so milliseconds, yet a whole frame still takes nearly 800 ms, because the light "decoder" part stays at around 750 ms.
The decoder here includes the memory attention that SAM 2 added. Recall how SAM 2 processes a frame:
- The image encoder outputs features at three scales, , and , where the subscript is the downsampling factor relative to the original image.
- Memory attention is a few Transformer layers that use the current frame's as the query and the concatenated memory features of the past frames as keys and values, producing features that incorporate the history.
- The mask decoder outputs a mask from , , and the user's prompts.
- The memory encoder encodes and the current mask into a new memory, which goes into the memory bank first-in, first-out.
The right chart takes memory attention apart and measures the pieces. Going from 4 layers to 2 and then 1 cuts latency almost proportionally. Within a single layer, removing self-attention or the feed-forward layer saves only a little, while removing cross-attention takes it from 200 ms down to 20 ms. The real bottleneck is the current frame's cross-attention to memory.
A quick calculation shows why. A 1024×1024 input is 64×64 at the level, which is 4,096 tokens; each frame's memory is also 64×64, with 64 channels. The memory bank holds 7 frames, so every token of the current frame attends to 7 × 4,096 = 28,672 memory tokens, with complexity . A phone NPU has limited parallelism, and matrix multiplications this large hit it especially hard.
The authors first tried the most direct combination, using RepViT-M1 as the encoder as EdgeSAM did and cutting memory attention from 4 layers to 2. On the iPhone it still managed only 2.5 frames per second. Reducing the number of memory frames is another option, but with fewer frames, occlusion handling and long-term consistency get worse.
So the authors came at it from another direction. Video is highly redundant in both space and time, and there's no need to store 4,096 tokens of memory for every frame.
Solving the Problem

EdgeTAM's architecture is exactly the same as SAM 2's, except for one new module inserted between the memory encoder and the memory bank, which compresses each frame's memory into a small number of tokens before it is stored.
Trying Pooling First
The simplest compression is average pooling. The authors tried 4×4 average pooling, which takes each frame's memory from 4,096 tokens to 256 and speed from 2.5 to 15.7 frames per second, but J&F on the SA-V validation set falls from 63.5 to 61.8, and on the test set from 62.1 to 59.8. The smaller the encoder, the more noticeable this loss.
Global Perceiver
The second idea comes from the Perceiver. A fixed number of learnable vectors (latents) cross-attend to the whole memory feature map, summarizing its content into themselves, and then do one round of self-attention among themselves:
is the memory of frame , is the positional encoding, and is the latents. Every latent can see the whole map and decides for itself what to summarize. The complexity of memory attention drops from to .
The problem is that the output vectors have no spatial arrangement. Although positional encoding is added to the input, position information can only be implicit in the vectors. Video object segmentation is dense per-pixel prediction and needs more explicit position information and local features; the Global Perceiver alone does only slightly better than pooling and is still worse than no compression.
2D Spatial Perceiver
EdgeTAM's solution is to add a second set of latents that have spatial positions. The memory features are first cut into non-overlapping squares, and each latent is responsible for just one of them:
These latents share the same network parameters as the Global Perceiver; the only difference is how much each latent can see. The positional encoding also moves from the input to the output, added to the compressed grid, so the output is still a small feature map with a spatial layout.
In practice there are two sets of 256 latents each. The 2D latents are arranged 16×16, each covering one 4×4 patch of the original 64×64 memory. The global latents can range freely over the whole map, and the authors observed some redundancy among them, with several attending to the same place. The two sets of outputs are concatenated, taking each frame's memory from 4,096 tokens to 512, 8 times fewer; cross-attention and self-attention are each stacked twice.
The factor of 8 is deliberate. The authors make roughly equal to the number of memory frames, , so that in memory attention the current frame's self-attention over itself and its cross-attention over memory cost about the same.
Distilling the Memory Modules Too

SAM 2 is trained in two stages, first image segmentation on SA-1B without the memory modules, then all modules together on images and video. EdgeTAM keeps the original task loss in both stages and adds feature distillation from a teacher, the publicly released SAM 2 Hiera-B+.
The image stage aligns only the image encoder's output . The video stage aligns the memory attention output as well as , so that the student's memory modules also learn directly from the teacher:
The superscripts and denote teacher and student. Methods like MobileSAM distill only the encoder, on images; EdgeTAM extends the same idea to the memory modules.
Training largely follows SAM 2's recipe. The image stage trains for 2 epochs on SA-1B; the video stage uses SA-V, 10% of SA-1B, plus DAVIS, MOSE and YouTube-VOS, for 130K iterations with 8 frames per clip. EdgeTAM doesn't have SAM 2's internal dataset, so the iterations drop from SAM 2's 300K to 130K. Finally, following SAM 2.1, the encoder is frozen and the model is fine-tuned on longer clips of 16 and then 32 frames; EdgeTAM is light on GPU memory, so where SAM 2 stopped at 16 frames, it can go further. The memory bank size is unchanged, and so is the inference cost.
Discussion
Ablations
The ablations all use one third of the training schedule and report J&F on the SA-V validation and test sets, with speed as FPS on the iPhone.
| Setting | SA-V val | SA-V test | FPS |
|---|---|---|---|
| RepViT-M1 + 2-layer memory attention | 63.5 | 62.1 | 2.5 |
| + 4×4 average pooling | 61.8 | 59.8 | 15.7 |
| + 256 global latents only | 62.0 | 60.6 | 15.7 |
| + 256 2D latents only | 63.1 | 62.4 | 15.7 |
| + both sets (2D Spatial Perceiver) | 64.4 | 62.5 | 15.7 |
| + distillation | 65.7 | 65.8 | 15.7 |
Compression makes it more than 6 times faster. At that speed, only the version using both sets of latents beats the uncompressed model on both metrics. Distillation costs nothing at inference and adds 3.3 on the test set.
Whether the Perceiver needs its self-attention layer was ablated too. The authors' reasoning is that each 2D latent covers its own cell with no overlap, so self-attention lets them exchange information. Adding it raises the validation set from 62.6 to 64.4, while the test set drops from 62.7 to 62.5, and the paper concludes that "our results verify this hypothesis."
Encoders and numbers of memory-attention layers were compared as well. ViT-Tiny with 2 layers of memory attention is the most accurate (67.9 / 66.0) but runs at only 7.4 frames per second; RepViT-M1 with 1 layer is the fastest, at 22.2 frames, but drops to 61.6 on the test set. The final choice is RepViT-M1 with 2 layers, at 65.7 / 65.8 and 15.7 frames.
Video Object Segmentation
| Method | MOSE | DAVIS 2017 | SA-V val | SA-V test | A100 FPS | iPhone FPS |
|---|---|---|---|---|---|---|
| Cutie-base+ | 71.7 | 88.1 | 61.3 | 62.8 | 57.2 | — |
| SAM 2-B+ | 75.8 | 90.9 | 73.6 | 74.1 | 64.8 | 0.7 |
| SAM 2.1-B+ | 76.6 | 90.2 | 76.8 | 77.0 | 64.1 | 0.7 |
| EdgeTAM | 70.0 | 87.7 | 72.3 | 71.7 | 150.9 | 15.7 |
On the iPhone, EdgeTAM goes from SAM 2's 0.7 frames per second to 15.7, 22 times faster. On SA-V it's 1 to 2.5 points below SAM 2 and about 5 below SAM 2.1, but about 10 points above earlier dedicated video segmentation models. On MOSE and DAVIS it's roughly level with the Cutie generation of models.
When reading the MOSE and DAVIS columns, keep in mind that EdgeTAM's video-stage training data includes the training sets of DAVIS, MOSE and YouTube-VOS. These are scores from a model that has seen in-distribution data, not the zero-shot results Section 4.5 calls them.
On the A100 it's only 2.3 times faster. The authors looked with a profiler and found that on an A100, EdgeTAM fills less than half of the compute units, and the time goes mostly to the CPU launching CUDA kernels and to IO; the model is so small that a big GPU can't make full use of it. That's why the paper keeps stressing on-phone latency, which is what it was designed for.
Image and Click Prompts
Without the memory modules, EdgeTAM also works as an image segmentation model. On SAM's 23 datasets, its average mIoU with 5 clicks is 81.7, higher than the original SAM ViT-H's 81.3, a point the paper goes out of its way to highlight; but with just 1 click it's 55.5, 2.6 below SAM and 6.4 below SAM 2.1.
Video shows something similar. On 17 video datasets with prompts on the first frame only, EdgeTAM's J&F with 1 click is 54.4 against SAM 2.1's 64.7, lower even than the combination of SAM generating the mask and Cutie tracking it. Only with 3 or more clicks, or the ground-truth mask on the first frame, does the gap shrink to 2 to 3 points. The vaguer the prompt, the more the small model loses out.
The authors also acknowledge a typical failure, in which EdgeTAM's tracking granularity keeps following the first few frames. Their example is a fast-moving bird whose feet aren't visible in the early frames; when the feet appear later, EdgeTAM never includes them in the mask.
What Was Open-Sourced
The official repo released inference code and weights, but no training code. Since June 2025, people have asked in the issues for the training code, the sampling ratio of each dataset, and how many GPUs were used for how long; as of November 2026, none of them has had a reply.
The repo later gained a community-contributed CoreML export containing only three models, the image encoder, the prompt encoder and the mask decoder, with neither memory attention nor the Perceiver; its bundled benchmark script also encodes the image first and times only the prompt and decoding. In issue #24, someone inferred from this script that the 16 FPS leaves out image encoding, but the script isn't how the paper measured. The paper measured the converted CoreML models with Xcode's performance report, and that conversion and measurement setup hasn't been released, so the 16 FPS can't currently be reproduced directly from the official code. That issue hasn't been answered either.
Conclusion
The most valuable part of the EdgeTAM paper is that it first broke down SAM 2's latency on a phone and showed that the bottleneck had moved from the encoder to the cross-attention over memory. The remedy is to compress memory before it's stored, keeping half of the tokens spatially arranged for dense prediction, plus feature distillation that covers the memory modules too. The result is 22 times faster on an iPhone and only a point or two below SAM 2 on SA-V.
In practice, its gap to SAM 2 widens noticeably when there are few clicks, so it suits settings where you can give several prompts or already have a mask on the first frame. The paper's speeds were measured on the NPU of an iPhone 15 Pro Max; on a server GPU such as the A100 it's only a little more than twice as fast as SAM 2. On other phones or inference frameworks, you'd do well to measure it again yourself.