1 DeepSeek R1 Model now Available in Amazon Bedrock Marketplace And Amazon SageMaker JumpStart
jordankeesler9 edited this page 1 week ago


Today, we are delighted to reveal 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 design, DeepSeek-R1, in addition to the distilled versions ranging from 1.5 to 70 billion criteria to construct, experiment, and properly 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 comparable actions to release the distilled versions of the models also.

Overview of DeepSeek-R1

DeepSeek-R1 is a large language design (LLM) developed by DeepSeek AI that utilizes support discovering to enhance thinking capabilities through a multi-stage training procedure from a DeepSeek-V3-Base foundation. A key distinguishing function is its support knowing (RL) step, which was used to improve the model's actions beyond the standard pre-training and fine-tuning process. By integrating RL, DeepSeek-R1 can adjust more efficiently to user feedback and objectives, eventually boosting both importance and clearness. In addition, DeepSeek-R1 employs a chain-of-thought (CoT) method, implying it's equipped to break down intricate questions and factor through them in a detailed manner. This directed thinking process allows the model to produce more accurate, transparent, and detailed responses. This model integrates RL-based fine-tuning with CoT abilities, aiming to create structured actions while concentrating on interpretability and user interaction. With its comprehensive capabilities DeepSeek-R1 has recorded the market's attention as a versatile text-generation design that can be integrated into numerous workflows such as agents, sensible thinking and information analysis jobs.

DeepSeek-R1 utilizes a Mixture of Experts (MoE) architecture and is 671 billion criteria in size. The MoE architecture permits activation of 37 billion criteria, allowing effective reasoning by routing questions to the most relevant expert "clusters." This technique enables the model to concentrate on various problem domains while maintaining general performance. DeepSeek-R1 needs at least 800 GB of HBM memory in FP8 format for reasoning. In this post, we will utilize an ml.p5e.48 xlarge instance to deploy the model. ml.p5e.48 xlarge features 8 Nvidia H200 GPUs supplying 1128 GB of GPU memory.

DeepSeek-R1 distilled designs 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 describes a procedure of training smaller sized, more efficient designs to simulate the behavior and reasoning patterns of the larger DeepSeek-R1 model, utilizing it as an instructor design.

You can deploy DeepSeek-R1 model either through SageMaker JumpStart or Bedrock Marketplace. Because DeepSeek-R1 is an emerging design, we recommend releasing this model with guardrails in place. In this blog, we will use Amazon Bedrock Guardrails to present safeguards, prevent damaging material, and assess designs against crucial security criteria. At the time of writing this blog, for DeepSeek-R1 releases on SageMaker JumpStart and Bedrock Marketplace, Bedrock Guardrails supports only the ApplyGuardrail API. You can develop numerous guardrails tailored to different use cases and apply them to the DeepSeek-R1 model, enhancing user experiences and standardizing security controls throughout your generative AI applications.

Prerequisites

To deploy the DeepSeek-R1 design, you require access to an ml.p5e circumstances. To check if you have quotas for P5e, open the Service Quotas console and under AWS Services, pick Amazon SageMaker, and verify 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 increase, produce a limit boost request and reach out to your account team.

Because you will be deploying this model with Amazon Bedrock Guardrails, make certain you have the correct AWS Identity and Gain Access To Management (IAM) authorizations to use Amazon Bedrock Guardrails. For instructions, see Establish authorizations to use guardrails for content filtering.

Implementing guardrails with the ApplyGuardrail API

Amazon Bedrock Guardrails allows you to present safeguards, avoid hazardous content, and evaluate models against essential security criteria. You can implement precaution for the DeepSeek-R1 design utilizing the Amazon Bedrock ApplyGuardrail API. This enables you to apply guardrails to assess user inputs and design reactions deployed on Amazon Bedrock Marketplace and SageMaker JumpStart. You can create a guardrail using the Amazon Bedrock console or the API. For the example code to develop the guardrail, see the GitHub repo.

The basic flow 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 model for inference. After getting the model's output, another guardrail check is applied. 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 indicating the nature of the intervention and whether it took place at the input or output phase. The examples showcased in the following sections demonstrate reasoning utilizing this API.

Deploy DeepSeek-R1 in Amazon Bedrock Marketplace

Amazon Bedrock Marketplace gives you access to over 100 popular, emerging, and specialized foundation designs (FMs) through Amazon Bedrock. To gain access to DeepSeek-R1 in Amazon Bedrock, complete the following steps:

1. On the Amazon Bedrock console, choose Model catalog under Foundation models in the navigation pane. At the time of writing 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 provider and pick the DeepSeek-R1 design.

The design detail page offers essential details about the design's capabilities, rates structure, and implementation standards. You can find detailed usage guidelines, including sample API calls and code snippets for integration. The design supports different text generation tasks, including content production, code generation, and question answering, using its reinforcement discovering optimization and CoT reasoning capabilities. The page likewise consists of implementation alternatives and licensing details to assist you get begun with DeepSeek-R1 in your applications. 3. To start utilizing DeepSeek-R1, select Deploy.

You will be prompted to set up the release 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 Variety of instances, enter a variety of instances (between 1-100). 6. For example type, pick your instance type. For optimum performance with DeepSeek-R1, a GPU-based circumstances type like ml.p5e.48 xlarge is advised. Optionally, you can configure innovative security and infrastructure settings, including virtual personal cloud (VPC) networking, service function consents, and file encryption settings. For many utilize cases, the default settings will work well. However, for production deployments, you may desire to review these settings to line up with your organization's security and compliance requirements. 7. Choose Deploy to start using the model.

When the implementation is total, you can test DeepSeek-R1's capabilities straight in the Amazon Bedrock playground. 8. Choose Open in play area to access an interactive interface where you can explore different triggers and change design criteria like temperature and optimum length. When utilizing R1 with Bedrock's InvokeModel and Playground Console, use DeepSeek's chat design template for optimal results. For example, content for reasoning.

This is an outstanding method to check out the design's thinking and text generation abilities before incorporating it into your applications. The play ground provides immediate feedback, assisting you comprehend how the design responds to numerous inputs and letting you tweak your prompts for optimal results.

You can quickly check the design in the play area through the UI. However, to conjure up the released model programmatically with any Amazon Bedrock APIs, you need to get the endpoint ARN.

Run reasoning using guardrails with the deployed DeepSeek-R1 endpoint

The following code example shows how to perform reasoning utilizing a released DeepSeek-R1 model through Amazon Bedrock using the invoke_model and ApplyGuardrail API. You can produce a guardrail using the Amazon Bedrock or the API. For the example code to produce the guardrail, see the GitHub repo. After you have developed the guardrail, use the following code to carry out guardrails. The script initializes the bedrock_runtime client, configures inference criteria, and sends out a request to generate text based upon a user timely.

Deploy DeepSeek-R1 with SageMaker JumpStart

SageMaker JumpStart is an artificial intelligence (ML) center with FMs, integrated algorithms, and prebuilt ML options that you can release with just a couple of clicks. With SageMaker JumpStart, you can tailor pre-trained designs to your usage case, with your information, and deploy them into production using either the UI or SDK.

Deploying DeepSeek-R1 design through SageMaker JumpStart provides two hassle-free techniques: utilizing the intuitive SageMaker JumpStart UI or carrying out programmatically through the SageMaker Python SDK. Let's explore both approaches to assist you choose the approach that best matches your needs.

Deploy DeepSeek-R1 through SageMaker JumpStart UI

Complete the following steps to deploy 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, select JumpStart in the navigation pane.

The model browser displays available designs, with details like the supplier name and design capabilities.

4. Look for DeepSeek-R1 to view the DeepSeek-R1 model card. Each model card reveals crucial details, consisting of:

- Model name

  • Provider name
  • Task category (for instance, Text Generation). Bedrock Ready badge (if applicable), showing that this design can be signed up with Amazon Bedrock, allowing you to utilize Amazon Bedrock APIs to conjure up the design

    5. Choose the design card to see the model details page.

    The design details page includes the following details:

    - The design name and company 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 requirements.
  • Usage standards

    Before you deploy the model, it's advised to review the design details and license terms to confirm compatibility with your usage case.

    6. Choose Deploy to continue with release.

    7. For Endpoint name, utilize the instantly produced name or develop a custom one.
  1. For example type ¸ select an instance type (default: ml.p5e.48 xlarge).
  2. For Initial instance count, enter the number of instances (default: 1). Selecting suitable instance types and counts is vital for expense 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.
  3. Review all configurations for precision. For this design, we strongly suggest sticking to SageMaker JumpStart default settings and making certain that network isolation remains in location.
  4. Choose Deploy to deploy the design.

    The deployment process can take numerous minutes to complete.

    When implementation is complete, your endpoint status will change to InService. At this moment, the design is prepared to accept inference demands through the endpoint. You can keep an eye on the release development 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 utilizing the SageMaker Python SDK

    To get going with DeepSeek-R1 using the SageMaker Python SDK, you will require to set up the SageMaker Python SDK and make certain you have the needed AWS consents and environment setup. The following is a detailed code example that demonstrates how to release and utilize DeepSeek-R1 for inference programmatically. The code for trademarketclassifieds.com deploying the model 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 reasoning with your SageMaker JumpStart predictor

    Similar to Amazon Bedrock, you can likewise utilize the ApplyGuardrail API with your SageMaker JumpStart predictor. You can develop a guardrail utilizing the Amazon Bedrock console or the API, and implement it as shown in the following code:

    Tidy up

    To avoid unwanted charges, finish the actions in this section to tidy up your resources.

    Delete the Amazon Bedrock Marketplace release

    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, select Marketplace deployments.
  5. In the Managed implementations section, locate the endpoint you wish to delete.
  6. Select the endpoint, and on the Actions menu, select Delete.
  7. Verify the endpoint details to make certain you're erasing the right deployment: 1. Endpoint name.
  8. Model name.
  9. 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 want 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 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 Getting begun 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 develop innovative solutions utilizing AWS services and accelerated calculate. Currently, he is concentrated on establishing strategies for fine-tuning and enhancing the inference efficiency of big language models. In his spare time, Vivek enjoys treking, seeing movies, 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 Professional Solutions Architect working on generative AI with the Third-Party Model Science team at AWS.

    Banu Nagasundaram leads item, engineering, and strategic partnerships for Amazon SageMaker JumpStart, SageMaker's artificial intelligence and generative AI hub. She is enthusiastic about developing services that assist clients accelerate their AI journey and unlock business worth.