1 DeepSeek R1 Model now Available in Amazon Bedrock Marketplace And Amazon SageMaker JumpStart
Charmain Herron edited this page 3 months ago


Today, we are excited to announce 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, along with the distilled versions ranging from 1.5 to 70 billion parameters to develop, experiment, and properly 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 versions of the designs also.

Overview of DeepSeek-R1

DeepSeek-R1 is a big language design (LLM) developed by DeepSeek AI that uses support learning to boost reasoning abilities through a multi-stage training procedure from a DeepSeek-V3-Base structure. An essential identifying function is its support learning (RL) action, which was utilized to fine-tune the model's responses beyond the basic pre-training and tweak process. By including RL, DeepSeek-R1 can adjust more effectively to user feedback and goals, ultimately enhancing both importance and clarity. In addition, DeepSeek-R1 employs a chain-of-thought (CoT) approach, implying it's equipped to break down intricate inquiries and reason through them in a detailed way. This directed thinking process allows the model to produce more precise, transparent, and detailed answers. This model combines RL-based fine-tuning with CoT abilities, aiming to produce structured responses while focusing on interpretability and user interaction. With its wide-ranging abilities DeepSeek-R1 has actually recorded the market's attention as a versatile text-generation design that can be incorporated into numerous workflows such as agents, logical reasoning and data analysis jobs.

DeepSeek-R1 utilizes a Mixture of Experts (MoE) architecture and is 671 billion parameters in size. The MoE architecture allows activation of 37 billion specifications, allowing efficient reasoning by routing inquiries to the most relevant specialist "clusters." This approach permits the design to focus on different problem domains while maintaining total 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 instance to release the model. ml.p5e.48 xlarge comes with 8 Nvidia H200 GPUs offering 1128 GB of GPU memory.

DeepSeek-R1 distilled models bring the reasoning abilities 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 describes a process of training smaller sized, more efficient models to imitate the habits and reasoning patterns of the larger DeepSeek-R1 design, utilizing it as an instructor design.

You can release DeepSeek-R1 model either through SageMaker JumpStart or Bedrock Marketplace. Because DeepSeek-R1 is an emerging design, we advise releasing this model with guardrails in location. In this blog, we will use Amazon Bedrock Guardrails to present safeguards, avoid hazardous content, and evaluate designs against key security requirements. At the time of composing this blog, for DeepSeek-R1 implementations on SageMaker JumpStart and Bedrock Marketplace, Bedrock Guardrails supports only the ApplyGuardrail API. You can develop numerous guardrails tailored to various use cases and use them to the DeepSeek-R1 design, enhancing user experiences and standardizing security controls across your generative AI applications.

Prerequisites

To release the DeepSeek-R1 model, you need 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 usage. Make certain that you have at least one ml.P5e.48 xlarge instance in the AWS Region you are deploying. To ask for a limit increase, produce a limitation increase request and reach out to your account team.

Because you will be deploying this design with Amazon Bedrock Guardrails, make certain you have the correct AWS Identity and Gain Access To Management (IAM) permissions to utilize Amazon Bedrock Guardrails. For guidelines, see Set up permissions to utilize guardrails for higgledy-piggledy.xyz content filtering.

Implementing guardrails with the ApplyGuardrail API

Amazon Bedrock Guardrails permits you to introduce safeguards, prevent damaging content, and examine designs against crucial safety requirements. You can execute precaution for the DeepSeek-R1 design utilizing the Amazon Bedrock ApplyGuardrail API. This allows you to use guardrails to assess user inputs and design actions deployed on Amazon Bedrock Marketplace and SageMaker JumpStart. You can develop a guardrail utilizing the Amazon Bedrock console or the API. For the example code to create the guardrail, see the GitHub repo.

The basic flow involves the following actions: First, the system receives an input for the design. This input is then processed through the ApplyGuardrail API. If the input passes the guardrail check, it's sent out to the design for inference. After receiving the model's output, another guardrail check is used. If the output passes this final check, it's returned as the outcome. However, if either the input or output is stepped in by the guardrail, a message is returned suggesting the nature of the intervention and whether it happened at the input or output stage. The examples showcased in the following areas demonstrate reasoning using this API.

Deploy DeepSeek-R1 in Amazon Bedrock Marketplace

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

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

The design detail page provides vital details about the model's abilities, pricing structure, and implementation standards. You can find detailed use instructions, including sample API calls and code snippets for integration. The design supports numerous text generation jobs, including content production, code generation, and concern answering, utilizing its reinforcement learning optimization and CoT thinking capabilities. The page likewise consists of deployment alternatives and licensing details to help you get started with DeepSeek-R1 in your applications. 3. To begin using DeepSeek-R1, .

You will be prompted to set up the release details for DeepSeek-R1. The design ID will be pre-populated. 4. For Endpoint name, enter an endpoint name (in between 1-50 alphanumeric characters). 5. For Number of circumstances, go into a number of circumstances (in between 1-100). 6. For example type, choose your instance type. For optimal performance with DeepSeek-R1, a GPU-based circumstances type like ml.p5e.48 xlarge is advised. Optionally, you can configure sophisticated security and infrastructure settings, including virtual private cloud (VPC) networking, service function approvals, and file encryption settings. For the majority of utilize cases, the default settings will work well. However, for production releases, you may wish to review these settings to line up with your organization's security and compliance requirements. 7. Choose Deploy to begin using the design.

When the release is complete, you can check DeepSeek-R1's abilities straight in the Amazon Bedrock play area. 8. Choose Open in play ground to access an interactive interface where you can try out various prompts and adjust design specifications like temperature and optimum length. When using R1 with Bedrock's InvokeModel and Playground Console, use DeepSeek's chat template for optimum results. For example, content for reasoning.

This is an outstanding way to check out the model's thinking and text generation abilities before incorporating it into your applications. The play ground provides immediate feedback, assisting you comprehend how the model reacts to numerous inputs and letting you fine-tune your triggers for optimum results.

You can rapidly check the model in the play area through the UI. However, to conjure up the deployed model programmatically with any Amazon Bedrock APIs, you require to get the endpoint ARN.

Run reasoning using guardrails with the released DeepSeek-R1 endpoint

The following code example shows how to perform inference using a released DeepSeek-R1 design through Amazon Bedrock using the invoke_model and ApplyGuardrail API. You can create a guardrail using the Amazon Bedrock console or the API. For the example code to create the guardrail, see the GitHub repo. After you have actually created the guardrail, utilize the following code to carry out guardrails. The script initializes the bedrock_runtime client, sets up reasoning specifications, and sends 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, integrated algorithms, and prebuilt ML options that you can deploy with just a few clicks. With SageMaker JumpStart, you can tailor pre-trained designs to your usage case, with your information, and deploy them into production utilizing either the UI or SDK.

Deploying DeepSeek-R1 model through SageMaker JumpStart provides 2 practical approaches: utilizing the intuitive SageMaker JumpStart UI or carrying out programmatically through the SageMaker Python SDK. Let's explore both approaches to assist you select the technique that best matches your requirements.

Deploy DeepSeek-R1 through SageMaker JumpStart UI

Complete the following steps to deploy DeepSeek-R1 utilizing SageMaker JumpStart:

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

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

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

- Model name

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

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

    The model details page consists of the following details:

    - The design name and provider details. Deploy button to deploy the design. About and Notebooks tabs with detailed details

    The About tab consists of crucial details, such as:

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

    Before you deploy the model, it's advised to evaluate 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 instantly created name or create a customized one.
  1. For Instance type ¸ pick an instance type (default: ml.p5e.48 xlarge).
  2. For Initial circumstances count, go into the number of circumstances (default: 1). Selecting suitable instance types and counts is essential for expense and efficiency optimization. Monitor your implementation to change these settings as needed.Under Inference type, Real-time inference is chosen by default. This is optimized for sustained traffic and low latency.
  3. Review all configurations for accuracy. For this design, we strongly suggest sticking to SageMaker JumpStart default settings and making certain that network isolation remains in place.
  4. Choose Deploy to deploy the design.

    The release procedure can take numerous minutes to complete.

    When implementation is complete, your endpoint status will alter to InService. At this point, the model is ready to accept reasoning demands through the endpoint. You can keep an eye on the implementation progress on the SageMaker console Endpoints page, which will display pertinent metrics and status details. When the deployment is total, you can invoke the design utilizing a SageMaker runtime client and integrate it with your applications.

    Deploy DeepSeek-R1 using the SageMaker Python SDK

    To get begun with DeepSeek-R1 utilizing the SageMaker Python SDK, you will need to set up the SageMaker Python SDK and make certain you have the required AWS authorizations and environment setup. The following is a detailed code example that shows how to release and use DeepSeek-R1 for reasoning programmatically. The code for releasing the model is provided 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 displayed in the following code:

    Tidy up

    To avoid unwanted charges, complete the steps in this area to clean up your resources.

    Delete the Amazon Bedrock Marketplace deployment

    If you deployed the design utilizing Amazon Bedrock Marketplace, complete the following steps:

    1. On the Amazon Bedrock console, under Foundation models in the navigation pane, select Marketplace implementations.
  5. In the Managed implementations section, find 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 deleting 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 expenses 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 release the DeepSeek-R1 design using Bedrock Marketplace and SageMaker JumpStart. Visit SageMaker JumpStart in SageMaker Studio or Amazon Bedrock Marketplace now to begin. For more details, describe Use Amazon Bedrock tooling with Amazon SageMaker JumpStart models, SageMaker JumpStart pretrained designs, 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 business develop ingenious services using AWS services and accelerated compute. Currently, he is focused on developing techniques for fine-tuning and optimizing the inference performance of large language designs. In his leisure time, Vivek delights in treking, 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 technology and Bioinformatics.

    Jonathan Evans is a Professional Solutions Architect dealing with 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 center. She is passionate about developing options that help consumers accelerate their AI journey and unlock company worth.