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 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, along with the distilled variations varying from 1.5 to 70 billion criteria to build, experiment, and properly scale your generative AI ideas 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 deploy the distilled versions of the designs too.
Overview of DeepSeek-R1
DeepSeek-R1 is a big language design (LLM) established by DeepSeek AI that utilizes reinforcement learning to enhance thinking abilities through a multi-stage training process from a DeepSeek-V3-Base foundation. A key distinguishing feature is its reinforcement knowing (RL) action, which was used to improve the design's reactions beyond the standard pre-training and fine-tuning process. By including RL, DeepSeek-R1 can adapt better to user feedback and goals, eventually enhancing both significance and clearness. In addition, DeepSeek-R1 employs a chain-of-thought (CoT) approach, indicating it's equipped to break down complicated queries and factor through them in a detailed manner. This assisted reasoning procedure allows the model to produce more accurate, transparent, and detailed answers. This model integrates RL-based fine-tuning with CoT abilities, aiming to generate structured reactions while concentrating on interpretability and user interaction. With its wide-ranging abilities DeepSeek-R1 has captured the market's attention as a versatile text-generation model that can be integrated into various workflows such as representatives, sensible reasoning and data 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 criteria, enabling effective by routing inquiries to the most relevant specialist "clusters." This approach enables the design to concentrate on various problem domains while maintaining general 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 instance to deploy the model. ml.p5e.48 xlarge comes with 8 Nvidia H200 GPUs offering 1128 GB of GPU memory.
DeepSeek-R1 distilled designs bring the thinking capabilities of the main R1 model to more effective architectures based on popular open models like Qwen (1.5 B, 7B, 14B, and 32B) and Llama (8B and 70B). Distillation describes a procedure of training smaller sized, more efficient designs to imitate the behavior and reasoning patterns of the bigger DeepSeek-R1 design, 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 model, we suggest deploying this model with guardrails in place. In this blog, we will utilize Amazon Bedrock Guardrails to introduce safeguards, prevent harmful content, and examine models against key safety requirements. At the time of writing this blog site, for DeepSeek-R1 releases on SageMaker JumpStart and Bedrock Marketplace, Bedrock Guardrails supports just the ApplyGuardrail API. You can produce numerous guardrails tailored to different usage cases and apply them to the DeepSeek-R1 model, enhancing 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 instance. To examine if you have quotas for P5e, open the Service Quotas console and under AWS Services, select Amazon SageMaker, and confirm you're utilizing 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 releasing. To ask for a limitation increase, produce a limitation boost demand and connect to your account group.
Because you will be releasing 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 Set up consents to utilize guardrails for material filtering.
Implementing guardrails with the ApplyGuardrail API
Amazon Bedrock Guardrails allows you to introduce safeguards, prevent harmful material, and assess models against essential security criteria. You can execute security procedures for the DeepSeek-R1 model using the Amazon Bedrock ApplyGuardrail API. This permits you to apply guardrails to assess user inputs and model reactions deployed on Amazon Bedrock Marketplace and SageMaker JumpStart. You can produce 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 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 design for reasoning. After receiving the design's output, another guardrail check is used. If the output passes this final 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 gives you access to over 100 popular, emerging, and specialized structure designs (FMs) through Amazon Bedrock. To gain access to DeepSeek-R1 in Amazon Bedrock, complete the following actions:
1. On the Amazon Bedrock console, choose Model brochure under Foundation designs in the navigation pane.
At the time of composing 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 select the DeepSeek-R1 model.
The design detail page supplies necessary details about the model's abilities, rates structure, and application guidelines. You can find detailed use instructions, including sample API calls and code bits for integration. The design supports various text generation tasks, including content development, code generation, and concern answering, utilizing its reinforcement finding out optimization and CoT thinking capabilities.
The page likewise consists of implementation options and licensing details to assist you start with DeepSeek-R1 in your applications.
3. To begin using DeepSeek-R1, choose Deploy.
You will be prompted to set up the deployment details for DeepSeek-R1. The design ID will be pre-populated.
4. For Endpoint name, go into an endpoint name (in between 1-50 alphanumeric characters).
5. For Variety of instances, enter a variety of circumstances (in between 1-100).
6. For example type, select 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 sophisticated security and infrastructure settings, consisting of virtual private cloud (VPC) networking, service role approvals, and file encryption settings. For it-viking.ch most utilize cases, the default settings will work well. However, for production implementations, you may wish to examine these settings to line up with your company's security and compliance requirements.
7. Choose Deploy to start using the design.
When the implementation is total, you can test DeepSeek-R1's abilities straight in the Amazon Bedrock playground.
8. Choose Open in playground to access an interactive user interface where you can try out different prompts and adjust model criteria like temperature and maximum length.
When using R1 with Bedrock's InvokeModel and Playground Console, utilize DeepSeek's chat template for optimum outcomes. For instance, content for reasoning.
This is an excellent way to explore the design's reasoning and text generation capabilities before incorporating it into your applications. The play area provides immediate feedback, helping you comprehend how the model responds to numerous inputs and letting you tweak your triggers for optimal results.
You can rapidly check the design in the play ground through the UI. However, to invoke the deployed model 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 shows how to perform inference using a deployed DeepSeek-R1 design through Amazon Bedrock using the invoke_model and ApplyGuardrail API. You can produce 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 produced the guardrail, use the following code to execute guardrails. The script initializes the bedrock_runtime customer, configures inference parameters, and sends a demand to generate text based on a user prompt.
Deploy DeepSeek-R1 with SageMaker JumpStart
SageMaker JumpStart is an artificial intelligence (ML) center 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 designs to your usage case, with your information, and release them into production utilizing either the UI or SDK.
Deploying DeepSeek-R1 model through SageMaker JumpStart provides 2 hassle-free techniques: utilizing the instinctive SageMaker JumpStart UI or carrying out programmatically through the SageMaker Python SDK. Let's check out both approaches to help you select the approach that best matches 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, pick Studio in the navigation pane.
2. First-time users will be prompted to develop a domain.
3. On the SageMaker Studio console, pick JumpStart in the navigation pane.
The model web browser displays available designs, with details like the supplier name and model abilities.
4. Search for DeepSeek-R1 to see the DeepSeek-R1 design card.
Each model card shows essential details, consisting of:
- Model name
- Provider name
- Task classification (for example, Text Generation).
Bedrock Ready badge (if suitable), suggesting that this model can be registered with Amazon Bedrock, permitting you to use Amazon Bedrock APIs to invoke the model
5. Choose the design card to view the design details page.
The model details page includes the following details:
- The model name and service provider details. Deploy button to release the design. About and Notebooks tabs with detailed details
The About tab includes essential details, such as:
- Model description. - License details.
- Technical requirements.
- Usage guidelines
Before you release the design, it's suggested to examine the design details and license terms to validate compatibility with your use case.
6. Choose Deploy to proceed with implementation.
7. For Endpoint name, utilize the immediately generated name or produce a customized one.
- For Instance type ¸ pick a circumstances type (default: ml.p5e.48 xlarge).
- For Initial circumstances count, enter the number of instances (default: 1). Selecting proper circumstances types and counts is crucial for cost and efficiency optimization. Monitor your deployment to change these settings as needed.Under Inference type, Real-time reasoning is picked by default. This is optimized for sustained traffic and low latency.
- Review all configurations for precision. For this design, we highly recommend adhering to SageMaker JumpStart default settings and making certain that network seclusion remains in location.
- Choose Deploy to deploy the model.
The release procedure can take numerous minutes to complete.
When release is total, your endpoint status will alter to InService. At this point, the design is all set to accept reasoning demands through the endpoint. You can monitor the release progress on the SageMaker console Endpoints page, which will show pertinent metrics and status details. When the release is complete, you can invoke the model utilizing a SageMaker runtime customer and incorporate it with your applications.
Deploy DeepSeek-R1 using the SageMaker Python SDK
To start with DeepSeek-R1 using the SageMaker Python SDK, you will require to set up the SageMaker Python SDK and make certain you have the essential AWS approvals 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 deploying the model is provided in the Github here. You can clone the note pad and run from SageMaker Studio.
You can run extra 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 produce a guardrail utilizing the Amazon Bedrock console or the API, and implement it as shown in the following code:
Clean up
To avoid unwanted charges, complete the actions in this section to clean up your resources.
Delete the Amazon Bedrock Marketplace implementation
If you deployed the model using Amazon Bedrock Marketplace, complete the following actions:
1. On the Amazon Bedrock console, under Foundation models in the navigation pane, select Marketplace releases. - In the Managed deployments area, locate the endpoint you wish to delete.
- Select the endpoint, and on the Actions menu, choose Delete.
- Verify the endpoint details to make certain you're erasing the correct implementation: 1. Endpoint name.
- Model name.
- Endpoint status
Delete the SageMaker JumpStart predictor
The SageMaker JumpStart design you deployed will sustain costs if you leave it running. Use the following code to delete 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 utilizing 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 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 companies build ingenious options using AWS services and sped up calculate. Currently, he is focused on establishing methods for fine-tuning and optimizing the reasoning performance of big language designs. In his downtime, Vivek enjoys treking, watching motion pictures, and attempting various foods.
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 Science 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 item, engineering, and strategic partnerships for Amazon SageMaker JumpStart, SageMaker's artificial intelligence and generative AI center. She is enthusiastic about developing options that help customers accelerate their AI journey and unlock organization worth.