Today, we are excited 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 variations ranging from 1.5 to 70 billion specifications to develop, experiment, and responsibly scale your generative AI ideas on AWS.
In this post, we show how to get started with DeepSeek-R1 on Amazon Bedrock Marketplace and SageMaker JumpStart. You can follow similar actions to release the distilled versions of the designs as well.
Overview of DeepSeek-R1
DeepSeek-R1 is a big language design (LLM) developed by DeepSeek AI that uses reinforcement learning to improve thinking capabilities through a multi-stage training process from a DeepSeek-V3-Base structure. A key distinguishing feature is its support knowing (RL) action, which was used to improve the design's actions beyond the basic pre-training and fine-tuning process. By incorporating RL, DeepSeek-R1 can adapt more successfully to user feedback and goals, eventually boosting both importance and clearness. In addition, DeepSeek-R1 employs a chain-of-thought (CoT) method, indicating it's equipped to break down complex questions and reason through them in a detailed way. This guided thinking process enables the design to produce more precise, transparent, and detailed responses. This design combines 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 actually captured the market's attention as a versatile text-generation design that can be integrated into various 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 allows activation of 37 billion criteria, making it possible for efficient reasoning by routing inquiries to the most appropriate expert "clusters." This technique enables the design to specialize in various problem domains while maintaining overall efficiency. DeepSeek-R1 needs a minimum of 800 GB of HBM memory in FP8 format for reasoning. In this post, we will use an ml.p5e.48 xlarge circumstances to release the model. ml.p5e.48 xlarge features 8 Nvidia H200 GPUs providing 1128 GB of GPU memory.
DeepSeek-R1 distilled models bring the thinking abilities of the main R1 model to more efficient architectures based on popular open models like Qwen (1.5 B, 7B, 14B, and 32B) and Llama (8B and 70B). Distillation refers to a process of training smaller, more efficient models to imitate the habits and thinking patterns of the larger DeepSeek-R1 model, using it as a teacher model.
You can deploy DeepSeek-R1 design either through SageMaker JumpStart or Bedrock Marketplace. Because DeepSeek-R1 is an emerging model, we recommend deploying this design with guardrails in location. In this blog, we will use Amazon Bedrock Guardrails to present safeguards, avoid hazardous material, and assess models against crucial safety requirements. At the time of composing this blog, for DeepSeek-R1 implementations 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 model, improving user experiences and standardizing safety controls throughout your generative AI applications.
Prerequisites
To release the DeepSeek-R1 model, you need access to an ml.p5e circumstances. To check if you have quotas for P5e, open the Service Quotas console and under AWS Services, choose Amazon SageMaker, and verify 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 request a limit boost, develop a limit increase demand and reach out to your account team.
Because you will be deploying this model with Amazon Bedrock Guardrails, make certain you have the proper AWS Identity and Gain Access To Management (IAM) consents to use Amazon Bedrock Guardrails. For instructions, see Establish consents to use guardrails for content filtering.
Implementing guardrails with the ApplyGuardrail API
Amazon Bedrock Guardrails permits you to present safeguards, avoid harmful content, and assess designs against key security requirements. You can carry out security measures for the DeepSeek-R1 design using the Amazon Bedrock ApplyGuardrail API. This enables you to apply guardrails to assess user inputs and model responses deployed 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 produce the guardrail, see the GitHub repo.
The basic circulation involves the following actions: 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 design for reasoning. After getting the design's output, another guardrail check is used. 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 happened at the input or output phase. The examples showcased in the following areas demonstrate reasoning using 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 steps:
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 pick the DeepSeek-R1 design.
The design detail page offers important details about the design's capabilities, prices structure, and execution guidelines. You can discover detailed use directions, including sample API calls and code bits for integration. The model supports numerous text generation jobs, including material production, code generation, and question answering, utilizing its support finding out optimization and CoT reasoning capabilities.
The page also includes deployment alternatives and bytes-the-dust.com licensing details to assist you start with DeepSeek-R1 in your applications.
3. To start utilizing 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, get in an endpoint name (between 1-50 alphanumeric characters).
5. For Variety of instances, go into a variety of instances (between 1-100).
6. For Instance type, choose your circumstances type. For optimal performance with DeepSeek-R1, a GPU-based instance 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 the majority of use cases, the default settings will work well. However, for production releases, you might wish to review these settings to line up with your and compliance requirements.
7. Choose Deploy to start using the design.
When the deployment is complete, you can evaluate DeepSeek-R1's abilities 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 specifications like temperature and maximum length.
When using R1 with Bedrock's InvokeModel and Playground Console, use DeepSeek's chat design template for optimal results. For instance, material for inference.
This is an excellent method to check out the design's reasoning and text generation capabilities before incorporating it into your applications. The playground provides instant feedback, assisting you understand how the model reacts to different inputs and letting you fine-tune your triggers for optimum outcomes.
You can rapidly test the design in the playground through the UI. However, to conjure up the deployed model programmatically with any Amazon Bedrock APIs, you need to get the endpoint ARN.
Run inference using guardrails with the released DeepSeek-R1 endpoint
The following code example demonstrates how to perform inference using 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 produce 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, sets up inference parameters, and sends a demand to generate text based upon a user timely.
Deploy DeepSeek-R1 with SageMaker JumpStart
SageMaker JumpStart is an artificial intelligence (ML) center with FMs, built-in algorithms, and prebuilt ML solutions that you can deploy with simply a few clicks. With SageMaker JumpStart, you can tailor pre-trained models to your use case, with your data, and release them into production utilizing either the UI or SDK.
Deploying DeepSeek-R1 model through SageMaker JumpStart uses two practical approaches: using the instinctive SageMaker JumpStart UI or executing programmatically through the SageMaker Python SDK. Let's explore both approaches to assist you choose the technique that best matches 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, pick Studio in the navigation pane.
2. First-time users will be prompted 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 company name and model capabilities.
4. Look for DeepSeek-R1 to view the DeepSeek-R1 design card.
Each design card shows essential details, consisting of:
- Model name
- Provider name
- Task classification (for example, Text Generation).
Bedrock Ready badge (if applicable), indicating that this design can be registered with Amazon Bedrock, enabling you to utilize Amazon Bedrock APIs to invoke the model
5. Choose the model card to view the model details page.
The model details page consists of the following details:
- The design name and company details. Deploy button to release 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 deploy the design, it's advised to review the design details and license terms to validate compatibility with your use case.
6. Choose Deploy to continue with implementation.
7. For Endpoint name, utilize the immediately produced name or produce a customized one.
- For Instance type ¸ choose a circumstances type (default: ml.p5e.48 xlarge).
- For Initial circumstances count, enter the variety of instances (default: 1). Selecting appropriate instance types and counts is crucial for cost and efficiency optimization. Monitor your implementation to adjust 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 accuracy. For this model, we highly suggest sticking to SageMaker JumpStart default settings and making certain that network seclusion remains in location.
- Choose Deploy to deploy the design.
The release process can take a number of minutes to complete.
When implementation is total, your endpoint status will change to InService. At this moment, the design is prepared to accept reasoning requests through the endpoint. You can keep an eye on the release progress on the SageMaker console Endpoints page, which will show relevant metrics and status details. When the deployment is complete, you can conjure up the model using a SageMaker runtime customer and integrate it with your applications.
Deploy DeepSeek-R1 using the SageMaker Python SDK
To start with DeepSeek-R1 using the SageMaker Python SDK, you will need to set up the SageMaker Python SDK and make certain you have the essential AWS authorizations 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 offered 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 inference with your SageMaker JumpStart predictor
Similar to Amazon Bedrock, you can likewise use 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 revealed in the following code:
Tidy up
To avoid unwanted charges, complete the actions in this area to tidy up your resources.
Delete the Amazon Bedrock Marketplace deployment
If you released the model using Amazon Bedrock Marketplace, total the following actions:
1. On the Amazon Bedrock console, under Foundation models in the navigation pane, pick Marketplace deployments. - In the Managed releases section, find the endpoint you want to delete.
- Select the endpoint, and on the Actions menu, select Delete.
- Verify the endpoint details to make certain you're deleting the right implementation: 1. Endpoint name.
- Model name.
- Endpoint status
Delete the SageMaker JumpStart predictor
The SageMaker JumpStart design you released will sustain costs if you leave it running. Use the following code to erase the endpoint if you desire 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 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 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 companies construct ingenious services using AWS services and sped up compute. Currently, he is concentrated on developing methods for fine-tuning and optimizing the inference performance of big language models. In his leisure time, Vivek enjoys hiking, enjoying films, and attempting various 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 Science and Bioinformatics.
Jonathan Evans is a Professional Solutions Architect working on generative AI with the Third-Party Model Science group at AWS.
Banu Nagasundaram leads item, engineering, and tactical collaborations for Amazon SageMaker JumpStart, SageMaker's artificial intelligence and generative AI hub. She is passionate about building services that help customers accelerate their AI journey and unlock organization value.