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 deploy DeepSeek AI's first-generation frontier design, DeepSeek-R1, in addition to the distilled versions ranging from 1.5 to 70 billion parameters to develop, experiment, and properly scale your generative AI concepts on AWS.
In this post, we show how to begin with DeepSeek-R1 on Amazon Bedrock Marketplace and SageMaker JumpStart. You can follow comparable actions to deploy the distilled versions of the designs also.
Overview of DeepSeek-R1
DeepSeek-R1 is a big language design (LLM) developed by DeepSeek AI that uses support finding out to enhance reasoning capabilities through a multi-stage training procedure from a DeepSeek-V3-Base structure. A crucial identifying feature is its reinforcement learning (RL) step, which was utilized to improve the design's responses beyond the basic pre-training and fine-tuning process. By incorporating RL, DeepSeek-R1 can adapt more effectively to user feedback and goals, eventually improving both significance and clearness. In addition, DeepSeek-R1 uses a chain-of-thought (CoT) technique, indicating it's equipped to break down complex queries and factor through them in a detailed manner. This guided thinking procedure enables the design to produce more accurate, transparent, and detailed responses. This design combines RL-based fine-tuning with CoT abilities, aiming to generate structured reactions while focusing on interpretability and user interaction. With its extensive abilities DeepSeek-R1 has captured the market's attention as a flexible text-generation model that can be integrated into different workflows such as agents, logical reasoning and information interpretation tasks.
DeepSeek-R1 utilizes a Mixture of Experts (MoE) architecture and is 671 billion parameters in size. The MoE architecture allows activation of 37 billion parameters, allowing effective reasoning by routing inquiries to the most relevant expert "clusters." This technique allows the model to specialize in different problem domains while maintaining total efficiency. 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 deploy the design. ml.p5e.48 xlarge includes 8 Nvidia H200 GPUs offering 1128 GB of GPU memory.
DeepSeek-R1 distilled designs bring the thinking capabilities of the main R1 design 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 process of training smaller sized, more efficient designs to mimic the behavior and thinking patterns of the bigger DeepSeek-R1 model, 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 design, we advise deploying this model with guardrails in place. In this blog, we will utilize Amazon Bedrock Guardrails to introduce safeguards, avoid harmful material, and evaluate models against crucial security requirements. At the time of writing this blog, for DeepSeek-R1 deployments on SageMaker JumpStart and Bedrock Marketplace, Bedrock Guardrails supports only the ApplyGuardrail API. You can produce multiple guardrails tailored to different usage cases and apply them to the DeepSeek-R1 model, enhancing user experiences and standardizing safety 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, garagesale.es open the Service Quotas console and under AWS Services, choose Amazon SageMaker, and validate you're using ml.p5e.48 xlarge for endpoint usage. Make certain that you have at least one ml.P5e.48 xlarge circumstances in the AWS Region you are releasing. To request a limitation boost, create a limitation increase demand and connect to your account team.
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 use Amazon Bedrock Guardrails. For directions, see Establish permissions to use guardrails for content filtering.
Implementing guardrails with the ApplyGuardrail API
Amazon Bedrock Guardrails enables you to present safeguards, prevent harmful content, and examine models against key safety criteria. You can implement security measures for the DeepSeek-R1 design using the Amazon Bedrock ApplyGuardrail API. This allows 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 circulation involves the following actions: 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 out to the model for inference. After receiving the model'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 stepped in by the guardrail, a message is returned showing the nature of the intervention and whether it happened at the input or output stage. The examples showcased in the following sections 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 structure models (FMs) through Amazon Bedrock. To gain access to DeepSeek-R1 in Amazon Bedrock, total the following steps:
1. On the Amazon Bedrock console, pick Model catalog under Foundation models 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 provider and select the DeepSeek-R1 design.
The design detail page offers vital details about the model's abilities, pricing structure, and engel-und-waisen.de application standards. You can discover detailed usage guidelines, consisting of sample API calls and code bits for combination. The model supports different text generation tasks, consisting of material development, code generation, and concern answering, utilizing its reinforcement learning optimization and CoT thinking capabilities.
The page likewise consists of release options and licensing details to assist you start with DeepSeek-R1 in your applications.
3. To begin utilizing DeepSeek-R1, choose Deploy.
You will be prompted to configure the release details for DeepSeek-R1. The design ID will be pre-populated.
4. For Endpoint name, go into an endpoint name (between 1-50 alphanumeric characters).
5. For Number of instances, get in a number of circumstances (between 1-100).
6. For example type, choose your instance type. For optimum efficiency with DeepSeek-R1, a GPU-based circumstances type like ml.p5e.48 xlarge is advised.
Optionally, you can set up sophisticated security and infrastructure settings, including virtual personal cloud (VPC) networking, service role authorizations, and file encryption settings. For many use cases, the default settings will work well. However, for production releases, you might wish to examine these settings to line up with your organization's security and compliance requirements.
7. Choose Deploy to begin using the design.
When the implementation is complete, you can check DeepSeek-R1's abilities straight in the Amazon Bedrock play area.
8. Choose Open in play area to access an interactive user interface where you can experiment with different triggers and adjust design parameters like temperature level and optimum length.
When using R1 with Bedrock's InvokeModel and Playground Console, utilize DeepSeek's chat template for ideal results. For example, material for reasoning.
This is an excellent method to check out the model's reasoning and text generation capabilities before integrating it into your applications. The playground provides instant feedback, helping you understand how the model reacts to numerous inputs and letting you fine-tune your prompts for optimal outcomes.
You can quickly test the design in the play ground through the UI. However, to invoke the released model programmatically with any Amazon Bedrock APIs, you need to get the endpoint ARN.
Run inference using guardrails with the deployed DeepSeek-R1 endpoint
The following code example demonstrates how to perform inference utilizing a deployed DeepSeek-R1 design through Amazon Bedrock utilizing the invoke_model and ApplyGuardrail API. You can produce 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 created the guardrail, use the following code to execute guardrails. The script initializes the bedrock_runtime customer, configures inference criteria, and sends out a demand to create text based on 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 options that you can deploy with just a couple of clicks. With SageMaker JumpStart, you can tailor pre-trained models to your usage case, with your information, and deploy them into production using either the UI or SDK.
Deploying DeepSeek-R1 model through SageMaker JumpStart offers 2 practical techniques: using the instinctive SageMaker JumpStart UI or carrying out programmatically through the SageMaker Python SDK. Let's check out both techniques to help you choose 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, pick Studio in the navigation pane.
2. First-time users will be prompted to create a domain.
3. On the SageMaker Studio console, choose JumpStart in the navigation pane.
The model web browser displays available designs, with details like the provider name and design capabilities.
4. Look for DeepSeek-R1 to view the DeepSeek-R1 design card.
Each model card shows key details, including:
- Model name
- Provider name
- Task category (for example, Text Generation).
Bedrock Ready badge (if appropriate), showing that this model can be registered with Amazon Bedrock, permitting you to utilize Amazon Bedrock APIs to invoke the model
5. Choose the model card to view the model details page.
The design details page includes the following details:
- The design name and supplier details. Deploy button to release the design. About and Notebooks tabs with detailed details
The About tab includes crucial details, such as:
- Model description. - License details.
- Technical requirements.
- Usage guidelines
Before you deploy the design, it's advised to review the model details and license terms to confirm compatibility with your usage case.
6. Choose Deploy to continue with deployment.
7. For Endpoint name, use the instantly generated name or produce a custom-made one.
- For example type ¸ select an instance type (default: ml.p5e.48 xlarge).
- For Initial circumstances count, enter the variety of instances (default: 1). Selecting suitable circumstances types and counts is vital for expense and efficiency optimization. Monitor your implementation to change these settings as needed.Under Inference type, Real-time inference is picked by default. This is optimized for sustained traffic and low latency.
- Review all setups for accuracy. For this model, we strongly advise adhering to SageMaker JumpStart default settings and making certain that network isolation remains in location.
- Choose Deploy to deploy the model.
The deployment procedure can take numerous minutes to finish.
When implementation is total, your endpoint status will change to InService. At this moment, the design is prepared to accept inference demands through the endpoint. You can keep track of the deployment 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 utilizing a SageMaker runtime customer and incorporate 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 require to set up the SageMaker Python SDK and make certain you have the necessary AWS consents and environment setup. The following is a detailed code example that shows how to release and utilize DeepSeek-R1 for inference 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 reasoning with your SageMaker JumpStart predictor
Similar to Amazon Bedrock, you can likewise use 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:
Tidy up
To prevent unwanted charges, complete the actions in this area to clean up your resources.
Delete the Amazon Bedrock Marketplace release
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, pick Marketplace deployments. - In the Managed deployments area, 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 deleting the proper 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 delete the endpoint if you want 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 start. For more details, refer to Use Amazon Bedrock tooling with Amazon SageMaker JumpStart designs, 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 helps emerging generative AI companies build ingenious services using AWS services and accelerated calculate. Currently, he is focused on for fine-tuning and optimizing the reasoning efficiency of big language designs. In his totally free time, Vivek delights in hiking, seeing films, and trying various cuisines.
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 bytes-the-dust.com Bioinformatics.
Jonathan Evans is a Professional Solutions Architect working on generative AI with the Third-Party Model Science group at AWS.
Banu Nagasundaram leads item, engineering, and tactical collaborations for Amazon SageMaker JumpStart, SageMaker's artificial intelligence and generative AI center. She is enthusiastic about constructing solutions that help customers accelerate their AI journey and unlock company worth.