Today, we are thrilled to reveal that DeepSeek R1 distilled Llama and Qwen designs are available through Amazon Bedrock Marketplace and Amazon SageMaker JumpStart. With this launch, you can now deploy DeepSeek AI's first-generation frontier model, DeepSeek-R1, in addition to the distilled versions varying from 1.5 to 70 billion specifications to construct, experiment, and properly scale your generative AI ideas on AWS.
In this post, we show how to get started 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 large language design (LLM) established by DeepSeek AI that uses reinforcement finding out to enhance thinking abilities through a multi-stage training process from a DeepSeek-V3-Base foundation. A crucial distinguishing function is its reinforcement knowing (RL) step, which was utilized to refine the model's responses beyond the standard pre-training and tweak process. By integrating RL, DeepSeek-R1 can adapt more effectively to user feedback and objectives, eventually enhancing both importance and clearness. In addition, DeepSeek-R1 employs a chain-of-thought (CoT) approach, implying it's equipped to break down complex questions and reason through them in a detailed manner. This assisted reasoning procedure enables the design to produce more accurate, transparent, and detailed answers. This model integrates RL-based fine-tuning with CoT capabilities, aiming to create structured responses while focusing on interpretability and user interaction. With its wide-ranging capabilities DeepSeek-R1 has actually caught the industry's attention as a flexible text-generation design that can be integrated into numerous workflows such as representatives, logical reasoning and information interpretation tasks.
DeepSeek-R1 utilizes a Mixture of Experts (MoE) architecture and is 671 billion specifications in size. The MoE architecture enables activation of 37 billion specifications, enabling effective inference by routing questions to the most pertinent specialist "clusters." This approach enables the design to specialize in various problem domains while maintaining overall effectiveness. DeepSeek-R1 requires a minimum of 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 design. ml.p5e.48 xlarge features 8 Nvidia H200 GPUs providing 1128 GB of GPU memory.
DeepSeek-R1 distilled designs bring the thinking capabilities of the main R1 model to more efficient architectures based upon popular open models like Qwen (1.5 B, 7B, 14B, and 32B) and Llama (8B and 70B). Distillation refers to a process of training smaller sized, more effective models to imitate the habits and thinking patterns of the larger DeepSeek-R1 design, utilizing it as a teacher model.
You can deploy DeepSeek-R1 design either through SageMaker JumpStart or Bedrock Marketplace. Because DeepSeek-R1 is an emerging model, we suggest deploying this design with guardrails in location. In this blog, we will utilize Amazon Bedrock Guardrails to introduce safeguards, avoid hazardous content, wiki.vst.hs-furtwangen.de and examine models against crucial security criteria. At the time of composing this blog site, for DeepSeek-R1 releases on SageMaker JumpStart and Bedrock Marketplace, Bedrock Guardrails supports only the ApplyGuardrail API. You can create numerous guardrails tailored to different usage cases and use them to the DeepSeek-R1 design, enhancing user experiences and standardizing safety controls across your generative AI applications.
Prerequisites
To deploy the DeepSeek-R1 design, 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, select 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 releasing. To request a limit increase, develop a limitation increase demand and connect to your account team.
Because you will be releasing this model with Amazon Bedrock Guardrails, make certain you have the correct AWS Identity and Gain Access To Management (IAM) consents to use Amazon Bedrock Guardrails. For instructions, see Set up permissions to use guardrails for material filtering.
Implementing guardrails with the ApplyGuardrail API
Amazon Bedrock Guardrails enables you to present safeguards, avoid damaging material, and evaluate models against essential safety requirements. You can implement precaution for the DeepSeek-R1 design using the Amazon Bedrock ApplyGuardrail API. This allows you to apply guardrails to evaluate user inputs and model reactions released on Amazon Bedrock Marketplace and SageMaker JumpStart. You can create a guardrail utilizing the Amazon Bedrock console or the API. For the example code to produce the guardrail, see the GitHub repo.
The basic flow involves the following steps: First, the system gets an input for the design. This input is then processed through the ApplyGuardrail API. If the input passes the guardrail check, it's sent to the design for reasoning. After receiving the design's output, another guardrail check is applied. 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 inference 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 actions:
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 provider and pick the DeepSeek-R1 model.
The design detail page supplies vital details about the design's capabilities, rates structure, and application standards. You can discover detailed use directions, including sample API calls and code snippets for integration. The design supports different text generation tasks, including material development, code generation, and concern answering, utilizing its support finding out optimization and CoT thinking capabilities.
The page also includes implementation alternatives and licensing details to help you get started with DeepSeek-R1 in your applications.
3. To start using DeepSeek-R1, choose Deploy.
You will be prompted to configure the implementation details for DeepSeek-R1. The model ID will be pre-populated.
4. For Endpoint name, go into an endpoint name (in between 1-50 alphanumeric characters).
5. For Number of circumstances, get in a number of instances (between 1-100).
6. For example 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 facilities settings, consisting of virtual private cloud (VPC) networking, service role approvals, and encryption settings. For the majority of utilize cases, the default settings will work well. However, for production releases, you may wish to review these settings to align with your company's security and compliance requirements.
7. Choose Deploy to begin utilizing the design.
When the release is total, you can evaluate DeepSeek-R1's capabilities straight in the Amazon Bedrock play ground.
8. Choose Open in play ground to access an interactive interface where you can try out different triggers and adjust model parameters like temperature and optimum length.
When utilizing R1 with Bedrock's InvokeModel and Playground Console, use DeepSeek's chat design template for optimum outcomes. For example, material for inference.
This is an excellent method to check out the design's thinking and text generation capabilities before integrating it into your applications. The playground provides immediate feedback, helping you comprehend how the design responds to various inputs and letting you fine-tune your prompts for optimum results.
You can rapidly check the design in the play ground through the UI. However, to conjure up the deployed model programmatically with any Amazon Bedrock APIs, you need to get the endpoint ARN.
Run reasoning using guardrails with the deployed DeepSeek-R1 endpoint
The following code example demonstrates how to perform reasoning using a deployed DeepSeek-R1 model through Amazon Bedrock using the invoke_model and ApplyGuardrail API. You can create 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 developed the guardrail, utilize the following code to execute guardrails. The script initializes the bedrock_runtime client, configures reasoning specifications, and sends a demand to create text based upon 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 deploy with just a few clicks. With SageMaker JumpStart, you can tailor pre-trained designs to your usage case, with your information, and deploy them into production using either the UI or SDK.
Deploying DeepSeek-R1 design through SageMaker JumpStart provides 2 practical techniques: utilizing the instinctive SageMaker JumpStart UI or executing programmatically through the SageMaker Python SDK. Let's explore both methods to help you select the approach that finest matches your requirements.
Deploy DeepSeek-R1 through SageMaker JumpStart UI
Complete the following steps to release DeepSeek-R1 using SageMaker JumpStart:
1. On the SageMaker console, choose Studio in the navigation pane.
2. First-time users will be triggered to develop a domain.
3. On the SageMaker Studio console, choose JumpStart in the navigation pane.
The design web browser displays available designs, with details like the provider name and design capabilities.
4. Look for DeepSeek-R1 to view the DeepSeek-R1 model card.
Each design card reveals key details, consisting of:
- Model name
- Provider name
- Task category (for example, Text Generation).
Bedrock Ready badge (if applicable), showing that this design can be registered with Amazon Bedrock, enabling you to use Amazon Bedrock APIs to invoke the model
5. Choose the design card to see the design details page.
The design details page includes the following details:
- The model name and supplier details. Deploy button to release the design. About and Notebooks tabs with detailed details
The About tab consists of crucial details, such as:
- Model . - License details.
- Technical specs.
- Usage standards
Before you deploy the design, it's advised to evaluate the design details and license terms to verify compatibility with your usage case.
6. Choose Deploy to proceed with implementation.
7. For Endpoint name, use the automatically generated name or develop a custom-made one.
- For Instance type ¸ select an instance type (default: ml.p5e.48 xlarge).
- For Initial instance count, go into the variety of instances (default: 1). Selecting proper instance types and counts is crucial for cost and performance optimization. Monitor your release to adjust 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 accuracy. For this model, we highly suggest sticking to SageMaker JumpStart default settings and making certain that network seclusion remains in place.
- Choose Deploy to release the model.
The deployment procedure can take numerous minutes to complete.
When implementation is total, your endpoint status will alter to InService. At this moment, the model is all set to accept inference requests through the endpoint. You can keep track of the implementation progress on the SageMaker console Endpoints page, which will display appropriate metrics and status details. When the implementation is total, you can invoke the model using a SageMaker runtime customer and integrate it with your applications.
Deploy DeepSeek-R1 utilizing the SageMaker Python SDK
To get going with DeepSeek-R1 using the SageMaker Python SDK, you will require to install the SageMaker Python SDK and make certain you have the necessary AWS consents 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 releasing the design is provided in the Github here. You can clone the notebook and range 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 likewise utilize the ApplyGuardrail API with your SageMaker JumpStart predictor. You can produce a guardrail utilizing the Amazon Bedrock console or the API, and execute it as displayed in the following code:
Tidy up
To avoid unwanted charges, finish the actions in this section to clean up your resources.
Delete the Amazon Bedrock Marketplace release
If you deployed the design utilizing Amazon Bedrock Marketplace, complete the following steps:
1. On the Amazon Bedrock console, under Foundation designs in the navigation pane, choose Marketplace releases. - In the Managed releases section, locate the endpoint you desire to delete.
- Select the endpoint, and on the Actions menu, pick Delete.
- Verify the endpoint details to make certain you're erasing the right deployment: 1. Endpoint name.
- Model name.
- Endpoint status
Delete the SageMaker JumpStart predictor
The SageMaker JumpStart model you released 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 checked out 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 begin. For more details, describe Use Amazon Bedrock tooling with Amazon SageMaker JumpStart models, SageMaker JumpStart pretrained models, Amazon SageMaker JumpStart Foundation Models, Amazon Bedrock Marketplace, and Beginning 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 construct ingenious services using AWS services and accelerated compute. Currently, he is focused on establishing methods for fine-tuning and enhancing the reasoning performance of large language models. In his leisure time, Vivek delights in hiking, watching movies, and trying different cuisines.
Niithiyn Vijeaswaran is a Generative AI Specialist Solutions Architect with the Third-Party Model Science group at AWS. His location of focus is AWS AI accelerators (AWS Neuron). He holds a Bachelor's degree in Computer Science 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 tactical partnerships for Amazon SageMaker JumpStart, SageMaker's artificial intelligence and generative AI center. She is passionate about constructing solutions that help consumers accelerate their AI journey and unlock organization worth.