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 deploy DeepSeek AI's first-generation frontier model, DeepSeek-R1, along with the distilled versions ranging from 1.5 to 70 billion parameters to construct, experiment, and responsibly scale your generative AI concepts on AWS.
In this post, setiathome.berkeley.edu we demonstrate how to start with DeepSeek-R1 on Amazon Bedrock Marketplace and SageMaker JumpStart. You can follow comparable actions to deploy the distilled versions of the designs too.
Overview of DeepSeek-R1
DeepSeek-R1 is a large language design (LLM) developed by DeepSeek AI that uses reinforcement learning to boost thinking capabilities through a multi-stage training procedure from a DeepSeek-V3-Base structure. An essential differentiating feature is its support learning (RL) action, which was used to refine the design's actions beyond the standard pre-training and tweak procedure. By including RL, DeepSeek-R1 can adjust more effectively to user feedback and objectives, eventually enhancing both significance and clearness. In addition, DeepSeek-R1 uses a chain-of-thought (CoT) method, meaning it's equipped to break down intricate questions and factor through them in a detailed way. This assisted reasoning procedure enables the model to produce more precise, transparent, and detailed answers. This design integrates RL-based fine-tuning with CoT capabilities, aiming to generate structured responses while concentrating on interpretability and user interaction. With its comprehensive abilities DeepSeek-R1 has caught the industry's attention as a flexible text-generation model that can be incorporated into different workflows such as agents, logical reasoning and information interpretation tasks.
DeepSeek-R1 uses a Mix of Experts (MoE) architecture and is 671 billion criteria in size. The MoE architecture enables activation of 37 billion specifications, allowing efficient reasoning by routing inquiries to the most appropriate specialist "clusters." This approach permits the design to specialize in different issue domains while maintaining total effectiveness. DeepSeek-R1 requires at least 800 GB of HBM memory in FP8 format for reasoning. In this post, we will use an ml.p5e.48 xlarge instance to release the design. ml.p5e.48 xlarge includes 8 Nvidia H200 GPUs providing 1128 GB of GPU memory.
DeepSeek-R1 distilled designs bring the thinking 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 procedure of training smaller sized, more efficient designs to mimic the behavior and reasoning patterns of the bigger DeepSeek-R1 model, utilizing it as an instructor model.
You can deploy DeepSeek-R1 design either through SageMaker JumpStart or Bedrock Marketplace. Because DeepSeek-R1 is an emerging design, we advise releasing this model with guardrails in place. In this blog site, we will use Amazon Bedrock Guardrails to introduce safeguards, avoid hazardous content, and assess designs against key security requirements. At the time of writing this blog site, for DeepSeek-R1 implementations on SageMaker JumpStart and Bedrock Marketplace, Bedrock Guardrails supports only the ApplyGuardrail API. You can produce numerous guardrails tailored to different use cases and use them to the DeepSeek-R1 model, enhancing user experiences and standardizing safety controls throughout your generative AI applications.
Prerequisites
To deploy the DeepSeek-R1 model, you require access to an ml.p5e circumstances. To examine 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 increase, produce a limit boost request and connect to your account group.
Because you will be deploying this model with Amazon Bedrock Guardrails, make certain you have the right AWS Identity and Gain Access To Management (IAM) approvals to use Amazon Bedrock Guardrails. For guidelines, see Set up permissions to utilize guardrails for content filtering.
Implementing guardrails with the ApplyGuardrail API
Amazon Bedrock Guardrails allows you to introduce safeguards, avoid harmful content, and assess designs against essential security requirements. You can carry out security measures for the DeepSeek-R1 model utilizing the Amazon Bedrock ApplyGuardrail API. This allows you to use guardrails to assess user inputs and model reactions released 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 develop the guardrail, see the GitHub repo.
The general circulation 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 design 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 intervened 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 utilizing this API.
Deploy DeepSeek-R1 in Amazon Bedrock Marketplace
Amazon Bedrock Marketplace gives you access to over 100 popular, emerging, and specialized structure models (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 catalog under Foundation models in the navigation pane.
At the time of composing this post, you can use the InvokeModel API to conjure up the design. It doesn't support Converse APIs and other Amazon Bedrock tooling.
2. Filter for DeepSeek as a service provider and select the DeepSeek-R1 design.
The design detail page supplies important details about the design's capabilities, pricing structure, and application standards. You can find detailed use instructions, including sample API calls and code bits for integration. The design supports various text generation tasks, consisting of material production, code generation, and concern answering, using its support discovering optimization and CoT reasoning capabilities.
The page likewise includes deployment alternatives and licensing details to help you get going with DeepSeek-R1 in your applications.
3. To begin using DeepSeek-R1, select Deploy.
You will be triggered to configure the release 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, enter a variety of circumstances (between 1-100).
6. For example 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 sophisticated security and facilities settings, including virtual personal cloud (VPC) networking, service function approvals, and encryption settings. For a lot of use cases, the default settings will work well. However, for production releases, you might wish to examine these settings to line up with your organization's security and compliance requirements.
7. Choose Deploy to start utilizing the model.
When the release is complete, you can check DeepSeek-R1's abilities straight in the Amazon Bedrock play ground.
8. Choose Open in play area to access an interactive interface where you can try out different prompts and change design criteria like temperature and maximum length.
When using R1 with Bedrock's InvokeModel and Playground Console, use DeepSeek's chat design template for ideal results. For example, material for inference.
This is an exceptional method to explore the design's reasoning and text generation capabilities before integrating it into your applications. The play ground offers immediate feedback, helping you understand how the design responds to various inputs and letting you tweak your triggers for ideal results.
You can rapidly test the model 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 reasoning utilizing guardrails with the released DeepSeek-R1 endpoint
The following code example shows how to perform reasoning utilizing a released DeepSeek-R1 design through Amazon Bedrock utilizing the invoke_model and ApplyGuardrail API. You can create a guardrail utilizing the Amazon Bedrock console or the API. For the example code to create the guardrail, see the GitHub repo. After you have actually produced the guardrail, use the following code to implement guardrails. The script initializes the bedrock_runtime client, configures inference specifications, and sends a request to produce text based on a user prompt.
Deploy DeepSeek-R1 with SageMaker JumpStart
SageMaker JumpStart is an (ML) hub with FMs, built-in algorithms, and prebuilt ML services that you can release with just a couple of clicks. With SageMaker JumpStart, you can tailor pre-trained models to your usage case, with your information, and release them into production using either the UI or SDK.
Deploying DeepSeek-R1 model through SageMaker JumpStart offers two practical approaches: using the intuitive SageMaker JumpStart UI or implementing programmatically through the SageMaker Python SDK. Let's explore both methods to assist you select the method 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, choose Studio in the navigation pane.
2. First-time users will be triggered to develop a domain.
3. On the SageMaker Studio console, pick JumpStart in the navigation pane.
The model browser displays available designs, with details like the supplier name and model capabilities.
4. Search for DeepSeek-R1 to see the DeepSeek-R1 model card.
Each design card shows key details, consisting of:
- Model name
- Provider name
- Task classification (for instance, Text Generation).
Bedrock Ready badge (if applicable), indicating that this design can be signed up with Amazon Bedrock, permitting you to use Amazon Bedrock APIs to conjure up the model
5. Choose the model card to see the model details page.
The model details page includes the following details:
- The design name and supplier details. Deploy button to release the design. About and Notebooks tabs with detailed details
The About tab includes crucial details, such as:
- Model description. - License details.
- Technical specs.
- Usage guidelines
Before you deploy the design, it's advised to evaluate the model details and license terms to validate compatibility with your usage case.
6. Choose Deploy to continue with deployment.
7. For Endpoint name, use the automatically produced name or create a custom one.
- For Instance type ¸ pick an instance type (default: ml.p5e.48 xlarge).
- For Initial instance count, get in the variety of instances (default: 1). Selecting suitable circumstances types and counts is important for cost and performance optimization. Monitor your implementation to change 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 precision. For this model, we strongly suggest adhering to SageMaker JumpStart default settings and making certain that network isolation remains in place.
- Choose Deploy to deploy the model.
The implementation process can take numerous minutes to finish.
When deployment is total, your endpoint status will alter to InService. At this moment, the design is ready to accept reasoning demands through the endpoint. You can keep track of the release development on the SageMaker console Endpoints page, which will display pertinent metrics and status details. When the deployment is total, you can invoke the design utilizing a SageMaker runtime client and incorporate it with your applications.
Deploy DeepSeek-R1 using the SageMaker Python SDK
To start 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 consents 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 releasing the design is provided in the Github here. You can clone the note pad and run 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 also use the ApplyGuardrail API with your SageMaker JumpStart predictor. You can create a guardrail utilizing the Amazon Bedrock console or the API, and implement it as shown in the following code:
Tidy up
To avoid undesirable charges, finish the actions in this section to tidy up your resources.
Delete the Amazon Bedrock Marketplace deployment
If you deployed the design using Amazon Bedrock Marketplace, total the following actions:
1. On the Amazon Bedrock console, under Foundation designs in the navigation pane, choose Marketplace releases. - In the Managed deployments section, 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 appropriate 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 erase 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 model using Bedrock Marketplace and SageMaker JumpStart. Visit SageMaker JumpStart in SageMaker Studio or Amazon Bedrock Marketplace now to get started. For more details, describe Use Amazon Bedrock tooling with Amazon SageMaker JumpStart designs, SageMaker JumpStart pretrained designs, Amazon SageMaker JumpStart Foundation Models, Amazon Bedrock Marketplace, and Getting going 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 construct innovative solutions utilizing AWS services and accelerated calculate. Currently, he is focused on developing strategies for fine-tuning and optimizing the reasoning performance of large language designs. In his leisure time, Vivek takes pleasure in hiking, enjoying motion pictures, and attempting various foods.
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 a Specialist 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 center. She is enthusiastic about building options that help consumers accelerate their AI journey and unlock service worth.