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 model, DeepSeek-R1, together with the distilled variations ranging from 1.5 to 70 billion criteria to develop, experiment, and responsibly scale your generative AI ideas on AWS.
In this post, we demonstrate how to begin with DeepSeek-R1 on Amazon Bedrock Marketplace and SageMaker JumpStart. You can follow comparable actions to release the distilled variations of the designs also.
Overview of DeepSeek-R1
DeepSeek-R1 is a big language design (LLM) established by DeepSeek AI that uses reinforcement discovering to improve thinking abilities through a multi-stage training procedure from a DeepSeek-V3-Base structure. An essential distinguishing function is its support learning (RL) step, which was used to refine the model's responses beyond the basic pre-training and fine-tuning procedure. By including RL, DeepSeek-R1 can adjust more efficiently to user feedback and goals, ultimately improving both significance and clarity. In addition, DeepSeek-R1 uses a chain-of-thought (CoT) method, indicating it's equipped to break down intricate questions and factor through them in a detailed way. This assisted thinking process permits the design to produce more precise, transparent, and detailed responses. This model combines RL-based fine-tuning with CoT abilities, aiming to produce structured actions while focusing on interpretability and user interaction. With its extensive capabilities DeepSeek-R1 has caught the market's attention as a versatile text-generation model that can be integrated into numerous workflows such as representatives, logical thinking and data interpretation jobs.
DeepSeek-R1 uses 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 inquiries to the most appropriate expert "clusters." This technique permits the design to concentrate on different issue domains while maintaining general effectiveness. DeepSeek-R1 requires at least 800 GB of HBM memory in FP8 format for inference. In this post, we will use an ml.p5e.48 xlarge circumstances to deploy the model. ml.p5e.48 xlarge includes 8 Nvidia H200 GPUs supplying 1128 GB of GPU memory.
DeepSeek-R1 distilled designs bring the thinking capabilities 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 procedure of training smaller sized, more effective designs to simulate the habits and reasoning patterns of the larger DeepSeek-R1 model, using it as an instructor design.
You can deploy DeepSeek-R1 design either through SageMaker JumpStart or Bedrock Marketplace. Because DeepSeek-R1 is an emerging design, we recommend releasing this model with guardrails in location. In this blog, we will use Amazon Bedrock Guardrails to present safeguards, prevent harmful content, and assess designs against essential security requirements. At the time of writing 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 different usage cases and apply them to the DeepSeek-R1 design, improving user experiences and standardizing security controls throughout your generative AI applications.
Prerequisites
To release the DeepSeek-R1 design, you require access to an ml.p5e instance. To check if you have quotas for P5e, open the Service Quotas console and under AWS Services, select Amazon SageMaker, and validate 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 releasing. To ask for a limit increase, produce a limit boost request and reach out 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 utilize Amazon Bedrock Guardrails. For directions, see Establish authorizations to use guardrails for content filtering.
Implementing guardrails with the ApplyGuardrail API
Amazon Bedrock Guardrails enables you to introduce safeguards, avoid hazardous content, and assess models against essential safety requirements. You can implement precaution for the DeepSeek-R1 design utilizing the Amazon Bedrock ApplyGuardrail API. This allows you to use guardrails to assess user inputs and mediawiki.hcah.in design responses released on Amazon Bedrock Marketplace and SageMaker JumpStart. You can produce a guardrail using the Amazon Bedrock console or the API. For the example code to develop the guardrail, see the GitHub repo.
The basic circulation involves the following steps: First, the system gets 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 final check, it's returned as the last outcome. However, if either the input or output is stepped in 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 areas show reasoning using this API.
Deploy DeepSeek-R1 in Amazon Bedrock Marketplace
Amazon Bedrock Marketplace offers 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 brochure 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 service provider and choose the DeepSeek-R1 model.
The design detail page offers necessary details about the design's capabilities, prices structure, and application guidelines. You can discover detailed usage directions, including sample API calls and code snippets for integration. The design supports numerous text generation tasks, consisting of material production, code generation, and concern answering, utilizing its reinforcement learning optimization and CoT reasoning abilities.
The page likewise includes release options and licensing details to assist you get begun with DeepSeek-R1 in your applications.
3. To begin using DeepSeek-R1, choose Deploy.
You will be triggered to configure the release details for DeepSeek-R1. The model ID will be pre-populated.
4. For Endpoint name, go into an endpoint name (in between 1-50 alphanumeric characters).
5. For Number of instances, go into a variety of instances (in between 1-100).
6. For Instance type, select your circumstances type. For optimal efficiency 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, including virtual private cloud (VPC) networking, service function authorizations, and encryption settings. For many use cases, the default settings will work well. However, for production deployments, you might desire to evaluate these settings to align with your organization's security and compliance requirements.
7. Choose Deploy to start utilizing the design.
When the implementation is complete, you can evaluate DeepSeek-R1's abilities 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 prompts and change design criteria like temperature and optimum length.
When utilizing R1 with Bedrock's InvokeModel and Playground Console, utilize DeepSeek's chat design template for optimum results. For example, material for inference.
This is an excellent method to check out the model's thinking and text generation abilities before incorporating it into your applications. The play area offers instant feedback, assisting you comprehend how the model reacts to various inputs and letting you fine-tune your prompts for optimum results.
You can rapidly check the model in the playground through the UI. However, to invoke the released model programmatically with any Amazon Bedrock APIs, you need to get the endpoint ARN.
Run reasoning using 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 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 produce the guardrail, see the GitHub repo. After you have actually produced the guardrail, utilize the following code to carry out guardrails. The script initializes the bedrock_runtime customer, configures inference criteria, and sends out a demand to generate 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 solutions that you can deploy with just a couple of clicks. With SageMaker JumpStart, you can tailor pre-trained designs to your use case, with your data, and deploy them into production using either the UI or SDK.
Deploying DeepSeek-R1 model through SageMaker JumpStart uses two practical methods: utilizing the instinctive SageMaker JumpStart UI or implementing programmatically through the SageMaker Python SDK. Let's check out both methods to assist you choose the approach that best matches your needs.
Deploy DeepSeek-R1 through SageMaker JumpStart UI
Complete the following actions to release DeepSeek-R1 using SageMaker JumpStart:
1. On the SageMaker console, pick Studio in the navigation pane.
2. First-time users will be prompted to develop a domain.
3. On the SageMaker Studio console, select JumpStart in the navigation pane.
The design internet browser shows available designs, with details like the provider name and design abilities.
4. Look for DeepSeek-R1 to view the DeepSeek-R1 design card.
Each design card shows essential details, including:
- Model name
- Provider name
- Task category (for example, Text Generation).
Bedrock Ready badge (if suitable), indicating that this model can be registered with Amazon Bedrock, permitting you to use Amazon Bedrock APIs to conjure up the model
5. Choose the design card to see the design details page.
The design details page consists of the following details:
- The model name and company details. Deploy button to deploy the design. About and Notebooks tabs with detailed details
The About tab consists of essential details, such as:
- Model description. - License details.
- Technical specifications.
- Usage guidelines
Before you deploy the model, it's advised to review the design details and license terms to validate compatibility with your use case.
6. Choose Deploy to proceed with release.
7. For Endpoint name, utilize the automatically created name or create a custom-made one.
- For Instance type ¸ select an instance type (default: ml.p5e.48 xlarge).
- For Initial instance count, enter the variety of circumstances (default: 1). Selecting proper instance types and counts is essential for cost and efficiency optimization. Monitor your implementation to change these settings as needed.Under Inference type, Real-time inference is picked by default. This is optimized for sustained traffic and low latency.
- Review all setups for precision. For this design, we strongly advise sticking to SageMaker JumpStart default settings and making certain that network seclusion remains in place.
- Choose Deploy to release the design.
The deployment process can take several minutes to finish.
When release is complete, your endpoint status will change to InService. At this moment, the model is prepared to accept reasoning requests through the endpoint. You can monitor the release progress on the SageMaker console Endpoints page, which will show pertinent metrics and status details. When the deployment is complete, you can conjure up the model 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 need to install the SageMaker Python SDK and make certain you have the needed AWS permissions and environment setup. The following is a detailed code example that shows how to release and utilize DeepSeek-R1 for inference programmatically. The code for deploying 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 utilize the ApplyGuardrail API with your SageMaker JumpStart predictor. You can develop a guardrail using the Amazon Bedrock console or the API, and execute it as displayed in the following code:
Clean up
To avoid undesirable charges, complete the actions in this section to clean up your resources.
Delete the Amazon Bedrock Marketplace implementation
If you deployed the design utilizing Amazon Bedrock Marketplace, complete the following steps:
1. On the Amazon Bedrock console, under Foundation designs in the navigation pane, pick Marketplace implementations. - In the Managed implementations section, locate 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 erasing the right implementation: 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 wish to stop sustaining charges. For more details, see Delete Endpoints and Resources.
Conclusion
In this post, we explored how you can access and release 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 designs, SageMaker JumpStart pretrained models, 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 construct ingenious services utilizing AWS services and sped up calculate. Currently, he is focused on developing strategies for fine-tuning and optimizing the inference performance of big language models. In his downtime, Vivek enjoys treking, seeing films, and trying various foods.
Niithiyn Vijeaswaran is a Generative AI Specialist Solutions Architect with the Third-Party Model Science team 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 Solutions Architect working on generative AI with the Third-Party Model Science team at AWS.
Banu Nagasundaram leads item, engineering, and tactical partnerships for Amazon SageMaker JumpStart, SageMaker's artificial intelligence and generative AI center. She is enthusiastic about building services that assist clients accelerate their AI journey and unlock organization value.