[논문 리뷰] BiFormer: Vision Transformer with Bi-Level Routing Attention
BiFormer는 브레레벨 라우팅 어텐션(BRA)을 도입한 동적, 쿼리 인식 희소 어텐션 메커니즘으로, 토큰-레벨 어텐션을 수행하기 전에 영역 수준의 관련성을 필터링하여 정확도와 효율성을 개선하며, 이미지넷에서 강한 결과를 얻고 낸 FLOPs가 낮으며 탐지 및 분할에 잘 이전된다.
As the core building block of vision transformers, attention is a powerful tool to capture long-range dependency. However, such power comes at a cost: it incurs a huge computation burden and heavy memory footprint as pairwise token interaction across all spatial locations is computed. A series of works attempt to alleviate this problem by introducing handcrafted and content-agnostic sparsity into attention, such as restricting the attention operation to be inside local windows, axial stripes, or dilated windows. In contrast to these approaches, we propose a novel dynamic sparse attention via bi-level routing to enable a more flexible allocation of computations with content awareness. Specifically, for a query, irrelevant key-value pairs are first filtered out at a coarse region level, and then fine-grained token-to-token attention is applied in the union of remaining candidate regions (\ie, routed regions). We provide a simple yet effective implementation of the proposed bi-level routing attention, which utilizes the sparsity to save both computation and memory while involving only GPU-friendly dense matrix multiplications. Built with the proposed bi-level routing attention, a new general vision transformer, named BiFormer, is then presented. As BiFormer attends to a small subset of relevant tokens in a extbf{query adaptive} manner without distraction from other irrelevant ones, it enjoys both good performance and high computational efficiency, especially in dense prediction tasks. Empirical results across several computer vision tasks such as image classification, object detection, and semantic segmentation verify the effectiveness of our design. Code is available at \url{https://github.com/rayleizhu/BiFormer}.
연구 동기 및 목표
- 비전 트랜스포머에서 정확도를 희생하지 않고도 효율적인, 장거리 모델링의 필요성을 제시한다.
- 관련 영역과 토큰에 선택적으로 주의를 기울이도록 하는 동적, 쿼리 인식 희소성 메커니즘(BRA)을 제안한다.
- 이미지 분류, 탐지, 분할을 위해 BRA로 구축된 백본 BiFormer를 개발한다.
- BRA가 적절한 영역 분할 하에서 vanilla 어텐션보다 낮은 복잡도를 달성한다는 복잡도 분석을 제공한다.
- 비교 가능한 FLOPs 하에서 ImageNet-1K, COCO, ADE20K에서 최첨단 또는 경쟁력 있는 성능을 시연한다.
제안 방법
- 먼저 영역 수준 친화 그래프를 구성하고 각 영역당 상위 k 연결을 유지하는 Bi-Level Routing Attention(BRA)을 도입한다.
- 영역 수준 쿼리/키를 영역별 토큰 표현의 평균으로 계산한다.
- 라우팅된 영역에서 해당 키/값 토큰을 모으고 이 희소하지만 모아진 세트에서 토큰-토큰 어텐션을 수행한다.
- 깊이별 컨볼루션을 통해 로컬 컨텍스트 강화 항을 추가한다.
실험 결과
연구 질문
- RQ1영역 수준 라우팅과 토큰 수준 어텐션을 결합하면 vanilla 또는 정적 희소 어텐션보다 더 적은 계산으로 동등하거나 더 나은 정확도를 달성할 수 있는가?
- RQ2BRA가 입력 해상도와 영역 분할에 따라 어떻게 확장되며, 결과 FLOPs/정확도 트레이드오프는 무엇인가?
- RQ3BiFormer는 비슷한 계산 예산에서 분류, 탐지, 분할 작업의 성능을 향상시키는가?
- RQ4다양한 쿼리에 대해 BRA가 의미론적으로 관련된 영역에 주의를 기울이는 것을 보여주는 정성적 증거는 무엇인가?
주요 결과
- 적절한 영역 분할로 BRA는 O((HW)^(4/3)) 복잡도를 달성하여 vanilla 어텐션에 비해 계산을 감소시킨다.
- BRA를 적용한 BiFormer가 ImageNet-1K에서 상위 1등으로 81.4%를 달성하며 ~2.2 GFLOPs(BiFormer-T), 83.8%로 ~4.5 GFLOPs(BiFormer-S)에서 여러 벤치마크를 같은 예산에서 능가한다.
- COCO에서 BiFormer-S/BIFormer-B는 경쟁력 있는 mAP를 제공하고 RetinaNet/Mask R-CNN 파이프라인에서 특히 작은 객체 성능이 더 우수하다.
- ADE20K에서 BiFormer-S/B는 Semantic FPN 및 UperNet 하에서 여러 희소 어텐션 기반 베이스라인을 상회하며, mIoU가 향상된다.
- 변형 실험에서 BRA가 분류 및 분할 작업에서 다른 희소 어텐션 메커니즘보다 우수하다는 것을 확인한다.
이 논문 읽기
누빈트 뷰어에서 원문을 열고, 읽으면서 궁금한 곳을 바로 물어보세요.
누빈트에서 이 논문 읽기이 리뷰는 AI가 논문 원문을 바탕으로 만들었습니다. 인용하기 전에 원문을 확인해 주세요.