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 design, DeepSeek-R1, along with the distilled versions varying from 1.5 to 70 billion parameters to build, disgaeawiki.info experiment, and properly scale your generative AI ideas on AWS.
In this post, we show how to start with DeepSeek-R1 on Amazon Bedrock Marketplace and SageMaker JumpStart. You can follow comparable actions to deploy the distilled variations of the models also.
Overview of DeepSeek-R1
DeepSeek-R1 is a large language design (LLM) developed by DeepSeek AI that utilizes support discovering to enhance thinking capabilities through a multi-stage training procedure from a DeepSeek-V3-Base foundation. A key differentiating feature is its support knowing (RL) step, which was used to refine the design's reactions beyond the standard pre-training and tweak procedure. By integrating RL, DeepSeek-R1 can adjust better to user feedback and goals, ultimately improving both significance and clarity. In addition, DeepSeek-R1 uses a chain-of-thought (CoT) technique, suggesting it's equipped to break down complicated questions and reason through them in a detailed way. This guided thinking process allows the design to produce more precise, transparent, and detailed responses. This design integrates RL-based fine-tuning with CoT capabilities, aiming to generate structured responses while focusing on interpretability and user interaction. With its comprehensive abilities DeepSeek-R1 has recorded the industry's attention as a flexible text-generation design that can be integrated into numerous workflows such as agents, sensible thinking and information analysis tasks.
DeepSeek-R1 utilizes a Mixture of Experts (MoE) architecture and is 671 billion criteria in size. The MoE architecture enables activation of 37 billion parameters, allowing efficient reasoning by routing queries to the most pertinent professional "clusters." This approach enables the model to focus on various problem domains while maintaining total efficiency. DeepSeek-R1 requires at least 800 GB of HBM memory in FP8 format for reasoning. In this post, we will utilize an ml.p5e.48 xlarge instance to release the model. ml.p5e.48 xlarge includes 8 Nvidia H200 GPUs supplying 1128 GB of GPU memory.
DeepSeek-R1 distilled models bring the reasoning abilities of the main R1 design to more effective architectures based upon popular open models like Qwen (1.5 B, 7B, 14B, and 32B) and Llama (8B and 70B). Distillation refers to a procedure of training smaller sized, more efficient models to mimic the behavior and thinking patterns of the bigger DeepSeek-R1 design, utilizing it as a teacher design.
You can release DeepSeek-R1 model either through SageMaker JumpStart or Bedrock Marketplace. Because DeepSeek-R1 is an emerging model, we suggest deploying this design with guardrails in location. In this blog site, we will utilize Amazon Bedrock Guardrails to present safeguards, prevent harmful content, and assess models against crucial security 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 produce multiple guardrails tailored to various use cases and apply them to the DeepSeek-R1 design, improving user experiences and standardizing safety controls across your generative AI applications.
Prerequisites
To deploy the DeepSeek-R1 design, 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, pick Amazon SageMaker, and confirm you're utilizing 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, create a limit boost demand and connect to your account team.
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) permissions to utilize Amazon Bedrock Guardrails. For guidelines, see Establish consents to utilize guardrails for content filtering.
Implementing guardrails with the ApplyGuardrail API
Amazon Bedrock Guardrails allows you to introduce safeguards, prevent harmful material, and evaluate models against essential safety criteria. You can implement precaution for the DeepSeek-R1 design utilizing the Amazon Bedrock ApplyGuardrail API. This enables you to use guardrails to evaluate user inputs and design responses released 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 develop the guardrail, see the GitHub repo.
The basic circulation includes the following actions: 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 model'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 intervened by the guardrail, a message is returned indicating the nature of the intervention and whether it happened at the input or output stage. The examples showcased in the following sections 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 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 brochure under Foundation designs in the navigation pane.
At the time of writing this post, you can use the InvokeModel API to conjure up the design. It does not support Converse APIs and other Amazon Bedrock tooling.
2. Filter for DeepSeek as a provider and choose the DeepSeek-R1 model.
The design detail page offers vital details about the design's abilities, prices structure, and execution guidelines. You can find detailed use guidelines, consisting of sample API calls and code snippets for integration. The model supports different text generation jobs, including material creation, code generation, and concern answering, using its support learning optimization and CoT reasoning abilities.
The page also consists of implementation choices and licensing details to help you start with DeepSeek-R1 in your applications.
3. To begin using DeepSeek-R1, choose Deploy.
You will be prompted to configure the implementation details for DeepSeek-R1. The model ID will be pre-populated.
4. For Endpoint name, get in an endpoint name (between 1-50 alphanumeric characters).
5. For Number of circumstances, get in a number of instances (in between 1-100).
6. For Instance type, choose your circumstances type. For ideal performance with DeepSeek-R1, a GPU-based circumstances type like ml.p5e.48 xlarge is recommended.
Optionally, you can set up advanced security and facilities settings, including virtual personal cloud (VPC) networking, service role consents, and file encryption settings. For the majority of utilize cases, the default settings will work well. However, for production deployments, you may want 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 check DeepSeek-R1's abilities straight in the Amazon Bedrock playground.
8. Choose Open in playground to access an interactive user interface where you can experiment with various prompts and change design specifications like temperature and optimum length.
When using R1 with Bedrock's InvokeModel and Playground Console, utilize DeepSeek's chat design template for optimal outcomes. For example, material for reasoning.
This is an outstanding way to check out the design's reasoning and text generation capabilities before incorporating it into your applications. The play ground offers immediate feedback, helping you understand how the model responds to numerous inputs and letting you fine-tune your triggers for ideal outcomes.
You can rapidly check the model in the play area through the UI. However, to conjure up the deployed model programmatically with any Amazon Bedrock APIs, you need to get the endpoint ARN.
Run reasoning using guardrails with the deployed DeepSeek-R1 endpoint
The following code example demonstrates how to perform inference utilizing a deployed DeepSeek-R1 model through Amazon Bedrock using the invoke_model and ApplyGuardrail API. 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. After you have actually developed the guardrail, use the following code to carry out guardrails. The script initializes the bedrock_runtime customer, configures reasoning specifications, and sends a request to create text based on 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 services 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 deploy them into production utilizing either the UI or SDK.
Deploying DeepSeek-R1 model through SageMaker JumpStart offers 2 hassle-free methods: using the user-friendly SageMaker JumpStart UI or executing programmatically through the SageMaker Python SDK. Let's check out 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 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 displays available designs, with details like the provider name and model capabilities.
4. Search for DeepSeek-R1 to view 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 appropriate), suggesting that this model can be signed up with Amazon Bedrock, permitting you to use Amazon Bedrock APIs to invoke the model
5. Choose the model card to see the model details page.
The model details page consists of the following details:
- The design name and service provider details. Deploy button to deploy the model. About and Notebooks tabs with detailed details
The About tab consists of essential details, such as:
- Model description. - License details.
- Technical requirements.
- Usage standards
Before you deploy the model, it's advised to review the model details and license terms to validate compatibility with your use case.
6. Choose Deploy to proceed with deployment.
7. For Endpoint name, utilize the automatically created name or create a customized one.
- For example type ¸ choose a circumstances type (default: ml.p5e.48 xlarge).
- For Initial instance count, go into the number of instances (default: 1). Selecting appropriate instance types and counts is essential for expense and efficiency optimization. Monitor your release to adjust these settings as needed.Under Inference type, Real-time inference is selected by default. This is optimized for sustained traffic and low latency.
- Review all configurations for precision. For this model, we strongly recommend sticking to SageMaker JumpStart default settings and making certain that network seclusion remains in place.
- Choose Deploy to deploy the model.
The implementation process can take a number of minutes to complete.
When deployment is total, your endpoint status will change to InService. At this point, the model is all set to accept inference demands through the endpoint. You can monitor the deployment development on the SageMaker console Endpoints page, which will show pertinent metrics and status details. When the deployment is total, you can conjure up the design utilizing a SageMaker runtime client and incorporate 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 necessary AWS permissions and environment setup. The following is a detailed code example that shows how to release and use DeepSeek-R1 for inference programmatically. The code for releasing the model is provided in the Github here. You can clone the notebook and range from SageMaker Studio.
You can run additional requests 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 execute it as revealed in the following code:
Tidy up
To prevent unwanted charges, finish the steps in this area to clean up your resources.
Delete the Amazon Bedrock Marketplace release
If you deployed the design using Amazon Bedrock Marketplace, complete the following steps:
1. On the Amazon Bedrock console, under Foundation models in the navigation pane, select Marketplace deployments. - In the Managed releases section, find the endpoint you desire to delete.
- Select the endpoint, and on the Actions menu, choose Delete.
- Verify the endpoint details to make certain you're deleting the right deployment: 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 want 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, describe 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 construct ingenious services using AWS services and accelerated calculate. Currently, he is concentrated on developing methods for fine-tuning and optimizing the reasoning performance of big language designs. In his totally free time, Vivek delights in hiking, watching movies, and trying different cuisines.
Niithiyn Vijeaswaran is a Generative AI Specialist Solutions Architect with the Third-Party Model Science team at AWS. His area of focus is AWS AI accelerators (AWS Neuron). He holds a Bachelor's degree in Computer technology and Bioinformatics.
Jonathan Evans is an Expert Solutions Architect working on generative AI with the Third-Party Model Science team at AWS.
Banu Nagasundaram leads product, engineering, and strategic collaborations for Amazon SageMaker JumpStart, SageMaker's artificial intelligence and generative AI center. She is enthusiastic about developing solutions that help customers accelerate their AI and unlock service worth.