Sequence Length Scaling in Vision Transformers for Scientific Images on Frontier
Aristeidis Tsaris, Chengming Zhang, Xiao Wang, Junqi Yin, Siyan Liu, Moetasim Ashfaq, Ming Fan, Jong Youl Choi, Mohamed Wahib, Dan Lu, Prasanna Balaprakash, Feiyi Wang
TL;DR
This paper tackles scaling Vision Transformers to ultra-long sequences for high-resolution scientific imagery on Frontier, addressing memory and communication bottlenecks. It introduces distributed sequence parallelism using DeepSpeed-Ulysses and Long Sequence Segmentation (LSS), augmented by pipeline and tensor parallelism and Flash Attention v2, to reach up to 1M tokens for models up to 10B parameters. The authors demonstrate a 94% batch scaling efficiency on 2,048 AMD MI250X GPUs and show up to 20% improvements in ERA5 temperature predictions when using longer sequences, including training a transformer with full attention at 188K sequence length. They provide empirical baselines, performance bottleneck analyses, and practical guidelines for deploying ultra-long ViTs on scientific data, highlighting the importance of sequence length alongside model size. The work paves the way for robust, scalable foundation models in Earth system science and other data-intensive domains.
Abstract
Vision Transformers (ViTs) are pivotal for foundational models in scientific imagery, including Earth science applications, due to their capability to process large sequence lengths. While transformers for text has inspired scaling sequence lengths in ViTs, yet adapting these for ViTs introduces unique challenges. We develop distributed sequence parallelism for ViTs, enabling them to handle up to 1M tokens. Our approach, leveraging DeepSpeed-Ulysses and Long-Sequence-Segmentation with model sharding, is the first to apply sequence parallelism in ViT training, achieving a 94% batch scaling efficiency on 2,048 AMD-MI250X GPUs. Evaluating sequence parallelism in ViTs, particularly in models up to 10B parameters, highlighted substantial bottlenecks. We countered these with hybrid sequence, pipeline, tensor parallelism, and flash attention strategies, to scale beyond single GPU memory limits. Our method significantly enhances climate modeling accuracy by 20% in temperature predictions, marking the first training of a transformer model on a full-attention matrix over 188K sequence length.
