Accelerating Transformer with Sparse Attention Accelerators

Kevin Di

Hatched by Kevin Di

Mar 07, 2024

5 min read

0

Accelerating Transformer with Sparse Attention Accelerators

Introduction:

The Transformer model has become a widely used architecture in natural language processing and computer vision tasks. However, the computational demands of the Transformer can be high, especially when dealing with large-scale datasets. In this article, we will explore different approaches to accelerate the Transformer model, specifically focusing on sparse attention accelerators. We will also discuss the advancements in hardware, such as the H100 GPU, that have contributed to improving the speed and efficiency of Transformer models.

Accelerating the Transformer Model:

In a traditional Transformer model, the encoder module consists of three main matrix multiplication operations: a) linear transformation of QKV, b) self-attention calculation, and c) feed-forward neural network (FFN). Sparse attention pruning is a technique that focuses on efficiently and accurately pruning the attention matrices at runtime, which can lead to significant speed improvements in the Transformer model [1] [2]. By using fixed patterns for pruning, researchers have been able to achieve high pruning efficiency without sacrificing prediction accuracy [3] [5].

One notable study in this field is the DOTA (Detect and Omit Weak Attentions for Scalable Transformer Acceleration) presented at ASPLOS 2022 [1]. This research proposes a method to detect and omit weak attentions during runtime, resulting in faster computation and improved efficiency. Another study, presented at ISCA 2022, introduces a gradient-based learned runtime pruning approach to accelerate attention calculations [2]. The MICRO 2022 paper, "Adaptable Butterfly Accelerator for Attention-based NNs via Hardware and Algorithm Co-design," explores the co-design of hardware and algorithms to achieve efficient acceleration of attention-based neural networks [3].

The H100 GPU:

The H100 GPU is a significant advancement in hardware that has greatly contributed to accelerating the Transformer model. Compared to its predecessor, the A100, the H100 GPU offers a 3.5x speed improvement in inference and a 2.3x speed improvement in training. When used in server clusters, the training speed can be further increased by up to 9 times, reducing the time required for complex tasks from a week to just 20 hours. Despite being more expensive than the A100, the H100 GPU's improved efficiency in training large models makes it a highly sought-after solution. With the integration of NVIDIA's latest high-speed connectivity system, the GPU performance per dollar can be increased by up to 4-5 times, making it even more appealing to customers.

Demand and Production:

The demand for H100 GPUs is soaring, with major companies and cloud providers investing heavily in this technology. Microsoft Azure reportedly has at least 50,000 H100 GPUs, while Google and Oracle have around 30,000 and 20,000 GPUs, respectively. Tesla and Amazon also possess a significant number of H100 GPUs, with at least 10,000 each. CoreWeave, a prominent player in the field, has a commitment for 35,000 GPUs, although the actual delivery may be around 10,000. It is estimated that the current demand for H100 GPUs is around 432,000 units, with companies like OpenAI, Inflection, and Meta requiring tens of thousands of units [3].

Looking towards the future, NVIDIA is expected to ship around 500,000 H100 GPUs in 2023. While the current production capacity of TSMC, the manufacturer of H100 GPUs, is still ramping up, it is anticipated that the supply shortage will be alleviated by the end of the year. According to the Financial Times, the shipments of H100 GPUs in 2024 are projected to increase three to fourfold, reaching 1.5-2 million units [4].

Cost Analysis:

The core logic chip of the H100 GPU has a size of 814mm^2 and is manufactured at TSMC's advanced Tainan Fab 18 using the 4N process node, which is equivalent to 5nm+. Each 12-inch wafer can yield 65 core logic chips, considering an 80% yield rate and cutting losses. TSMC's pricing for a 12-inch wafer in 2023 is around $13,400, which translates to approximately $200 per chip.

As for the cost of HBM (High Bandwidth Memory), it is generally undisclosed. However, according to reports, HBM is priced at around five to six times that of existing DRAM products. Considering that GDDR6 VRAM costs approximately $3 per GB, it can be estimated that HBM is priced at around $15 per GB. This means that the cost of HBM in an H100 SXM GPU would be approximately $1500.

The cost of CoWoS (Chip-on-Wafer-on-Substrate) packaging is estimated to contribute around $1000 to the total cost, while SK Hynix accounts for $1500. Taking into account other materials such as PCB, the overall material cost does not exceed $3000.

Conclusion:

Accelerating the Transformer model has become a topic of great interest, with researchers focusing on techniques like sparse attention pruning to improve efficiency. The introduction of the H100 GPU has revolutionized the field by significantly enhancing the speed and performance of Transformer models. As demand continues to rise, it is crucial for hardware manufacturers to meet the market's needs. In conclusion, here are three actionable pieces of advice for those working with the Transformer model:

  1. Explore sparse attention pruning techniques: Investigate and implement methods for efficiently pruning attention matrices at runtime. This can significantly enhance the speed and efficiency of Transformer models.

  2. Stay updated on hardware advancements: Keep track of the latest developments in hardware, such as the H100 GPU. Understanding the capabilities and specifications of new hardware can help optimize the performance of Transformer models.

  3. Optimize model architecture: Continuously explore ways to improve the architecture of Transformer models. This could involve designing more efficient self-attention mechanisms or incorporating hardware-friendly features to enhance acceleration.

By incorporating these strategies, researchers and practitioners can unlock the full potential of the Transformer model and drive advancements in natural language processing and computer vision tasks.

Sources

← Back to Library

Hatch New Ideas with Glasp AI 🐣

Glasp AI allows you to hatch new ideas based on your curated content. Let's curate and create with Glasp AI :)

Start Hatching 🐣