1 DeepSeek R1 Model now Available in Amazon Bedrock Marketplace And Amazon SageMaker JumpStart
lesleymartinov edited this page 1 month 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 delighted to reveal 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, in addition to the distilled versions ranging from 1.5 to 70 billion specifications to develop, experiment, and properly scale your generative AI concepts on AWS.

In this post, we demonstrate how to start with DeepSeek-R1 on Amazon Bedrock Marketplace and SageMaker JumpStart. You can follow similar steps to deploy 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 uses support learning to boost thinking capabilities through a multi-stage training process from a DeepSeek-V3-Base foundation. An essential identifying function is its reinforcement knowing (RL) step, which was utilized to fine-tune the model's reactions beyond the standard pre-training and tweak process. By including RL, DeepSeek-R1 can adjust more effectively to user feedback and objectives, eventually boosting both relevance and clarity. In addition, DeepSeek-R1 utilizes a chain-of-thought (CoT) approach, meaning it's geared up to break down intricate inquiries and reason through them in a detailed manner. This guided thinking process permits the model to produce more precise, transparent, and detailed responses. This model combines RL-based fine-tuning with CoT capabilities, aiming to produce structured actions while focusing on interpretability and user interaction. With its extensive capabilities DeepSeek-R1 has actually caught the market's attention as a versatile text-generation model that can be incorporated into numerous workflows such as representatives, sensible reasoning and data analysis jobs.

DeepSeek-R1 uses a Mix of Experts (MoE) architecture and is 671 billion specifications in size. The MoE architecture enables activation of 37 billion specifications, allowing efficient reasoning by routing queries to the most appropriate specialist "clusters." This method allows the design to concentrate on various problem domains while maintaining overall efficiency. 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 deploy the design. ml.p5e.48 xlarge comes with 8 Nvidia H200 GPUs offering 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 models like Qwen (1.5 B, 7B, 14B, and 32B) and Llama (8B and 70B). Distillation describes a process of training smaller sized, more effective designs to imitate the habits and thinking patterns of the larger DeepSeek-R1 model, using it as an instructor design.

You can deploy DeepSeek-R1 model either through SageMaker JumpStart or Bedrock Marketplace. Because DeepSeek-R1 is an emerging model, we advise releasing this design with guardrails in location. In this blog site, we will use Amazon Bedrock Guardrails to introduce safeguards, prevent damaging material, and assess designs against crucial 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 produce numerous guardrails tailored to different use cases and apply them to the DeepSeek-R1 design, enhancing user experiences and standardizing safety controls across your generative AI applications.

Prerequisites

To release the DeepSeek-R1 design, 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 confirm you're utilizing ml.p5e.48 xlarge for endpoint use. Make certain that you have at least one ml.P5e.48 xlarge instance in the AWS Region you are releasing. To request a limitation boost, produce a limit boost demand and reach out to your account team.

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) permissions to use Amazon Bedrock Guardrails. For directions, see Set up authorizations to utilize guardrails for material filtering.

Implementing guardrails with the ApplyGuardrail API

Amazon Bedrock permits you to present safeguards, avoid damaging material, and examine models against crucial security criteria. You can carry out precaution for the DeepSeek-R1 design utilizing the Amazon Bedrock ApplyGuardrail API. This allows you to use guardrails to assess user inputs and model actions deployed 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 create the guardrail, see the GitHub repo.

The basic circulation involves the following steps: First, the system gets an input for the design. 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 model's output, another guardrail check is applied. If the output passes this final check, it's returned as the 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 phase. The examples showcased in the following areas demonstrate inference using this API.

Deploy DeepSeek-R1 in Amazon Bedrock Marketplace

Amazon Bedrock Marketplace offers 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, select Model catalog 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 does not support Converse APIs and other Amazon Bedrock tooling. 2. Filter for DeepSeek as a service provider and pick the DeepSeek-R1 model.

The design detail page offers important details about the model's abilities, rates structure, and execution guidelines. You can find detailed usage guidelines, consisting of sample API calls and code bits for integration. The design supports numerous text generation jobs, including content creation, code generation, and concern answering, using its reinforcement discovering optimization and CoT reasoning abilities. The page likewise includes implementation choices and licensing details to assist you begin with DeepSeek-R1 in your applications. 3. To begin utilizing 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, enter an endpoint name (in between 1-50 alphanumeric characters). 5. For Number of instances, get in a variety of circumstances (between 1-100). 6. For example type, select your instance type. For optimum performance with DeepSeek-R1, a GPU-based circumstances type like ml.p5e.48 xlarge is suggested. Optionally, you can set up advanced security and infrastructure settings, including virtual private cloud (VPC) networking, service function permissions, and file encryption settings. For a lot of utilize cases, the default settings will work well. However, for production releases, you might desire to examine these settings to line up with your organization's security and compliance requirements. 7. Choose Deploy to begin utilizing the design.

When the release is total, you can check DeepSeek-R1's capabilities straight in the Amazon Bedrock play area. 8. Choose Open in play ground to access an interactive user interface where you can try out different prompts and adjust model parameters like temperature level and maximum length. When using R1 with Bedrock's InvokeModel and Playground Console, utilize DeepSeek's chat template for optimal outcomes. For example, content for inference.

This is an outstanding way to explore the design's reasoning and text generation abilities before integrating it into your applications. The playground provides immediate feedback, assisting you understand how the design reacts to numerous inputs and letting you fine-tune your prompts for optimum results.

You can rapidly evaluate the model in the playground through the UI. However, to invoke 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 demonstrates how to carry out inference utilizing a deployed DeepSeek-R1 design through Amazon Bedrock using the invoke_model and ApplyGuardrail API. You can produce a guardrail utilizing the Amazon Bedrock console or the API. For the example code to create the guardrail, see the GitHub repo. After you have actually developed the guardrail, use the following code to execute guardrails. The script initializes the bedrock_runtime customer, sets up inference specifications, and sends a demand to generate text based on a user timely.

Deploy DeepSeek-R1 with SageMaker JumpStart

SageMaker JumpStart is an artificial intelligence (ML) center with FMs, surgiteams.com built-in algorithms, and prebuilt ML solutions that you can release with just a couple of clicks. With SageMaker JumpStart, you can tailor pre-trained designs to your usage case, with your data, and deploy them into production utilizing either the UI or SDK.

Deploying DeepSeek-R1 model through SageMaker JumpStart provides two hassle-free techniques: utilizing the intuitive SageMaker JumpStart UI or carrying out programmatically through the SageMaker Python SDK. Let's explore both approaches to assist you pick the method 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, pick Studio in the navigation pane. 2. First-time users will be prompted to produce a domain. 3. On the SageMaker Studio console, select JumpStart in the navigation pane.

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

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

- Model name

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

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

    The design details page includes the following details:

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

    The About tab consists of crucial details, such as:

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

    Before you deploy the model, it's recommended to examine the model details and license terms to validate compatibility with your use case.

    6. Choose Deploy to proceed with release.

    7. For Endpoint name, use the immediately produced name or develop a custom-made one.
  1. For example type ¸ pick a circumstances type (default: ml.p5e.48 xlarge).
  2. For Initial instance count, get in the variety of instances (default: 1). Selecting proper circumstances types and counts is vital for cost and performance optimization. Monitor your deployment to change these settings as needed.Under Inference type, Real-time reasoning is chosen by default. This is optimized for sustained traffic and low latency.
  3. Review all configurations for precision. For this design, we highly recommend sticking to SageMaker JumpStart default settings and making certain that network seclusion remains in place.
  4. Choose Deploy to release the design.

    The implementation process can take several minutes to complete.

    When release is total, your endpoint status will change to InService. At this moment, the model is all set to accept inference requests through the endpoint. You can monitor the release progress on the SageMaker console Endpoints page, which will display relevant metrics and status details. When the release is total, you can invoke the design utilizing a SageMaker runtime customer and integrate it with your applications.

    Deploy DeepSeek-R1 utilizing the SageMaker Python SDK

    To start 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 authorizations and environment setup. The following is a detailed code example that shows how to deploy and use DeepSeek-R1 for reasoning programmatically. The code for deploying the model is offered in the Github here. You can clone the notebook and range from SageMaker Studio.

    You can run extra requests against the predictor:

    Implement guardrails and run inference with your SageMaker JumpStart predictor

    Similar to Amazon Bedrock, you can also utilize the ApplyGuardrail API with your SageMaker JumpStart predictor. You can create a guardrail utilizing the Amazon Bedrock console or the API, and implement it as revealed in the following code:

    Tidy up

    To avoid undesirable charges, finish the steps in this section to tidy up your resources.

    Delete the Amazon Bedrock Marketplace deployment

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

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

    Delete the SageMaker JumpStart predictor

    The SageMaker JumpStart model 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 checked out how you can access and deploy the DeepSeek-R1 model 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 Starting with Amazon SageMaker JumpStart.

    About the Authors

    Vivek Gangasani is a Lead Specialist Solutions Architect for Inference at AWS. He assists emerging generative AI companies develop innovative options utilizing AWS services and accelerated calculate. Currently, he is concentrated on establishing methods for fine-tuning and optimizing the inference efficiency of large language designs. In his complimentary time, Vivek delights in hiking, seeing movies, and attempting various foods.

    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 Third-Party Model Science group at AWS.

    Banu Nagasundaram leads product, engineering, and strategic collaborations for Amazon SageMaker JumpStart, SageMaker's artificial intelligence and generative AI center. She is passionate about constructing options that help clients accelerate their AI journey and unlock service value.