Editor’s introduction
The study assessed large language models on multiple AI accelerators and GPUs using a transformer micro-benchmark, the GPT-2 XL model, and a science-driven application called GenSLM. Performance was measured across key factors including sequence length, model size, sparsity, and gradient accumulation steps. However, the evaluation is limited to specific model types and does not include broader application domains or alternative model architectures.
Introduction
To address these requirements, AI accelerators, designed on non-traditional architectures, such as dataflow, have emerged. These accelerators are custom-built to efficiently support AI workloads with their powerful hardware compute engines and novel software optimizations. They are proven to effectively train several AI models, with a special focus on LLMs. With their unique system characteristics, these AI accelerators are empowered to tackle the challenges posed by LLMs. Besides their capability in training, these accelerators are able to run some of the largest GPT models, besides providing a suite of pre-trained GPT models. These models demonstrate the versatility and scalability of AI accelerators. With the increase in the size and complexity of LLMs, innovative training techniques have become critical, such as sparsity, to further enhance the training of LLMs with billions of parameters.
We present an overview of LLMs and the various AI accelerators in Section II, followed by details of the evaluated models, namely the transformer block micro-benchmark, GPT-2 XL, and GenSLM application in Section III. We describe in Section IV the implementation of the LLMs on different AI accelerators. We present experimental results in Section V, followed by conclusions in Section VI.
Overview of Large Language Models and AI Accelerators
Large language models are a type of artificial intelligence system that use deep learning algorithms to process and generate natural language text. These models have become increasingly popular in recent years due to their ability to perform a wide range of language-related tasks, such as machine translation, text summarization, and question answering. The development of large language models has been driven by advances in deep learning techniques, particularly in the area of transformer models. These models use self-attention mechanisms to process text input, allowing them to capture complex patterns and relationships within language data. They are also pretrained on large datasets using unsupervised learning techniques, such as masked language modeling and next-sentence prediction, which help them to learn a broad range of language features and structures. Fine-tuning on specific tasks further improves their performance and adaptability.
One of the most well-known LLMs is the GPT (Generative Pretrained Transformer) series, which was developed by OpenAI and is used to answer questions, translate languages, and generate text. These tasks are realized by generative pre-training of a language model on a diverse data corpus of unlabeled text, followed by discriminative fine-tuning on a specific task. Task-aware input transformations during fine-tuning help achieve effective transfer with minimal changes to the model architecture. Owing to the neural architectural differences, GPT models can broadly be classified into GPT GPT-2, GPT-3, and more recently GPT-4.
AI accelerators comprised of GPU-based systems and novel non-traditional AI hardware, such as dataflow architectures, have proven to boost the efficiency of diverse AI models. Below we describe the accelerators used in this study, while the configurations are listed in Table I.
Nvidia A100: The A100 GPU consists of 6912 CUDA cores and 432 Tensor cores to accelerate parallel workloads. On a single DGX node, there are 4 A100 GPUs, interconnected with NVLink. We use a forked implementation of Microsoft’s Megatron-DeepSpeed66 6 Which is itself a fork of NVIDIA’s original Megatron-LM framework for our evaluations. In doing so, we can take full advantage of DeepSpeed’s various optimizations and convenient features such as ZeRO offloading and automatic metric tracking (with communication + FLOP profiling). All experiments were conducted on the Polaris supercomputer at the Argonne Leadership Computing Facility (ALCF) with 4 A100 GPUs and 40 GB memory per node.
Evaluation
Metrics: Evaluating the performance of large language models goes beyond traditional metrics and includes considerations of computational efficiency and hardware utilization. As these models have grown in size and complexity, it is essential to assess their ability to process and generate text efficiently, especially considering the computational resources required for training and inference. Throughput is a key performance metric that measures the rate at which a large language model can process a given amount of input data. It is often quantified in terms of tokens or sentences processed per second. Higher throughput values indicate better efficiency and the ability to handle large-scale language processing tasks effectively. In this work, we present the throughput in the number of tokens per second across the evaluated systems.
Hardware utilization is another important metric in evaluating large language models, as it assesses how effectively the computational resources are utilized during model training and inference. It involves multiple design choices, such as model parallelism, memory management, and efficient data processing techniques. Profiling the models to extract hardware utilization across the evaluated systems is ongoing and will be included in the final version.
Transformer micro-benchmark
The evaluation of the transformer micro-benchmark involved a meticulous implementation process aimed at assessing the computational efficiency and performance characteristics of this kernel on different AI accelerators. The transformer micro-benchmark is designed to simulate the core operation in the transformer models, which is widely utilized in various natural language processing tasks. The transformer micro-benchmark utilizes a layer in a standardized GPT-2 XL model with an input sequence of 1024, ensuring consistent and comparable results across different platforms. The implementation is carried out using the same deep learning framework, PyTorch, tailored to the unique capabilities of each platform. The workload is used to exploit parallelism and hardware-specific optimizations and to achieve optimal throughput and computational speed. Careful attention is paid to factors such as batch size to avoid bottlenecks and fully utilize the available hardware resources.
We use batch sizes of 8, 16, 32, and 64 for different configurations. Performance metrics, such as TFLOPS, are collected to quantify the capabilities of each hardware platform in handling the demanding computations required by the transformer models. This evaluation provides valuable insights into the strengths and weaknesses of different hardware when dealing with transformer-based workloads.
GPT-2 XL pre-training
Nvidia A100: We ran the models with varying micro-batch sizes, sequence lengths, and tensor-parallel degree on different node counts, up to 64 A100 GPUs. These are implemented with Megatron-DeepSpeed using ZeRO Stage 1 with fp16 precision. In these experiments, flash attention flash-attn was enabled, which is known to relieve memory pressure and generally improve throughput. BPE-based tokenizer with a vocabulary size of was used. The sequence lengths up to 2k were used. Experiments with Nvidia’s NeMo framework for generative AI are part of planned future work.
Habana Gaudi2: We ran the GPT-2 XL model implemented in PyTorch with a sequence length of 1024 with a local batch size of 32 on each HPU device. The training of the GPT-2 XL model on Habana Gaudi2 represents a powerful and cutting-edge combination of software and hardware capabilities. The data format used in training is BF16. The training samples are generated using a BPE tokenizer.
AMD MI250: On the AMD MI250 system, we evaluated the performance of GPT-2 with absolute position embeddings trained with a causal language modeling (CLM) objective on the OWT dataset for up to 8 GPUs. We leverage GPT-2 tokenizer based on byte-level Byte-Pair-Encoding. We used the reference PyTorch 2.0 implementation from Hugging Face to realize this. The performance is evaluated for sequence lengths of 1024 on batch sizes of 16 and 32 per GPU as well as GAS values of 1 and 4.
GenSLM
We implemented the GenSLM science application on Nvidia A100, SambaNova SN30, and Cerebras CS-2. The model is implemented using a PyTorch framework on all three systems. It uses the genomic sequence dataset and tokenizes it using a codon-level tokenizer that splits genomes into blocks of 3 nucleic acids. As the GenSLM application includes models with different number of model parameters ranging from 25M to 25B, we used two different model parameter sizes in this exercise.
The SN30 implementation for GenSLM is based on the GPT-2 13B parameter model that uses a context length of 1024 with 44 layers, 64 attention heads, an embedding size of 4992, and a vocabulary size of 71. This GPT-2 13B parameter model with a batch size of 32 can be mapped within 4 tiles or equivalently half an RDU. The model used on Cerebras is a GPT-3 XL, a 1.5B parameter model that has 24 hidden layers and 16 attention heads. The model uses a vocabulary size of 70 and an embedding size of 2048. The model is trained for the genomic sequences of sequence length 10240 and a local size of 27. The other model parameters are similar to the GPT-2 XL implementation details as listed above. The GPT3-XL model is scaled across the two CS-2s to provide a global batch size of 54. On Nvidia A100, we use an identical GPT-2 13B model consisting of 40 layers of hidden dimension 5120 and 40 attention heads.
Transformer micro-benchmark
It is observed that NVIDIA A100 GPU demonstrates the baseline throughput, capitalizing on its advanced tensor cores and parallel processing capabilities. The throughput with FP16 and BF16 precision is 4̃x higher than FP32. A100 exhibits 2x theoretical performance for single precision compared to half precision. Additional performance improvement could arise due to a reduction in memory access using half-precision and this transformer is memory intensive kernel. SambaNova SN30, with its reconfigurable Dataflow architecture, exhibits impressive performance with BF16 precision, showcasing its potential for handling complex transformer workloads using the half-precision format. Due to the pipelined/fusion execution on RDUs, there is naturally a warmup and cooldown phase as in any pipeline. More samples in a batch lead to longer steady-state behavior and higher effective throughput. Graphcore Bow IPU, powered by IPUs, demonstrates exceptional performance with FP32 and FP16 precision, highlighting its suitability for NLP tasks. Meanwhile, Habana Gaudi2 exhibits robust performance with all three formats, emphasizing its prowess in efficiently executing various transformer computations. In the backward pass, we think it’s due to higher utilization of hardware, and that brings higher throughput. AMD MI250, capitalizing on its dedicated Tensor Processing Core array, exhibited remarkable acceleration and consistent throughput in the backward pass.
Scaling study
The speedups across the number of devices on each evaluated system along with the scaling efficiencies are listed in Table II. A striking observation from this study showed that the model trained on 16 SN30 RDUs, 2 CS-2s, and 16 IPUs outperformed the runs on 64 A100s.99 9 We aim to arrive at a fair comparison across the systems to the greatest possible extent. Additionally, Gaudi2 reported the highest scaling efficiency of 104%. This scaling behavior is due to the optimizations from the Synapse software stack that help minimize the overhead in the sharding of the model and data across multiple HPUS. This is followed by Bow Pod64 which attains scaling efficiency of 100%. The superlinear scaling is enabled by the use of the replicated tensor sharding – as the scale is increased, the pressure on DRAM I/O is reduced for weight loading and IPU-Links are leveraged to exchange shards of weight tensors. Additionally, Bow-IPU has 900 MB of SRAM and currently, it does not use DRAM for running this model hence, we would not be able to fit it into a single IPU due to the SRAM size limitation. We use 4 IPUs and run pipeline-parallel, with model layers distributed across the IPUs. Cerebras CS-2’s scales at 95.7% efficiency, which demonstrates the efficiency of the weight streaming technique with dedicated nodes, MemoryX for saving all model weights, and SwarmX to stream these weights to the compute engine. It is interesting to note that the SN30 and MI250 have scaling efficiencies around 80% which is higher than the A100 number at 75.8%.
The results show that all the evaluated accelerators demonstrate increased throughput as the models are run across an increased number of devices. Though computationally expensive, models with a larger number of parameters can be trained better with more devices. As model sizes scale up in order of trillion parameters, it may not be feasible to run them on increased device count, thereby stressing the need to implement new approaches to fit larger models on fewer devices with the goal of improving the time to train a model given a computational budget.1010 10 Note that the A100 and IPU results begin at 4 devices, and CS-2 stops after 2.
Impact of sequence length
The need for scaling the sequence length in the large language model tasks has been highlighted in recent works with scaling to more than 1B tokens. Large context lengths are extremely important in synthesizing genomic data as seen in the GenSLM science applications. Hence we study the impact of scaling the sequence lengths for the GPT-2 model and present the results on Nvidia A100, SambaNova SN30, and Cerebras CS-2 and exclude others either due to limited support or a work in progress. For this study, we use the GPT-2 XL 1.5B parameter model on both A100 and Cerebras system and both the Cerebras CS-2 and SambaNova SN30 use the GPT2-13B parameter model. As we can see from Table III, Nvidia A100 needs a minimum of 4 devices to fit a dataset of smaller sequence length. On the other hand, SambaNova SN30 and Cerebras CS-2, owing to their large local memory and compute architecture, can fit models with longer sequence lengths on a single compute device. SambaNova SN30 can fit a 13B parameter model with varying sizes of sequence lengths ranging from 1K to 64K, all on a single RDU. The results are presented when we run 8 instances of the model on a node in data parallel mode. We see a predictable decline in the throughput with an increase in the sequence length. Moreover, from a sequence length of 32k, the implementation uses segmented softmax implementation. We see a similar trend of sequence lengths impacting the throughput when the sequence length increases from 1K to 8K for the CS-2 system for a GPT-2 XL model.
Conclusions
In this paper, we performed an extensive and comprehensive evaluation of generative AI models on non-traditional hardware with a focus on GPT models, an in-depth analysis of a core transformer block, and a science application (GenSLM). Additionally, we explored the scaling behavior of the GPT-2 model to gain insights into its performance characteristics. One of our important observations is the memory limitations inherent to the hardware that restrict the feasibility of the size of models that can fit on a single device. It further requires a distributed implementation, such as data parallel, with an increased number of devices. A near-linear scaling is also observed with an increased number of devices. Furthermore, the adoption of optimizations, such as weight sparsity, helps effectively reduce the communication overhead in distributed implementations.
We plan to continue this evaluation with a focus on longer sequence lengths and benchmark representative models for the emerging generative AI for science applications. We also would like to extend this comprehensive benchmarking study with larger models such as 175B parameter models and with generative models with distinct architectures such as Llama. It has been observed that to facilitate effective training of significantly larger models, such as trillion parameters in AI for science applications, leveraging non-traditional AI hardware would be pivotal. Optimizing other metrics besides model throughput, such as power consumption and I/O in training, particularly with increased computation and the utilization of larger data sets, will also be essential.


