1 DeepSeek-R1 Model now Available in Amazon Bedrock Marketplace And Amazon SageMaker JumpStart
desmondporter5 edited this page 2025-02-28 08:12:17 +08:00
This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.


Today, we are excited 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 deploy DeepSeek AI's first-generation frontier model, DeepSeek-R1, along with the distilled variations ranging from 1.5 to 70 billion criteria to develop, experiment, and responsibly scale your generative AI concepts on AWS.

In this post, we show how to get going with DeepSeek-R1 on Amazon Bedrock Marketplace and SageMaker JumpStart. You can follow comparable steps to release the distilled variations of the models also.

Overview of DeepSeek-R1

DeepSeek-R1 is a large language design (LLM) established by DeepSeek AI that uses reinforcement finding out to improve reasoning abilities through a multi-stage training procedure from a DeepSeek-V3-Base foundation. An essential distinguishing feature is its reinforcement learning (RL) action, which was utilized to fine-tune the design's reactions beyond the basic pre-training and fine-tuning procedure. By incorporating RL, DeepSeek-R1 can adapt better to user feedback and objectives, eventually enhancing both importance and clearness. In addition, DeepSeek-R1 employs a chain-of-thought (CoT) approach, meaning it's geared up to break down complex questions and reason through them in a detailed manner. This assisted reasoning procedure enables the model to produce more precise, transparent, and detailed answers. This model combines RL-based fine-tuning with CoT capabilities, aiming to produce structured responses while focusing on interpretability and user interaction. With its extensive abilities DeepSeek-R1 has actually captured the market's attention as a flexible text-generation model that can be incorporated into various workflows such as agents, rational thinking and data analysis tasks.

DeepSeek-R1 uses a Mixture of Experts (MoE) architecture and is 671 billion specifications in size. The MoE architecture allows activation of 37 billion parameters, allowing effective inference by routing queries to the most appropriate professional "clusters." This method allows the model to specialize in different problem domains while maintaining overall efficiency. 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 release the model. 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 efficient architectures based upon 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 effective designs to simulate the behavior and thinking patterns of the bigger DeepSeek-R1 model, using it as a teacher design.

You can release DeepSeek-R1 model either through SageMaker JumpStart or Bedrock Marketplace. Because DeepSeek-R1 is an emerging model, we recommend releasing this design with guardrails in location. In this blog, we will use Amazon Bedrock Guardrails to introduce safeguards, prevent harmful material, and assess models against crucial safety requirements. At the time of composing this blog, for DeepSeek-R1 deployments on SageMaker JumpStart and Bedrock Marketplace, Bedrock Guardrails supports only the ApplyGuardrail API. You can produce several guardrails tailored to different usage cases and use them to the DeepSeek-R1 model, enhancing user experiences and standardizing security controls across your generative AI applications.

Prerequisites

To deploy the DeepSeek-R1 model, you need access to an ml.p5e instance. To examine 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 usage. Make certain that you have at least one ml.P5e.48 xlarge instance in the AWS Region you are releasing. To request a limitation increase, develop a limitation 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 correct AWS Identity and Gain Access To Management (IAM) approvals to utilize Amazon Bedrock Guardrails. For guidelines, see Set up consents to utilize guardrails for material filtering.

Implementing guardrails with the ApplyGuardrail API

Amazon Bedrock Guardrails allows you to present safeguards, prevent harmful material, and examine models against crucial security requirements. You can implement precaution for the DeepSeek-R1 model utilizing the Amazon Bedrock ApplyGuardrail API. This permits you to use guardrails to examine user inputs and 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 produce the guardrail, see the GitHub repo.

The basic circulation involves the following actions: 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 model's output, another guardrail check is used. If the output passes this last check, it's returned as the 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 took place at the input or output phase. The examples showcased in the following sections show inference 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, total the following actions:

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 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 company and pick the DeepSeek-R1 model.

The model detail page provides necessary details about the design's abilities, prices structure, and implementation standards. You can find detailed usage directions, including sample API calls and code snippets for combination. The model supports different text generation tasks, including content development, code generation, and concern answering, utilizing its reinforcement finding out optimization and CoT thinking abilities. The page likewise includes release alternatives and licensing details to assist you get going with DeepSeek-R1 in your applications. 3. To start using DeepSeek-R1, pick Deploy.

You will be prompted to set up the deployment details for DeepSeek-R1. The model ID will be pre-populated. 4. For Endpoint name, go into an endpoint name (between 1-50 alphanumeric characters). 5. For Number of instances, enter a variety of instances (between 1-100). 6. For example type, select your circumstances type. For optimum efficiency with DeepSeek-R1, a GPU-based circumstances type like ml.p5e.48 xlarge is recommended. Optionally, you can set up advanced security and infrastructure settings, including virtual private cloud (VPC) networking, service function authorizations, and file encryption settings. For the majority of use cases, the default settings will work well. However, for production releases, you may want to examine these settings to line up with your company's security and compliance requirements. 7. Choose Deploy to start utilizing the design.

When the implementation is total, you can check DeepSeek-R1's abilities straight in the Amazon Bedrock playground. 8. Choose Open in play ground to access an interactive interface where you can experiment with various triggers and change model criteria like temperature and maximum length. When utilizing R1 with Bedrock's InvokeModel and Playground Console, utilize DeepSeek's chat template for ideal results. For instance, material for reasoning.

This is an outstanding method to check out the model's reasoning and text generation abilities before integrating it into your applications. The playground supplies immediate feedback, assisting you comprehend how the design responds to different inputs and letting you tweak your triggers for optimal results.

You can quickly evaluate the model in the playground through the UI. However, to invoke the deployed model programmatically with any Amazon Bedrock APIs, you need to get the endpoint ARN.

Run inference utilizing guardrails with the released DeepSeek-R1 endpoint

The following code example shows how to perform inference using a deployed DeepSeek-R1 model through Amazon Bedrock utilizing the invoke_model and ApplyGuardrail API. You can produce a guardrail utilizing the Amazon Bedrock console or the API. For the example code to produce the guardrail, see the GitHub repo. After you have actually created the guardrail, use the following code to execute guardrails. The script initializes the bedrock_runtime client, configures inference criteria, and sends a demand to create text based on a user timely.

Deploy DeepSeek-R1 with SageMaker JumpStart

SageMaker JumpStart is an artificial intelligence (ML) hub with FMs, integrated algorithms, and prebuilt ML services that you can deploy with simply a couple of clicks. With SageMaker JumpStart, you can tailor pre-trained models 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 provides 2 convenient methods: using the intuitive SageMaker JumpStart UI or carrying out programmatically through the SageMaker Python SDK. Let's explore both techniques to help you select the technique that best matches your requirements.

Deploy DeepSeek-R1 through SageMaker JumpStart UI

Complete the following actions to release DeepSeek-R1 utilizing SageMaker JumpStart:

1. On the SageMaker console, pick Studio in the navigation pane. 2. First-time users will be triggered to produce a domain. 3. On the SageMaker Studio console, choose JumpStart in the navigation pane.

The model web browser shows available designs, with details like the supplier name and model abilities.

4. Look for DeepSeek-R1 to see the DeepSeek-R1 model card. Each model card shows crucial details, including:

- Model name

  • Provider name
  • Task classification (for example, Text Generation). Bedrock Ready badge (if appropriate), indicating that this model can be registered with Amazon Bedrock, allowing you to utilize Amazon Bedrock APIs to conjure up the model

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

    The model details page includes the following details:

    - The design name and service provider 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 specifications.
  • Usage standards

    Before you release the model, it's suggested to examine 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 immediately produced name or produce a customized one.
  1. For example type ¸ pick an instance type (default: ml.p5e.48 xlarge).
  2. For Initial instance count, enter the number of instances (default: 1). Selecting suitable circumstances types and counts is important for cost and efficiency optimization. Monitor your release 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.
  3. Review all setups for precision. For this model, we strongly suggest sticking to SageMaker JumpStart default settings and making certain that network seclusion remains in location.
  4. Choose Deploy to release the design.

    The deployment process can take several minutes to complete.

    When release is total, your endpoint status will alter to InService. At this moment, the model is ready to accept reasoning demands through the endpoint. You can keep track of the implementation development on the SageMaker console Endpoints page, which will display appropriate metrics and status details. When the release is total, you can invoke the design using 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 install the SageMaker Python SDK and make certain you have the necessary AWS permissions and environment setup. The following is a detailed code example that demonstrates how to deploy and utilize DeepSeek-R1 for reasoning programmatically. The code for releasing the model is provided in the Github here. You can clone the notebook 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 utilize the ApplyGuardrail API with your SageMaker JumpStart predictor. You can develop a guardrail utilizing the Amazon Bedrock console or the API, and execute it as displayed in the following code:

    Tidy up

    To prevent unwanted charges, finish the steps in this area to clean up your resources.

    Delete the Amazon Bedrock Marketplace release

    If you deployed the design utilizing Amazon Bedrock Marketplace, total the following actions:

    1. On the Amazon Bedrock console, under Foundation designs in the navigation pane, choose Marketplace releases.
  5. In the Managed releases area, locate the endpoint you wish to delete.
  6. Select the endpoint, and on the Actions menu, setiathome.berkeley.edu pick Delete.
  7. Verify the endpoint details to make certain you're deleting the right implementation: 1. Endpoint name.
  8. Model name.
  9. Endpoint status

    Delete the SageMaker JumpStart predictor

    The SageMaker JumpStart design you deployed will sustain expenses if you leave it running. Use the following code to delete the endpoint if you desire to stop sustaining charges. For more details, raovatonline.org see Delete Endpoints and Resources.

    Conclusion

    In this post, we checked out 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 get going. For more details, describe Use Amazon Bedrock tooling with Amazon SageMaker JumpStart designs, SageMaker JumpStart pretrained models, trademarketclassifieds.com 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 generative AI companies construct ingenious solutions using AWS services and accelerated compute. Currently, he is concentrated on establishing techniques for fine-tuning and enhancing the inference efficiency of big language models. In his spare time, Vivek takes pleasure in hiking, watching films, and attempting various cuisines.

    Niithiyn Vijeaswaran is a Generative AI Specialist Solutions Architect with the Third-Party Model Science group 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 an Expert Solutions Architect working on generative AI with the Third-Party Model Science group at AWS.

    Banu Nagasundaram leads item, engineering, and tactical partnerships for Amazon SageMaker JumpStart, SageMaker's artificial intelligence and generative AI hub. She is passionate about constructing solutions that assist customers accelerate their AI journey and unlock company worth.