Skip to main content
QUICK REVIEW

[Paper Review] UFO-ViT: High Performance Linear Vision Transformer without Softmax

Jeong-geun Song|arXiv (Cornell University)|Sep 29, 2021
CCD and CMOS Imaging SensorsEngineering46 references10 citations
TL;DR

UFO-ViT proposes a linear-complexity vision transformer that replaces the softmax nonlinearity in self-attention with an L2-normalization-based unit force operation, achieving state-of-the-art performance on image classification and dense prediction tasks while reducing computational cost and memory usage. The method maintains high accuracy across model sizes with O(N) complexity, outperforming existing transformers and CNNs on ImageNet1k and COCO benchmarks.

ABSTRACT

Vision transformers have become one of the most important models for computer vision tasks. Although they outperform prior works, they require heavy computational resources on a scale that is quadratic to $N$. This is a major drawback of the traditional self-attention (SA) algorithm. Here, we propose the Unit Force Operated Vision Transformer (UFO-ViT), a novel SA mechanism that has linear complexity. The main approach of this work is to eliminate nonlinearity from the original SA. We factorize the matrix multiplication of the SA mechanism without complicated linear approximation. By modifying only a few lines of code from the original SA, the proposed models outperform most transformer-based models on image classification and dense prediction tasks on most capacity regimes.

Motivation & Objective

  • To address the O(N²) computational complexity of standard self-attention in vision transformers, which limits scalability on high-resolution inputs.
  • To eliminate the softmax nonlinearity in self-attention without performance degradation, enabling linear-time attention mechanisms.
  • To develop a model that maintains high accuracy across diverse vision tasks—especially image classification and dense prediction—while significantly reducing FLOPs and memory usage.
  • To enable efficient deployment on high-resolution inputs, particularly for dense prediction tasks like object detection and semantic segmentation, where resolution varies.

Proposed method

  • Replace the softmax operation in self-attention with L2 normalization to eliminate the quadratic complexity of matrix exponentiation.
  • Apply the associative law of matrix multiplication to factorize the attention computation into O(N) operations by restructuring QK^T into unit vectors.
  • Introduce XNorm, a normalization scheme that projects queries and keys onto a unit hypersphere, stabilizing training and removing dependency on initialization.
  • Use affine scaling modules (inspired by ResMLP) to adjust residual connections, maintaining stability across model depths.
  • Design the architecture to be resolution-agnostic: model weights do not depend on input resolution, enabling consistent performance across varying input sizes.
  • Implement the method with minimal code changes—only a few lines modified from standard ViT, ensuring backward compatibility and ease of integration.

Experimental results

Research questions

  • RQ1Can a vision transformer achieve linear complexity in self-attention without sacrificing performance on image classification tasks?
  • RQ2Does replacing softmax with L2 normalization in self-attention preserve or improve accuracy compared to standard transformers and prior linear approximations?
  • RQ3Can the proposed method scale efficiently to high-resolution inputs, especially in dense prediction tasks like object detection and instance segmentation?
  • RQ4How does the model's memory consumption and inference speed compare to existing transformers and CNNs across varying input resolutions and model capacities?

Key findings

  • UFO-ViT-S achieves 44.6 mAP on COCO instance segmentation with only 39.7M parameters, outperforming ResNet50 and PVT-Small while using fewer parameters.
  • UFO-ViT-M achieves 46.0 mAP on COCO with 56.4M parameters, surpassing Swin-T and XCiT-S12/16 in mAP while using less than half the FLOPs of Swin-S.
  • The model maintains linear memory growth with input resolution: GPU memory usage scales linearly with the number of tokens, unlike quadratic growth in standard transformers.
  • UFO-ViT supports up to 4× larger batch sizes on a single V100 GPU than DeiT and Swin Transformers, indicating superior memory efficiency.
  • Inference throughput is significantly higher than DeiT and comparable or better than Swin Transformers, especially at higher resolutions.
  • UFO-ViT-B performs slightly worse than UFO-ViT-M on bounding box detection but achieves better performance on small object detection and instance segmentation, indicating better feature representation for fine-grained tasks.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.