Today, we are thrilled to announce 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 versions ranging from 1.5 to 70 billion criteria to build, experiment, and responsibly scale your generative AI ideas on AWS.
In this post, we demonstrate how to get going with DeepSeek-R1 on Amazon Bedrock Marketplace and SageMaker JumpStart. You can follow similar actions to release the distilled variations of the designs also.
Overview of DeepSeek-R1
DeepSeek-R1 is a big language design (LLM) developed by DeepSeek AI that uses support learning to boost reasoning abilities through a multi-stage training procedure from a DeepSeek-V3-Base foundation. A key identifying feature is its support knowing (RL) action, which was used to improve the design's actions beyond the basic pre-training and tweak procedure. By including RL, DeepSeek-R1 can adjust better to user feedback and goals, eventually improving both relevance and clarity. In addition, DeepSeek-R1 employs a chain-of-thought (CoT) approach, meaning it's geared up to break down complex questions and factor through them in a detailed way. This assisted reasoning procedure enables the design to produce more accurate, transparent, and detailed answers. This design combines RL-based fine-tuning with CoT capabilities, aiming to produce structured responses while concentrating on interpretability and user interaction. With its comprehensive capabilities DeepSeek-R1 has captured the market's attention as a flexible text-generation model that can be integrated into numerous workflows such as representatives, logical thinking and information interpretation tasks.
DeepSeek-R1 utilizes a Mix of Experts (MoE) architecture and is 671 billion criteria in size. The MoE architecture enables activation of 37 billion criteria, making it possible for efficient inference by routing queries to the most pertinent specialist "clusters." This technique permits the design to specialize in different problem domains while maintaining overall effectiveness. DeepSeek-R1 requires a minimum of 800 GB of HBM memory in FP8 format for reasoning. In this post, we will utilize an ml.p5e.48 xlarge circumstances to release the design. ml.p5e.48 xlarge includes 8 Nvidia H200 GPUs supplying 1128 GB of GPU memory.
DeepSeek-R1 distilled models bring the thinking 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 describes a process of training smaller sized, more efficient designs to mimic the behavior and reasoning patterns of the larger DeepSeek-R1 model, utilizing 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 advise deploying this design with guardrails in location. In this blog site, we will use Amazon Bedrock Guardrails to introduce safeguards, avoid hazardous content, and evaluate models against crucial safety criteria. At the time of composing this blog site, for DeepSeek-R1 releases on SageMaker JumpStart and Bedrock Marketplace, Bedrock Guardrails supports just the ApplyGuardrail API. You can create multiple 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 design, 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 validate you're using 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 request a limit boost, create a limitation boost request and connect to your account team.
Because you will be releasing this design with Amazon Bedrock Guardrails, make certain you have the appropriate AWS Identity and Gain Access To Management (IAM) approvals to use Amazon Bedrock Guardrails. For guidelines, see Establish consents to use guardrails for content filtering.
Implementing guardrails with the ApplyGuardrail API
Amazon Bedrock Guardrails permits you to introduce safeguards, prevent hazardous material, and examine models against essential safety requirements. You can carry out precaution for the DeepSeek-R1 model utilizing the Amazon Bedrock ApplyGuardrail API. This permits you to apply guardrails to assess user inputs and model actions 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 develop the guardrail, see the GitHub repo.
The general flow includes the following actions: 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 final check, it's returned as the last 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 occurred at the input or output phase. The examples showcased in the following areas show inference 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, 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 use 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 offers important details about the model's abilities, rates structure, and implementation guidelines. You can find detailed use guidelines, consisting of sample API calls and archmageriseswiki.com code bits for combination. The model supports different text generation jobs, including content production, code generation, and wiki.vst.hs-furtwangen.de question answering, utilizing its support finding out optimization and CoT reasoning abilities.
The page likewise includes implementation options and licensing details to help you get begun with DeepSeek-R1 in your applications.
3. To begin using DeepSeek-R1, pick Deploy.
You will be triggered to configure the implementation details for DeepSeek-R1. The design ID will be pre-populated.
4. For Endpoint name, go into an endpoint name (between 1-50 alphanumeric characters).
5. For Number of circumstances, go into a variety of circumstances (between 1-100).
6. For Instance type, pick your instance type. For optimal efficiency with DeepSeek-R1, a GPU-based instance type like ml.p5e.48 xlarge is advised.
Optionally, you can set up innovative security and facilities settings, including virtual personal cloud (VPC) networking, service function approvals, and encryption settings. For many utilize cases, the default settings will work well. However, for production releases, you may want to evaluate these settings to line up with your company's security and compliance requirements.
7. Choose Deploy to start utilizing the model.
When the release is total, you can check DeepSeek-R1's capabilities straight in the Amazon Bedrock play area.
8. Choose Open in play ground to access an interactive interface where you can experiment with different triggers and change design criteria like temperature level and optimum length.
When utilizing R1 with Bedrock's InvokeModel and Playground Console, utilize DeepSeek's chat template for optimal results. For instance, material for reasoning.
This is an excellent way to explore the design's thinking and text generation abilities before incorporating it into your applications. The play ground supplies instant feedback, helping you comprehend how the design reacts to different inputs and letting you tweak your triggers for optimal results.
You can quickly evaluate the model in the playground through the UI. However, to invoke the released design programmatically with any Amazon Bedrock APIs, you require to get the endpoint ARN.
Run reasoning utilizing guardrails with the deployed DeepSeek-R1 endpoint
The following code example demonstrates how to carry out inference using a deployed DeepSeek-R1 design through Amazon Bedrock utilizing the invoke_model and ApplyGuardrail API. 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. After you have developed the guardrail, use the following code to implement guardrails. The script initializes the bedrock_runtime customer, sets up inference criteria, and sends 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 services that you can deploy 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 utilizing either the UI or SDK.
Deploying DeepSeek-R1 model through SageMaker JumpStart offers 2 hassle-free approaches: using the instinctive SageMaker JumpStart UI or carrying out programmatically through the SageMaker Python SDK. Let's check out both methods to assist you pick the approach that best suits your needs.
Deploy DeepSeek-R1 through SageMaker JumpStart UI
Complete the following actions to deploy DeepSeek-R1 using 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 models, with details like the provider name and model abilities.
4. Search for DeepSeek-R1 to see the DeepSeek-R1 model card.
Each design card shows essential details, including:
- Model name
- Provider name
- Task classification (for instance, Text Generation).
Bedrock Ready badge (if relevant), showing that this design can be registered with Amazon Bedrock, allowing you to use Amazon Bedrock APIs to conjure up the model
5. Choose the model card to view the model details page.
The design details page consists of the following details:
- The design name and provider details. Deploy button to release the model. About and Notebooks tabs with detailed details
The About tab consists of important details, such as:
- Model description. - License details.
- Technical specifications.
- Usage guidelines
Before you deploy the model, it's recommended to examine the design details and license terms to verify compatibility with your usage case.
6. Choose Deploy to continue with deployment.
7. For Endpoint name, use the immediately generated name or develop a custom-made one.
- For Instance type ¸ choose an instance type (default: ml.p5e.48 xlarge).
- For Initial instance count, get in the number of circumstances (default: 1). Selecting suitable circumstances types and counts is essential for expense and efficiency optimization. Monitor your implementation to adjust these settings as needed.Under Inference type, Real-time reasoning is picked by default. This is enhanced for sustained traffic and low latency.
- Review all configurations for accuracy. For this design, we strongly advise adhering to SageMaker JumpStart default settings and making certain that network isolation remains in place.
- Choose Deploy to release the design.
The deployment procedure can take a number of minutes to finish.
When deployment is total, your endpoint status will change to InService. At this point, the model is all set to accept reasoning demands through the endpoint. You can keep track of the release progress on the SageMaker console Endpoints page, which will display relevant metrics and status details. When the release is total, you can conjure up the design using a SageMaker runtime customer 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 need to set up the SageMaker Python SDK and make certain you have the essential AWS permissions 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 design is provided in the Github here. You can clone the note pad and range 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 also utilize the ApplyGuardrail API with your SageMaker JumpStart predictor. You can develop a guardrail using the Amazon Bedrock console or the API, and implement it as shown in the following code:
Tidy up
To avoid unwanted charges, complete the steps 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 models in the navigation pane, select Marketplace implementations. - In the Managed implementations section, find the endpoint you want to delete.
- Select the endpoint, and on the Actions menu, choose Delete.
- Verify the endpoint details to make certain you're deleting the appropriate release: 1. Endpoint name.
- Model name.
- Endpoint status
Delete the SageMaker JumpStart predictor
The SageMaker JumpStart model 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 utilizing Bedrock Marketplace and SageMaker JumpStart. Visit SageMaker JumpStart in or Amazon Bedrock Marketplace now to get going. For more details, describe Use Amazon Bedrock tooling with Amazon SageMaker JumpStart models, SageMaker JumpStart pretrained designs, Amazon SageMaker JumpStart Foundation Models, Amazon Bedrock Marketplace, and Beginning with Amazon SageMaker JumpStart.
About the Authors
Vivek Gangasani is a Lead Specialist Solutions Architect for Inference at AWS. He assists emerging generative AI companies build innovative solutions utilizing AWS services and accelerated compute. Currently, he is concentrated on developing techniques for fine-tuning and enhancing the reasoning performance of large language designs. In his totally free time, Vivek takes pleasure in hiking, yewiki.org 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 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 team at AWS.
Banu Nagasundaram leads product, engineering, and strategic partnerships for Amazon SageMaker JumpStart, SageMaker's artificial intelligence and generative AI hub. She is enthusiastic about constructing solutions that assist customers accelerate their AI journey and unlock business value.