- Newest
- Most votes
- Most comments
When considering deployment options for an open-source LLM like Llama, there are several factors to consider in terms of pricing and deployment models. Let's compare the options you mentioned:
-
Amazon Bedrock: Amazon Bedrock offers a fully managed service for accessing LLMs through API calls. The pricing for Bedrock is based on the number of tokens processed during inference. You have two pricing options: on-demand or Provisioned Throughput. With Bedrock, you don't need to manage any infrastructure, making it a convenient option for those who want to focus on using the model rather than managing it.
-
Amazon SageMaker: SageMaker provides multiple deployment options for LLMs:
a) Real-time Inference: This is ideal for use cases requiring low-latency, near-instantaneous responses. You're charged based on the instance type and duration of the endpoint being active.
b) Serverless Inference: This option is suitable for workloads with variable traffic patterns and can tolerate cold starts. Pricing is based on the duration of inference requests and the amount of memory provisioned.
c) Asynchronous Inference: This is best for large payloads or long processing times. Pricing is similar to real-time inference but with higher limits on payload size and processing time.
With SageMaker, you have more control over the infrastructure but still benefit from managed services.
- Self-hosted on EC2: This option gives you the most control but also requires the most management. You'll be responsible for setting up and maintaining the infrastructure. Pricing is based on the EC2 instance type you choose and how long you run it. This option can be cost-effective if you have the expertise to optimize resource usage and can handle the operational overhead.
When comparing these options, consider the following:
- Ease of use: Bedrock is the simplest to use, followed by SageMaker, with EC2 requiring the most management.
- Scalability: Both Bedrock and SageMaker offer automatic scaling, while with EC2, you'd need to manage scaling yourself.
- Cost structure: Bedrock charges per token, SageMaker per instance-hour or request duration, and EC2 per instance-hour.
- Performance requirements: If you need fine-tuned control over latency and throughput, SageMaker or EC2 might be better options.
- Usage patterns: For sporadic usage, Bedrock or SageMaker Serverless Inference might be more cost-effective. For consistent, high-volume usage, a dedicated SageMaker endpoint or EC2 instance could be more economical.
To make the best decision, you should estimate your expected usage patterns, performance requirements, and calculate the costs for each option based on your specific use case. AWS provides pricing calculators and examples that can help you make a more accurate comparison for your particular needs.
Sources
Pricing model of DeepSeek-R1 distilled Llama models with Amazon Bedrock Custom Model Import | AWS re:Post
MLPER-12: Choose an optimal deployment option in the cloud - Machine Learning Lens
Community | How To Choose Your LLM
Deploy models for inference - Amazon SageMaker AI
answered 2 years ago
It's always worth double-checking finer details on pricing because nobody wants to be surprised, but I'd say the general considerations are:
- For standard, "serverless" models on Bedrock, you pay for actual usage in terms of tokens/images/etc, whereas for the other options (SageMaker, EC2, and Bedrock Provisioned Throughput for custom models), you'll generally be paying based on infrastructure - even if what you deploy is under-utilized. To my knowledge right now (and of course it might change in future), using custom/fine-tuned models on Bedrock always means moving to the provisioned/infrastructure-based charging model.
- As far as I've seen so far, the pricing for Bedrock Marketplace deployments (where you'll usually see they mention instance types e.g.
ml.p5.48xlargeor etc) has been the same as the equivalent instances in SageMaker real-time inference. However, "Provisioned Throughput" agreements in terms of "Model Units" are different and should refer to the Bedrock pricing page. - In general, SageMaker instance-hour pricing will be higher than the equivalent EC2 on-demand rate... But you get benefits from using the more fully-managed service. For example:
- SageMaker real-time-inference has a whole host of features for managing endpoint lifecycle e.g. rolling deployments and health checks, scaling options and etc. You can scale down to zero when not in use, pack multiple adapters into one endpoint, and so on.
- Similar to Bedrock Marketplace, SageMaker JumpStart provides pre-packaged implementations for many models... But also opportunities to customize and bring your own scripts or libraries if you want without changing platform. Some variants of the AWS Deep Learning Containers are only consumable via SageMaker or have SageMaker-specific features too.
- Since SageMaker endpoint containers are deployed and accessed through the service APIs, you have a li'l extra layer of security and load balancing functionality already built in.
- There's the broader range of ML project lifecycle features available on SageMaker too - from notebooks to experiment tracking (with MLFlow, CometML, DeepChecks, etc etc)... Other features like SageMaker Hyperpod clusters or "Training" jobs can have useful features for inference workloads too.
...So in summary, since the services provide qualitatively different things, understanding the functionality (built-in features) vs boundaries (region support, proprietary model availability, etc) that's available through each one is probably the place to start. Particularly with EC2 vs SageMaker, it's hard to articulate the pricing comparison without a handle on how much extra effort you'd need to implement the same benefits (and whether they're helpful to you).
For anything priced based on infrastructure rather than tokens/calls (including Bedrock Provisioned Throughput), it's probably also worth performance/load testing because different serving implementations of a model might provide different out-of-the-box trade-offs. You could check out LLMeter to dive into that.
Relevant content
asked 3 years ago
- AWS OFFICIALUpdated 2 years ago
