DeepSeek-R1 Model now Available in Amazon Bedrock Marketplace And Amazon SageMaker JumpStart
Today, we are excited to announce that DeepSeek R1 distilled Llama and Qwen designs 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 variations ranging from 1.5 to 70 billion parameters to develop, experiment, and responsibly 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 similar steps to release the distilled variations of the designs also.
Overview of DeepSeek-R1
DeepSeek-R1 is a large language model (LLM) established by DeepSeek AI that utilizes support learning to enhance thinking abilities through a multi-stage training procedure from a DeepSeek-V3-Base structure. A crucial identifying feature is its support learning (RL) step, which was utilized to improve the model's reactions beyond the basic pre-training and fine-tuning process. By incorporating RL, DeepSeek-R1 can adapt more successfully to user feedback and goals, ultimately boosting both relevance and clarity. In addition, DeepSeek-R1 employs a chain-of-thought (CoT) method, meaning it's equipped to break down complex questions and factor through them in a detailed manner. This guided thinking process allows the design to produce more precise, transparent, and detailed answers. This design integrates RL-based fine-tuning with CoT capabilities, aiming to generate structured reactions while focusing on interpretability and user interaction. With its extensive capabilities DeepSeek-R1 has captured the industry's attention as a versatile text-generation model that can be integrated into different workflows such as agents, rational thinking and information analysis jobs.
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 effective inference by routing inquiries to the most relevant specialist "clusters." This technique allows the model to concentrate on various issue domains while maintaining overall effectiveness. DeepSeek-R1 requires at least 800 GB of HBM memory in FP8 format for reasoning. In this post, we will use an ml.p5e.48 xlarge circumstances to deploy the design. ml.p5e.48 xlarge features 8 Nvidia H200 GPUs supplying 1128 GB of GPU memory.
DeepSeek-R1 distilled models bring the thinking abilities of the main R1 design to more effective architectures based on popular open designs like Qwen (1.5 B, 7B, 14B, setiathome.berkeley.edu and 32B) and Llama (8B and 70B). Distillation refers to a procedure 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 model.
You can deploy DeepSeek-R1 model either through SageMaker JumpStart or Bedrock Marketplace. Because DeepSeek-R1 is an emerging model, we advise releasing this design with guardrails in location. In this blog, we will utilize Amazon Bedrock Guardrails to introduce safeguards, prevent damaging material, and evaluate designs against essential security requirements. At the time of composing this blog, for DeepSeek-R1 deployments on SageMaker JumpStart and Bedrock Marketplace, Bedrock Guardrails supports only the ApplyGuardrail API. You can develop multiple guardrails tailored to various use cases and use them to the DeepSeek-R1 model, improving user experiences and standardizing security controls throughout your generative AI applications.
Prerequisites
To release the DeepSeek-R1 model, you need access to an ml.p5e circumstances. To inspect if you have quotas for P5e, open the Service Quotas console and under AWS Services, select Amazon SageMaker, and validate you're utilizing 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 limitation increase, develop a limit increase request and reach out to your account group.
Because you will be releasing this model with Amazon Bedrock Guardrails, make certain you have the proper AWS Identity and Gain Access To Management (IAM) authorizations to use Amazon Bedrock Guardrails. For guidelines, see Establish authorizations to use guardrails for content filtering.
Implementing guardrails with the ApplyGuardrail API
Amazon Bedrock Guardrails allows you to introduce safeguards, avoid hazardous material, and against essential safety requirements. You can execute safety measures for the DeepSeek-R1 design utilizing the Amazon Bedrock ApplyGuardrail API. This allows you to apply guardrails to examine user inputs and design responses deployed 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 produce the guardrail, see the GitHub repo.
The basic circulation involves the following steps: First, the system receives an input for the design. 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 getting the model's output, another guardrail check is used. If the output passes this last check, it's returned as the outcome. However, if either the input or output is stepped in 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 sections demonstrate reasoning using this API.
Deploy DeepSeek-R1 in Amazon Bedrock Marketplace
Amazon Bedrock Marketplace provides you access to over 100 popular, emerging, and specialized structure 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 models in the navigation pane.
At the time of composing this post, you can use the InvokeModel API to invoke the model. It doesn't 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 provides necessary details about the model's abilities, prices structure, and implementation standards. You can find detailed usage guidelines, consisting of sample API calls and code bits for integration. The model supports numerous text generation jobs, including content production, code generation, and question answering, utilizing its support learning optimization and CoT reasoning abilities.
The page also includes implementation alternatives and licensing details to assist you get going with DeepSeek-R1 in your applications.
3. To start utilizing DeepSeek-R1, pick 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 Variety of instances, enter a variety of instances (in between 1-100).
6. For example type, choose 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 facilities settings, consisting of virtual private cloud (VPC) networking, service function authorizations, and file encryption settings. For many utilize cases, the default settings will work well. However, for production implementations, you may wish to examine these settings to line up with your organization's security and compliance requirements.
7. Choose Deploy to start using the design.
When the deployment is total, you can check DeepSeek-R1's capabilities straight in the Amazon Bedrock play ground.
8. Choose Open in playground to access an interactive user interface where you can experiment with different triggers and change design parameters like temperature level and maximum length.
When using R1 with Bedrock's InvokeModel and Playground Console, use DeepSeek's chat template for optimal outcomes. For example, material for reasoning.
This is an exceptional method to explore the design's reasoning and text generation abilities before incorporating it into your applications. The play ground supplies instant feedback, helping you understand how the model reacts to numerous inputs and letting you fine-tune your prompts for optimal results.
You can rapidly evaluate the design in the play area through the UI. However, to conjure up the deployed model programmatically with any Amazon Bedrock APIs, you require to get the endpoint ARN.
Run inference utilizing guardrails with the deployed DeepSeek-R1 endpoint
The following code example demonstrates how to carry out inference utilizing a deployed DeepSeek-R1 design through Amazon Bedrock using the invoke_model and ApplyGuardrail API. You can produce a guardrail using 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, use the following code to carry out guardrails. The script initializes the bedrock_runtime customer, configures reasoning parameters, and sends out a demand to generate text based upon a user prompt.
Deploy DeepSeek-R1 with SageMaker JumpStart
SageMaker JumpStart is an artificial intelligence (ML) hub with FMs, integrated algorithms, and prebuilt ML solutions that you can release with just a few clicks. With SageMaker JumpStart, you can tailor pre-trained models to your usage case, with your information, and release them into production using either the UI or SDK.
Deploying DeepSeek-R1 model through SageMaker JumpStart uses 2 convenient techniques: utilizing the instinctive SageMaker JumpStart UI or implementing programmatically through the SageMaker Python SDK. Let's explore both methods to help you choose the method that finest fits your needs.
Deploy DeepSeek-R1 through SageMaker JumpStart UI
Complete the following steps to deploy DeepSeek-R1 using SageMaker JumpStart:
1. On the SageMaker console, select Studio in the navigation pane.
2. First-time users will be prompted to produce a domain.
3. On the SageMaker Studio console, select JumpStart in the navigation pane.
The design internet browser displays available designs, with details like the company name and model abilities.
4. Look for DeepSeek-R1 to view the DeepSeek-R1 design card.
Each design card reveals essential details, consisting of:
- Model name
- Provider name
-
Task category (for instance, Text Generation).
Bedrock Ready badge (if appropriate), showing that this design can be signed up with Amazon Bedrock, allowing you to use Amazon Bedrock APIs to invoke the design
5. Choose the model card to see the design details page.
The design details page includes the following details:
- The model name and supplier details. Deploy button to deploy the design. About and Notebooks tabs with detailed details
The About tab includes important details, such as:
- Model description. - License details.
- Technical specifications.
- Usage guidelines
Before you release the design, it's advised to evaluate the design details and license terms to verify compatibility with your use case.
6. Choose Deploy to continue with deployment.
7. For Endpoint name, use the immediately created name or create a custom-made one.
- For example type ¸ choose an instance type (default: ml.p5e.48 xlarge).
- For Initial circumstances count, enter the variety of instances (default: 1). Selecting suitable instance types and counts is crucial for cost and performance optimization. Monitor your implementation to change these settings as needed.Under Inference type, Real-time inference is picked by default. This is enhanced for sustained traffic and low latency.
- Review all configurations for precision. For this design, we highly suggest sticking to SageMaker JumpStart default settings and making certain that network seclusion remains in place.
- Choose Deploy to deploy the model.
The deployment process can take numerous minutes to complete.
When implementation is complete, your endpoint status will change to InService. At this moment, the model is ready to accept inference requests through the endpoint. You can keep an eye on the implementation development on the SageMaker console Endpoints page, which will display relevant metrics and status details. When the release is total, you can invoke the model using a SageMaker runtime customer and incorporate it with your applications.
Deploy DeepSeek-R1 using the SageMaker Python SDK
To start 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 authorizations 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 releasing the design is provided in the Github here. You can clone the notebook and range from SageMaker Studio.
You can run additional demands against the predictor:
Implement guardrails and run reasoning 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 displayed in the following code:
Tidy up
To prevent undesirable charges, finish the actions in this area to clean up your resources.
Delete the Amazon Bedrock Marketplace implementation
If you deployed the design utilizing Amazon Bedrock Marketplace, complete the following steps:
1. On the Amazon Bedrock console, under Foundation models in the navigation pane, pick Marketplace implementations. - In the Managed deployments area, find 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 erasing the appropriate release: 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 deploy the DeepSeek-R1 model utilizing Bedrock Marketplace and SageMaker JumpStart. Visit SageMaker JumpStart in SageMaker Studio or Amazon Bedrock Marketplace now to get begun. For more details, refer to Use Amazon Bedrock tooling with Amazon SageMaker JumpStart designs, SageMaker JumpStart pretrained designs, 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 helps emerging generative AI companies build ingenious solutions utilizing AWS services and accelerated calculate. Currently, he is concentrated on establishing techniques for fine-tuning and optimizing the inference performance of big language designs. In his leisure time, Vivek delights in hiking, seeing motion pictures, and trying different foods.
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 Professional Solutions Architect dealing with 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 passionate about developing options that help consumers accelerate their AI journey and unlock business worth.