DeepSeek-R1 Model now Available in Amazon Bedrock Marketplace And Amazon SageMaker JumpStart
Today, we are thrilled to announce 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, along with the distilled versions ranging from 1.5 to 70 billion specifications to develop, experiment, and responsibly scale your generative AI ideas on AWS.
In this post, we demonstrate how to get begun with DeepSeek-R1 on Amazon Bedrock Marketplace and SageMaker JumpStart. You can follow comparable steps to deploy the distilled versions of the designs too.
Overview of DeepSeek-R1
DeepSeek-R1 is a large language model (LLM) developed by DeepSeek AI that uses reinforcement discovering to boost thinking abilities through a multi-stage training process from a DeepSeek-V3-Base structure. A crucial differentiating function is its reinforcement knowing (RL) action, which was utilized to fine-tune the model's responses beyond the standard pre-training and tweak process. By including RL, DeepSeek-R1 can adapt more successfully to user feedback and objectives, ultimately improving both relevance and clearness. In addition, DeepSeek-R1 employs a chain-of-thought (CoT) approach, implying it's equipped to break down complex queries and factor through them in a detailed way. This assisted reasoning procedure enables the design to produce more precise, transparent, and detailed responses. This design integrates RL-based fine-tuning with CoT abilities, aiming to create structured responses while focusing on interpretability and user interaction. With its wide-ranging capabilities DeepSeek-R1 has captured the market's attention as a versatile text-generation design that can be integrated into various workflows such as agents, rational reasoning and data analysis tasks.
DeepSeek-R1 uses a Mix of Experts (MoE) architecture and is 671 billion criteria in size. The MoE architecture permits activation of 37 billion parameters, making it possible for efficient reasoning by routing queries to the most appropriate specialist "clusters." This approach permits the model to focus on various problem domains while maintaining general efficiency. DeepSeek-R1 needs at least 800 GB of HBM memory in FP8 format for reasoning. In this post, we will utilize an ml.p5e.48 xlarge instance to deploy the design. ml.p5e.48 xlarge includes 8 Nvidia H200 GPUs supplying 1128 GB of GPU memory.
DeepSeek-R1 distilled models bring the reasoning capabilities of the main R1 design to more efficient architectures based on popular open models 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 mimic the behavior and thinking patterns of the bigger DeepSeek-R1 model, utilizing it as an instructor model.
You can release DeepSeek-R1 model either through SageMaker JumpStart or Bedrock Marketplace. Because DeepSeek-R1 is an emerging design, we advise releasing this model with guardrails in location. In this blog site, we will use Amazon Bedrock Guardrails to present safeguards, prevent damaging content, and examine designs against essential security criteria. At the time of composing this blog, for DeepSeek-R1 deployments on SageMaker JumpStart and Bedrock Marketplace, Bedrock Guardrails supports only the ApplyGuardrail API. You can develop multiple guardrails tailored to various use cases and apply them to the DeepSeek-R1 design, improving user experiences and standardizing safety controls throughout your generative AI applications.
Prerequisites
To release the DeepSeek-R1 design, you require access to an ml.p5e circumstances. To inspect if you have quotas for bytes-the-dust.com P5e, open the Service Quotas console and under AWS Services, select Amazon SageMaker, and verify you're utilizing ml.p5e.48 xlarge for endpoint use. Make certain that you have at least one ml.P5e.48 xlarge circumstances in the AWS Region you are deploying. To ask for a limit increase, develop a limitation increase request and reach out to your account group.
Because you will be releasing this model with Amazon Bedrock Guardrails, make certain you have the right AWS Identity and Gain Access To Management (IAM) consents to use Amazon Bedrock Guardrails. For guidelines, see Establish permissions to utilize guardrails for content filtering.
Implementing guardrails with the ApplyGuardrail API
Amazon Bedrock Guardrails allows you to introduce safeguards, avoid harmful material, and assess models against key security requirements. You can implement safety procedures for the DeepSeek-R1 model utilizing the Amazon Bedrock ApplyGuardrail API. This enables you to use guardrails to examine 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 produce the guardrail, see the GitHub repo.
The general circulation involves the following actions: First, the system gets 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 design for reasoning. After getting the model's output, another guardrail check is used. If the output passes this last check, it's returned as the outcome. However, if either the input or output is stepped in by the guardrail, a message is returned indicating the nature of the intervention and whether it occurred at the input or output stage. The examples showcased in the following areas demonstrate inference using this API.
Deploy DeepSeek-R1 in Amazon Bedrock Marketplace
Amazon Bedrock Marketplace provides 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 actions:
1. On the Amazon Bedrock console, select Model catalog under Foundation designs in the navigation pane.
At the time of writing this post, you can utilize the InvokeModel API to invoke the model. It does not support Converse APIs and other Amazon Bedrock tooling.
2. Filter for DeepSeek as a provider and pick the DeepSeek-R1 model.
The model detail page provides necessary details about the design's capabilities, prices structure, and application guidelines. You can discover detailed usage guidelines, including sample API calls and code snippets for combination. The design supports various text generation tasks, including material creation, code generation, and question answering, using its support discovering optimization and CoT thinking capabilities.
The page likewise includes release choices and licensing details to help you get started with DeepSeek-R1 in your applications.
3. To begin utilizing DeepSeek-R1, choose Deploy.
You will be triggered to configure the release details for DeepSeek-R1. The design ID will be pre-populated.
4. For Endpoint name, go into an endpoint name (between 1-50 alphanumeric characters).
5. For Number of instances, go into a number of instances (between 1-100).
6. For example type, pick your circumstances type. For optimal efficiency with DeepSeek-R1, a GPU-based instance type like ml.p5e.48 xlarge is advised.
Optionally, you can set up sophisticated security and infrastructure settings, including virtual private cloud (VPC) networking, service role consents, and file encryption settings. For many use cases, the default settings will work well. However, for production implementations, you may want to review these settings to align with your company's security and compliance requirements.
7. Choose Deploy to begin utilizing the model.
When the implementation is complete, you can test DeepSeek-R1's capabilities straight in the Amazon Bedrock playground.
8. Choose Open in play ground to access an interactive user interface where you can try out different prompts and adjust design specifications like temperature level and optimum length.
When using R1 with Bedrock's InvokeModel and Playground Console, use DeepSeek's chat design template for ideal results. For example, material for inference.
This is an outstanding way to explore the design's thinking and text generation capabilities before incorporating it into your applications. The play area supplies immediate feedback, assisting you comprehend how the model reacts to various inputs and letting you fine-tune your triggers for ideal results.
You can quickly check the model in the playground through the UI. However, to invoke the released model programmatically with any Amazon Bedrock APIs, you require to get the endpoint ARN.
Run inference using guardrails with the deployed DeepSeek-R1 endpoint
The following code example shows how to carry out inference using a released DeepSeek-R1 design through Amazon Bedrock using the invoke_model and ApplyGuardrail API. 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. After you have developed the guardrail, use the following code to carry out guardrails. The script initializes the bedrock_runtime customer, sets up reasoning parameters, and sends out a request to produce text based on a user timely.
Deploy DeepSeek-R1 with SageMaker JumpStart
SageMaker JumpStart is an artificial intelligence (ML) hub with FMs, built-in algorithms, and prebuilt ML services that you can deploy with simply a couple of clicks. With SageMaker JumpStart, you can tailor pre-trained models to your use case, with your data, and release them into production using either the UI or SDK.
Deploying DeepSeek-R1 model through SageMaker JumpStart provides two convenient methods: using the user-friendly SageMaker JumpStart UI or carrying out programmatically through the SageMaker Python SDK. Let's explore both techniques to assist you choose the method that best fits your needs.
Deploy DeepSeek-R1 through SageMaker JumpStart UI
Complete the following actions to deploy DeepSeek-R1 using SageMaker JumpStart:
1. On the SageMaker console, choose Studio in the navigation pane.
2. First-time users will be triggered to create a domain.
3. On the SageMaker Studio console, choose JumpStart in the navigation pane.
The model web browser displays available models, with details like the company name and design capabilities.
4. Search for DeepSeek-R1 to see the DeepSeek-R1 model card.
Each design card reveals crucial details, including:
- Model name
- Provider name
- Task classification (for instance, Text Generation).
Bedrock Ready badge (if suitable), showing that this design can be registered with Amazon Bedrock, enabling you to utilize Amazon Bedrock APIs to invoke the model
5. Choose the model card to see the design details page.
The design details page includes the following details:
- The design name and company details. Deploy button to deploy the design. About and Notebooks tabs with detailed details
The About tab includes essential details, such as:
- Model description. - License details.
- Technical specs.
- Usage guidelines
Before you release the model, it's recommended to review the model details and license terms to confirm compatibility with your use case.
6. Choose Deploy to continue with implementation.
7. For Endpoint name, use the immediately generated name or develop a custom one.
- For Instance type ¸ select an instance type (default: ml.p5e.48 xlarge).
- For Initial circumstances count, get in the number of circumstances (default: 1). Selecting appropriate instance types and counts is important for expense and performance optimization. Monitor your release to adjust these settings as needed.Under Inference type, Real-time reasoning is picked by default. This is optimized for sustained traffic and low latency.
- Review all configurations for accuracy. For this model, 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 deployment process can take a number of minutes to complete.
When implementation is total, your endpoint status will alter to InService. At this point, the design is prepared to accept inference demands through the endpoint. You can keep an eye on the release development on the SageMaker console Endpoints page, which will display appropriate metrics and status details. When the implementation is complete, you can conjure up the model using a SageMaker runtime client and incorporate it with your applications.
Deploy DeepSeek-R1 utilizing the SageMaker Python SDK
To begin with DeepSeek-R1 using the SageMaker Python SDK, you will require 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 reasoning programmatically. The code for deploying the model is offered in the Github here. You can clone the notebook and run from SageMaker Studio.
You can run additional requests against the predictor:
Implement guardrails and run inference with your SageMaker JumpStart predictor
Similar to Amazon Bedrock, you can also use the ApplyGuardrail API with your SageMaker . You can develop 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 tidy up your resources.
Delete the Amazon Bedrock Marketplace implementation
If you deployed the design using Amazon Bedrock Marketplace, total the following actions:
1. On the Amazon Bedrock console, under Foundation models in the navigation pane, select Marketplace deployments. - In the Managed implementations 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 right implementation: 1. Endpoint name.
- Model name.
- Endpoint status
Delete the SageMaker JumpStart predictor
The SageMaker JumpStart design you deployed will sustain expenses if you leave it running. Use the following code to erase the endpoint if you want to stop sustaining charges. For more details, see Delete Endpoints and Resources.
Conclusion
In this post, we checked out how you can access and deploy the DeepSeek-R1 model utilizing 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 models, SageMaker JumpStart pretrained models, Amazon SageMaker JumpStart Foundation Models, Amazon Bedrock Marketplace, and Beginning with Amazon SageMaker JumpStart.
About the Authors
Vivek Gangasani is a Lead Specialist Solutions Architect for Inference at AWS. He helps emerging generative AI business build innovative solutions using AWS services and sped up compute. Currently, he is focused on developing strategies for fine-tuning and enhancing the inference performance of big language models. In his downtime, Vivek delights in hiking, watching films, and attempting different cuisines.
Niithiyn Vijeaswaran is a Generative AI Specialist Solutions Architect with the Third-Party Model Science team 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 an Expert Solutions Architect dealing with generative AI with the Third-Party Model Science team at AWS.
Banu Nagasundaram leads item, engineering, and tactical collaborations 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 company value.