1 DeepSeek R1 Model now Available in Amazon Bedrock Marketplace And Amazon SageMaker JumpStart
scarlettedouar edited this page 2 months ago
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 thrilled to announce 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 model, DeepSeek-R1, along with the distilled versions ranging from 1.5 to 70 billion specifications to build, 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 similar actions to release the distilled variations of the designs also.

Overview of DeepSeek-R1

DeepSeek-R1 is a large language model (LLM) developed by DeepSeek AI that utilizes support learning to boost thinking abilities through a multi-stage training process from a DeepSeek-V3-Base structure. An essential distinguishing function is its reinforcement learning (RL) action, which was used to refine the design's reactions beyond the standard pre-training and fine-tuning procedure. By including RL, DeepSeek-R1 can adjust more effectively to user feedback and objectives, eventually boosting both importance and clearness. In addition, DeepSeek-R1 uses a chain-of-thought (CoT) technique, meaning it's geared up to break down intricate queries and factor through them in a detailed way. This assisted thinking procedure enables the model to produce more precise, 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 capabilities DeepSeek-R1 has recorded the market's attention as a flexible text-generation model that can be incorporated into different workflows such as agents, logical thinking and information interpretation jobs.

DeepSeek-R1 uses a Mix of Experts (MoE) architecture and is 671 billion parameters in size. The MoE architecture allows activation of 37 billion parameters, enabling effective inference by routing queries to the most appropriate expert "clusters." This method enables the model to specialize in different problem domains while maintaining general 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 deploy the design. ml.p5e.48 xlarge includes 8 Nvidia H200 GPUs supplying 1128 GB of GPU memory.

DeepSeek-R1 distilled designs bring the reasoning capabilities of the main R1 design to more efficient architectures based upon 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 effective designs to mimic the behavior and reasoning patterns of the bigger DeepSeek-R1 model, utilizing 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 advise releasing this model with guardrails in location. In this blog, we will use Amazon Bedrock Guardrails to introduce safeguards, avoid harmful content, and assess models against crucial security requirements. At the time of composing this blog site, for DeepSeek-R1 releases on SageMaker JumpStart and Bedrock Marketplace, Bedrock Guardrails supports only the ApplyGuardrail API. You can create 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 release 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, select 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 releasing. To ask for a limitation boost, create 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 right AWS Identity and Gain Access To Management (IAM) consents to use Amazon Bedrock Guardrails. For guidelines, see Set up approvals to utilize guardrails for material filtering.

Implementing guardrails with the ApplyGuardrail API

Amazon Bedrock Guardrails allows you to present safeguards, prevent hazardous material, and examine designs against essential safety criteria. You can execute precaution for the DeepSeek-R1 model 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 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 out to the model for inference. After getting the design's output, another guardrail check is applied. If the output passes this last check, it's returned as the final result. 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 stage. The examples showcased in the following sections 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 designs (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 writing this post, you can utilize 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 company and choose the DeepSeek-R1 model.

The model detail page offers important details about the model's capabilities, pricing structure, and execution standards. You can discover detailed usage guidelines, consisting of sample API calls and code snippets for integration. The design supports numerous text generation jobs, including content production, code generation, and question answering, using its support finding out optimization and CoT thinking abilities. The page likewise consists of deployment choices and licensing details to assist you get started with DeepSeek-R1 in your applications. 3. To begin using DeepSeek-R1, select Deploy.

You will be prompted to configure the implementation details for DeepSeek-R1. The design ID will be pre-populated. 4. For Endpoint name, get in an endpoint name (in between 1-50 alphanumeric characters). 5. For Variety of instances, enter a variety of instances (between 1-100). 6. For example type, choose your instance type. For ideal efficiency with DeepSeek-R1, a GPU-based instance type like ml.p5e.48 xlarge is advised. Optionally, you can configure sophisticated security and infrastructure settings, including virtual personal cloud (VPC) networking, service role permissions, and bytes-the-dust.com encryption settings. For the majority of utilize cases, the default settings will work well. However, for production deployments, you might wish to examine these settings to line up with your organization's security and compliance requirements. 7. Choose Deploy to begin using the model.

When the release is total, you can evaluate DeepSeek-R1's capabilities straight in the Amazon Bedrock play ground. 8. Choose Open in play area to access an interactive user interface where you can try out different triggers and adjust design criteria like temperature level and optimum length. When utilizing R1 with Bedrock's InvokeModel and Playground Console, utilize DeepSeek's chat template for optimum outcomes. For example, content for reasoning.

This is an excellent method to explore the model's thinking and text generation capabilities before integrating it into your applications. The play area supplies immediate feedback, helping you understand how the model reacts to various inputs and letting you tweak your prompts for ideal results.

You can rapidly evaluate the design in the play ground 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 utilizing guardrails with the released DeepSeek-R1 endpoint

The following code example shows how to carry out inference utilizing a released DeepSeek-R1 design through Amazon Bedrock utilizing the invoke_model and ApplyGuardrail API. You can create 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 actually produced the guardrail, use the following code to carry out guardrails. The script initializes the bedrock_runtime customer, sets up inference parameters, and sends a request to produce text based upon a user timely.

Deploy DeepSeek-R1 with SageMaker JumpStart

SageMaker JumpStart is an artificial intelligence (ML) hub with FMs, built-in algorithms, and prebuilt ML options that you can deploy with simply 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 model through SageMaker JumpStart offers 2 convenient techniques: using the user-friendly SageMaker JumpStart UI or executing programmatically through the SageMaker Python SDK. Let's check out both techniques to help you choose the technique that best suits your needs.

Deploy DeepSeek-R1 through SageMaker JumpStart UI

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

1. On the SageMaker console, select 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 internet browser shows available models, with details like the supplier name and design abilities.

4. Search for DeepSeek-R1 to see the DeepSeek-R1 model card. Each design card shows key details, consisting of:

- Model name

  • Provider name
  • Task category (for example, Text Generation). Bedrock Ready badge (if applicable), showing that this model can be signed up with Amazon Bedrock, permitting you to use APIs to invoke the model

    5. Choose the design card to view the design details page.

    The model details page includes the following details:

    - The model name and supplier details. Deploy button to release the model. 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 design, it's advised to evaluate the model details and license terms to confirm compatibility with your use case.

    6. Choose Deploy to continue with implementation.

    7. For Endpoint name, utilize the automatically produced name or create a customized one.
  1. For example type ¸ choose an instance type (default: ml.p5e.48 xlarge).
  2. For Initial instance count, get in the variety of instances (default: 1). Selecting appropriate instance types and counts is crucial for cost and efficiency optimization. Monitor your deployment to adjust these settings as needed.Under Inference type, Real-time inference is selected by default. This is optimized for sustained traffic and low latency.
  3. Review all configurations for precision. 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 implementation procedure can take several minutes to complete.

    When implementation is total, your endpoint status will change to InService. At this point, the model is prepared to accept inference requests through the endpoint. You can monitor the implementation development on the SageMaker console Endpoints page, which will show pertinent metrics and status details. When the implementation is total, you can invoke the design using a SageMaker runtime client and integrate it with your applications.

    Deploy DeepSeek-R1 utilizing the SageMaker Python SDK

    To begin with DeepSeek-R1 using the SageMaker Python SDK, you will require to set up the SageMaker Python SDK and make certain you have the necessary AWS consents and environment setup. The following is a detailed code example that shows how to release and use DeepSeek-R1 for inference programmatically. The code for 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 also use the ApplyGuardrail API with your SageMaker JumpStart predictor. You can produce 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, complete the steps in this section to clean 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 implementations.
  5. In the Managed deployments section, locate 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 deleting the proper release: 1. Endpoint name.
  8. Model name.
  9. 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 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 begin. For more details, refer to Use Amazon Bedrock tooling with Amazon SageMaker JumpStart models, 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 assists emerging generative AI business build innovative options utilizing AWS services and sped up calculate. Currently, he is focused on establishing techniques for fine-tuning and optimizing the inference performance of large language designs. In his downtime, Vivek delights in hiking, enjoying movies, and trying different foods.

    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 Specialist Solutions Architect working on generative AI with the Third-Party Model Science group at AWS.

    Banu Nagasundaram leads product, engineering, and tactical collaborations for Amazon SageMaker JumpStart, SageMaker's artificial intelligence and generative AI hub. She is enthusiastic about building services that help consumers accelerate their AI journey and unlock organization value.