It is Over, A Sneak Peek into ChatGPT-4’s Killer Details

Chan Kulatunga
TecWinds
Published in
5 min readJul 12, 2023

The world of artificial intelligence has been abuzz with excitement as details about GPT-4, the latest model from OpenAI, have been leaked. With over 1.8 trillion parameters spread across 120 layers, GPT-4 is more than ten times the size of its predecessor, GPT-3. In this article, we will delve into the specifications and features of GPT-4, providing you with an exclusive insider’s look into the future of natural language processing.

Table of Contents

1. Introduction: The Dawn of GPT-4
2. Parameters Count: Unraveling the Immense Scale
3. Mixture of Experts: A Cost-Effective Approach
4. MoE Routing: Simplifying Expert Selection
5. Inference: Optimizing Resource Utilization
6. Dataset: Training GPT-4
7. GPT-4 32K: Pre-training and Fine-tuning
8. Batch Size: Scaling Training Efficiency
9. Parallelism Strategies: Maximizing GPU Utilization
10. Training Cost: The Price of Innovation
11. Mixture of Expert Tradeoffs: Striking the Right Balance
12. GPT-4 Inference Cost: A Costlier Endeavor
13. Multi-Query Attention: Enhancing Efficiency
14. Continuous Batching: Balancing Latency and Costs
15. Vision Multi-Modal: Integrating Vision and Text
16. Speculative Decoding: Improving Inference Speed
17. Inference Architecture: A Cluster of GPUs
18. The Quest for Quality Data: Dataset Mixture

1. Introduction: The Dawn of GPT-4

The arrival of GPT-4 marks a significant milestone in the field of natural language processing. As the successor to GPT-3, this advanced model promises to push the boundaries of what AI systems can achieve. Let’s dive deeper into the specifics and uncover the secrets behind its impressive capabilities.

2. Parameters Count: Unraveling the Immense Scale

GPT-4 boasts an astounding 1.8 trillion parameters, a monumental leap from GPT-3. These parameters form the building blocks of the model, allowing it to process and understand vast amounts of text data. With such a massive parameter count, GPT-4 possesses a remarkable capacity to capture intricate patterns and nuances within language.

3. Mixture of Experts: A Cost-Effective Approach

To manage the enormous scale of GPT-4 while keeping costs reasonable, OpenAI has implemented a mixture of experts (MoE) model. By utilizing 16 experts, each with approximately 111 billion parameters for the multi-layer perceptron (MLP), OpenAI strikes a balance between performance and efficiency. This MoE approach enables GPT-4 to deliver exceptional results without compromising on resource utilization.

4. MoE Routing: Simplifying Expert Selection

While other models often employ complex routing algorithms to determine which experts handle specific tokens, GPT-4’s MoE routing algorithm takes a simpler approach. With approximately 55 billion shared parameters for attention, GPT-4 efficiently distributes tokens among the 16 experts. This streamlined routing process ensures optimal performance and smooth operation.

5. Inference: Optimizing Resource Utilization

Inference, the process of generating tokens, requires fewer resources compared to the training phase. GPT-4 leverages approximately 280 billion parameters and 560 TFLOPs for each forward pass during inference. This efficiency contrasts with the 1.8 trillion parameters and 3,700 TFLOPs needed for a purely dense model. By carefully balancing computational requirements, GPT-4 delivers impressive performance in real-world scenarios.

6. Dataset: Training GPT-4

GPT-4 undergoes training on a vast dataset comprising around 13 trillion tokens. These tokens encompass both text-based and code-based data, with two epochs dedicated to the former and four epochs to the latter. OpenAI sources training data from various platforms, including CommonCrawl, RefinedWeb, ScaleAI, and internal fine-tuning data. This extensive dataset ensures GPT-4’s exposure to a wide range of information, enhancing its ability to understand diverse contexts.

7. GPT-4 32K: Pre-training and Fine-tuning

During the pre-training phase, GPT-4 focuses on an 8k context length (seqlen). Following this initial phase, GPT-4 undergoes fine-tuning based on the 8k pre-training. The resulting 32k seqlen version of GPT-4 exhibits enhanced performance and refined capabilities.

8. Batch Size: Scaling Training Efficiency

OpenAI gradually increases the batch size over multiple days during training. By the end of the process, a staggering batch size of 60 million tokens is utilized. While this equates to a batch size of 7.5 million tokens per expert, not every expert receives all tokens. The selection of an appropriate batch size is crucial for optimizing the efficiency and effectiveness of the training process.9. Parallelism Strategies: Maximizing GPU Utilization

To leverage the power of their A100 GPUs, OpenAI implements eight-way tensor parallelism, reaching the limit imposed by NVLink. In addition, 15-way pipeline parallelism further enhances the processing capabilities. By employing these parallelism strategies, OpenAI maximizes GPU utilization, achieving higher efficiency and faster results.

10. Training Cost: The Price of Innovation

The training cost for GPT-4 is substantial, with OpenAI estimating approximately $63 million for this particular run alone. With a training FLOPS of approximately 2.15e25 and the use of around 25,000 A100 GPUs for 90 to 100 days, this colossal undertaking reflects the dedication and resources required to develop state-of-the-art AI models.

11. Mixture of Expert Tradeoffs: Striking the Right Balance

While research suggests that using 64 to 128 experts can achieve better loss, OpenAI consciously chose to employ 16 experts in GPT-4. This decision stems from the challenges associated with generalization and convergence when dealing with a higher number of experts. By opting for a more conservative approach, OpenAI ensures a stable and reliable performance across a wide range of tasks.

12. GPT-4 Inference Cost: A Costlier Endeavor

GPT-4’s inference cost is approximately three times that of the 175 billion parameter model, Davinci. The increased cost primarily stems from the larger clusters required for GPT-4 and the consequent lower utilization achieved. It’s worth noting that these cost estimates assume high utilization and significant batch sizes, highlighting the need for careful resource management.

13. Multi-Query Attention: Enhancing Efficiency

Similar to other models in the field, GPT-4 utilizes Multi-Query Attention (MQA). By implementing MQA, GPT-4 only requires one head, reducing memory capacity for the key-value (KV) cache. However, due to its larger size, the 32k seqlen version of GPT-4 cannot run on 40GB A100

From a Pastebin Share.

--

--