Today, we are excited 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 design, DeepSeek-R1, along with the distilled variations ranging from 1.5 to 70 billion criteria to develop, experiment, and properly scale your generative AI ideas on AWS.
In this post, we show how to start with DeepSeek-R1 on Amazon Bedrock Marketplace and SageMaker JumpStart. You can follow comparable actions to deploy the distilled versions of the models also.
Overview of DeepSeek-R1
DeepSeek-R1 is a large language model (LLM) established by DeepSeek AI that uses support finding out to improve reasoning capabilities through a multi-stage training process from a DeepSeek-V3-Base structure. An essential distinguishing function is its support learning (RL) step, which was used to fine-tune the model's reactions beyond the basic pre-training and fine-tuning procedure. By including RL, DeepSeek-R1 can adapt more effectively to user feedback and goals, ultimately improving both importance and clearness. In addition, DeepSeek-R1 employs a chain-of-thought (CoT) approach, suggesting it's equipped to break down complicated questions and reason through them in a detailed way. This assisted reasoning procedure permits the model to produce more accurate, transparent, and detailed responses. This design combines RL-based fine-tuning with CoT abilities, aiming to create structured actions while focusing on interpretability and user interaction. With its wide-ranging abilities DeepSeek-R1 has caught the market's attention as a versatile text-generation model that can be integrated into different workflows such as agents, rational thinking and data interpretation tasks.
DeepSeek-R1 uses a Mixture of Experts (MoE) architecture and is 671 billion criteria in size. The MoE architecture enables activation of 37 billion criteria, enabling efficient inference by routing inquiries to the most relevant specialist "clusters." This approach permits the model to focus on different problem domains while maintaining general effectiveness. DeepSeek-R1 needs at least 800 GB of HBM memory in FP8 format for inference. In this post, we will utilize an ml.p5e.48 xlarge instance to deploy the design. ml.p5e.48 xlarge features 8 Nvidia H200 GPUs providing 1128 GB of GPU memory.
DeepSeek-R1 distilled designs bring the thinking abilities of the main R1 model to more efficient architectures based on popular open designs like Qwen (1.5 B, 7B, 14B, and 32B) and Llama (8B and 70B). Distillation refers to a procedure of training smaller sized, more efficient designs to imitate the habits and thinking patterns of the bigger DeepSeek-R1 design, utilizing it as a teacher model.
You can release DeepSeek-R1 design either through SageMaker JumpStart or Bedrock Marketplace. Because DeepSeek-R1 is an emerging model, we advise deploying this design with guardrails in location. In this blog site, we will use Amazon Bedrock Guardrails to introduce safeguards, prevent damaging content, and examine designs against essential security requirements. At the time of composing this blog, for DeepSeek-R1 implementations on SageMaker JumpStart and Bedrock Marketplace, Bedrock Guardrails supports only the ApplyGuardrail API. You can create multiple guardrails tailored to different use cases and use them to the DeepSeek-R1 design, enhancing user experiences and standardizing security controls across your generative AI applications.
Prerequisites
To release the DeepSeek-R1 model, you require access to an ml.p5e instance. To inspect if you have quotas for P5e, open the Service Quotas console and under AWS Services, choose Amazon SageMaker, and confirm you're utilizing 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 deploying. To request a limit increase, produce a limit boost request and connect to your account group.
Because you will be deploying this model with Amazon Bedrock Guardrails, make certain you have the correct AWS Identity and Gain Access To Management (IAM) permissions to utilize Amazon Bedrock Guardrails. For guidelines, see Establish approvals to use guardrails for material filtering.
guardrails with the ApplyGuardrail API
Amazon Bedrock Guardrails enables you to introduce safeguards, prevent hazardous content, and assess models against key security criteria. You can execute precaution for the DeepSeek-R1 model utilizing the Amazon Bedrock ApplyGuardrail API. This allows you to apply guardrails to examine user inputs and design reactions 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 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 to the model for reasoning. After getting the design's output, another guardrail check is used. If the output passes this final check, it's returned as the result. 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 occurred at the input or output phase. The examples showcased in the following sections demonstrate reasoning 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, total the following steps:
1. On the Amazon Bedrock console, choose Model brochure under Foundation designs in the navigation pane.
At the time of writing this post, you can use the InvokeModel API to conjure up the design. It does not support Converse APIs and other Amazon Bedrock tooling.
2. Filter for DeepSeek as a service provider and choose the DeepSeek-R1 model.
The model detail page supplies vital details about the design's abilities, prices structure, and implementation standards. You can discover detailed usage directions, including sample API calls and code snippets for integration. The design supports various text generation tasks, consisting of content production, code generation, and concern answering, utilizing its support learning optimization and CoT reasoning capabilities.
The page also includes implementation choices and licensing details to assist you begin with DeepSeek-R1 in your applications.
3. To begin utilizing DeepSeek-R1, choose Deploy.
You will be prompted to set up the release details for DeepSeek-R1. The model ID will be pre-populated.
4. For Endpoint name, enter an endpoint name (in between 1-50 alphanumeric characters).
5. For Number of circumstances, enter a variety of instances (between 1-100).
6. For Instance type, pick your circumstances type. For optimum performance with DeepSeek-R1, a GPU-based instance type like ml.p5e.48 xlarge is suggested.
Optionally, you can configure innovative security and infrastructure settings, consisting of virtual private cloud (VPC) networking, service function permissions, and file encryption settings. For most utilize cases, the default settings will work well. However, for production releases, you might wish to review these settings to align with your organization's security and compliance requirements.
7. Choose Deploy to begin using the model.
When the implementation is total, you can evaluate DeepSeek-R1's capabilities straight in the Amazon Bedrock play area.
8. Choose Open in playground to access an interactive interface where you can experiment with various triggers and change design parameters like temperature level and maximum length.
When utilizing R1 with Bedrock's InvokeModel and Playground Console, utilize DeepSeek's chat design template for optimum results. For example, content for inference.
This is an excellent method to explore the model's reasoning and text generation abilities before integrating it into your applications. The play area provides instant feedback, helping you understand how the model reacts to numerous inputs and letting you tweak your triggers for optimum results.
You can rapidly check the design in the play ground through the UI. However, to invoke the released model programmatically with any Amazon Bedrock APIs, you require to get the endpoint ARN.
Run inference utilizing guardrails with the released DeepSeek-R1 endpoint
The following code example demonstrates how to carry out inference using a deployed DeepSeek-R1 model 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 produce the guardrail, see the GitHub repo. After you have produced the guardrail, utilize the following code to carry out guardrails. The script initializes the bedrock_runtime client, sets up inference specifications, and sends out a demand to generate text based upon a user timely.
Deploy DeepSeek-R1 with SageMaker JumpStart
SageMaker JumpStart is an artificial intelligence (ML) hub with FMs, integrated algorithms, and prebuilt ML services that you can release with just a couple of clicks. With SageMaker JumpStart, you can tailor pre-trained models to your usage case, with your data, and release them into production utilizing either the UI or SDK.
Deploying DeepSeek-R1 design through SageMaker JumpStart offers 2 hassle-free methods: utilizing the user-friendly SageMaker JumpStart UI or carrying out programmatically through the SageMaker Python SDK. Let's explore both approaches to help you pick the method that best matches your needs.
Deploy DeepSeek-R1 through SageMaker JumpStart UI
Complete the following steps to deploy DeepSeek-R1 utilizing SageMaker JumpStart:
1. On the SageMaker console, pick Studio in the navigation pane.
2. First-time users will be prompted to produce a domain.
3. On the SageMaker Studio console, select JumpStart in the navigation pane.
The design web browser displays available models, with details like the company name and model abilities.
4. Search for DeepSeek-R1 to see the DeepSeek-R1 model card.
Each model card shows essential details, including:
- Model name
- Provider name
- Task category (for instance, Text Generation).
Bedrock Ready badge (if relevant), suggesting that this design can be signed up with Amazon Bedrock, permitting you to use Amazon Bedrock APIs to conjure up the model
5. Choose the model card to see the design details page.
The model details page includes the following details:
- The design name and company details. Deploy button to release the design. About and Notebooks tabs with detailed details
The About tab consists of important details, such as:
- Model description. - License details. - Technical specs.
- Usage guidelines
Before you deploy the design, it's suggested to examine the design details and license terms to verify compatibility with your usage case.
6. Choose Deploy to proceed with deployment.
7. For Endpoint name, utilize the automatically created name or create a custom one.
- For example type ¸ select an instance type (default: ml.p5e.48 xlarge).
- For Initial instance count, enter the variety of circumstances (default: 1). Selecting appropriate instance types and counts is crucial for expense and performance optimization. Monitor your implementation to adjust these settings as needed.Under Inference type, Real-time reasoning is selected by default. This is enhanced for sustained traffic and low latency.
- Review all setups for precision. For this model, we highly advise adhering to SageMaker JumpStart default settings and making certain that network isolation remains in location.
- Choose Deploy to release the design.
The release procedure can take several minutes to complete.
When deployment is complete, your endpoint status will alter to InService. At this point, the design is prepared to accept reasoning requests through the endpoint. You can keep track of the deployment development on the SageMaker console Endpoints page, which will display pertinent metrics and status details. When the deployment is complete, you can conjure up the design utilizing a SageMaker runtime customer and integrate it with your applications.
Deploy DeepSeek-R1 using the SageMaker Python SDK
To start with DeepSeek-R1 utilizing the SageMaker Python SDK, you will require to install the SageMaker Python SDK and make certain you have the essential AWS approvals and environment setup. The following is a detailed code example that demonstrates how to deploy and use 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 extra requests 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 utilizing the Amazon Bedrock console or the API, and execute it as shown in the following code:
Clean 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 utilizing Amazon Bedrock Marketplace, total the following actions:
1. On the Amazon Bedrock console, under Foundation models in the navigation pane, select Marketplace releases. - In the Managed implementations section, locate the endpoint you want to erase.
- Select the endpoint, and on the Actions menu, choose Delete.
- Verify the endpoint details to make certain you're erasing the appropriate 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 erase the endpoint if you want 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 utilizing 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 designs, SageMaker JumpStart pretrained designs, 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 helps emerging generative AI business construct innovative options utilizing AWS services and accelerated compute. Currently, he is focused on developing techniques for fine-tuning and enhancing the reasoning efficiency of large language models. In his totally free time, archmageriseswiki.com Vivek delights in treking, enjoying motion pictures, and attempting different foods.
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 a Professional Solutions Architect dealing with generative AI with the Third-Party Model Science team at AWS.
Banu Nagasundaram leads item, engineering, and tactical partnerships for Amazon SageMaker JumpStart, SageMaker's artificial intelligence and generative AI hub. She is passionate about building solutions that help customers accelerate their AI journey and unlock company worth.