Today, we are delighted to reveal 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 specifications to develop, experiment, and responsibly scale your generative AI concepts on AWS.
In this post, we show how to get begun with DeepSeek-R1 on Amazon Bedrock Marketplace and SageMaker JumpStart. You can follow comparable steps to release the distilled versions of the models also.
Overview of DeepSeek-R1
DeepSeek-R1 is a big language model (LLM) established by DeepSeek AI that utilizes support learning to improve thinking abilities through a multi-stage training process from a DeepSeek-V3-Base foundation. An essential distinguishing feature is its reinforcement knowing (RL) step, which was used to improve the model's actions beyond the standard pre-training and tweak process. By integrating RL, DeepSeek-R1 can adapt better to user feedback and objectives, eventually boosting both relevance and clarity. In addition, DeepSeek-R1 employs a chain-of-thought (CoT) technique, implying it's geared up to break down complicated questions and reason through them in a detailed way. This assisted thinking process permits the model to produce more accurate, transparent, and detailed answers. This model combines RL-based fine-tuning with CoT capabilities, aiming to create structured actions while focusing on interpretability and user interaction. With its comprehensive capabilities DeepSeek-R1 has recorded the market's attention as a flexible text-generation design that can be incorporated into different workflows such as agents, logical thinking and information analysis tasks.
DeepSeek-R1 utilizes a Mix of Experts (MoE) architecture and is 671 billion criteria in size. The MoE architecture permits activation of 37 billion criteria, making it possible for efficient inference by routing queries to the most appropriate expert "clusters." This technique enables the design to focus on various problem domains while maintaining overall 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 release the design. ml.p5e.48 xlarge features 8 Nvidia H200 GPUs providing 1128 GB of GPU memory.
DeepSeek-R1 distilled designs bring the reasoning abilities of the main R1 model to more effective architectures based on popular open models like Qwen (1.5 B, 7B, 14B, and 32B) and Llama (8B and 70B). Distillation describes a process of training smaller, more efficient designs to mimic the habits and reasoning patterns of the larger DeepSeek-R1 design, utilizing it as a teacher design.
You can deploy DeepSeek-R1 design either through SageMaker JumpStart or Bedrock Marketplace. Because DeepSeek-R1 is an emerging design, we suggest releasing this design with guardrails in place. In this blog, we will use Amazon Bedrock Guardrails to introduce safeguards, avoid harmful content, and assess models against essential security criteria. At the time of composing this blog site, for wiki.whenparked.com DeepSeek-R1 deployments on SageMaker JumpStart and Bedrock Marketplace, Bedrock Guardrails supports only the ApplyGuardrail API. You can produce several guardrails tailored to different usage cases and apply them to the DeepSeek-R1 model, enhancing user experiences and standardizing safety controls across your generative AI applications.
Prerequisites
To deploy the DeepSeek-R1 model, you require access to an ml.p5e circumstances. To check if you have quotas for P5e, open the Service Quotas console and under AWS Services, select Amazon SageMaker, and confirm you're utilizing ml.p5e.48 xlarge for endpoint use. Make certain that you have at least one ml.P5e.48 xlarge instance in the AWS Region you are deploying. To ask for a limitation increase, develop a limit increase demand and connect to your account team.
Because you will be releasing this model 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 introduce safeguards, avoid hazardous content, and assess designs against essential safety requirements. You can carry out security measures for the DeepSeek-R1 model utilizing the Amazon Bedrock ApplyGuardrail API. This permits you to use guardrails to examine user inputs and design actions released on Amazon Bedrock Marketplace and SageMaker JumpStart. You can develop a guardrail utilizing the Amazon Bedrock console or the API. For the example code to create the guardrail, see the GitHub repo.
The basic flow includes the following actions: 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 design for inference. After receiving the model'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 stepped in by the guardrail, a message is returned indicating the nature of the intervention and whether it took place at the input or output phase. The examples showcased in the following sections demonstrate inference using this API.
Deploy DeepSeek-R1 in Amazon Bedrock Marketplace
Amazon Bedrock Marketplace offers you access to over 100 popular, emerging, and specialized foundation designs (FMs) through Amazon Bedrock. To gain access to DeepSeek-R1 in Amazon Bedrock, complete the following actions:
1. On the Amazon Bedrock console, choose 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 design. It does not support Converse APIs and other Amazon Bedrock tooling.
2. Filter for DeepSeek as a company and choose the DeepSeek-R1 design.
The design detail page supplies important details about the model's capabilities, prices structure, and implementation guidelines. You can find detailed usage directions, consisting of sample API calls and code snippets for combination. The design supports different text generation tasks, including content creation, code generation, and question answering, using its reinforcement learning optimization and CoT thinking abilities.
The page also includes deployment choices and licensing details to assist you start with DeepSeek-R1 in your applications.
3. To begin using DeepSeek-R1, select Deploy.
You will be prompted to configure the implementation details for DeepSeek-R1. The design ID will be pre-populated.
4. For Endpoint name, get in an endpoint name (in between 1-50 alphanumeric characters).
5. For Number of instances, get in a number of circumstances (in between 1-100).
6. For Instance type, pick your instance type. For ideal performance with DeepSeek-R1, a GPU-based circumstances 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 function permissions, and encryption settings. For the majority of utilize cases, the default settings will work well. However, for production deployments, you may wish to review these settings to line up with your company's security and compliance requirements.
7. Choose Deploy to begin using the model.
When the release is total, you can test DeepSeek-R1's capabilities straight in the Amazon Bedrock play area.
8. Choose Open in play area to access an interactive interface where you can explore various triggers and change model criteria like temperature level and optimum length.
When using R1 with Bedrock's InvokeModel and Playground Console, utilize DeepSeek's chat design template for optimal outcomes. For instance, content for reasoning.
This is an exceptional way to explore the model's reasoning and text generation abilities before incorporating it into your applications. The play ground offers instant feedback, assisting you comprehend how the model responds to numerous inputs and letting you tweak your triggers for optimal results.
You can rapidly check the design in the play area through the UI. However, to invoke the released design 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 perform inference using a deployed 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 create the guardrail, see the GitHub repo. After you have actually produced the guardrail, use the following code to implement guardrails. The script initializes the bedrock_runtime customer, sets up inference criteria, and sends a request to create 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 release with just a couple of clicks. With SageMaker JumpStart, you can models to your use case, with your data, and release them into production utilizing either the UI or SDK.
Deploying DeepSeek-R1 design through SageMaker JumpStart provides 2 hassle-free approaches: using the user-friendly SageMaker JumpStart UI or implementing programmatically through the SageMaker Python SDK. Let's explore both approaches to assist you pick the approach that finest fits your requirements.
Deploy DeepSeek-R1 through SageMaker JumpStart UI
Complete the following actions to release DeepSeek-R1 utilizing SageMaker JumpStart:
1. On the SageMaker console, select Studio in the navigation pane.
2. First-time users will be prompted to create a domain.
3. On the SageMaker Studio console, select JumpStart in the navigation pane.
The design browser displays available models, with details like the provider name and model abilities.
4. Look for DeepSeek-R1 to view the DeepSeek-R1 design card.
Each model card reveals essential details, consisting of:
- Model name
- Provider name
- Task classification (for example, Text Generation).
Bedrock Ready badge (if appropriate), showing that this model can be signed up with Amazon Bedrock, allowing you to use Amazon Bedrock APIs to conjure up the model
5. Choose the design card to view the design details page.
The model details page includes the following details:
- The model name and service provider details. Deploy button to release the model. About and Notebooks tabs with detailed details
The About tab consists of important details, such as:
- Model description. - License details.
- Technical requirements.
- Usage guidelines
Before you release the design, it's advised to evaluate the model details and license terms to verify compatibility with your use case.
6. Choose Deploy to proceed with release.
7. For Endpoint name, utilize the instantly produced name or create a custom-made one.
- For example type ¸ select a circumstances type (default: ml.p5e.48 xlarge).
- For Initial instance count, get in the variety of instances (default: 1). Selecting suitable instance types and counts is important for cost and efficiency optimization. Monitor your implementation to adjust 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 configurations for precision. For this model, we strongly advise sticking to SageMaker JumpStart default settings and making certain that network seclusion remains in place.
- Choose Deploy to release the model.
The implementation process can take numerous minutes to finish.
When deployment is total, your endpoint status will change to InService. At this moment, the model is all set to accept reasoning requests through the endpoint. You can keep an eye on the deployment progress on the SageMaker console Endpoints page, which will show relevant metrics and status details. When the deployment is complete, you can invoke the model utilizing a SageMaker runtime client and incorporate it with your applications.
Deploy DeepSeek-R1 using the SageMaker Python SDK
To start with DeepSeek-R1 using the SageMaker Python SDK, you will require to set up the SageMaker Python SDK and make certain you have the required AWS permissions 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 offered in the Github here. You can clone the note pad and range from SageMaker Studio.
You can run additional 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 create a guardrail using the Amazon Bedrock console or the API, and implement it as shown in the following code:
Tidy up
To avoid unwanted charges, complete the steps in this area to tidy up your resources.
Delete the Amazon Bedrock Marketplace release
If you released the design utilizing Amazon Bedrock Marketplace, complete the following steps:
1. On the Amazon Bedrock console, under Foundation models in the navigation pane, select Marketplace releases. - In the Managed implementations area, locate the endpoint you wish to erase.
- Select the endpoint, and on the Actions menu, pick Delete.
- Verify the endpoint details to make certain you're erasing the appropriate deployment: 1. Endpoint name.
- Model name.
- Endpoint status
Delete the SageMaker JumpStart predictor
The SageMaker JumpStart design you deployed will sustain costs if you leave it running. Use the following code to erase the endpoint if you desire 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 model using Bedrock Marketplace and SageMaker JumpStart. Visit SageMaker JumpStart in SageMaker Studio or Amazon Bedrock Marketplace now to get begun. For more details, refer to Use Amazon Bedrock tooling with Amazon SageMaker JumpStart designs, SageMaker JumpStart pretrained models, Amazon SageMaker JumpStart Foundation Models, Amazon Bedrock Marketplace, and Starting 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 build innovative options utilizing AWS services and accelerated compute. Currently, he is focused on establishing techniques for fine-tuning and enhancing the inference performance of large language designs. In his complimentary time, Vivek enjoys treking, watching movies, 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 technology 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 options that help customers accelerate their AI journey and unlock company worth.