How to Choose a GPU Cloud for AI Inference
In this article
Choosing a GPU cloud for AI inference means picking a service that balances cost, latency, throughput, and ease of use for your specific model and traffic patterns. This guide walks through the key technical and business factors, from hardware selection to pricing models, so you can make an informed decision without overpaying or underprovisioning.
What You'll Need
- A clear idea of your model's inference requirements: model size (parameters), input/output sizes, and expected requests per second.
- Basic familiarity with cloud concepts (instances, regions, APIs) and containerization (Docker) if you plan to deploy custom models.
- A budget range and an understanding of whether you need reserved capacity or can tolerate spot/preemptible instances.
- Your model's framework (PyTorch, TensorFlow, ONNX, etc.) and any specific optimizations (TensorRT, vLLM, TGI) you plan to use.
Step-by-Step
- Define your inference workload profile. Estimate peak and average requests per second, latency targets (p95), and batch size. For LLMs, note the context window length and generation length, as these heavily impact memory and compute. For vision models, note image resolution and batch size.
- Determine your GPU memory and compute needs. For LLMs, a rule of thumb is that model weights in FP16 require about 2 GB per billion parameters, plus KV cache and overhead. For example, a 7B model needs roughly 14–16 GB VRAM. For vision or embedding models, check the model card or benchmark on a local GPU first. Choose GPUs like A10, L4, A100, H100, or newer generations based on that.
- Compare GPU instance types across providers. Major clouds (AWS, GCP, Azure) offer dedicated GPU instances; specialized providers (Lambda, RunPod, Vast.ai, CoreWeave) often offer cheaper rates or more flexible configurations. Use the provider's calculator or spot pricing pages to compare per-hour costs for the GPU you need.
- Check latency and network performance. If your inference needs to be fast (under 100 ms), choose a region close to your users and ensure the provider offers low-latency networking (e.g., InfiniBand for multi-GPU, but for single GPU it's less critical). Run a simple ping test to a test endpoint if possible.
- Evaluate scaling and autoscaling features. Look for managed inference services (like SageMaker, Vertex AI, or provider-specific solutions) that can auto-scale based on traffic. If using raw instances, check if the provider supports Kubernetes or has an autoscaler integration.
- Review pricing models carefully. On-demand is flexible but expensive; reserved instances (1-year or 3-year) offer 30–60% discounts; spot/preemptible can be 60–90% cheaper but may be interrupted. For inference, you need consistent availability, so spot is only viable if you have a fallback or can tolerate occasional failures.
- Test with your actual model. Most providers offer free credits or trial hours. Deploy your model on the smallest suitable instance, run a load test (using tools like Locust or hey) to measure latency and throughput, and compare against your targets. Test with realistic input sizes and concurrency.
- Check for inference-specific optimizations. Some providers offer pre-built containers for popular frameworks (vLLM, TensorRT-LLM, TGI) that can drastically improve throughput. Verify that the provider supports your preferred optimization stack and that the GPU drivers are up to date.
- Review security and compliance. If your data is sensitive, ensure the provider offers encryption at rest and in transit, VPC support, and compliance certifications (SOC 2, HIPAA, etc.) if needed. Check data residency options if you have regulatory constraints.
- Consider total cost of ownership. Include egress fees, storage costs (for model artifacts), and any additional charges for monitoring or logging. A provider with a lower per-hour rate might have higher egress costs, so calculate total monthly cost for your expected traffic.
Common Mistakes
- Overprovisioning based on peak load. Buying a huge GPU for occasional spikes wastes money. Instead, use autoscaling or a mix of on-demand and spot for bursts.
- Ignoring memory bandwidth. For LLM inference, memory bandwidth is often the bottleneck, not raw compute. A GPU with more VRAM but lower bandwidth may perform worse than a smaller one with higher bandwidth.
- Not testing with real traffic. Synthetic benchmarks can mislead. Always load-test with your actual model and request patterns.
- Choosing a region far from users. Latency across continents can ruin user experience. Pick a region close to your user base.
- Overlooking cold start times. If you use serverless inference, cold starts can add seconds of latency. For real-time applications, warm instances are better.
Tips
- Start with a small instance and scale up only if needed. Many models run fine on a single L4 or A10, which costs much less than an A100.
- Use model quantization (e.g., INT8, FP8) to reduce VRAM and increase throughput, but test accuracy impact first.
- If you have predictable traffic, reserve instances for the baseline and use spot for bursts.
- Look for providers that offer free tier or credits for prototyping—this lets you test without commitment.
- Consider using a multi-region setup if your users are global, but only if latency is critical.
Troubleshooting
If your inference is too slow or too expensive, try the following:
- Latency too high: Check if the bottleneck is network or GPU. Run a local test on the instance; if local latency is fine, the issue is network. Consider a provider with better peering or move to a region closer to users.
- Out of memory errors: Reduce batch size, use a smaller model variant, or apply quantization. Ensure you're using the correct container that supports memory optimization.
- Costs exceeding budget: Switch to reserved instances for steady load, or use spot for non-critical jobs. Also, review if you're overprovisioning—monitor GPU utilization; if it's below 30%, downsize.
- Provider-specific issues: Check the provider's status page; if the issue persists, contact support. Many providers have community forums with known fixes.
Frequently Asked Questions
What is the cheapest GPU cloud for AI inference?
Spot instances on major clouds or specialized providers like Vast.ai or RunPod often have the lowest hourly rates. However, the cheapest option may not be reliable for production; always test stability.
Can I use consumer GPUs like RTX 4090 for inference?
Yes, for small models and low traffic, consumer GPUs can work. But they lack ECC memory and have lower reliability, and many cloud providers don't offer them. For production, data-center GPUs are safer.
How do I estimate the GPU memory needed for my model?
For LLMs, multiply the number of parameters (in billions) by 2 GB for FP16 weights, then add about 1–2 GB for KV cache and overhead. For other models, use a profiler like PyTorch's torch.cuda.max_memory_allocated() during a test run.
What is the difference between on-demand and spot instances for inference?
On-demand guarantees availability but costs more. Spot instances are cheaper but can be terminated with little notice. For inference, you generally need on-demand or reserved, unless your workload can tolerate interruptions.
Should I use a managed inference service or raw GPU instances?
Managed services (like SageMaker or Vertex AI) handle scaling, monitoring, and security, but cost more and may have less flexibility. Raw instances are cheaper and customizable but require more operational work. Choose based on your team's expertise and time.
How do I compare providers fairly?
Use the same model, same input size, and same concurrency to test on each provider. Measure latency (p50, p95) and throughput (requests per second) per dollar. Include egress costs in your comparison.