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, along with the distilled variations varying from 1.5 to 70 billion criteria to construct, experiment, and responsibly scale your generative AI ideas on AWS.
In this post, we demonstrate how to get going 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 model (LLM) established by DeepSeek AI that utilizes reinforcement finding out to boost reasoning capabilities through a multi-stage training procedure from a DeepSeek-V3-Base structure. A crucial distinguishing function is its support learning (RL) step, which was used to improve the design's responses beyond the standard pre-training and tweak process. By incorporating RL, DeepSeek-R1 can adapt more successfully to user feedback and objectives, eventually improving both significance and clarity. In addition, DeepSeek-R1 uses a chain-of-thought (CoT) method, indicating it's equipped to break down intricate questions and factor through them in a detailed manner. This guided thinking process allows the design to produce more accurate, transparent, and detailed answers. This design integrates RL-based fine-tuning with CoT capabilities, aiming to create structured responses while concentrating on interpretability and user interaction. With its comprehensive capabilities DeepSeek-R1 has recorded the market's attention as a versatile text-generation model that can be integrated into numerous workflows such as representatives, sensible reasoning and information analysis jobs.
DeepSeek-R1 uses a Mixture of Experts (MoE) architecture and is 671 billion criteria in size. The MoE architecture allows activation of 37 billion specifications, making it possible for efficient inference by routing questions to the most pertinent expert "clusters." This technique permits the model to specialize in different problem domains while maintaining overall effectiveness. DeepSeek-R1 requires a minimum of 800 GB of HBM memory in FP8 format for reasoning. In this post, we will use an ml.p5e.48 xlarge instance to release the design. ml.p5e.48 xlarge comes with 8 Nvidia H200 GPUs providing 1128 GB of GPU memory.
DeepSeek-R1 distilled models 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, more effective designs to simulate the behavior 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 model, we suggest releasing this model with guardrails in location. In this blog, we will use Amazon Bedrock Guardrails to introduce safeguards, avoid harmful content, and assess designs against essential security 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 produce multiple guardrails tailored to various usage cases and use them to the DeepSeek-R1 design, improving 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 circumstances. To check if you have quotas for P5e, open the Service Quotas console and under AWS Services, choose Amazon SageMaker, and verify 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 releasing. To ask for a limit increase, produce a limitation increase demand and reach out to your account group.
Because you will be releasing this design with Amazon Bedrock Guardrails, make certain you have the right AWS Identity and To Management (IAM) permissions to utilize Amazon Bedrock Guardrails. For instructions, see Set up authorizations to use guardrails for content filtering.
Implementing guardrails with the ApplyGuardrail API
Amazon Bedrock Guardrails allows you to present safeguards, avoid damaging material, and evaluate models against crucial safety requirements. You can implement security measures for the DeepSeek-R1 design utilizing the Amazon Bedrock ApplyGuardrail API. This permits you to apply guardrails to examine user inputs and design reactions deployed 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 general circulation includes the following steps: First, the system receives 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 applied. If the output passes this final check, hb9lc.org it's returned as the last outcome. However, if either the input or output is intervened by the guardrail, a message is returned suggesting the nature of the intervention and whether it happened at the input or output stage. The examples showcased in the following areas show reasoning utilizing this API.
Deploy DeepSeek-R1 in Amazon Bedrock Marketplace
Amazon Bedrock Marketplace gives you access to over 100 popular, emerging, and specialized foundation 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 model. It doesn't support Converse APIs and other Amazon Bedrock tooling.
2. Filter for DeepSeek as a service provider and pick the DeepSeek-R1 model.
The model detail page supplies necessary details about the design's abilities, pricing structure, and application guidelines. You can find detailed use guidelines, consisting of sample API calls and code snippets for integration. The design supports numerous text generation jobs, including content production, code generation, and question answering, using its reinforcement learning optimization and CoT thinking capabilities.
The page likewise includes implementation choices and licensing details to assist you get going with DeepSeek-R1 in your applications.
3. To begin utilizing DeepSeek-R1, select Deploy.
You will be triggered to configure the implementation details for DeepSeek-R1. The model ID will be pre-populated.
4. For Endpoint name, enter an endpoint name (between 1-50 alphanumeric characters).
5. For Variety of instances, get in a number of instances (between 1-100).
6. For Instance type, choose your circumstances type. For optimum efficiency with DeepSeek-R1, a GPU-based instance type like ml.p5e.48 xlarge is recommended.
Optionally, you can set up sophisticated security and infrastructure settings, including virtual personal cloud (VPC) networking, service function permissions, and file encryption settings. For most use cases, the default settings will work well. However, for production implementations, you might want to review these settings to line up with your organization's security and compliance requirements.
7. Choose Deploy to begin utilizing the model.
When the implementation is complete, you can evaluate DeepSeek-R1's capabilities straight in the Amazon Bedrock play ground.
8. Choose Open in playground to access an interactive interface where you can explore various triggers and change model parameters like temperature and maximum length.
When utilizing R1 with Bedrock's InvokeModel and Playground Console, use DeepSeek's chat template for ideal results. For instance, material for inference.
This is an exceptional method to explore the model's reasoning and text generation abilities before integrating it into your applications. The play ground offers immediate feedback, assisting you understand how the design reacts to various inputs and letting you tweak your triggers for optimum outcomes.
You can quickly check the model in the play ground through the UI. However, to conjure up the released model programmatically with any Amazon Bedrock APIs, you need to get the endpoint ARN.
Run inference utilizing guardrails with the deployed DeepSeek-R1 endpoint
The following code example shows how to carry out reasoning using a released DeepSeek-R1 design through Amazon Bedrock using the invoke_model and ApplyGuardrail API. You can develop a guardrail utilizing the Amazon Bedrock console or the API. For the example code to develop the guardrail, see the GitHub repo. After you have actually produced the guardrail, use the following code to carry out guardrails. The script initializes the bedrock_runtime client, sets up reasoning criteria, and sends a demand to produce 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 options that you can deploy with simply a few clicks. With SageMaker JumpStart, you can tailor pre-trained models to your usage case, with your data, and deploy them into production utilizing either the UI or SDK.
Deploying DeepSeek-R1 model through SageMaker JumpStart offers two hassle-free techniques: using the instinctive SageMaker JumpStart UI or executing programmatically through the SageMaker Python SDK. Let's check out both techniques to assist you select the approach that finest 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, select 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 model internet browser shows available models, with details like the supplier name and model abilities.
4. Search for DeepSeek-R1 to view the DeepSeek-R1 design card.
Each design card reveals key details, including:
- Model name
- Provider name
- Task category (for example, Text Generation).
Bedrock Ready badge (if appropriate), indicating that this design can be registered with Amazon Bedrock, allowing you to utilize Amazon Bedrock APIs to invoke the model
5. Choose the design card to see the model details page.
The design details page consists of the following details:
- The model name and service provider details. Deploy button to release the design. About and Notebooks tabs with detailed details
The About tab includes essential details, such as:
- Model description. - License details.
- Technical requirements.
- Usage guidelines
Before you deploy the design, it's recommended to examine the model details and license terms to validate compatibility with your usage case.
6. Choose Deploy to proceed with deployment.
7. For Endpoint name, utilize the instantly produced name or create a custom one.
- For Instance type ¸ pick a circumstances type (default: ml.p5e.48 xlarge).
- For Initial instance count, get in the number of circumstances (default: 1). Selecting appropriate instance types and counts is important for expense and efficiency 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 design, we strongly recommend adhering to SageMaker JumpStart default settings and making certain that network isolation remains in location.
- Choose Deploy to deploy the model.
The implementation procedure can take several minutes to complete.
When release is total, your endpoint status will alter to InService. At this moment, the design is all set to accept inference demands through the endpoint. You can keep an eye on the implementation development on the SageMaker console Endpoints page, which will show relevant metrics and status details. When the implementation is complete, you can conjure up the design using a SageMaker runtime client and integrate it with your applications.
Deploy DeepSeek-R1 using the SageMaker Python SDK
To get begun with DeepSeek-R1 utilizing the SageMaker Python SDK, you will need to set up the SageMaker Python SDK and make certain you have the needed AWS permissions and environment setup. The following is a detailed code example that demonstrates how to deploy 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 range from SageMaker Studio.
You can run extra requests against the predictor:
Implement guardrails and run reasoning 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 undesirable charges, finish the actions 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 actions:
1. On the Amazon Bedrock console, under Foundation designs in the navigation pane, select Marketplace implementations. - In the Managed deployments area, find 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 right 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 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 start. 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 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 build innovative solutions utilizing AWS services and accelerated compute. Currently, he is concentrated on establishing strategies for fine-tuning and enhancing the inference efficiency of large language designs. In his spare time, Vivek delights in hiking, viewing movies, and trying various foods.
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 technology and Bioinformatics.
Jonathan Evans is a Professional Solutions Architect dealing with generative AI with the Third-Party Model Science group at AWS.
Banu Nagasundaram leads item, engineering, and strategic partnerships for Amazon SageMaker JumpStart, SageMaker's artificial intelligence and generative AI center. She is enthusiastic about constructing services that assist clients accelerate their AI journey and unlock company value.