DeepSeek-R1 Model now Available in Amazon Bedrock Marketplace And Amazon SageMaker JumpStart
Today, we are thrilled 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, together 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, we demonstrate how to begin with DeepSeek-R1 on Amazon Bedrock Marketplace and SageMaker JumpStart. You can follow similar steps to release the distilled versions of the designs also.
Overview of DeepSeek-R1
DeepSeek-R1 is a large language model (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 differentiating feature is its support learning (RL) step, which was used to fine-tune the model's responses beyond the basic pre-training and tweak procedure. By including RL, DeepSeek-R1 can adapt better to user feedback and objectives, eventually boosting both significance and clearness. In addition, DeepSeek-R1 employs a chain-of-thought (CoT) approach, indicating it's geared up to break down complex questions and reason through them in a detailed way. This assisted reasoning process enables the model to produce more accurate, transparent, and detailed responses. This design integrates RL-based fine-tuning with CoT capabilities, aiming to create structured responses while focusing on interpretability and user interaction. With its comprehensive capabilities DeepSeek-R1 has actually caught the market's attention as a flexible text-generation model that can be incorporated into different workflows such as agents, rational thinking and data interpretation jobs.
DeepSeek-R1 utilizes a Mix of Experts (MoE) architecture and is 671 billion parameters in size. The MoE architecture allows activation of 37 billion parameters, making it possible for effective inference by routing inquiries to the most appropriate specialist "clusters." This approach enables the model to concentrate on various problem domains while maintaining total efficiency. DeepSeek-R1 needs a minimum of 800 GB of HBM memory in FP8 format for inference. In this post, we will use an ml.p5e.48 xlarge instance to deploy the design. ml.p5e.48 xlarge comes with 8 Nvidia H200 GPUs supplying 1128 GB of GPU memory.
DeepSeek-R1 distilled designs bring the reasoning abilities of the main R1 design to more effective architectures based upon 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 models to simulate the habits and thinking patterns of the larger DeepSeek-R1 model, utilizing it as a teacher model.
You can release DeepSeek-R1 design either through SageMaker JumpStart or Bedrock Marketplace. Because DeepSeek-R1 is an emerging design, we advise releasing this design with guardrails in place. In this blog site, we will utilize Amazon Bedrock Guardrails to present safeguards, avoid damaging content, and assess designs against essential safety requirements. At the time of composing this blog, for DeepSeek-R1 deployments on SageMaker JumpStart and Bedrock Marketplace, Bedrock Guardrails supports just the ApplyGuardrail API. You can create numerous guardrails tailored to different use cases and apply them to the DeepSeek-R1 model, improving user experiences and standardizing security controls across your generative AI applications.
Prerequisites
To release the DeepSeek-R1 design, you require access to an ml.p5e circumstances. To inspect 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 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 increase, develop a limitation boost 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 utilize Amazon Bedrock Guardrails. For guidelines, see Set up approvals to use guardrails for material filtering.
Implementing guardrails with the ApplyGuardrail API
Amazon Bedrock Guardrails enables you to present safeguards, avoid harmful material, and examine models against key safety criteria. You can execute precaution for the DeepSeek-R1 model using the Amazon Bedrock ApplyGuardrail API. This enables you to use guardrails to examine user inputs and design actions deployed 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 model. This input is then processed through the ApplyGuardrail API. If the input passes the guardrail check, it's sent to the model for inference. After receiving 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 stage. The examples showcased in the following areas show inference utilizing 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, total the following steps:
1. On the Amazon Bedrock console, choose Model catalog under Foundation designs in the navigation pane.
At the time of composing this post, you can utilize the InvokeModel API to invoke the model. It does not support Converse APIs and other Amazon Bedrock tooling.
2. Filter for DeepSeek as a service provider and pick the DeepSeek-R1 model.
The design detail page supplies vital details about the model's capabilities, prices structure, and execution guidelines. You can find detailed use guidelines, consisting of sample API calls and code snippets for combination. The design supports different text generation tasks, consisting of content production, code generation, and concern answering, utilizing its reinforcement learning optimization and CoT thinking capabilities.
The page also includes implementation options and licensing details to assist you get started with DeepSeek-R1 in your applications.
3. To begin utilizing DeepSeek-R1, choose Deploy.
You will be triggered to set up the implementation details for DeepSeek-R1. The model ID will be pre-populated.
4. For Endpoint name, enter an endpoint name (between 1-50 alphanumeric characters).
5. For Number of circumstances, get in a number of circumstances (in between 1-100).
6. For example type, select your circumstances type. For optimal performance with DeepSeek-R1, a GPU-based instance type like ml.p5e.48 xlarge is advised.
Optionally, you can configure sophisticated security and facilities settings, consisting of virtual private cloud (VPC) networking, service function approvals, and encryption settings. For a lot of utilize cases, the default settings will work well. However, for production deployments, you might want to evaluate these settings to line up with your organization's security and compliance requirements.
7. Choose Deploy to begin using the design.
When the deployment is complete, you can evaluate DeepSeek-R1's abilities straight in the Amazon Bedrock play area.
8. Choose Open in playground to access an interactive user interface where you can experiment with various triggers and adjust model specifications like temperature level and maximum length.
When using R1 with Bedrock's InvokeModel and Playground Console, use DeepSeek's chat design template for optimal results. For example, material for reasoning.
This is an excellent method to explore the model's reasoning and text generation capabilities before integrating it into your applications. The playground supplies immediate feedback, helping you understand how the design reacts to numerous inputs and letting you tweak your prompts for ideal outcomes.
You can quickly evaluate the design in the play area through the UI. However, to conjure up the released design 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 shows how to perform reasoning utilizing a deployed DeepSeek-R1 model 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 produced the guardrail, use the following code to implement guardrails. The script initializes the bedrock_runtime client, configures reasoning specifications, and sends a request 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 few clicks. With SageMaker JumpStart, you can tailor pre-trained designs to your usage case, with your data, and deploy them into production utilizing either the UI or SDK.
Deploying DeepSeek-R1 model through SageMaker JumpStart offers two convenient methods: utilizing the user-friendly SageMaker JumpStart UI or implementing programmatically through the SageMaker Python SDK. Let's explore both approaches to assist you pick the method that finest matches your requirements.
Deploy DeepSeek-R1 through SageMaker JumpStart UI
Complete the following steps to release DeepSeek-R1 utilizing SageMaker JumpStart:
1. On the SageMaker console, pick Studio in the navigation pane.
2. First-time users will be prompted to produce a domain.
3. On the SageMaker Studio console, choose JumpStart in the navigation pane.
The model browser shows available models, with details like the service provider name and model abilities.
4. Search for DeepSeek-R1 to see the DeepSeek-R1 design card.
Each design card reveals essential details, consisting of:
- Model name
- Provider name
- Task classification (for example, Text Generation).
Bedrock Ready badge (if suitable), showing that this design can be signed up with Amazon Bedrock, permitting you to use 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 model name and provider 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 release the design, it's advised to evaluate the design details and license terms to confirm compatibility with your use case.
6. Choose Deploy to continue with release.
7. For Endpoint name, use the automatically produced name or produce a custom-made one.
- For Instance type ¸ choose an instance type (default: ml.p5e.48 xlarge).
- For Initial instance count, enter the variety of instances (default: 1). Selecting appropriate instance types and counts is vital 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 enhanced for sustained traffic and low latency.
- Review all setups for accuracy. For wiki.myamens.com this model, we highly advise sticking to SageMaker JumpStart default settings and making certain that network isolation remains in location.
- Choose Deploy to deploy the design.
The implementation procedure can take several minutes to complete.
When deployment is total, your endpoint status will alter to InService. At this point, the design is ready to accept reasoning requests through the endpoint. You can monitor the release progress on the SageMaker console Endpoints page, which will show appropriate metrics and status details. When the deployment is complete, you can conjure up the design utilizing a SageMaker runtime customer and integrate it with your applications.
Deploy DeepSeek-R1 utilizing the SageMaker Python SDK
To get started with DeepSeek-R1 using the SageMaker Python SDK, you will require to set up the SageMaker Python SDK and make certain you have the required AWS permissions and environment setup. The following is a detailed code example that shows how to deploy and utilize DeepSeek-R1 for reasoning programmatically. The code for releasing the design is offered 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 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 displayed in the following code:
Clean up
To prevent unwanted charges, complete the steps in this area to tidy up your resources.
Delete the Amazon Bedrock Marketplace deployment
If you deployed the model utilizing Amazon Bedrock Marketplace, complete the following actions:
1. On the Amazon Bedrock console, under Foundation designs in the navigation pane, select Marketplace releases. - In the Managed deployments area, locate the endpoint you desire to erase.
- Select the endpoint, and on the Actions menu, pick 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 design you released 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 checked out how you can access and release the DeepSeek-R1 model utilizing Bedrock Marketplace and SageMaker JumpStart. Visit SageMaker JumpStart in SageMaker Studio or Amazon Bedrock Marketplace now to get going. For more details, describe Use Amazon Bedrock tooling with Amazon SageMaker JumpStart models, SageMaker JumpStart pretrained models, Amazon SageMaker JumpStart Foundation Models, Amazon Marketplace, and Starting with Amazon SageMaker JumpStart.
About the Authors
Vivek Gangasani is a Lead Specialist Solutions Architect for Inference at AWS. He helps emerging generative AI companies construct innovative services using AWS services and sped up compute. Currently, he is focused on developing techniques for fine-tuning and enhancing the inference performance of large language models. In his downtime, Vivek delights in hiking, watching films, and trying different 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 technology and Bioinformatics.
Jonathan Evans is a Specialist Solutions Architect dealing with 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 passionate about building services that help clients accelerate their AI journey and unlock company value.