Today, we are delighted 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, together with the distilled versions ranging from 1.5 to 70 billion criteria to construct, experiment, and responsibly scale your generative AI concepts on AWS.
In this post, we demonstrate how to start with DeepSeek-R1 on Amazon Bedrock Marketplace and SageMaker JumpStart. You can follow similar steps to release 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 support learning to boost thinking abilities through a multi-stage training process from a DeepSeek-V3-Base structure. An essential identifying feature is its support knowing (RL) step, which was used to refine the design's actions beyond the basic pre-training and tweak process. By including RL, DeepSeek-R1 can adjust better to user feedback and goals, ultimately enhancing both significance and clearness. In addition, DeepSeek-R1 utilizes a chain-of-thought (CoT) technique, suggesting it's geared up to break down complex questions and reason through them in a detailed manner. This guided thinking procedure enables the design to produce more precise, transparent, and detailed answers. This design integrates RL-based fine-tuning with CoT capabilities, aiming to create structured actions while concentrating on interpretability and user interaction. With its wide-ranging abilities DeepSeek-R1 has recorded the market'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 uses a Mix of Experts (MoE) architecture and is 671 billion criteria in size. The MoE architecture permits activation of 37 billion specifications, making it possible for efficient reasoning by routing questions to the most relevant specialist "clusters." This method allows the model to focus on different issue domains while maintaining total effectiveness. 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 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 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 describes a procedure of training smaller sized, more effective designs to imitate the behavior and thinking patterns of the bigger DeepSeek-R1 model, using 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 deploying this model with guardrails in place. In this blog, we will use Amazon Bedrock Guardrails to present safeguards, prevent damaging content, and examine designs against essential safety requirements. At the time of composing this blog site, for DeepSeek-R1 deployments on SageMaker JumpStart and Bedrock Marketplace, Bedrock Guardrails supports just the ApplyGuardrail API. You can create numerous guardrails tailored to various usage cases and use them to the DeepSeek-R1 design, enhancing user experiences and yewiki.org standardizing security controls throughout your generative AI applications.
Prerequisites
To deploy the DeepSeek-R1 model, you require access to an ml.p5e circumstances. To inspect if you have quotas for P5e, open the Service Quotas console and under AWS Services, pick 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 deploying. To ask for a limit boost, develop a limitation increase demand and connect to your account team.
Because you will be releasing this design with Amazon Bedrock Guardrails, make certain you have the correct AWS Identity and Gain Access To Management (IAM) approvals to use Amazon Bedrock Guardrails. For guidelines, see Set up authorizations to use guardrails for content filtering.
Implementing guardrails with the ApplyGuardrail API
Amazon Bedrock Guardrails allows you to introduce safeguards, avoid hazardous content, and evaluate models against crucial safety requirements. You can execute precaution for the DeepSeek-R1 model utilizing the Amazon Bedrock ApplyGuardrail API. This permits you to apply guardrails to examine user inputs and model actions 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 circulation involves 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 out to the model for reasoning. After receiving the design's output, another guardrail check is used. If the output passes this last check, it's returned as the final 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 stage. The examples showcased in the following sections show reasoning utilizing this API.
Deploy DeepSeek-R1 in Amazon Bedrock Marketplace
Amazon Bedrock Marketplace provides 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 actions:
1. On the Amazon Bedrock console, choose Model catalog under Foundation designs in the navigation pane.
At the time of writing this post, you can utilize the InvokeModel API to conjure up the model. It does not support Converse APIs and other Amazon Bedrock tooling.
2. Filter for DeepSeek as a provider and choose the DeepSeek-R1 model.
The model detail page offers essential details about the design's capabilities, prices structure, and application guidelines. You can discover detailed use guidelines, consisting of sample API calls and code snippets for integration. The model supports numerous text generation tasks, including material development, code generation, and concern answering, utilizing its support finding out optimization and CoT thinking capabilities.
The page also consists of deployment alternatives and licensing details to help you begin with DeepSeek-R1 in your applications.
3. To begin using DeepSeek-R1, pick Deploy.
You will be triggered to configure the release 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 Variety of circumstances, get in a variety of instances (in between 1-100).
6. For example type, choose your circumstances 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 personal cloud (VPC) networking, service function authorizations, and encryption settings. For the majority of use cases, the default settings will work well. However, for production releases, you might desire to evaluate these settings to line up with your organization's security and compliance requirements.
7. Choose Deploy to start using the design.
When the implementation is total, you can evaluate DeepSeek-R1's abilities straight in the Amazon Bedrock play ground.
8. Choose Open in play ground to access an interactive user interface where you can explore different triggers and adjust design parameters like temperature level and maximum length.
When utilizing R1 with Bedrock's InvokeModel and Playground Console, use DeepSeek's chat design template for optimum outcomes. For instance, material for reasoning.
This is an exceptional way to explore the design's reasoning and text generation capabilities before incorporating it into your applications. The play ground provides immediate feedback, helping you comprehend how the model responds to numerous inputs and letting you fine-tune your prompts for optimal outcomes.
You can quickly check the model in the playground through the UI. However, to invoke the released design programmatically with any Amazon Bedrock APIs, you require to get the endpoint ARN.
Run inference using guardrails with the deployed DeepSeek-R1 endpoint
The following code example demonstrates how to perform reasoning utilizing a deployed DeepSeek-R1 design through Amazon Bedrock utilizing the invoke_model and ApplyGuardrail API. You can develop a guardrail utilizing the Amazon Bedrock console or the API. For the example code to produce the guardrail, see the GitHub repo. After you have actually created the guardrail, use the following code to carry out guardrails. The script initializes the bedrock_runtime customer, configures inference criteria, and sends a demand to create text based on a user prompt.
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 release with simply a few clicks. With SageMaker JumpStart, you can tailor pre-trained models to your usage case, with your data, and release them into production using either the UI or SDK.
Deploying DeepSeek-R1 model through SageMaker JumpStart offers 2 convenient methods: utilizing the intuitive SageMaker JumpStart UI or implementing programmatically through the SageMaker Python SDK. Let's check out both approaches to help you choose the method that finest suits your requirements.
Deploy DeepSeek-R1 through SageMaker JumpStart UI
Complete the following steps to release DeepSeek-R1 utilizing 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, choose JumpStart in the navigation pane.
The model browser shows available designs, with details like the supplier name and model capabilities.
4. Look for DeepSeek-R1 to see the DeepSeek-R1 model card.
Each model card reveals essential details, consisting of:
- Model name
- Provider name
- Task classification (for instance, Text Generation).
Bedrock Ready badge (if relevant), showing that this design can be registered with Amazon Bedrock, allowing you to use Amazon Bedrock APIs to invoke the model
5. Choose the design card to see the model details page.
The model details page consists of the following details:
- The design name and company 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 release the design, it's recommended to examine the model details and license terms to confirm compatibility with your usage case.
6. Choose Deploy to proceed with deployment.
7. For Endpoint name, utilize the automatically generated name or develop a custom-made one.
- For example type ¸ select an instance type (default: ml.p5e.48 xlarge).
- For Initial instance count, get in the variety of instances (default: 1). Selecting appropriate circumstances types and counts is essential for cost and performance optimization. Monitor your implementation 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 configurations for accuracy. For this design, we strongly suggest sticking to SageMaker JumpStart default settings and making certain that network isolation remains in location.
- Choose Deploy to release the model.
The deployment process can take several minutes to complete.
When deployment is complete, your endpoint status will alter to InService. At this point, 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 display appropriate metrics and status details. When the release is total, you can conjure up the model 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 using the SageMaker Python SDK, you will need to install the SageMaker Python SDK and make certain you have the necessary AWS permissions and environment setup. The following is a detailed code example that shows how to deploy and utilize DeepSeek-R1 for inference programmatically. The code for releasing the model is offered in the Github here. You can clone the note pad 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 also utilize the ApplyGuardrail API with your SageMaker JumpStart predictor. You can develop a guardrail using the Amazon Bedrock console or the API, and it as displayed in the following code:
Tidy up
To avoid undesirable charges, complete the steps in this section to clean up your resources.
Delete the Amazon Bedrock Marketplace deployment
If you released the model using Amazon Bedrock Marketplace, total the following actions:
1. On the Amazon Bedrock console, under Foundation designs in the navigation pane, choose Marketplace implementations. - In the Managed deployments section, find 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 deleting the correct release: 1. Endpoint name.
- Model name.
- Endpoint status
Delete the SageMaker JumpStart predictor
The SageMaker JumpStart design 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 explored how you can access and release the DeepSeek-R1 model using Bedrock Marketplace and SageMaker JumpStart. Visit SageMaker JumpStart in SageMaker Studio or Amazon Bedrock Marketplace now to get started. 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 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 business build ingenious services utilizing AWS services and accelerated compute. Currently, he is concentrated on establishing strategies for fine-tuning and optimizing the inference performance of big language designs. In his complimentary time, Vivek takes pleasure in treking, viewing films, and trying different 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 technology and Bioinformatics.
Jonathan Evans is a Professional Solutions Architect working on generative AI with the Third-Party Model Science team at AWS.
Banu Nagasundaram leads product, engineering, and tactical collaborations for Amazon SageMaker JumpStart, SageMaker's artificial intelligence and generative AI hub. She is enthusiastic about building services that help customers accelerate their AI journey and unlock company value.