Today, we are thrilled to announce that DeepSeek R1 distilled Llama and Qwen models 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, together with the distilled variations varying from 1.5 to 70 billion parameters to develop, experiment, and properly scale your generative AI concepts on AWS.
In this post, we demonstrate how to begin with DeepSeek-R1 on Amazon Bedrock Marketplace and SageMaker JumpStart. You can follow comparable actions to deploy the distilled variations of the models as well.
Overview of DeepSeek-R1
DeepSeek-R1 is a large language design (LLM) developed by DeepSeek AI that utilizes reinforcement finding out to boost thinking abilities through a multi-stage training procedure from a DeepSeek-V3-Base structure. A crucial differentiating feature is its reinforcement learning (RL) step, which was utilized to fine-tune the model's reactions beyond the basic pre-training and tweak process. By including RL, DeepSeek-R1 can adapt better to user feedback and goals, ultimately boosting both relevance and clearness. In addition, DeepSeek-R1 utilizes a chain-of-thought (CoT) technique, meaning it's geared up to break down complicated questions and reason through them in a detailed manner. This assisted thinking process permits the model to produce more accurate, transparent, and detailed answers. This design integrates RL-based fine-tuning with CoT abilities, aiming to generate structured reactions while focusing on interpretability and user interaction. With its wide-ranging abilities DeepSeek-R1 has captured the market's attention as a flexible text-generation design that can be integrated into different workflows such as representatives, sensible reasoning and information interpretation tasks.
DeepSeek-R1 uses a Mixture of Experts (MoE) architecture and is 671 billion parameters in size. The MoE architecture permits activation of 37 billion parameters, enabling efficient inference by routing queries to the most appropriate specialist "clusters." This approach permits the design to focus on different issue domains while maintaining general effectiveness. DeepSeek-R1 needs a minimum of 800 GB of HBM memory in FP8 format for reasoning. In this post, we will utilize an ml.p5e.48 xlarge circumstances to deploy the model. ml.p5e.48 xlarge comes with 8 Nvidia H200 GPUs providing 1128 GB of GPU memory.
DeepSeek-R1 distilled designs bring the thinking capabilities of the main R1 design to more efficient architectures based upon popular open designs like Qwen (1.5 B, 7B, 14B, and 32B) and Llama (8B and 70B). Distillation refers to a process of training smaller sized, more efficient designs to imitate the habits and thinking patterns of the bigger DeepSeek-R1 model, utilizing it as an instructor design.
You can release DeepSeek-R1 model either through SageMaker JumpStart or Bedrock Marketplace. Because DeepSeek-R1 is an emerging design, we suggest deploying this design with guardrails in place. In this blog, we will utilize Amazon Bedrock Guardrails to introduce safeguards, prevent harmful content, and assess models against essential security criteria. At the time of composing this blog, for DeepSeek-R1 releases on SageMaker JumpStart and Bedrock Marketplace, Bedrock Guardrails supports only the ApplyGuardrail API. You can develop several guardrails tailored to different use cases and use them to the DeepSeek-R1 model, enhancing user experiences and standardizing security controls throughout your generative AI applications.
Prerequisites
To deploy the DeepSeek-R1 model, you require access to an ml.p5e circumstances. To inspect if you have quotas for P5e, open the Service Quotas console and under AWS Services, select Amazon SageMaker, and verify you're using ml.p5e.48 xlarge for endpoint usage. Make certain that you have at least one ml.P5e.48 xlarge instance in the AWS Region you are releasing. To ask for a limit increase, create a limit increase request and connect to your account group.
Because you will be deploying this model with Amazon Bedrock Guardrails, make certain you have the right AWS Identity and Gain Access To Management (IAM) authorizations to utilize Amazon Bedrock Guardrails. For guidelines, see Establish consents to use guardrails for material filtering.
Implementing guardrails with the ApplyGuardrail API
Amazon Bedrock Guardrails allows you to present safeguards, prevent damaging material, and examine designs against crucial safety requirements. You can carry out security steps for the DeepSeek-R1 design utilizing the Amazon Bedrock ApplyGuardrail API. This permits you to use guardrails to assess user inputs and model responses deployed on Amazon Bedrock Marketplace and SageMaker JumpStart. You can create a guardrail utilizing the Amazon Bedrock console or the API. For the example code to develop the guardrail, see the GitHub repo.
The general flow includes the following steps: First, the system receives an input for the design. This input is then processed through the ApplyGuardrail API. If the input passes the guardrail check, it's sent out to the model for reasoning. After getting the design's output, another guardrail check is used. If the output passes this last check, it's returned as the result. However, if either the input or output is intervened by the guardrail, a message is returned showing the nature of the intervention and whether it took place at the input or output stage. The examples showcased in the following sections demonstrate reasoning utilizing this API.
Deploy DeepSeek-R1 in Amazon Bedrock Marketplace
Amazon Bedrock Marketplace offers you access to over 100 popular, emerging, and specialized structure models (FMs) through Amazon Bedrock. To gain access to DeepSeek-R1 in Amazon Bedrock, total the following steps:
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 invoke the design. It doesn't support Converse APIs and other Amazon Bedrock tooling.
2. Filter for DeepSeek as a supplier and pick the DeepSeek-R1 design.
The model detail page offers necessary details about the design's capabilities, pricing structure, and implementation guidelines. You can find detailed usage instructions, including sample API calls and code snippets for integration. The model supports different text generation tasks, including material creation, code generation, and concern answering, utilizing its support learning optimization and CoT reasoning capabilities.
The page likewise consists of release choices and licensing details to help you get going with DeepSeek-R1 in your applications.
3. To begin using DeepSeek-R1, select Deploy.
You will be prompted to set up the deployment details for DeepSeek-R1. The model ID will be pre-populated.
4. For Endpoint name, go into an endpoint name (in between 1-50 alphanumeric characters).
5. For Variety of instances, enter a number of circumstances (between 1-100).
6. For example type, pick your circumstances type. For ideal performance with DeepSeek-R1, a GPU-based circumstances type like ml.p5e.48 xlarge is suggested.
Optionally, you can configure advanced security and infrastructure settings, including virtual private cloud (VPC) networking, service function authorizations, and encryption settings. For a lot of use cases, the default settings will work well. However, for production deployments, you might desire to evaluate these settings to line up with your company's security and compliance requirements.
7. Choose Deploy to begin using the model.
When the deployment is total, you can evaluate DeepSeek-R1's capabilities straight in the Amazon Bedrock play area.
8. Choose Open in play area to access an interactive user interface where you can experiment with various triggers and change design parameters like temperature level and maximum length.
When using R1 with Bedrock's InvokeModel and Playground Console, use DeepSeek's chat template for optimal results. For example, material for reasoning.
This is an exceptional way to check out the model's thinking and text generation abilities before integrating it into your applications. The playground supplies immediate feedback, helping you understand how the design reacts to numerous inputs and letting you tweak your triggers for optimal outcomes.
You can rapidly evaluate the design in the playground through the UI. However, to invoke the deployed model programmatically with any Amazon Bedrock APIs, you require to get the endpoint ARN.
Run reasoning utilizing guardrails with the released DeepSeek-R1 endpoint
The following code example shows how to carry out inference utilizing a released DeepSeek-R1 design through Amazon Bedrock utilizing the invoke_model and ApplyGuardrail API. You can develop a guardrail utilizing the Amazon Bedrock console or the API. For the example code to produce the guardrail, see the GitHub repo. After you have actually created the guardrail, utilize the following code to implement guardrails. The script initializes the bedrock_runtime client, configures reasoning specifications, and sends a request to produce text based on 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 release with simply a few clicks. With SageMaker JumpStart, you can tailor pre-trained models to your usage case, with your information, and deploy them into production utilizing either the UI or SDK.
Deploying DeepSeek-R1 model through SageMaker JumpStart offers 2 convenient methods: utilizing the instinctive SageMaker JumpStart UI or implementing programmatically through the SageMaker Python SDK. Let's explore both techniques to help you choose the method 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, choose Studio in the navigation pane.
2. First-time users will be prompted to develop a domain.
3. On the SageMaker Studio console, pick JumpStart in the navigation pane.
The design browser shows available models, with details like the service provider name and design capabilities.
4. Search for DeepSeek-R1 to see the DeepSeek-R1 model card.
Each design card shows key details, consisting of:
- Model name
- Provider name
- Task classification (for instance, Text Generation).
Bedrock Ready badge (if applicable), indicating that this model can be signed up with Amazon Bedrock, allowing you to utilize Amazon Bedrock APIs to invoke the design
5. Choose the model card to view the model details page.
The model details page includes the following details:
- The model name and company details. Deploy button to deploy the model. About and Notebooks tabs with detailed details
The About tab includes crucial details, such as:
- Model description. - License details.
- Technical specifications.
- Usage standards
Before you deploy the model, it's advised to evaluate the model details and license terms to validate compatibility with your usage case.
6. Choose Deploy to proceed with release.
7. For Endpoint name, utilize the automatically produced name or develop a customized one.
- For example type ¸ choose a circumstances type (default: ml.p5e.48 xlarge).
- For Initial instance count, get in the number of instances (default: 1). Selecting suitable instance types and counts is vital for and efficiency optimization. Monitor your implementation to change these settings as needed.Under Inference type, Real-time reasoning is chosen by default. This is optimized for sustained traffic and low latency.
- Review all setups for precision. For this design, we highly advise sticking to SageMaker JumpStart default settings and making certain that network isolation remains in location.
- Choose Deploy to release the design.
The implementation procedure can take several minutes to complete.
When release is total, your endpoint status will change to InService. At this point, the model is all set to accept inference requests through the endpoint. You can keep track of the release progress on the SageMaker console Endpoints page, which will show appropriate metrics and status details. When the deployment is complete, you can invoke the model utilizing a SageMaker runtime customer and integrate it with your applications.
Deploy DeepSeek-R1 using the SageMaker Python SDK
To begin with DeepSeek-R1 utilizing the SageMaker Python SDK, you will require to set up the SageMaker Python SDK and make certain you have the required AWS consents and environment setup. The following is a detailed code example that shows how to release and utilize DeepSeek-R1 for reasoning programmatically. The code for releasing the design is provided in the Github here. You can clone the notebook and run from SageMaker Studio.
You can run extra requests against the predictor:
Implement guardrails and run inference with your SageMaker JumpStart predictor
Similar to Amazon Bedrock, you can also utilize the ApplyGuardrail API with your SageMaker JumpStart predictor. You can create a guardrail using the Amazon Bedrock console or the API, and implement it as displayed in the following code:
Clean up
To avoid unwanted charges, finish the steps in this area to clean up your resources.
Delete the Amazon Bedrock Marketplace implementation
If you deployed the design using Amazon Bedrock Marketplace, total the following steps:
1. On the Amazon Bedrock console, under Foundation designs in the navigation pane, select Marketplace releases. - In the Managed deployments area, locate the endpoint you wish to delete.
- Select the endpoint, and on the Actions menu, pick Delete.
- Verify the endpoint details to make certain you're erasing the correct deployment: 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 erase the endpoint if you wish to stop sustaining charges. For more details, see Delete Endpoints and Resources.
Conclusion
In this post, we explored 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, describe Use Amazon Bedrock tooling with Amazon SageMaker JumpStart designs, SageMaker JumpStart pretrained models, Amazon SageMaker JumpStart Foundation Models, Amazon Bedrock Marketplace, and Getting begun 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 construct ingenious solutions using AWS services and sped up compute. Currently, he is concentrated on developing techniques for fine-tuning and enhancing the inference efficiency of large language designs. In his free time, Vivek enjoys hiking, systemcheck-wiki.de enjoying films, and attempting various cuisines.
Niithiyn Vijeaswaran is a Generative AI Specialist Solutions Architect with the Third-Party Model Science group at AWS. His area 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 strategic collaborations for Amazon SageMaker JumpStart, SageMaker's artificial intelligence and generative AI center. She is enthusiastic about building solutions that assist consumers accelerate their AI journey and unlock business worth.