Today, we are delighted 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 release DeepSeek AI's first-generation frontier model, DeepSeek-R1, along with the distilled variations ranging from 1.5 to 70 billion parameters to construct, experiment, and properly 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 deploy the distilled versions of the designs too.
Overview of DeepSeek-R1
DeepSeek-R1 is a big language model (LLM) established by DeepSeek AI that utilizes support finding out to enhance thinking capabilities through a multi-stage training procedure from a DeepSeek-V3-Base foundation. A crucial differentiating function is its reinforcement knowing (RL) action, which was utilized to improve the model's reactions beyond the basic pre-training and tweak procedure. By incorporating RL, DeepSeek-R1 can adapt more successfully to user feedback and objectives, ultimately enhancing both relevance and clarity. In addition, DeepSeek-R1 utilizes a chain-of-thought (CoT) method, indicating it's equipped to break down intricate questions and factor through them in a detailed way. This guided reasoning process permits the model to produce more accurate, transparent, and detailed responses. This design combines RL-based fine-tuning with CoT abilities, aiming to create structured responses while focusing on interpretability and user interaction. With its comprehensive capabilities DeepSeek-R1 has actually captured the market's attention as a versatile text-generation model that can be integrated into numerous workflows such as agents, sensible reasoning and data analysis tasks.
DeepSeek-R1 uses a Mixture of Experts (MoE) architecture and is 671 billion specifications in size. The MoE architecture enables activation of 37 billion parameters, allowing effective reasoning by routing queries to the most relevant professional "clusters." This approach allows the design to specialize in different problem domains while maintaining total efficiency. DeepSeek-R1 requires a minimum of 800 GB of HBM memory in FP8 format for inference. In this post, we will use an ml.p5e.48 xlarge instance to deploy the design. ml.p5e.48 xlarge comes with 8 Nvidia H200 GPUs providing 1128 GB of GPU memory.
DeepSeek-R1 distilled designs bring the reasoning abilities of the main R1 design 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 process of training smaller sized, more efficient designs to imitate the habits and reasoning patterns of the larger DeepSeek-R1 model, using it as an instructor model.
You can deploy DeepSeek-R1 model either through SageMaker JumpStart or Bedrock Marketplace. Because DeepSeek-R1 is an emerging model, we suggest releasing this model with guardrails in location. In this blog site, we will utilize Amazon Bedrock Guardrails to introduce safeguards, avoid hazardous material, and examine designs against key safety criteria. At the time of composing this blog site, for DeepSeek-R1 releases on SageMaker JumpStart and Bedrock Marketplace, Bedrock Guardrails supports only the ApplyGuardrail API. You can produce numerous guardrails tailored to various use cases and use them to the DeepSeek-R1 model, 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 instance. To inspect if you have quotas for P5e, open the Service Quotas console and under AWS Services, select Amazon SageMaker, and verify you're using ml.p5e.48 xlarge for endpoint usage. 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 boost, produce a limit boost demand bytes-the-dust.com and connect to your account team.
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) approvals to use Amazon Bedrock Guardrails. For directions, see Establish authorizations to use guardrails for content filtering.
Implementing guardrails with the ApplyGuardrail API
Amazon Bedrock Guardrails permits you to present safeguards, prevent hazardous content, and examine designs against crucial security requirements. You can carry out security procedures for the DeepSeek-R1 design using the Amazon Bedrock ApplyGuardrail API. This allows you to apply guardrails to evaluate user inputs and model reactions released 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 create the guardrail, see the GitHub repo.
The basic flow involves the following steps: First, the system gets an input for the model. This input is then processed through the ApplyGuardrail API. If the input passes the guardrail check, it's sent out to the model for reasoning. After receiving the design's output, another guardrail check is applied. If the output passes this last check, it's returned as the outcome. However, if either the input or output is intervened by the guardrail, a message is returned indicating the nature of the intervention and whether it occurred at the input or output stage. The examples showcased in the following sections show reasoning utilizing this API.
Deploy DeepSeek-R1 in Amazon Bedrock Marketplace
Amazon Bedrock Marketplace provides you access to over 100 popular, emerging, and specialized structure models (FMs) through Amazon Bedrock. To gain access to DeepSeek-R1 in Amazon Bedrock, complete the following steps:
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 doesn't support Converse APIs and other Amazon Bedrock tooling.
2. Filter for DeepSeek as a provider and pick the DeepSeek-R1 model.
The design detail page provides vital details about the design's capabilities, pricing structure, and implementation standards. You can find detailed use guidelines, consisting of sample API calls and code snippets for integration. The design supports various text generation jobs, consisting of content creation, code generation, and concern answering, using its reinforcement discovering optimization and CoT thinking capabilities.
The page also includes deployment options and licensing details to assist you start with DeepSeek-R1 in your applications.
3. To start using DeepSeek-R1, pick Deploy.
You will be prompted to set up the implementation details for DeepSeek-R1. The model ID will be pre-populated.
4. For Endpoint name, enter an endpoint name (in between 1-50 alphanumeric characters).
5. For Number of circumstances, get in a variety of instances (between 1-100).
6. For example type, pick your instance type. For optimum efficiency with DeepSeek-R1, a GPU-based circumstances type like ml.p5e.48 xlarge is recommended.
Optionally, you can configure advanced security and infrastructure settings, including virtual personal cloud (VPC) networking, service role approvals, and encryption settings. For many use cases, the default settings will work well. However, for production releases, you might desire to review these settings to align with your organization's security and compliance requirements.
7. Choose Deploy to begin utilizing the model.
When the implementation is complete, you can test DeepSeek-R1's capabilities straight in the Amazon Bedrock play area.
8. Choose Open in play area to access an interactive user interface where you can experiment with various triggers and adjust design parameters like temperature level and optimum length.
When utilizing R1 with Bedrock's InvokeModel and Playground Console, utilize DeepSeek's chat template for optimum outcomes. For instance, material for reasoning.
This is an excellent method to check out the design's reasoning and text generation abilities before incorporating it into your applications. The playground provides instant feedback, assisting you comprehend how the design responds to various inputs and letting you fine-tune your prompts for ideal results.
You can rapidly test the design in the play area through the UI. However, to invoke the deployed design programmatically with any Amazon Bedrock APIs, you require to get the endpoint ARN.
Run inference using guardrails with the released DeepSeek-R1 endpoint
The following code example shows how to perform inference utilizing 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 develop the guardrail, see the GitHub repo. After you have produced the guardrail, use the following code to execute guardrails. The the bedrock_runtime client, sets up reasoning criteria, and sends out a request to create text based upon 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 solutions that you can deploy with simply a couple of 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 design through SageMaker JumpStart offers two convenient methods: using the intuitive SageMaker JumpStart UI or executing programmatically through the SageMaker Python SDK. Let's check out both techniques to help you pick the technique 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, select Studio in the navigation pane.
2. First-time users will be prompted to produce a domain.
3. On the SageMaker Studio console, pick JumpStart in the navigation pane.
The design web browser shows available designs, with details like the supplier name and model capabilities.
4. Search for DeepSeek-R1 to view the DeepSeek-R1 model card.
Each design card reveals essential details, consisting of:
- Model name
- Provider name
- Task classification (for instance, Text Generation).
Bedrock Ready badge (if applicable), suggesting that this model can be registered with Amazon Bedrock, enabling you to use Amazon Bedrock APIs to invoke the design
5. Choose the design card to see the model details page.
The model details page consists of the following details:
- The design name and company details. Deploy button to release the model. About and Notebooks tabs with detailed details
The About tab includes crucial details, such as:
- Model description. - License details.
- Technical specifications.
- Usage guidelines
Before you deploy the design, it's advised 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 automatically created name or produce a custom-made one.
- For Instance type ¸ choose a circumstances type (default: ml.p5e.48 xlarge).
- For Initial instance count, go into the variety of circumstances (default: 1). Selecting appropriate 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 selected by default. This is enhanced for sustained traffic and low latency.
- Review all setups for accuracy. For this model, we highly suggest adhering to SageMaker JumpStart default settings and making certain that network seclusion remains in place.
- Choose Deploy to deploy the model.
The release process can take numerous minutes to complete.
When deployment is total, your endpoint status will alter to InService. At this moment, the design is prepared to accept reasoning requests through the endpoint. You can keep track of the deployment progress on the SageMaker console Endpoints page, which will display pertinent metrics and status details. When the release is total, you can invoke the design utilizing a SageMaker runtime customer and integrate it with your applications.
Deploy DeepSeek-R1 utilizing the SageMaker Python SDK
To begin with DeepSeek-R1 utilizing the SageMaker Python SDK, you will require to install the SageMaker Python SDK and make certain you have the required AWS permissions and environment setup. The following is a detailed code example that demonstrates how to deploy and utilize DeepSeek-R1 for inference programmatically. The code for deploying the model is supplied in the Github here. You can clone the notebook 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 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 displayed in the following code:
Tidy up
To avoid unwanted charges, finish the actions in this area to tidy up your resources.
Delete the Amazon Bedrock Marketplace implementation
If you released the design using Amazon Bedrock Marketplace, complete the following steps:
1. On the Amazon Bedrock console, under Foundation models in the navigation pane, pick Marketplace releases. - In the Managed implementations area, find the endpoint you want 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 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 models, SageMaker JumpStart pretrained designs, Amazon SageMaker JumpStart Foundation Models, Amazon Bedrock Marketplace, and Getting started 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 construct innovative services utilizing AWS services and accelerated compute. Currently, he is concentrated on establishing techniques for fine-tuning and enhancing the reasoning efficiency of big language designs. In his downtime, Vivek enjoys hiking, seeing movies, and attempting different 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 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 product, engineering, and tactical collaborations for Amazon SageMaker JumpStart, SageMaker's artificial intelligence and generative AI hub. She is enthusiastic about constructing solutions that assist clients accelerate their AI journey and unlock business worth.