Today, we are thrilled 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 model, DeepSeek-R1, in addition to the distilled variations varying from 1.5 to 70 billion parameters to build, experiment, and properly scale your generative AI ideas on AWS.
In this post, we show how to get going with DeepSeek-R1 on Amazon Bedrock Marketplace and SageMaker JumpStart. You can follow comparable actions to deploy the distilled variations of the designs too.
Overview of DeepSeek-R1
DeepSeek-R1 is a big language design (LLM) developed by DeepSeek AI that utilizes support learning to enhance reasoning capabilities through a multi-stage training process from a DeepSeek-V3-Base foundation. A crucial distinguishing feature is its support knowing (RL) step, which was utilized to improve the design's responses beyond the basic pre-training and tweak procedure. By incorporating RL, DeepSeek-R1 can adjust better to user feedback and objectives, ultimately enhancing both relevance and clarity. In addition, DeepSeek-R1 employs a chain-of-thought (CoT) approach, implying it's geared up to break down complex questions and reason through them in a detailed manner. This directed reasoning process permits the design to produce more accurate, transparent, and detailed responses. This design combines RL-based fine-tuning with CoT abilities, aiming to produce structured reactions while focusing on interpretability and user interaction. With its wide-ranging capabilities DeepSeek-R1 has captured the industry's attention as a versatile text-generation design that can be integrated into different workflows such as agents, sensible reasoning and data interpretation tasks.
DeepSeek-R1 uses a Mix of Experts (MoE) architecture and is 671 billion specifications in size. The MoE architecture enables activation of 37 billion criteria, enabling effective inference by routing queries to the most relevant professional "clusters." This approach permits the model to focus on various issue domains while maintaining total efficiency. DeepSeek-R1 needs 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 design. ml.p5e.48 xlarge features 8 Nvidia H200 GPUs offering 1128 GB of GPU memory.
DeepSeek-R1 distilled models bring the reasoning abilities of the main R1 design to more effective architectures based on popular open designs 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 models to mimic the habits and reasoning patterns of the larger DeepSeek-R1 model, utilizing it as a teacher model.
You can deploy DeepSeek-R1 design 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, we will use Amazon Bedrock Guardrails to present safeguards, avoid hazardous content, and examine designs against key safety criteria. At the time of writing 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 design, improving user experiences and standardizing safety controls across your generative AI applications.
Prerequisites
To deploy the DeepSeek-R1 model, you require access to an ml.p5e circumstances. To check if you have quotas for P5e, open the Service Quotas console and under AWS Services, select Amazon SageMaker, and verify 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 deploying. To ask for a limitation boost, create a limit increase request and connect 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) approvals to utilize Amazon Bedrock Guardrails. For instructions, see Establish approvals to use guardrails for content filtering.
Implementing guardrails with the ApplyGuardrail API
Amazon Bedrock Guardrails enables you to present safeguards, avoid harmful material, and examine designs against key safety criteria. You can execute safety procedures for the DeepSeek-R1 model utilizing the Amazon Bedrock ApplyGuardrail API. This enables you to apply guardrails to evaluate user inputs and model responses deployed on Amazon Bedrock Marketplace and SageMaker JumpStart. You can develop 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 reasoning. After receiving the model'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 intervened by the guardrail, a message is returned showing the nature of the intervention and whether it happened at the input or output phase. The examples showcased in the following areas show inference using 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, complete the following actions:
1. On the Amazon Bedrock console, pick Model catalog under Foundation models in the navigation pane.
At the time of writing this post, you can utilize the InvokeModel API to invoke the design. It doesn't support Converse APIs and other Amazon Bedrock tooling.
2. Filter for DeepSeek as a provider and choose the DeepSeek-R1 design.
The design detail page provides necessary details about the model's abilities, prices structure, and application standards. You can find detailed usage guidelines, including sample API calls and code snippets for integration. The model supports various text generation jobs, including content development, code generation, and question answering, using its support finding out optimization and CoT thinking abilities.
The page also consists of release choices and licensing details to assist you get started with DeepSeek-R1 in your applications.
3. To start using DeepSeek-R1, pick Deploy.
You will be prompted to configure the release details for DeepSeek-R1. The model ID will be pre-populated.
4. For Endpoint name, enter an endpoint name (between 1-50 alphanumeric characters).
5. For Number of circumstances, get in a number of instances (between 1-100).
6. For example type, select your instance type. For optimum performance with DeepSeek-R1, a GPU-based instance type like ml.p5e.48 xlarge is recommended.
Optionally, you can set up sophisticated security and facilities settings, consisting of virtual private cloud (VPC) networking, service function consents, and file encryption settings. For a lot of use cases, the default settings will work well. However, for production deployments, you may wish to evaluate these settings to line up with your company's security and compliance requirements.
7. Choose Deploy to start utilizing the design.
When the implementation is complete, you can check DeepSeek-R1's capabilities straight in the Amazon Bedrock play ground.
8. Choose Open in play area to access an interactive interface where you can explore different prompts 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 optimal outcomes. For example, content for reasoning.
This is an outstanding method to explore the design's thinking and text generation capabilities before integrating it into your applications. The play area offers instant feedback, helping you understand how the model reacts to various inputs and garagesale.es letting you tweak your prompts for ideal results.
You can rapidly check the design in the playground through the UI. However, to invoke the deployed design programmatically with any Amazon Bedrock APIs, you need 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 utilizing the invoke_model and ApplyGuardrail API. You can produce 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 produced the guardrail, use the following code to execute guardrails. The script initializes the bedrock_runtime client, configures reasoning specifications, and sends out a demand to produce text based on a user prompt.
Deploy DeepSeek-R1 with SageMaker JumpStart
SageMaker JumpStart is an artificial intelligence (ML) hub with FMs, integrated algorithms, and prebuilt ML options that you can deploy with simply a couple of clicks. With SageMaker JumpStart, you can models to your use case, wiki.whenparked.com with your information, and release them into production using either the UI or SDK.
Deploying DeepSeek-R1 design through SageMaker JumpStart provides two practical approaches: utilizing the user-friendly SageMaker JumpStart UI or carrying out programmatically through the SageMaker Python SDK. Let's check out both approaches to help you select the technique that finest matches your needs.
Deploy DeepSeek-R1 through SageMaker JumpStart UI
Complete the following steps to deploy DeepSeek-R1 utilizing SageMaker JumpStart:
1. On the SageMaker console, select Studio in the navigation pane.
2. First-time users will be triggered to create a domain.
3. On the SageMaker Studio console, select JumpStart in the navigation pane.
The design web browser displays available designs, with details like the provider name and design capabilities.
4. Look for DeepSeek-R1 to view the DeepSeek-R1 model card.
Each design card shows essential details, consisting of:
- Model name
- Provider name
- Task classification (for example, Text Generation).
Bedrock Ready badge (if appropriate), indicating that this model can be registered with Amazon Bedrock, enabling you to utilize Amazon Bedrock APIs to invoke the model
5. Choose the design card to see the model details page.
The design details page consists of the following details:
- The design name and company 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 model, it's advised to review the model details and license terms to confirm compatibility with your usage case.
6. Choose Deploy to continue with implementation.
7. For Endpoint name, use the instantly generated name or produce a customized one.
- For example type ¸ pick an instance type (default: ml.p5e.48 xlarge).
- For Initial instance count, go into the variety of circumstances (default: 1). Selecting proper circumstances types and counts is vital for cost and performance optimization. Monitor your deployment to adjust these settings as needed.Under Inference type, Real-time inference is chosen by default. This is enhanced for sustained traffic and low latency.
- Review all configurations for accuracy. For this model, we strongly recommend sticking to SageMaker JumpStart default settings and making certain that network isolation remains in location.
- Choose Deploy to deploy the model.
The deployment procedure can take numerous minutes to finish.
When implementation is total, your endpoint status will alter to InService. At this moment, the design is ready to accept inference demands through the endpoint. You can monitor the release 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 utilizing a SageMaker runtime client and incorporate it with your applications.
Deploy DeepSeek-R1 using the SageMaker Python SDK
To get going with DeepSeek-R1 utilizing the SageMaker Python SDK, you will require 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 shows how to deploy and use DeepSeek-R1 for inference programmatically. The code for deploying the model 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 inference with your SageMaker JumpStart predictor
Similar to Amazon Bedrock, you can likewise utilize the ApplyGuardrail API with your SageMaker JumpStart predictor. You can create 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 section to clean up your resources.
Delete the Amazon Bedrock Marketplace deployment
If you released the design utilizing Amazon Bedrock Marketplace, total the following steps:
1. On the Amazon Bedrock console, under Foundation models in the navigation pane, pick Marketplace implementations. - In the Managed implementations section, locate the endpoint you want to erase.
- Select the endpoint, and on the Actions menu, select 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 design you released will sustain costs if you leave it running. Use the following code to delete the endpoint if you wish 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 using Bedrock Marketplace and SageMaker JumpStart. Visit SageMaker JumpStart in SageMaker Studio or Amazon Bedrock Marketplace now to begin. 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 begun 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 develop innovative options utilizing AWS services and sped up compute. Currently, he is concentrated on developing methods for fine-tuning and optimizing the reasoning efficiency of big language designs. In his downtime, Vivek enjoys treking, seeing motion pictures, and attempting different foods.
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 Science and Bioinformatics.
Jonathan Evans is a Professional Solutions Architect working on generative AI with the Third-Party Model Science group at AWS.
Banu Nagasundaram leads item, engineering, and tactical collaborations for Amazon SageMaker JumpStart, SageMaker's artificial intelligence and generative AI hub. She is enthusiastic about developing options that assist consumers accelerate their AI journey and unlock organization worth.