Today, we are excited 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 deploy DeepSeek AI's first-generation frontier design, DeepSeek-R1, along with the distilled versions ranging from 1.5 to 70 billion parameters to build, 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 comparable steps to release the distilled variations of the designs too.
Overview of DeepSeek-R1
DeepSeek-R1 is a big language design (LLM) developed by DeepSeek AI that uses reinforcement finding out to improve reasoning capabilities through a multi-stage training process from a DeepSeek-V3-Base structure. An essential identifying function is its reinforcement learning (RL) action, which was used to refine the design's actions beyond the standard pre-training and tweak process. By integrating RL, setiathome.berkeley.edu DeepSeek-R1 can adapt more efficiently to user feedback and goals, eventually boosting both relevance and clarity. 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 guided thinking process enables the design to produce more precise, transparent, and detailed answers. This design combines RL-based fine-tuning with CoT capabilities, aiming to create structured reactions while focusing on interpretability and user interaction. With its extensive capabilities DeepSeek-R1 has caught the market's attention as a versatile text-generation model that can be integrated into various workflows such as agents, logical thinking and data analysis tasks.
DeepSeek-R1 utilizes a Mix of Experts (MoE) architecture and is 671 billion criteria in size. The MoE architecture permits activation of 37 billion criteria, making it possible for effective reasoning by routing inquiries to the most pertinent expert "clusters." This method permits the model to specialize in various problem domains while maintaining overall efficiency. DeepSeek-R1 requires at least 800 GB of HBM memory in FP8 format for inference. In this post, we will utilize an ml.p5e.48 xlarge circumstances to deploy the model. ml.p5e.48 xlarge includes 8 Nvidia H200 GPUs offering 1128 GB of GPU memory.
DeepSeek-R1 distilled designs bring the thinking 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 describes a procedure of training smaller, more effective designs to mimic the behavior and reasoning patterns of the larger DeepSeek-R1 design, utilizing it as a teacher 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 location. In this blog site, we will utilize Amazon Bedrock Guardrails to introduce safeguards, prevent harmful material, and examine designs against crucial safety requirements. At the time of composing this blog, for DeepSeek-R1 implementations on SageMaker JumpStart and Bedrock Marketplace, Bedrock Guardrails supports just the ApplyGuardrail API. You can create several guardrails tailored to different use cases and use them to the DeepSeek-R1 design, enhancing user experiences and standardizing safety controls throughout your generative AI applications.
Prerequisites
To deploy the DeepSeek-R1 design, you need access to an ml.p5e instance. To inspect 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 circumstances in the AWS Region you are releasing. To ask for a limit increase, develop a limit increase demand and reach out to your account team.
Because you will be deploying this design with Amazon Bedrock Guardrails, make certain you have the right AWS Identity and Gain Access To Management (IAM) consents to utilize Amazon Bedrock Guardrails. For directions, see Establish consents to utilize guardrails for material filtering.
Implementing guardrails with the ApplyGuardrail API
Amazon Bedrock Guardrails permits you to introduce safeguards, prevent hazardous content, and assess models against essential safety requirements. You can carry out safety measures for the DeepSeek-R1 model utilizing the Amazon Bedrock ApplyGuardrail API. This enables you to use guardrails to evaluate user inputs and model actions 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 develop the guardrail, see the GitHub repo.
The basic circulation includes 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 to the model for inference. After getting the model's output, another guardrail check is used. If the output passes this final check, it's returned as the final outcome. 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 occurred at the input or output stage. The examples showcased in the following areas demonstrate reasoning utilizing this API.
Deploy DeepSeek-R1 in Amazon Bedrock Marketplace
Amazon Bedrock Marketplace gives 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, pick 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 does not support Converse APIs and other Amazon Bedrock tooling.
2. Filter for DeepSeek as a company and choose the DeepSeek-R1 design.
The model detail page supplies vital details about the design's capabilities, pricing structure, and application standards. You can discover detailed usage guidelines, consisting of sample API calls and code snippets for integration. The design supports numerous text generation jobs, including material production, code generation, and question answering, utilizing its reinforcement finding out optimization and CoT reasoning abilities.
The page likewise consists of implementation options and licensing details to help you start with DeepSeek-R1 in your applications.
3. To start using DeepSeek-R1, choose Deploy.
You will be triggered to configure the deployment details for DeepSeek-R1. The design ID will be pre-populated.
4. For Endpoint name, get in an endpoint name (in between 1-50 alphanumeric characters).
5. For Variety of instances, get in a variety of instances (between 1-100).
6. For example type, pick your instance type. For ideal performance with DeepSeek-R1, a GPU-based instance type like ml.p5e.48 xlarge is advised.
Optionally, you can set up innovative security and infrastructure settings, including virtual private cloud (VPC) networking, service role permissions, and file encryption settings. For the majority of utilize cases, the default settings will work well. However, for production deployments, you may desire to evaluate these settings to line up with your company's security and compliance requirements.
7. Choose Deploy to begin using the design.
When the release is complete, you can evaluate DeepSeek-R1's capabilities straight in the Amazon Bedrock play area.
8. Choose Open in play ground to access an interactive interface where you can try out various prompts and adjust design parameters like temperature and optimum length.
When utilizing R1 with Bedrock's InvokeModel and Playground Console, use DeepSeek's chat template for optimal outcomes. For example, content for reasoning.
This is an outstanding way to explore the design's reasoning and text generation capabilities before incorporating it into your applications. The playground supplies immediate feedback, helping you comprehend how the design reacts to numerous inputs and letting you fine-tune your prompts for ideal outcomes.
You can rapidly check the model in the play ground through the UI. However, to conjure up 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 shows how to carry out inference utilizing a deployed 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 actually developed the guardrail, use the following code to carry out guardrails. The script initializes the bedrock_runtime customer, sets up inference criteria, 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) center with FMs, built-in algorithms, and prebuilt ML options that you can deploy with simply a few clicks. With SageMaker JumpStart, you can tailor pre-trained designs to your usage case, with your data, and deploy them into production utilizing either the UI or SDK.
Deploying DeepSeek-R1 design through SageMaker JumpStart uses 2 practical techniques: utilizing the intuitive SageMaker JumpStart UI or carrying out programmatically through the SageMaker Python SDK. Let's check out both methods to assist you pick the approach that best fits your requirements.
Deploy DeepSeek-R1 through SageMaker JumpStart UI
Complete the following actions to deploy DeepSeek-R1 utilizing SageMaker JumpStart:
1. On the SageMaker console, demo.qkseo.in pick Studio in the navigation pane.
2. First-time users will be triggered to develop a domain.
3. On the SageMaker Studio console, select JumpStart in the navigation pane.
The model internet browser displays available designs, with details like the company name and design capabilities.
4. Search for DeepSeek-R1 to see the DeepSeek-R1 model card.
Each model card reveals essential details, including:
- Model name
- Provider name
- Task category (for instance, Text Generation).
Bedrock Ready badge (if applicable), showing that this design can be signed up with Amazon Bedrock, permitting you to utilize Amazon Bedrock APIs to conjure up the design
5. Choose the design card to view the design details page.
The design details page of the following details:
- The design name and service provider details. Deploy button to release the model. About and Notebooks tabs with detailed details
The About tab consists of important details, such as:
- Model description. - License details.
- Technical specifications.
- Usage guidelines
Before you deploy the model, it's suggested to examine the design details and license terms to validate compatibility with your usage case.
6. Choose Deploy to proceed with deployment.
7. For Endpoint name, utilize the immediately generated name or develop a custom-made one.
- For Instance type ¸ select an instance type (default: ml.p5e.48 xlarge).
- For Initial circumstances count, go into the number of instances (default: 1). Selecting appropriate instance types and counts is crucial for cost and efficiency optimization. Monitor your implementation to adjust these settings as needed.Under Inference type, Real-time reasoning is chosen by default. This is enhanced for sustained traffic and low latency.
- Review all configurations for precision. For this design, we strongly advise adhering to SageMaker JumpStart default settings and making certain that network seclusion remains in location.
- Choose Deploy to release the design.
The implementation procedure can take numerous minutes to finish.
When implementation is complete, your endpoint status will change to InService. At this point, the model is prepared to accept inference demands through the endpoint. You can monitor the deployment progress on the SageMaker console Endpoints page, which will show pertinent metrics and status details. When the deployment is total, you can conjure up the model utilizing a SageMaker runtime client and incorporate it with your applications.
Deploy DeepSeek-R1 utilizing the SageMaker Python SDK
To get going with DeepSeek-R1 utilizing the SageMaker Python SDK, you will need to install the SageMaker Python SDK and make certain you have the necessary AWS approvals 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 model is provided 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 execute it as revealed in the following code:
Tidy up
To prevent unwanted charges, finish the actions in this area to tidy up your resources.
Delete the Amazon Bedrock Marketplace implementation
If you deployed the design using Amazon Bedrock Marketplace, total the following actions:
1. On the Amazon Bedrock console, under Foundation designs in the navigation pane, select Marketplace implementations. - In the Managed implementations section, locate the endpoint you wish to erase.
- Select the endpoint, and on the Actions menu, choose Delete.
- Verify the endpoint details to make certain you're deleting the correct implementation: 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 want 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 design utilizing 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 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 ingenious solutions using AWS services and accelerated compute. Currently, he is concentrated on establishing strategies for fine-tuning and optimizing the inference efficiency of large language designs. In his downtime, Vivek takes pleasure in hiking, seeing motion pictures, and trying various cuisines.
Niithiyn Vijeaswaran is a Generative AI Specialist Solutions Architect with the Third-Party Model Science team at AWS. His location 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 group at AWS.
Banu Nagasundaram leads product, engineering, and strategic collaborations for Amazon SageMaker JumpStart, SageMaker's artificial intelligence and generative AI hub. She is enthusiastic about developing options that assist clients accelerate their AI journey and unlock company worth.