Today, we are delighted to reveal 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, along with the distilled variations varying from 1.5 to 70 billion specifications to construct, experiment, and responsibly scale your generative AI concepts 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 versions of the models also.
Overview of DeepSeek-R1
DeepSeek-R1 is a large language model (LLM) developed by DeepSeek AI that uses reinforcement learning to improve reasoning abilities through a multi-stage training procedure from a DeepSeek-V3-Base structure. An essential identifying function is its reinforcement learning (RL) action, which was utilized to refine the design's actions beyond the basic pre-training and fine-tuning process. By integrating RL, DeepSeek-R1 can adapt better to user feedback and goals, ultimately enhancing both significance and clarity. In addition, DeepSeek-R1 employs a chain-of-thought (CoT) approach, meaning it's equipped to break down intricate inquiries and reason through them in a detailed manner. This directed reasoning process allows the model to produce more accurate, transparent, and detailed answers. This design combines RL-based fine-tuning with CoT abilities, aiming to produce 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 integrated into various workflows such as agents, sensible thinking and data interpretation jobs.
DeepSeek-R1 utilizes a Mix of Experts (MoE) architecture and is 671 billion parameters in size. The MoE architecture enables activation of 37 billion parameters, making it possible for effective inference by routing queries to the most pertinent expert "clusters." This technique allows the design to focus on various issue domains while maintaining total effectiveness. DeepSeek-R1 requires a minimum of 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 features 8 Nvidia H200 GPUs providing 1128 GB of GPU memory.
DeepSeek-R1 distilled models bring the thinking capabilities of the main R1 model to more effective architectures based on popular open designs 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 mimic the habits and thinking patterns of the larger DeepSeek-R1 design, using it as an instructor design.
You can release DeepSeek-R1 design either through SageMaker JumpStart or Bedrock Marketplace. Because DeepSeek-R1 is an emerging model, we advise releasing this design with guardrails in location. In this blog site, we will utilize Amazon Bedrock Guardrails to present safeguards, avoid harmful content, and examine designs against essential security requirements. At the time of writing this blog, for DeepSeek-R1 releases on SageMaker JumpStart and Bedrock Marketplace, Bedrock Guardrails supports just the ApplyGuardrail API. You can develop several guardrails tailored to various use cases and apply them to the DeepSeek-R1 design, enhancing user experiences and standardizing security controls across your generative AI applications.
Prerequisites
To release 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, choose 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 releasing. To ask for a limitation increase, develop a limitation increase demand and reach out to your account group.
Because you will be deploying this design with Amazon Bedrock Guardrails, make certain you have the right AWS Identity and Gain Access To Management (IAM) consents to use Amazon Bedrock Guardrails. For directions, see Set up permissions to utilize guardrails for material filtering.
Implementing guardrails with the ApplyGuardrail API
Amazon Bedrock Guardrails permits you to introduce safeguards, prevent damaging material, and assess designs against crucial security requirements. You can execute security procedures for the DeepSeek-R1 design utilizing the Amazon Bedrock ApplyGuardrail API. This enables you to use guardrails to examine user inputs and design reactions deployed on Amazon Bedrock Marketplace and . You can produce a guardrail using the Amazon Bedrock console or the API. For the example code to produce the guardrail, see the GitHub repo.
The general circulation involves the following steps: 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 inference. After receiving the design'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 suggesting the nature of the intervention and whether it happened at the input or output stage. The examples showcased in the following sections demonstrate inference utilizing this API.
Deploy DeepSeek-R1 in Amazon Bedrock Marketplace
Amazon Bedrock Marketplace provides you access to over 100 popular, emerging, and specialized foundation models (FMs) through Amazon Bedrock. To gain access to DeepSeek-R1 in Amazon Bedrock, complete the following actions:
1. On the Amazon Bedrock console, choose Model brochure under Foundation models in the navigation pane.
At the time of composing this post, you can utilize the InvokeModel API to invoke the model. 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 supplies important details about the model's abilities, pricing structure, and application standards. You can discover detailed use guidelines, consisting of sample API calls and code snippets for integration. The model supports numerous text generation jobs, consisting of content creation, code generation, and question answering, utilizing its reinforcement finding out optimization and CoT reasoning capabilities.
The page likewise includes implementation alternatives and licensing details to assist you get going with DeepSeek-R1 in your applications.
3. To begin using DeepSeek-R1, select Deploy.
You will be triggered to set up the deployment details for DeepSeek-R1. The design 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, get in a number of instances (between 1-100).
6. For example type, select your circumstances type. For optimum performance with DeepSeek-R1, a GPU-based circumstances type like ml.p5e.48 xlarge is suggested.
Optionally, you can configure advanced security and infrastructure settings, consisting of virtual private cloud (VPC) networking, service role approvals, and file encryption settings. For a lot of utilize cases, the default settings will work well. However, for production releases, you may wish to examine these settings to line up with your organization's security and compliance requirements.
7. Choose Deploy to start using the model.
When the deployment is total, you can evaluate DeepSeek-R1's capabilities straight in the Amazon Bedrock playground.
8. Choose Open in play area to access an interactive interface where you can experiment with different triggers and change design parameters like temperature level and optimum length.
When using R1 with Bedrock's InvokeModel and Playground Console, utilize DeepSeek's chat template for ideal outcomes. For example, material for reasoning.
This is an exceptional method to check out the design's thinking and text generation capabilities before integrating it into your applications. The playground supplies immediate feedback, assisting you comprehend how the model reacts to different inputs and letting you tweak your triggers for ideal results.
You can quickly test the design in the play area through the UI. However, to conjure up the deployed design programmatically with any Amazon Bedrock APIs, you require to get the endpoint ARN.
Run inference utilizing guardrails with the released DeepSeek-R1 endpoint
The following code example demonstrates how to perform reasoning utilizing a deployed DeepSeek-R1 model through Amazon Bedrock using the invoke_model and ApplyGuardrail API. 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. After you have developed the guardrail, utilize the following code to implement guardrails. The script initializes the bedrock_runtime client, configures inference specifications, and sends a request to create text based upon 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 few 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 design through SageMaker JumpStart offers two hassle-free techniques: using the instinctive SageMaker JumpStart UI or implementing programmatically through the SageMaker Python SDK. Let's explore both methods to assist you choose the approach that best matches your requirements.
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 create 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 company name and design capabilities.
4. Look for DeepSeek-R1 to view the DeepSeek-R1 model card.
Each model card shows key details, consisting of:
- Model name
- Provider name
- Task category (for instance, Text Generation).
Bedrock Ready badge (if appropriate), suggesting that this design can be registered with Amazon Bedrock, allowing you to utilize Amazon Bedrock APIs to conjure up the design
5. Choose the model card to see the model details page.
The model details page consists of the following details:
- The design name and supplier details. Deploy button to deploy the design. About and Notebooks tabs with detailed details
The About tab includes important details, such as:
- Model description. - License details.
- Technical specs.
- Usage standards
Before you release the model, it's recommended to examine the model details and license terms to verify compatibility with your use case.
6. Choose Deploy to proceed with implementation.
7. For Endpoint name, utilize the immediately generated name or produce a custom-made one.
- For Instance type ¸ pick a circumstances type (default: ml.p5e.48 xlarge).
- For Initial circumstances count, enter the number of instances (default: 1). Selecting suitable instance types and counts is important for expense and performance optimization. Monitor your implementation to adjust these settings as needed.Under Inference type, Real-time reasoning is chosen by default. This is enhanced for sustained traffic and low latency.
- Review all configurations for precision. For this design, we strongly advise adhering to SageMaker JumpStart default settings and making certain that network isolation remains in location.
- Choose Deploy to deploy the design.
The release procedure can take several minutes to finish.
When deployment is total, your endpoint status will change to InService. At this point, the model is ready to accept reasoning requests through the endpoint. You can keep an eye on the deployment progress on the SageMaker console Endpoints page, which will show appropriate metrics and status details. When the implementation is complete, you can invoke the model utilizing a SageMaker runtime customer and integrate it with your applications.
Deploy DeepSeek-R1 using the SageMaker Python SDK
To begin with DeepSeek-R1 utilizing the SageMaker Python SDK, you will require to set up the SageMaker Python SDK and make certain you have the needed AWS authorizations and environment setup. The following is a detailed code example that shows how to release and use DeepSeek-R1 for reasoning programmatically. The code for releasing the design is offered in the Github here. You can clone the note pad and run from SageMaker Studio.
You can run additional demands 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 produce a guardrail utilizing the Amazon Bedrock console or the API, and implement it as revealed in the following code:
Clean up
To avoid unwanted charges, finish the steps in this area to clean up your resources.
Delete the Amazon Bedrock Marketplace deployment
If you released the model using Amazon Bedrock Marketplace, total the following steps:
1. On the Amazon Bedrock console, wavedream.wiki under Foundation models in the navigation pane, select Marketplace implementations. - In the Managed releases section, locate the endpoint you wish to delete.
- Select the endpoint, and on the Actions menu, pick Delete.
- Verify the endpoint details to make certain you're erasing the appropriate implementation: 1. Endpoint name.
- Model name.
- Endpoint status
Delete the SageMaker JumpStart predictor
The SageMaker JumpStart model you deployed will sustain expenses 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 checked out 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 get started. 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 Getting going with Amazon SageMaker JumpStart.
About the Authors
Vivek Gangasani is a Lead Specialist Solutions Architect for Inference at AWS. He assists emerging generative AI business build ingenious services using AWS services and accelerated calculate. Currently, he is concentrated on establishing techniques for fine-tuning and enhancing the inference efficiency of big language models. In his downtime, Vivek delights in hiking, enjoying movies, and attempting different 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 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 strategic partnerships for Amazon SageMaker JumpStart, SageMaker's artificial intelligence and generative AI center. She is passionate about building services that help customers accelerate their AI journey and unlock service value.