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 design, DeepSeek-R1, together 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 designs as well.
Overview of DeepSeek-R1
DeepSeek-R1 is a large language design (LLM) developed by DeepSeek AI that utilizes reinforcement discovering to improve reasoning capabilities through a multi-stage training procedure from a DeepSeek-V3-Base structure. A crucial differentiating function is its support learning (RL) action, which was used to refine the design's actions beyond the standard pre-training and tweak procedure. By integrating RL, DeepSeek-R1 can adapt better to user feedback and goals, ultimately enhancing both significance and clearness. In addition, DeepSeek-R1 uses a chain-of-thought (CoT) approach, implying it's equipped to break down intricate queries and factor through them in a detailed manner. This assisted reasoning process enables the design to produce more precise, transparent, and detailed responses. This model integrates RL-based fine-tuning with CoT capabilities, aiming to produce structured actions while focusing on interpretability and user interaction. With its extensive abilities DeepSeek-R1 has recorded the industry's attention as a versatile text-generation model that can be integrated into numerous workflows such as representatives, rational reasoning and data interpretation tasks.
DeepSeek-R1 utilizes a Mixture of Experts (MoE) architecture and is 671 billion specifications in size. The MoE architecture permits activation of 37 billion criteria, allowing efficient reasoning by routing questions to the most pertinent expert "clusters." This method allows the design to concentrate on various problem domains while maintaining total efficiency. 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 instance to deploy the model. ml.p5e.48 xlarge features 8 Nvidia H200 GPUs supplying 1128 GB of GPU memory.
DeepSeek-R1 distilled designs bring the reasoning abilities of the main R1 design 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 sized, more effective designs to imitate the behavior and thinking patterns of the bigger DeepSeek-R1 design, utilizing it as a teacher design.
You can release 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 site, we will utilize Amazon Bedrock Guardrails to introduce safeguards, prevent damaging material, and examine models against crucial safety requirements. At the time of writing this blog site, for DeepSeek-R1 releases on SageMaker JumpStart and Bedrock Marketplace, Bedrock Guardrails supports only the ApplyGuardrail API. You can create several guardrails tailored to various use cases and use them to the DeepSeek-R1 model, enhancing user experiences and standardizing safety controls throughout your generative AI applications.
Prerequisites
To release the DeepSeek-R1 model, you need access to an ml.p5e instance. To examine if you have quotas for P5e, open the Service Quotas console and under AWS Services, choose Amazon SageMaker, and confirm you're using 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 releasing. To request a limit boost, develop a limit boost request and reach out 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) authorizations to utilize Amazon Bedrock Guardrails. For instructions, see Establish permissions to utilize guardrails for content filtering.
Implementing guardrails with the ApplyGuardrail API
Amazon Bedrock Guardrails permits you to introduce safeguards, prevent damaging material, and evaluate models against key security requirements. You can implement safety steps for the DeepSeek-R1 model using the Amazon Bedrock ApplyGuardrail API. This allows you to apply guardrails to examine user inputs and design reactions released on Amazon Bedrock Marketplace and SageMaker JumpStart. You can produce a guardrail using the Amazon Bedrock console or the API. For the example code to create the guardrail, see the GitHub repo.
The basic flow involves 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 inference. After receiving the model's output, another guardrail check is applied. If the output passes this final check, it's returned as the 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 took place at the input or output phase. The examples showcased in the following areas demonstrate inference utilizing 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 catalog under Foundation designs in the navigation pane.
At the time of composing this post, you can utilize the InvokeModel API to conjure up the design. It doesn't support Converse APIs and other Amazon Bedrock tooling.
2. Filter for DeepSeek as a supplier and select the DeepSeek-R1 model.
The design detail page provides vital details about the model's capabilities, rates structure, and execution guidelines. You can find detailed use directions, including sample API calls and code bits for integration. The model supports different text generation tasks, including content creation, code generation, and concern answering, utilizing its support discovering optimization and CoT reasoning capabilities.
The page likewise consists of implementation choices and licensing details to assist you get going with DeepSeek-R1 in your applications.
3. To start utilizing DeepSeek-R1, choose Deploy.
You will be prompted to configure the release 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 Number of circumstances, enter a number of instances (in between 1-100).
6. For Instance type, pick your circumstances type. For ideal efficiency with DeepSeek-R1, a GPU-based circumstances type like ml.p5e.48 xlarge is suggested.
Optionally, you can configure advanced security and infrastructure settings, consisting of virtual private cloud (VPC) networking, service function authorizations, and encryption settings. For many use cases, the default settings will work well. However, for production implementations, you might want to evaluate these settings to align with your company's security and compliance requirements.
7. Choose Deploy to begin utilizing the model.
When the release is complete, you can check 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 experiment with different triggers and change design criteria like temperature and maximum length.
When utilizing R1 with Bedrock's InvokeModel and Playground Console, utilize DeepSeek's chat template for ideal outcomes. For instance, material for reasoning.
This is an outstanding way to check out the model's thinking and text generation abilities before integrating it into your applications. The play ground supplies immediate feedback, assisting you comprehend how the model reacts to various inputs and letting you tweak your triggers for optimum outcomes.
You can quickly check the design in the playground through the UI. However, to conjure up the deployed design programmatically with any Amazon Bedrock APIs, you require to get the endpoint ARN.
Run inference using guardrails with the released DeepSeek-R1 endpoint
The following code example demonstrates how to carry out inference utilizing a released DeepSeek-R1 model through Amazon Bedrock using the invoke_model and ApplyGuardrail API. You can create 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 created the guardrail, utilize the following code to carry out guardrails. The script initializes the bedrock_runtime customer, configures inference specifications, and sends a demand to produce text based on a user prompt.
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 use case, with your information, and release them into production utilizing either the UI or SDK.
Deploying DeepSeek-R1 design through SageMaker JumpStart uses two hassle-free approaches: using the intuitive SageMaker JumpStart UI or carrying out programmatically through the SageMaker Python SDK. Let's explore both methods to help you pick the technique that best fits 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 triggered to produce a domain.
3. On the SageMaker Studio console, select JumpStart in the navigation pane.
The model browser shows available models, with details like the supplier name and design abilities.
4. Search for DeepSeek-R1 to see the DeepSeek-R1 design card.
Each design card shows essential details, consisting of:
- Model name
- Provider name
- Task classification (for instance, Text Generation).
Bedrock Ready badge (if applicable), suggesting that this model can be signed up with Amazon Bedrock, allowing you to utilize Amazon Bedrock APIs to conjure up the design
5. Choose the model card to view the design details page.
The model details page consists of the following details:
- The model name and provider details. Deploy button to deploy the design. About and Notebooks tabs with detailed details
The About tab consists of crucial details, such as:
- Model description. - License details.
- Technical specifications.
- Usage guidelines
Before you release the model, it's advised to evaluate the design details and license terms to validate compatibility with your use case.
6. Choose Deploy to proceed with implementation.
7. For Endpoint name, use the immediately generated name or produce a custom-made one.
- For Instance type ¸ choose an instance type (default: ml.p5e.48 xlarge).
- For Initial instance count, go into the number of instances (default: 1). Selecting appropriate circumstances types and counts is essential for expense and performance optimization. Monitor your deployment to change these settings as needed.Under Inference type, Real-time inference is selected by default. This is enhanced for sustained traffic and low latency.
- Review all setups for precision. For this model, 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 release is complete, your endpoint status will alter to InService. At this moment, the design is all set to accept inference demands through the endpoint. You can monitor the implementation development on the SageMaker console Endpoints page, which will display relevant metrics and status details. When the deployment is complete, you can invoke the design utilizing a SageMaker runtime customer and incorporate it with your applications.
Deploy DeepSeek-R1 utilizing 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 consents and environment setup. The following is a detailed code example that shows how to deploy and use DeepSeek-R1 for reasoning programmatically. The code for deploying the model is supplied in the Github here. You can clone the note pad 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 JumpStart predictor. You can produce a guardrail using the Amazon Bedrock console or the API, and implement it as displayed in the following code:
Tidy up
To prevent unwanted charges, finish the steps in this area to clean up your resources.
Delete the Amazon Bedrock Marketplace implementation
If you released the model utilizing Amazon Bedrock Marketplace, total the following actions:
1. On the console, under Foundation designs in the navigation pane, select Marketplace deployments. - In the Managed releases section, find 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 deleting the proper release: 1. Endpoint name.
- Model name.
- Endpoint status
Delete the SageMaker JumpStart predictor
The SageMaker JumpStart design you released 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 deploy the DeepSeek-R1 model using 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 designs, SageMaker JumpStart pretrained models, Amazon SageMaker JumpStart Foundation Models, Amazon Bedrock Marketplace, and Getting going 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 construct innovative solutions using AWS services and accelerated compute. Currently, he is focused on developing strategies for fine-tuning and optimizing the reasoning performance of large language designs. In his free time, Vivek delights in treking, bytes-the-dust.com enjoying motion pictures, and trying 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 Specialist Solutions Architect dealing with generative AI with the Third-Party Model Science team at AWS.
Banu Nagasundaram leads product, engineering, and strategic partnerships for Amazon SageMaker JumpStart, SageMaker's artificial intelligence and generative AI center. She is enthusiastic about developing solutions that assist clients accelerate their AI journey and unlock service value.