SAM-Lightening: A Lightweight Segment Anything Model with Dilated Flash Attention to Achieve 30 times Acceleration
Not on the map. Why?
Abstract (arXiv)
Segment Anything Model (SAM) has garnered significant attention in segmentation tasks due to their zero-shot generalization ability. However, a broader application of SAMs to real-world practice has been restricted by their low inference speed and high computational memory demands, which mainly stem from the attention mechanism. Existing work concentrated on optimizing the encoder, yet has not adequately addressed the inefficiency of the attention mechanism itself, even when distilled to a smaller model, which thus leaves space for further improvement. In response, we introduce SAM-Lightening, a variant of SAM, that features a re-engineered attention mechanism, termed Dilated Flash Attention. It not only facilitates higher parallelism, enhancing processing efficiency but also retains compatibility with the existing FlashAttention. Correspondingly, we propose a progressive distillation to enable an efficient knowledge transfer from the vanilla SAM without costly training from scratch. Experiments on COCO and LVIS reveal that SAM-Lightening significantly outperforms the state-of-the-art methods in both run-time efficiency and segmentation accuracy. Specifically, it can achieve an inference speed of 7 milliseconds (ms) per image, for images of size 1024*1024 pixels, which is 30.1 times faster than the vanilla SAM and 2.1 times than the state-of-the-art. Moreover, it takes only 244MB memory, which is 3.5% of the vanilla SAM. The code and weights are available at https://anonymous.4open.science/r/SAM-LIGHTENING-BC25/.
Key facts. Cited by 7 papers in the map (data through 7 Oct 2026). Builds on 16 of its 21 references that are in the map. First posted on arXiv 14 Mar 2024.
Builds on
16 of 21 references.
References · 16
- 2014Microsoft COCO: Common Objects in Contextcited by 17,498
- 2015Distilling the Knowledge in a Neural Networkcited by 10,076
- 2023Segment Anythingcited by 8,158
- 2022FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awarenesscited by 3,611
- 2023FlashAttention-2: Faster Attention with Better Parallelism and Work Partitioningcited by 2,551
- 2019MMDetection: Open MMLab Detection Toolbox and Benchmarkcited by 1,379
- 2019LVIS: A Dataset for Large Vocabulary Instance Segmentationcited by 1,215
- 2023Faster Segment Anything: Towards Lightweight SAM for Mobile Applicationscited by 345
- 2023Fast Segment Anythingcited by 286
- 2022TinyViT: Fast Pretraining Distillation for Small Vision Transformerscited by 232
- 2023Track Anything: Segment Anything Meets Videoscited by 230
- 2023SegGPT: Segmenting Everything In Contextcited by 193
4 more
- 2023EfficientSAM: Leveraged Masked Image Pretraining for Efficient Segment Anythingcited by 187
- 2023SAM-Med2Dcited by 123
- 2023Anything-3D: Towards Single-view Anything Reconstruction in the Wildcited by 91
- 2021Show, Attend and Distill:Knowledge Distillation via Attention-based Feature Matchingcited by 76
Built on by
Citing papers per year: 2024: 3; 2025: 4.
7 papers.
- 2024On Efficient Variants of Segment Anything Model: A Surveycited by 16
- 2024De-LightSAM: Modality-Decoupled Lightweight SAM for Generalizable Medical Segmentationcited by 11
- 2025Vision Foundation Models in Medical Image Analysis: Advances and Challengescited by 9
- 2024Swiss Army Knife: Synergizing Biases in Knowledge from Vision Foundation Models for Multi-Task Learningcited by 6
- 2025Exploring Few-Shot Defect Segmentation in General Industrial Scenarios with Metric Learning and Vision Foundation Modelscited by 4
- 2025Hierarchical Self-Prompting SAM: A Prompt-Free Medical Image Segmentation Frameworkcited by 4
- 2025Cues3D: Unleashing the Power of Sole NeRF for Consistent and Unique Instances in Open-Vocabulary 3D Panoptic Segmentationcited by 1
- 2025Hierarchical Self-Prompting SAM: A Prompt-Free Medical Image Segmentation Framework3 Jun 2025
- 2025Cues3D: Unleashing the Power of Sole NeRF for Consistent and Unique Instances in Open-Vocabulary 3D Panoptic Segmentation1 May 2025
- 2025Vision Foundation Models in Medical Image Analysis: Advances and Challenges20 Feb 2025
- 2025Exploring Few-Shot Defect Segmentation in General Industrial Scenarios with Metric Learning and Vision Foundation Models3 Feb 2025
- 2024Swiss Army Knife: Synergizing Biases in Knowledge from Vision Foundation Models for Multi-Task Learning18 Oct 2024
- 2024On Efficient Variants of Segment Anything Model: A Survey7 Oct 2024
- 2024De-LightSAM: Modality-Decoupled Lightweight SAM for Generalizable Medical Segmentation19 Jul 2024