Today, we are excited 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 design, DeepSeek-R1, along with the distilled versions varying from 1.5 to 70 billion parameters to build, 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 actions to deploy the distilled variations of the models as well.
Overview of DeepSeek-R1
DeepSeek-R1 is a big language model (LLM) developed by DeepSeek AI that utilizes reinforcement learning to enhance thinking abilities through a multi-stage training process from a DeepSeek-V3-Base structure. An essential identifying function is its support knowing (RL) action, which was utilized to fine-tune the design's responses beyond the standard pre-training and tweak procedure. By integrating RL, DeepSeek-R1 can adjust more effectively to user feedback and goals, eventually enhancing both importance and clarity. In addition, DeepSeek-R1 employs a chain-of-thought (CoT) approach, suggesting it's equipped to break down complicated queries and factor through them in a detailed manner. This guided thinking process permits the model to produce more precise, transparent, and detailed responses. This model combines RL-based fine-tuning with CoT capabilities, aiming to produce structured actions while concentrating on interpretability and user interaction. With its wide-ranging abilities DeepSeek-R1 has captured the market's attention as a versatile text-generation design that can be integrated into numerous workflows such as agents, rational thinking and data analysis jobs.
DeepSeek-R1 utilizes a Mix of Experts (MoE) architecture and is 671 billion criteria in size. The MoE architecture permits activation of 37 billion specifications, allowing efficient inference by routing questions to the most pertinent expert "clusters." This approach permits the model to concentrate on different problem domains while maintaining general performance. DeepSeek-R1 needs at least 800 GB of HBM memory in FP8 format for inference. In this post, we will use an ml.p5e.48 xlarge circumstances to release the model. ml.p5e.48 xlarge includes 8 Nvidia H200 GPUs supplying 1128 GB of GPU memory.
DeepSeek-R1 distilled models bring the reasoning abilities 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 efficient models to imitate the habits and thinking patterns of the larger DeepSeek-R1 design, using it as an instructor model.
You can deploy DeepSeek-R1 model either through SageMaker JumpStart or Bedrock Marketplace. Because DeepSeek-R1 is an emerging model, we recommend deploying this design with guardrails in place. In this blog, we will utilize Amazon Bedrock Guardrails to introduce safeguards, prevent harmful material, and evaluate designs against essential safety 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 usage cases and apply them to the DeepSeek-R1 model, improving user experiences and standardizing safety controls across your generative AI applications.
Prerequisites
To release the DeepSeek-R1 model, you need access to an ml.p5e instance. To check if you have quotas for P5e, open the Service Quotas console and under AWS Services, select 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 boost, develop a limit increase request and connect to your account team.
Because you will be releasing this design with Amazon Bedrock Guardrails, make certain you have the proper AWS Identity and Gain Access To Management (IAM) consents to use Amazon Bedrock Guardrails. For instructions, see Set up permissions to use guardrails for content filtering.
Implementing guardrails with the ApplyGuardrail API
Amazon Bedrock Guardrails enables you to present safeguards, avoid harmful material, and examine models against key safety criteria. You can execute precaution for the DeepSeek-R1 model utilizing the Amazon Bedrock ApplyGuardrail API. This enables you to apply guardrails to evaluate user inputs and design reactions 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 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 out to the design 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 last 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 took place at the input or output stage. The examples showcased in the following sections demonstrate reasoning using this API.
Deploy DeepSeek-R1 in Amazon Bedrock Marketplace
Amazon Bedrock Marketplace gives you access to over 100 popular, emerging, and specialized structure designs (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 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 service provider and choose the DeepSeek-R1 design.
The model detail page supplies vital details about the model's abilities, prices structure, and application standards. You can find detailed use guidelines, consisting of sample API calls and code bits for combination. The design supports different text generation tasks, including content development, code generation, and concern answering, using its reinforcement discovering optimization and CoT thinking capabilities.
The page also consists of implementation alternatives and licensing details to help you get begun with DeepSeek-R1 in your applications.
3. To begin using DeepSeek-R1, select 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 Variety of circumstances, enter a number of instances (between 1-100).
6. For Instance type, select your instance type. For optimal performance with DeepSeek-R1, a GPU-based circumstances 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 role permissions, and file encryption settings. For a lot of utilize cases, the default settings will work well. However, for production deployments, you might wish to evaluate these settings to line up with your company's security and compliance requirements.
7. Choose Deploy to start utilizing the model.
When the implementation is total, you can check DeepSeek-R1's abilities straight in the Amazon Bedrock play area.
8. Choose Open in playground to access an interactive interface where you can try out various triggers and change design specifications like temperature level and optimum length.
When utilizing R1 with Bedrock's InvokeModel and Playground Console, utilize DeepSeek's chat template for optimum outcomes. For instance, material for inference.
This is an exceptional way to check out the design's thinking and text generation capabilities before integrating it into your applications. The play area provides instant feedback, helping you comprehend how the model reacts to numerous inputs and letting you tweak your prompts for ideal outcomes.
You can 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 reasoning utilizing guardrails with the released DeepSeek-R1 endpoint
The following code example demonstrates how to carry out reasoning using a deployed DeepSeek-R1 design through Amazon Bedrock using the invoke_model and ApplyGuardrail API. You can produce a guardrail using the Amazon Bedrock console or the API. For the example code to develop the guardrail, see the GitHub repo. After you have created the guardrail, utilize the following code to implement guardrails. The script initializes the bedrock_runtime customer, sets up inference parameters, and sends a demand to generate text based upon a user prompt.
Deploy DeepSeek-R1 with SageMaker JumpStart
SageMaker JumpStart is an artificial intelligence (ML) hub with FMs, integrated algorithms, and prebuilt ML options that you can deploy with simply a couple of clicks. With SageMaker JumpStart, you can tailor pre-trained designs 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 practical techniques: utilizing the intuitive SageMaker JumpStart UI or implementing programmatically through the SageMaker Python SDK. Let's explore both techniques to assist you choose the approach that finest matches your requirements.
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 create a domain.
3. On the SageMaker Studio console, bytes-the-dust.com pick JumpStart in the navigation pane.
The design browser shows available designs, with details like the provider name and model capabilities.
4. Search for DeepSeek-R1 to see the DeepSeek-R1 design card.
Each design card reveals essential details, including:
- Model name
- Provider name
- Task category (for example, Text Generation).
Bedrock Ready badge (if relevant), showing that this design can be signed up with Amazon Bedrock, enabling you to utilize Amazon Bedrock APIs to conjure up the model
5. Choose the model card to see the model details page.
The model details page consists of the following details:
- The model name and company 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 specs.
- Usage guidelines
Before you release the design, it's advised to examine the model details and license terms to validate compatibility with your use case.
6. Choose Deploy to continue with release.
7. For Endpoint name, use the automatically produced name or develop a customized one.
- For Instance type ¸ pick a circumstances type (default: ml.p5e.48 xlarge).
- For Initial circumstances count, enter the variety of circumstances (default: 1). Selecting proper circumstances types and counts is essential for expense and efficiency optimization. Monitor your implementation to change these settings as needed.Under Inference type, Real-time inference is selected by default. This is optimized for sustained traffic and low latency.
- Review all setups for precision. For this design, we highly recommend sticking to SageMaker JumpStart default settings and making certain that network seclusion remains in place.
- Choose Deploy to release the design.
The deployment process can take a number of minutes to complete.
When deployment is total, your endpoint status will alter to InService. At this point, the model 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 release is complete, you can conjure up the design using a SageMaker runtime customer and incorporate it with your applications.
Deploy DeepSeek-R1 utilizing 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 essential AWS permissions 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 design is provided in the Github here. You can clone the notebook and run from SageMaker Studio.
You can run additional demands against the predictor:
Implement guardrails and run reasoning with your SageMaker JumpStart predictor
Similar to Amazon Bedrock, you can likewise use the ApplyGuardrail API with your SageMaker JumpStart predictor. 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, complete the actions in this section to clean up your resources.
Delete the Amazon Bedrock Marketplace release
If you released the model using Amazon Bedrock Marketplace, complete the following steps:
1. On the Amazon Bedrock console, under Foundation designs in the navigation pane, pick Marketplace releases. - In the Managed releases area, find the endpoint you desire to delete.
- Select the endpoint, and on the Actions menu, choose Delete.
- Verify the endpoint details to make certain you're erasing the appropriate release: 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 checked out 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 begin. For more details, describe Use Amazon Bedrock tooling with Amazon SageMaker JumpStart models, SageMaker JumpStart pretrained designs, 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 business develop innovative options using AWS services and sped up compute. Currently, he is focused on establishing strategies for fine-tuning and enhancing the inference efficiency of large language models. In his downtime, Vivek takes pleasure in treking, enjoying movies, and trying various 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 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 product, engineering, and tactical collaborations for Amazon SageMaker JumpStart, SageMaker's artificial intelligence and generative AI center. She is enthusiastic about developing solutions that assist customers accelerate their AI journey and unlock service value.