Navigating the High Cost of AI Compute: Insights and Advice
Hatched by Glasp
Sep 27, 2023
4 min read
9 views
Navigating the High Cost of AI Compute: Insights and Advice
Introduction:
In the rapidly evolving field of artificial intelligence (AI), one significant factor driving the industry today is the high cost of training and inference. The demand for compute resources far outweighs the supply, with some companies spending more than 80% of their total capital on compute resources alone. This article aims to explore the complexities and costs associated with AI infrastructure, as well as provide actionable advice for startups and developers looking to navigate this challenging landscape.
Understanding the Compute Requirements:
AI infrastructure is expensive because the underlying algorithmic problems are extremely computationally hard. For example, the complexity of generating a single word with GPT-3, a model with approximately 175 billion parameters, is far greater than the complexity of sorting a database table with a million entries. Therefore, it is crucial to choose the smallest model that effectively solves your use case.
To estimate the compute and memory requirements of a transformer model, a rule of thumb is to consider the number of parameters and the number of input and output tokens. For inference, a forward pass takes approximately 2np floating point operations (FLOPs), while training requires approximately 6*p FLOPs per token. Memory requirements can be optimized by using shorter floating point values, such as 16-bit or even 8-bit representations.
Dealing with Compute Constraints:
To accelerate AI compute, specialized chips known as AI accelerator cards, such as GPUs (graphics processing units), are needed. However, there are several challenges to overcome. Firstly, the bottleneck is often not the compute power of the GPU itself but the ability to transfer data from the specialized graphics memory to the tensor cores. Secondly, models with a large number of weights may not fit into the graphics memory of any GPU, requiring techniques like weight streaming and partitioning. Lastly, various optimizations, such as using shorter floating point representations or sparse matrices, can be employed to speed up computation.
Training vs. Inference:
Training a transformer model takes about three times as long per token as doing inference. However, due to the significantly larger training dataset, training can take longer by a factor of 1 billion. Training is also more challenging to parallelize, as updated weights need to be exchanged between nodes. Creating a suitable network setup becomes a primary challenge when training very large models.
Choosing the Right Infrastructure:
When it comes to AI infrastructure, startups and app companies don't necessarily need to build their own from scratch. Hosted model services, such as OpenAI and Hugging Face for language or Replicate for image generation, offer the ability to search rapidly for product-market fit without managing the underlying infrastructure. These services provide developers with meaningful control over model performance through prompt engineering and fine-tuning abstractions via API calls.
However, some startups, particularly those training new foundation models or building vertically integrated AI applications, may require fine-grained control over training and inference. In such cases, managing the infrastructure can become a source of competitive advantage. While the cloud is generally the right place for AI infrastructure, very large-scale operations may benefit from running their own data centers.
Factors to Consider in Infrastructure Selection:
When selecting AI infrastructure, several factors should be taken into account:
-
Compute capacity and availability: The most powerful GPUs, like Nvidia A100s, have been in short supply for the past year. While the top cloud providers may have large purchasing power, startups may find that availability is not guaranteed. Specialized AI clouds and new providers can offer alternatives.
-
Network interconnects: For training, network bandwidth is crucial, especially for large models. Clusters with dedicated fabrics between nodes, like NVLink, are needed to train certain models effectively. Egress traffic fees can also impact the cost of image generation.
-
GPU selection: Picking the right type of GPU for your specific application is essential. Different GPUs perform differently on various workloads, and choosing the right one can significantly reduce costs.
Actionable Advice:
Based on the insights discussed, here are three actionable pieces of advice for navigating the high cost of AI compute:
-
Optimize your models: Choose the smallest model that effectively solves your use case and leverage optimizations like shorter floating point representations or sparse matrices to reduce compute requirements.
-
Consider hosted model services: Startups and app companies can benefit from using hosted model services, allowing them to focus on product-market fit without the need to manage infrastructure. APIs can provide control over model performance.
-
Choose infrastructure wisely: Evaluate your specific requirements, including compute capacity, network interconnects, GPU selection, and latency needs. Consider the cloud for most cases, but at a very large scale, running your own data center may become more cost-effective.
Conclusion:
The high cost of AI compute presents a challenge for startups and developers. However, by understanding the compute requirements, leveraging hosted model services, and choosing infrastructure wisely, it is possible to navigate this landscape effectively. Optimizing models and considering factors like network interconnects and GPU selection can also help reduce costs. While the future may bring advancements in AI infrastructure, it is crucial to stay informed and adapt to changing technologies and requirements.
Sources
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 🐣