DeepSeek-R1 Model now Available in Amazon Bedrock Marketplace And Amazon SageMaker JumpStart
Today, we are excited to reveal that DeepSeek R1 distilled Llama and Qwen designs are available through Amazon Bedrock Marketplace and Amazon SageMaker JumpStart. With this launch, you can now release DeepSeek AI's first-generation frontier model, DeepSeek-R1, in addition to the distilled versions varying from 1.5 to 70 billion specifications to develop, experiment, and responsibly scale your generative AI concepts on AWS.
In this post, we show how to get going with DeepSeek-R1 on Amazon Bedrock Marketplace and SageMaker JumpStart. You can follow comparable actions to deploy the distilled versions of the designs too.
Overview of DeepSeek-R1
DeepSeek-R1 is a big language model (LLM) established by DeepSeek AI that utilizes support discovering to boost thinking abilities through a multi-stage training procedure from a DeepSeek-V3-Base structure. An essential identifying function is its support learning (RL) step, which was utilized to improve the model's responses beyond the standard pre-training and tweak procedure. By incorporating RL, DeepSeek-R1 can adapt more successfully to user feedback and goals, eventually enhancing both importance and clarity. In addition, DeepSeek-R1 employs a chain-of-thought (CoT) approach, suggesting it's equipped to break down intricate queries and reason through them in a detailed way. This directed reasoning procedure enables the design to produce more accurate, transparent, and detailed responses. This design combines RL-based fine-tuning with CoT capabilities, aiming to produce structured actions while concentrating on interpretability and user interaction. With its comprehensive capabilities DeepSeek-R1 has actually captured the market's attention as a versatile text-generation design that can be integrated into different workflows such as agents, rational reasoning and information interpretation jobs.
DeepSeek-R1 utilizes a Mixture of Experts (MoE) architecture and is 671 billion parameters in size. The MoE architecture enables activation of 37 billion criteria, enabling efficient reasoning by routing queries to the most appropriate expert "clusters." This method allows the model to focus on different problem domains while maintaining total effectiveness. DeepSeek-R1 needs at least 800 GB of HBM memory in FP8 format for reasoning. In this post, we will use an ml.p5e.48 xlarge instance to deploy the design. ml.p5e.48 xlarge includes 8 Nvidia H200 GPUs providing 1128 GB of GPU memory.
DeepSeek-R1 distilled designs bring the reasoning capabilities of the main R1 model to more efficient architectures based upon popular open designs like Qwen (1.5 B, surgiteams.com 7B, 14B, and 32B) and Llama (8B and 70B). Distillation refers to a procedure of training smaller sized, more efficient designs to simulate the behavior and thinking patterns of the bigger DeepSeek-R1 design, using it as an instructor model.
You can release DeepSeek-R1 model either through SageMaker JumpStart or Bedrock Marketplace. Because DeepSeek-R1 is an emerging model, we recommend deploying this design with guardrails in location. In this blog site, we will use Amazon Bedrock Guardrails to present safeguards, prevent damaging content, and assess models against essential safety criteria. At the time of composing this blog site, for DeepSeek-R1 implementations on SageMaker JumpStart and Bedrock Marketplace, Bedrock Guardrails supports only the ApplyGuardrail API. You can create multiple guardrails tailored to various use cases and use them to the DeepSeek-R1 model, enhancing user experiences and standardizing safety controls throughout your generative AI applications.
Prerequisites
To release the DeepSeek-R1 model, you need access to an ml.p5e instance. To examine if you have quotas for P5e, open the Service Quotas console and under AWS Services, pick Amazon SageMaker, and validate you're using ml.p5e.48 xlarge for endpoint usage. Make certain that you have at least one ml.P5e.48 xlarge in the AWS Region you are releasing. To request a limitation increase, develop a limit boost request and connect to your account group.
Because you will be releasing this design with Amazon Bedrock Guardrails, make certain you have the appropriate AWS Identity and Gain Access To Management (IAM) consents to use Amazon Bedrock Guardrails. For guidelines, see Set up authorizations to utilize guardrails for material filtering.
Implementing guardrails with the ApplyGuardrail API
Amazon Bedrock Guardrails permits you to present safeguards, prevent hazardous material, and examine models against essential safety criteria. You can execute security procedures for the DeepSeek-R1 design utilizing the Amazon Bedrock ApplyGuardrail API. This enables you to apply guardrails to assess user inputs and design responses deployed on Amazon Bedrock Marketplace and SageMaker JumpStart. You can produce a guardrail utilizing the Amazon Bedrock console or the API. For the example code to create the guardrail, see the GitHub repo.
The general circulation includes the following steps: First, the system gets an input for the model. This input is then processed through the ApplyGuardrail API. If the input passes the guardrail check, it's sent out to the design for inference. After getting the design's output, another guardrail check is applied. If the output passes this last check, it's returned as the last outcome. However, if either the input or output is intervened by the guardrail, a message is returned indicating the nature of the intervention and whether it happened at the input or output phase. The examples showcased in the following sections show inference using this API.
Deploy DeepSeek-R1 in Amazon Bedrock Marketplace
Amazon Bedrock Marketplace gives you access to over 100 popular, emerging, and specialized structure designs (FMs) through Amazon Bedrock. To gain access to DeepSeek-R1 in Amazon Bedrock, complete the following actions:
1. On the Amazon Bedrock console, select Model catalog under Foundation models in the navigation pane.
At the time of writing this post, you can use the InvokeModel API to conjure up the model. It doesn't support Converse APIs and other Amazon Bedrock tooling.
2. Filter for DeepSeek as a service provider and choose the DeepSeek-R1 design.
The model detail page offers necessary details about the design's capabilities, pricing structure, and application guidelines. You can discover detailed usage directions, including sample API calls and code bits for integration. The model supports numerous text generation jobs, including content creation, code generation, and question answering, using its reinforcement learning optimization and CoT thinking capabilities.
The page also includes release choices and licensing details to assist you get begun with DeepSeek-R1 in your applications.
3. To start utilizing DeepSeek-R1, pick Deploy.
You will be triggered to configure the implementation details for DeepSeek-R1. The model ID will be pre-populated.
4. For Endpoint name, get in an endpoint name (in between 1-50 alphanumeric characters).
5. For Number of circumstances, enter a number of circumstances (in between 1-100).
6. For Instance type, select your circumstances type. For optimum efficiency with DeepSeek-R1, a GPU-based instance type like ml.p5e.48 xlarge is suggested.
Optionally, you can configure advanced security and infrastructure settings, consisting of virtual personal cloud (VPC) networking, service function permissions, and file encryption settings. For a lot of use cases, the default settings will work well. However, for production implementations, you might desire to evaluate these settings to align with your company's security and compliance requirements.
7. Choose Deploy to start utilizing the design.
When the deployment is complete, you can test DeepSeek-R1's abilities straight in the Amazon Bedrock play area.
8. Choose Open in play ground to access an interactive user interface where you can experiment with different prompts and adjust model parameters like temperature level and optimum length.
When using R1 with Bedrock's InvokeModel and Playground Console, use DeepSeek's chat design template for optimal outcomes. For instance, material for inference.
This is an outstanding method to check out the model's reasoning and text generation capabilities before incorporating it into your applications. The playground supplies immediate feedback, helping you understand how the design responds to various inputs and letting you tweak your triggers for ideal outcomes.
You can rapidly evaluate the design in the play area through the UI. However, to invoke the released model programmatically with any Amazon Bedrock APIs, you require to get the endpoint ARN.
Run reasoning utilizing guardrails with the deployed DeepSeek-R1 endpoint
The following code example shows how to perform inference utilizing a released DeepSeek-R1 design through Amazon Bedrock using the invoke_model and ApplyGuardrail API. You can develop a guardrail using the Amazon Bedrock console or the API. For the example code to develop the guardrail, see the GitHub repo. After you have actually created the guardrail, use the following code to execute guardrails. The script initializes the bedrock_runtime client, sets up inference specifications, and sends out a request to create text based upon a user timely.
Deploy DeepSeek-R1 with SageMaker JumpStart
SageMaker JumpStart is an artificial intelligence (ML) center with FMs, built-in algorithms, and prebuilt ML solutions that you can deploy with just a few clicks. With SageMaker JumpStart, you can tailor pre-trained models to your use case, with your data, and deploy them into production utilizing either the UI or SDK.
Deploying DeepSeek-R1 model through SageMaker JumpStart offers 2 convenient methods: using the intuitive SageMaker JumpStart UI or executing programmatically through the SageMaker Python SDK. Let's check out both techniques to assist you choose the approach that best matches your requirements.
Deploy DeepSeek-R1 through SageMaker JumpStart UI
Complete the following steps to release DeepSeek-R1 using SageMaker JumpStart:
1. On the SageMaker console, select Studio in the navigation pane.
2. First-time users will be prompted to produce a domain.
3. On the SageMaker Studio console, choose JumpStart in the navigation pane.
The model web browser shows available designs, with details like the provider name and model capabilities.
4. Look for DeepSeek-R1 to view the DeepSeek-R1 model card.
Each design card reveals key details, including:
- Model name
- Provider name
- Task classification (for example, Text Generation).
Bedrock Ready badge (if applicable), suggesting that this design can be signed up with Amazon Bedrock, enabling you to use Amazon Bedrock APIs to conjure up the model
5. Choose the model card to view the design details page.
The model details page consists of the following details:
- The model name and service provider details. Deploy button to deploy the design. About and Notebooks tabs with detailed details
The About tab includes crucial details, such as:
- Model description. - License details.
- Technical specs.
- Usage standards
Before you release the design, it's suggested to examine the design details and license terms to verify compatibility with your use case.
6. Choose Deploy to proceed with release.
7. For Endpoint name, utilize the automatically generated name or produce a custom-made one.
- For example type ¸ pick an instance type (default: ml.p5e.48 xlarge).
- For Initial instance count, go into the variety of instances (default: 1). Selecting suitable circumstances types and counts is important for cost and performance optimization. Monitor your implementation to adjust these settings as needed.Under Inference type, Real-time inference is picked by default. This is optimized for sustained traffic and low latency.
- Review all setups for precision. For this design, we strongly suggest sticking to SageMaker JumpStart default settings and making certain that network isolation remains in place.
- Choose Deploy to deploy the model.
The implementation procedure can take numerous minutes to finish.
When implementation is total, your endpoint status will alter to InService. At this point, the model is ready to accept reasoning demands through the endpoint. You can monitor the deployment progress on the SageMaker console Endpoints page, which will show appropriate metrics and status details. When the release is total, you can conjure up the design using a SageMaker runtime client and incorporate it with your applications.
Deploy DeepSeek-R1 utilizing the SageMaker Python SDK
To get started with DeepSeek-R1 using the SageMaker Python SDK, you will need to install the SageMaker Python SDK and make certain you have the essential AWS consents and environment setup. The following is a detailed code example that demonstrates how to release and utilize DeepSeek-R1 for inference programmatically. The code for releasing the model is supplied in the Github here. You can clone the note pad and range from SageMaker Studio.
You can run extra demands against the predictor:
Implement guardrails and run inference with your SageMaker JumpStart predictor
Similar to Amazon Bedrock, you can likewise utilize the ApplyGuardrail API with your SageMaker JumpStart predictor. You can produce a guardrail utilizing the Amazon Bedrock console or the API, and execute it as shown in the following code:
Tidy up
To avoid unwanted charges, finish the steps in this section to clean up your resources.
Delete the Amazon Bedrock Marketplace deployment
If you released the design using Amazon Bedrock Marketplace, complete the following steps:
1. On the Amazon Bedrock console, under Foundation models in the navigation pane, select Marketplace deployments. - In the Managed releases area, locate the endpoint you wish to erase.
- Select the endpoint, and on the Actions menu, choose Delete.
- Verify the endpoint details to make certain you're deleting the proper implementation: 1. Endpoint name.
- Model name.
- Endpoint status
Delete the SageMaker JumpStart predictor
The SageMaker JumpStart model you deployed will sustain expenses if you leave it running. Use the following code to delete the endpoint if you wish to stop sustaining charges. For more details, see Delete Endpoints and Resources.
Conclusion
In this post, we checked out how you can access and release the DeepSeek-R1 design using Bedrock Marketplace and SageMaker JumpStart. Visit SageMaker JumpStart in SageMaker Studio or Amazon Bedrock Marketplace now to get going. For more details, refer to Use Amazon Bedrock tooling with Amazon SageMaker JumpStart models, SageMaker JumpStart pretrained models, Amazon SageMaker JumpStart Foundation Models, Amazon Bedrock Marketplace, and Getting going with Amazon SageMaker JumpStart.
About the Authors
Vivek Gangasani is a Lead Specialist Solutions Architect for Inference at AWS. He assists emerging generative AI companies develop ingenious solutions utilizing AWS services and accelerated compute. Currently, he is concentrated on establishing techniques for fine-tuning and optimizing the inference efficiency of large language models. In his spare time, Vivek enjoys treking, seeing movies, and trying various foods.
Niithiyn Vijeaswaran is a Generative AI Specialist Solutions Architect with the Third-Party Model Science team at AWS. His location of focus is AWS AI accelerators (AWS Neuron). He holds a Bachelor's degree in Computer Science and Bioinformatics.
Jonathan Evans is a Specialist Solutions Architect working on generative AI with the Third-Party Model Science group at AWS.
Banu Nagasundaram leads item, engineering, and tactical partnerships for Amazon SageMaker JumpStart, SageMaker's artificial intelligence and generative AI center. She is passionate about developing services that assist clients accelerate their AI journey and unlock organization worth.