1 DeepSeek R1 Model now Available in Amazon Bedrock Marketplace And Amazon SageMaker JumpStart
marcuspung5402 edited this page 2 months ago


Today, we are thrilled 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 design, DeepSeek-R1, along with the distilled versions varying from 1.5 to 70 billion parameters to develop, experiment, and responsibly scale your generative AI concepts on AWS.

In this post, we demonstrate how to get going with DeepSeek-R1 on Amazon Bedrock Marketplace and SageMaker JumpStart. You can follow comparable actions to release the distilled variations of the designs as well.

Overview of DeepSeek-R1

DeepSeek-R1 is a large language design (LLM) established by DeepSeek AI that utilizes support discovering to enhance thinking abilities through a multi-stage training procedure from a DeepSeek-V3-Base foundation. A key differentiating function is its support learning (RL) action, which was utilized to fine-tune the design's reactions beyond the standard pre-training and tweak procedure. By including RL, DeepSeek-R1 can adapt 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 geared up to break down complicated queries and reason through them in a detailed way. This assisted thinking process permits the design to produce more accurate, transparent, and detailed answers. This design integrates RL-based fine-tuning with CoT abilities, aiming to create structured reactions while concentrating on interpretability and user interaction. With its wide-ranging abilities DeepSeek-R1 has captured the market's attention as a versatile text-generation design that can be integrated into various workflows such as representatives, rational reasoning and data analysis 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 specifications, allowing effective inference by routing inquiries to the most pertinent specialist "clusters." This technique allows the model to focus on different issue domains while maintaining general effectiveness. DeepSeek-R1 needs at least 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 comes with 8 Nvidia H200 GPUs providing 1128 GB of GPU memory.

DeepSeek-R1 distilled designs bring the thinking capabilities of the main R1 design to more efficient architectures based on popular open designs like Qwen (1.5 B, 7B, 14B, and 32B) and Llama (8B and 70B). Distillation refers to a procedure of training smaller sized, more efficient designs to mimic the habits and thinking patterns of the bigger DeepSeek-R1 design, using it as a teacher model.

You can release DeepSeek-R1 model either through SageMaker JumpStart or Bedrock Marketplace. Because DeepSeek-R1 is an emerging model, we suggest deploying this model with guardrails in location. In this blog, we will utilize Amazon Bedrock Guardrails to introduce safeguards, prevent damaging material, and assess designs against key security criteria. At the time of this blog, for DeepSeek-R1 implementations on SageMaker JumpStart and Bedrock Marketplace, Bedrock Guardrails supports just the ApplyGuardrail API. You can create numerous guardrails tailored to different use cases and use them to the DeepSeek-R1 model, improving user experiences and standardizing safety controls across your generative AI applications.

Prerequisites

To deploy the DeepSeek-R1 design, you require 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 confirm you're using ml.p5e.48 xlarge for endpoint usage. Make certain that you have at least one ml.P5e.48 xlarge circumstances in the AWS Region you are deploying. To ask for a limitation boost, create a limitation boost request and reach out to your account group.

Because you will be releasing this model with Amazon Bedrock Guardrails, make certain you have the proper AWS Identity and Gain Access To Management (IAM) authorizations to use Amazon Bedrock Guardrails. For directions, disgaeawiki.info 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 damaging material, and examine models against crucial safety requirements. You can implement security steps for the DeepSeek-R1 model utilizing the Amazon Bedrock ApplyGuardrail API. This enables you to use guardrails to evaluate user inputs and model responses released 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 general circulation includes 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 design for reasoning. After receiving the design's output, another guardrail check is applied. If the output passes this last check, it's returned as the last result. 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 occurred at the input or output phase. The examples showcased in the following sections show inference using this API.

Deploy DeepSeek-R1 in Amazon Bedrock Marketplace

Amazon Bedrock Marketplace offers you access to over 100 popular, emerging, and specialized structure designs (FMs) through Amazon Bedrock. To gain access to DeepSeek-R1 in Amazon Bedrock, total the following actions:

1. On the Amazon Bedrock console, pick Model catalog under Foundation models in the navigation pane. At the time of writing this post, you can use the InvokeModel API to conjure up the design. It doesn't support Converse APIs and other Amazon Bedrock tooling. 2. Filter for DeepSeek as a supplier and pick the DeepSeek-R1 model.

The design detail page provides important details about the model's capabilities, pricing structure, and execution standards. You can find detailed usage directions, including sample API calls and code snippets for combination. The design supports numerous text generation tasks, consisting of content production, code generation, and question answering, using its support discovering optimization and CoT thinking capabilities. The page also includes implementation choices and licensing details to help you get begun with DeepSeek-R1 in your applications. 3. To begin using DeepSeek-R1, choose 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, enter an endpoint name (in between 1-50 alphanumeric characters). 5. For Variety of circumstances, get in a number of instances (in between 1-100). 6. For Instance type, choose 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 innovative security and infrastructure settings, including virtual personal cloud (VPC) networking, service function consents, and encryption settings. For a lot of utilize cases, the default settings will work well. However, for production implementations, you may want to review these settings to line up with your company's security and compliance requirements. 7. Choose Deploy to start utilizing the model.

When the deployment is total, you can check DeepSeek-R1's abilities straight in the Amazon Bedrock play ground. 8. Choose Open in play area to access an interactive interface where you can explore various triggers and change model specifications like temperature level and optimum length. When using R1 with Bedrock's InvokeModel and Playground Console, utilize DeepSeek's chat design template for ideal results. For instance, content for reasoning.

This is an exceptional way to explore the model's thinking and text generation abilities before integrating it into your applications. The playground provides instant feedback, helping you comprehend how the design reacts to different inputs and letting you fine-tune your prompts for optimum results.

You can rapidly test the model in the play ground through the UI. However, to invoke the released 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 demonstrates how to carry out reasoning utilizing a released DeepSeek-R1 design through Amazon Bedrock utilizing 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 created the guardrail, use the following code to execute guardrails. The script initializes the bedrock_runtime client, sets up reasoning criteria, and sends out a request to generate text based upon a user prompt.

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 release with just a few clicks. With SageMaker JumpStart, you can tailor pre-trained models to your use case, with your information, and release them into production utilizing either the UI or SDK.

Deploying DeepSeek-R1 design through SageMaker JumpStart uses 2 convenient approaches: utilizing the user-friendly SageMaker JumpStart UI or implementing programmatically through the SageMaker Python SDK. Let's check out both methods to help you choose the approach that best fits 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, choose Studio in the navigation pane. 2. First-time users will be prompted to develop a domain. 3. On the SageMaker Studio console, select JumpStart in the navigation pane.

The model browser shows available models, with details like the provider name and model abilities.

4. Look for DeepSeek-R1 to view the DeepSeek-R1 model card. Each design card reveals key details, including:

- Model name

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

    5. Choose the design card to see the design 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 crucial details, such as:

    - Model description.
  • License details.
  • Technical specifications.
  • Usage guidelines

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

    6. Choose Deploy to continue with implementation.

    7. For Endpoint name, utilize the automatically generated name or develop a customized one.
  1. For example type ¸ pick a circumstances type (default: ml.p5e.48 xlarge).
  2. For Initial instance count, get in the variety of circumstances (default: 1). Selecting appropriate circumstances types and counts is vital for expense and performance optimization. Monitor your implementation to change these settings as needed.Under Inference type, Real-time reasoning is selected by default. This is enhanced for sustained traffic and low latency.
  3. Review all configurations for accuracy. For this design, we highly advise adhering to SageMaker JumpStart default settings and making certain that network seclusion remains in location.
  4. Choose Deploy to deploy the model.

    The deployment process can take a number of minutes to finish.

    When implementation is total, your endpoint status will alter to InService. At this point, the model is prepared to accept reasoning demands through the endpoint. You can keep track of the release progress on the SageMaker console Endpoints page, which will display pertinent metrics and status details. When the release is complete, you can invoke the model utilizing a SageMaker runtime customer and incorporate it with your applications.

    Deploy DeepSeek-R1 utilizing the SageMaker Python SDK

    To get begun with DeepSeek-R1 using the SageMaker Python SDK, you will need 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 shows how to deploy and utilize DeepSeek-R1 for inference programmatically. The code for deploying the design is provided in the Github here. You can clone the notebook and range 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 use the ApplyGuardrail API with your SageMaker JumpStart predictor. You can create a guardrail using the Amazon Bedrock console or the API, and execute it as displayed in the following code:

    Tidy up

    To prevent undesirable charges, complete the steps in this section to tidy up your resources.

    Delete the Amazon Bedrock Marketplace deployment

    If you released the design using Amazon Bedrock Marketplace, total the following steps:

    1. On the Amazon Bedrock console, under Foundation designs in the navigation pane, select Marketplace implementations.
  5. In the Managed implementations area, find the endpoint you wish to erase.
  6. Select the endpoint, and on the Actions menu, choose Delete.
  7. Verify the endpoint details to make certain you're erasing the appropriate deployment: 1. Endpoint name.
  8. Model name.
  9. Endpoint status

    Delete the SageMaker JumpStart predictor

    The SageMaker JumpStart model you deployed 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 checked out 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 get begun. For more details, describe Use Amazon Bedrock tooling with Amazon SageMaker JumpStart designs, SageMaker JumpStart pretrained models, 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 helps emerging generative AI business construct innovative options utilizing AWS services and accelerated compute. Currently, he is concentrated on developing techniques for fine-tuning and enhancing the inference efficiency of large language models. In his downtime, Vivek takes pleasure in treking, viewing motion pictures, and trying 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 a Specialist Solutions Architect working on generative AI with the Third-Party Model Science team at AWS.

    Banu Nagasundaram leads product, engineering, and strategic collaborations for Amazon SageMaker JumpStart, SageMaker's artificial intelligence and generative AI center. She is enthusiastic about building options that help consumers accelerate their AI journey and unlock company worth.