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


Today, we are excited 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, together with the distilled variations varying from 1.5 to 70 billion specifications to develop, experiment, and properly scale your generative AI ideas 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 versions of the designs also.

Overview of DeepSeek-R1

DeepSeek-R1 is a big language design (LLM) established by DeepSeek AI that utilizes support finding out to enhance thinking abilities through a multi-stage training process from a DeepSeek-V3-Base foundation. A crucial differentiating feature is its reinforcement knowing (RL) action, which was used to refine the design's actions beyond the basic pre-training and fine-tuning procedure. By integrating RL, DeepSeek-R1 can adapt more successfully to user feedback and goals, ultimately enhancing both importance and clearness. In addition, DeepSeek-R1 uses a chain-of-thought (CoT) method, meaning it's equipped to break down complicated inquiries and reason through them in a detailed manner. This directed thinking procedure allows the design to produce more accurate, transparent, and detailed answers. This model combines RL-based fine-tuning with CoT capabilities, aiming to generate structured actions while focusing on interpretability and user interaction. With its comprehensive abilities DeepSeek-R1 has actually captured the industry's attention as a versatile text-generation model that can be integrated into various workflows such as agents, logical reasoning and information analysis tasks.

DeepSeek-R1 utilizes a Mix of Experts (MoE) architecture and is 671 billion criteria in size. The MoE architecture allows activation of 37 billion specifications, allowing effective reasoning by routing inquiries to the most pertinent expert "clusters." This technique allows the model to focus on various issue domains while maintaining overall effectiveness. DeepSeek-R1 needs at least 800 GB of HBM memory in FP8 format for inference. In this post, we will use an ml.p5e.48 xlarge instance to release the design. ml.p5e.48 xlarge comes with 8 Nvidia H200 GPUs supplying 1128 GB of GPU memory.

DeepSeek-R1 distilled models bring the reasoning capabilities of the main R1 design to more effective architectures based on popular open designs like Qwen (1.5 B, archmageriseswiki.com 7B, 14B, and 32B) and Llama (8B and 70B). Distillation refers to a process of training smaller, more effective models to mimic the behavior and reasoning patterns of the larger DeepSeek-R1 model, using it as a teacher model.

You can release DeepSeek-R1 design either through SageMaker JumpStart or Bedrock Marketplace. Because DeepSeek-R1 is an emerging design, we advise releasing this design with guardrails in location. In this blog, we will use Amazon Bedrock Guardrails to present safeguards, prevent harmful content, and assess models against essential safety requirements. At the time of composing this blog, for DeepSeek-R1 implementations on SageMaker JumpStart and Bedrock Marketplace, Bedrock Guardrails supports just the ApplyGuardrail API. You can develop numerous guardrails tailored to various usage cases and apply them to the DeepSeek-R1 model, enhancing user experiences and standardizing safety controls throughout your generative AI applications.

Prerequisites

To release the DeepSeek-R1 design, you require access to an ml.p5e circumstances. To examine if you have quotas for P5e, open the Service Quotas console and under AWS Services, select Amazon SageMaker, and validate you're utilizing 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 releasing. To request a limitation increase, create a limitation boost request and connect 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) consents 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, avoid damaging material, and assess designs against essential safety requirements. You can implement safety steps for the DeepSeek-R1 design using the Amazon Bedrock ApplyGuardrail API. This allows you to apply guardrails to examine user inputs and model actions 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 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 out to the design for reasoning. After getting the model's output, another guardrail check is used. If the output passes this final 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 showing the nature of the intervention and whether it occurred at the input or output stage. The examples showcased in the following sections show reasoning using this API.

Deploy DeepSeek-R1 in Amazon Bedrock Marketplace

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

1. On the Amazon Bedrock console, pick Model brochure under Foundation designs in the navigation pane. At the time of composing this post, you can utilize the InvokeModel API to conjure up the model. It doesn't support Converse APIs and other Amazon Bedrock tooling. 2. Filter for DeepSeek as a service provider and choose the DeepSeek-R1 design.

The design detail page provides necessary details about the design's abilities, rates structure, and implementation standards. You can find detailed usage guidelines, consisting of sample API calls and code snippets for combination. The model supports various text generation jobs, consisting of content production, code generation, and concern answering, utilizing its reinforcement learning optimization and CoT thinking abilities. The page likewise includes release options and licensing details to help you begin with DeepSeek-R1 in your applications. 3. To start using DeepSeek-R1, pick Deploy.

You will be triggered to set up the deployment 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 Number of circumstances, get in a variety of circumstances (in between 1-100). 6. For example type, select your instance type. For ideal performance with DeepSeek-R1, a GPU-based instance type like ml.p5e.48 xlarge is advised. Optionally, you can configure sophisticated security and facilities settings, including virtual personal cloud (VPC) networking, service role 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 align with your organization's security and compliance requirements. 7. Choose Deploy to begin utilizing the model.

When the release is complete, you can test DeepSeek-R1's capabilities straight in the Amazon Bedrock play ground. 8. Choose Open in play area to access an interactive interface where you can explore different prompts and adjust design criteria like temperature and optimum length. When using R1 with Bedrock's InvokeModel and Playground Console, use DeepSeek's chat template for optimum outcomes. 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 play ground supplies instant feedback, helping you comprehend how the design reacts to numerous inputs and letting you fine-tune your triggers for optimum outcomes.

You can quickly evaluate the design 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 using guardrails with the released DeepSeek-R1 endpoint

The following code example shows how to perform inference utilizing a deployed DeepSeek-R1 design through Amazon Bedrock utilizing the invoke_model and ApplyGuardrail API. 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. After you have developed the guardrail, use the following code to carry out guardrails. The script initializes the bedrock_runtime customer, sets up reasoning criteria, and sends out a demand to create text based on a user prompt.

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 information, and deploy them into production utilizing either the UI or SDK.

Deploying DeepSeek-R1 model through SageMaker JumpStart provides 2 hassle-free approaches: utilizing the user-friendly SageMaker JumpStart UI or executing programmatically through the SageMaker Python SDK. Let's explore both methods to help you choose the method that finest matches your requirements.

Deploy DeepSeek-R1 through SageMaker JumpStart UI

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

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

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

4. Look for DeepSeek-R1 to view the DeepSeek-R1 design 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 signed up with Amazon Bedrock, allowing you to use Amazon Bedrock APIs to conjure up the model

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

    The model details page consists of the following details:

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

    6. Choose Deploy to proceed with implementation.

    7. For Endpoint name, utilize the immediately created name or wavedream.wiki create a customized one.
  1. For example type ¸ choose an instance type (default: ml.p5e.48 xlarge).
  2. For Initial instance count, go into the variety of circumstances (default: 1). Selecting appropriate instance types and counts is vital for expense and performance optimization. Monitor your release to adjust these settings as needed.Under Inference type, Real-time reasoning is selected by default. This is optimized for sustained traffic and low latency.
  3. Review all setups for precision. For this design, we highly suggest adhering to SageMaker JumpStart default settings and making certain that network seclusion remains in place.
  4. Choose Deploy to deploy the design.

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

    When deployment is complete, your endpoint status will change to InService. At this point, the design is ready to accept reasoning requests through the endpoint. You can keep track of the implementation progress on the SageMaker console Endpoints page, which will show relevant metrics and status details. When the implementation is complete, you can conjure up the model using 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 install the SageMaker Python SDK and make certain you have the essential AWS permissions and environment setup. The following is a detailed code example that shows how to deploy and utilize DeepSeek-R1 for reasoning programmatically. The code for releasing the model is offered in the Github here. You can clone the notebook and range from SageMaker Studio.

    You can run extra 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 utilizing the Amazon Bedrock console or the API, and execute it as shown in the following code:

    Tidy up

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

    Delete the Amazon Bedrock Marketplace deployment

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

    1. On the Amazon Bedrock console, under Foundation models in the navigation pane, choose Marketplace implementations.
  5. In the Managed implementations 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 erasing the correct release: 1. Endpoint name.
  8. Model name.
  9. Endpoint status

    Delete the SageMaker JumpStart predictor

    The SageMaker JumpStart design you released 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 explored 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 start. For more details, refer to Use Amazon Bedrock tooling with Amazon SageMaker JumpStart models, SageMaker JumpStart pretrained designs, Amazon SageMaker JumpStart Foundation Models, Amazon Bedrock Marketplace, and Getting started 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 services utilizing AWS services and sped up compute. Currently, he is focused on establishing strategies for fine-tuning and optimizing the reasoning performance of large language designs. In his downtime, Vivek takes pleasure in treking, seeing films, and trying various cuisines.

    Niithiyn Vijeaswaran is a Generative AI Specialist Solutions Architect with the Third-Party Model Science group 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 Professional Solutions Architect dealing with generative AI with the Science group 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 building options that help clients accelerate their AI journey and unlock organization worth.