DeepSeek-R1 Model now Available in Amazon Bedrock Marketplace And Amazon SageMaker JumpStart
Today, we are delighted 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 release DeepSeek AI's first-generation frontier model, DeepSeek-R1, in addition to the distilled versions ranging from 1.5 to 70 billion 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 similar steps to deploy the distilled variations of the designs too.
Overview of DeepSeek-R1
DeepSeek-R1 is a big language model (LLM) established by DeepSeek AI that utilizes support learning to enhance thinking abilities through a multi-stage training process from a DeepSeek-V3-Base foundation. A key differentiating function is its support knowing (RL) step, which was used to fine-tune the design's responses beyond the standard pre-training and fine-tuning process. By incorporating RL, DeepSeek-R1 can adjust more effectively to user feedback and objectives, ultimately enhancing both relevance and clearness. In addition, DeepSeek-R1 employs a chain-of-thought (CoT) technique, meaning it's equipped to break down complicated questions and factor through them in a detailed way. This directed thinking procedure permits the model to produce more accurate, transparent, and detailed responses. This design combines RL-based fine-tuning with CoT capabilities, aiming to create structured actions while concentrating on interpretability and user interaction. With its extensive capabilities DeepSeek-R1 has recorded the market's attention as a flexible text-generation design that can be integrated into various workflows such as agents, rational reasoning and information analysis jobs.
DeepSeek-R1 uses a Mix of Experts (MoE) architecture and is 671 billion parameters in size. The MoE architecture permits activation of 37 billion parameters, enabling efficient reasoning by routing questions to the most appropriate professional "clusters." This technique allows the design to specialize in different issue domains while maintaining overall efficiency. DeepSeek-R1 needs a minimum of 800 GB of HBM memory in FP8 format for inference. In this post, we will utilize an ml.p5e.48 xlarge instance to release the model. ml.p5e.48 xlarge features 8 Nvidia H200 GPUs providing 1128 GB of GPU memory.
DeepSeek-R1 distilled designs bring the reasoning abilities 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 designs to mimic the behavior and thinking 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 design, we recommend releasing this design with guardrails in location. In this blog site, we will use Amazon Bedrock Guardrails to present safeguards, avoid harmful content, and assess models against crucial security criteria. At the time of composing this blog, for DeepSeek-R1 deployments on SageMaker JumpStart and Bedrock Marketplace, Bedrock Guardrails supports just the ApplyGuardrail API. You can develop numerous guardrails tailored to different usage cases and use them to the DeepSeek-R1 model, improving user experiences and standardizing security controls throughout your generative AI applications.
Prerequisites
To deploy the DeepSeek-R1 model, you need access to an ml.p5e instance. To examine if you have quotas for P5e, open the Service Quotas console and under AWS Services, choose 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 boost, develop a limit boost demand and connect to your account group.
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) authorizations to utilize Amazon Bedrock Guardrails. For trademarketclassifieds.com directions, see Set up permissions to utilize guardrails for material filtering.
Implementing guardrails with the ApplyGuardrail API
Amazon Bedrock Guardrails allows you to introduce safeguards, avoid hazardous content, and evaluate designs against essential safety requirements. You can carry out precaution for the DeepSeek-R1 design using the Amazon Bedrock ApplyGuardrail API. This enables you to use guardrails to assess user inputs and model responses deployed on Amazon Bedrock Marketplace and SageMaker JumpStart. You can create a guardrail using the Amazon Bedrock console or the API. For the example code to create the guardrail, see the GitHub repo.
The general circulation includes the following actions: 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 to the model for inference. After getting the design's output, another guardrail check is applied. If the output passes this last check, it's returned as the result. 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 happened at the input or output phase. The examples showcased in the following areas demonstrate 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 models (FMs) through Amazon Bedrock. To gain access to DeepSeek-R1 in Amazon Bedrock, total the following actions:
1. On the Amazon Bedrock console, pick Model brochure 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 company and pick the DeepSeek-R1 model.
The model detail page offers necessary details about the model's abilities, prices structure, and implementation guidelines. You can discover detailed use guidelines, including sample API calls and code snippets for combination. The model supports various text generation jobs, including material production, code generation, and question answering, using its reinforcement discovering optimization and CoT thinking capabilities.
The page also includes release alternatives and licensing details to help you get started with DeepSeek-R1 in your applications.
3. To start utilizing DeepSeek-R1, pick Deploy.
You will be prompted to set up the implementation details for DeepSeek-R1. The design ID will be pre-populated.
4. For Endpoint name, enter an endpoint name (in between 1-50 alphanumeric characters).
5. For Number of instances, enter a number of circumstances (in between 1-100).
6. For Instance type, pick your instance type. For optimal performance with DeepSeek-R1, a GPU-based instance type like ml.p5e.48 xlarge is suggested.
Optionally, you can configure innovative security and facilities settings, consisting of virtual personal cloud (VPC) networking, service role approvals, and encryption settings. For most use cases, the default settings will work well. However, for production releases, you may wish to examine these settings to align with your company's security and compliance requirements.
7. Choose Deploy to start using the model.
When the deployment is complete, you can test DeepSeek-R1's capabilities straight in the Amazon Bedrock play area.
8. Choose Open in playground to access an interactive interface where you can experiment with different triggers and adjust model specifications like temperature level and optimum length.
When utilizing R1 with Bedrock's InvokeModel and Playground Console, utilize DeepSeek's chat design template for optimum outcomes. For instance, content for reasoning.
This is an outstanding method to explore the model's reasoning and text generation capabilities before integrating it into your applications. The playground offers immediate feedback, helping you understand how the design reacts to various 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 design programmatically with any Amazon Bedrock APIs, you require to get the endpoint ARN.
Run inference utilizing guardrails with the released DeepSeek-R1 endpoint
The following code example demonstrates how to carry out inference using a released 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 created the guardrail, utilize the following code to implement guardrails. The script initializes the bedrock_runtime customer, configures reasoning specifications, 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 services that you can deploy with just a few clicks. With SageMaker JumpStart, you can tailor pre-trained designs to your use case, with your information, and release them into production utilizing either the UI or SDK.
Deploying DeepSeek-R1 design through SageMaker JumpStart offers 2 hassle-free methods: using the intuitive SageMaker JumpStart UI or carrying out programmatically through the SageMaker Python SDK. Let's explore both methods to assist you pick the technique 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, select Studio in the navigation pane.
2. First-time users will be prompted to produce a domain.
3. On the SageMaker Studio console, choose JumpStart in the navigation pane.
The design browser shows available designs, with details like the supplier name and design capabilities.
4. Look for DeepSeek-R1 to see the DeepSeek-R1 model card.
Each model card shows essential details, consisting of:
- Model name
- Provider name
- Task classification (for instance, Text Generation).
Bedrock Ready badge (if suitable), indicating that this design can be signed up with Amazon Bedrock, allowing you to utilize Amazon Bedrock APIs to conjure up the model
5. Choose the model card to see the design details page.
The model details page consists of the following details:
- The design name and service provider details. Deploy button to release the design. About and Notebooks tabs with detailed details
The About tab consists of important details, such as:
- Model description. - License details. - Technical specifications.
- Usage standards
Before you deploy the model, it's recommended to examine the design details and license terms to validate compatibility with your use case.
6. Choose Deploy to continue with implementation.
7. For Endpoint name, use the instantly created name or create a custom-made one.
- For Instance type ¸ select a circumstances type (default: ml.p5e.48 xlarge).
- For Initial instance count, go into the variety of circumstances (default: 1). Selecting suitable circumstances types and counts is vital for cost and efficiency optimization. Monitor your deployment to change these settings as needed.Under Inference type, Real-time reasoning is chosen by default. This is optimized for sustained traffic and low latency.
- Review all setups for precision. For this design, we strongly advise sticking to SageMaker JumpStart default settings and making certain that network seclusion remains in place.
- Choose Deploy to deploy the design.
The deployment procedure can take a number of minutes to complete.
When release is complete, your endpoint status will change to InService. At this moment, the design is all set to accept reasoning requests through the endpoint. You can monitor the implementation development on the SageMaker console Endpoints page, which will show pertinent metrics and status details. When the release is total, you can conjure up the model using a SageMaker runtime client and incorporate it with your applications.
Deploy DeepSeek-R1 utilizing the SageMaker Python SDK
To begin with DeepSeek-R1 using the SageMaker Python SDK, you will require to set up the SageMaker Python SDK and make certain you have the necessary AWS permissions 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 notebook and run from SageMaker Studio.
You can run extra demands against the predictor:
Implement guardrails and run reasoning with your SageMaker JumpStart predictor
Similar to Amazon Bedrock, you can likewise utilize the ApplyGuardrail API with your SageMaker JumpStart predictor. You can develop a guardrail utilizing the Amazon Bedrock console or the API, and implement it as displayed in the following code:
Clean up
To prevent undesirable charges, complete the steps in this section to clean up your resources.
Delete the Amazon Bedrock Marketplace deployment
If you deployed the model utilizing Amazon Bedrock Marketplace, complete the following actions:
1. On the Amazon Bedrock console, under Foundation designs in the navigation pane, select Marketplace implementations. - In the Managed deployments area, find the endpoint you wish to erase.
- Select the endpoint, and on the Actions menu, pick Delete.
- Verify the endpoint details to make certain you're erasing the correct release: 1. Endpoint name.
- Model name.
- Endpoint status
Delete the SageMaker JumpStart predictor
The SageMaker JumpStart model you deployed 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 design 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 Starting with Amazon SageMaker JumpStart.
About the Authors
Vivek Gangasani is a Lead Specialist Solutions Architect for Inference at AWS. He helps emerging generative AI business build ingenious solutions using AWS services and sped up compute. Currently, he is focused on establishing techniques for fine-tuning and optimizing the inference efficiency of large language models. In his downtime, Vivek enjoys treking, viewing motion pictures, and attempting various 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 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 strategic partnerships for Amazon SageMaker JumpStart, SageMaker's artificial intelligence and generative AI center. She is passionate about constructing options that assist clients accelerate their AI journey and unlock service value.