1 DeepSeek-R1 Model now Available in Amazon Bedrock Marketplace And Amazon SageMaker JumpStart
Fatima Howie edited this page 2025-02-07 18:50:24 +08:00
This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.


Today, we are delighted 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 release DeepSeek AI's first-generation frontier design, DeepSeek-R1, together with the distilled variations 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 start with DeepSeek-R1 on Amazon Bedrock Marketplace and SageMaker JumpStart. You can follow comparable steps to deploy the distilled variations of the designs also.

Overview of DeepSeek-R1

DeepSeek-R1 is a large language design (LLM) established by DeepSeek AI that utilizes reinforcement discovering to improve reasoning capabilities through a multi-stage training procedure from a DeepSeek-V3-Base structure. A key identifying feature is its reinforcement learning (RL) action, which was used to fine-tune the design's responses beyond the standard pre-training and tweak process. By incorporating RL, DeepSeek-R1 can adjust better to user feedback and objectives, ultimately enhancing both importance and clearness. In addition, DeepSeek-R1 uses a chain-of-thought (CoT) technique, implying it's geared up to break down complex queries and reason through them in a detailed way. This directed reasoning process permits the model to produce more precise, transparent, and detailed responses. This design combines RL-based fine-tuning with CoT capabilities, aiming to create structured actions while concentrating on interpretability and user interaction. With its wide-ranging capabilities DeepSeek-R1 has caught the industry's attention as a flexible text-generation model that can be incorporated into various workflows such as agents, sensible thinking and information interpretation jobs.

DeepSeek-R1 uses a Mix of Experts (MoE) architecture and is 671 billion criteria in size. The MoE architecture permits activation of 37 billion criteria, enabling effective inference by routing queries to the most relevant expert "clusters." This method enables the design to focus on various issue domains while maintaining total 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 instance to release the design. ml.p5e.48 xlarge features 8 Nvidia H200 GPUs providing 1128 GB of GPU memory.

DeepSeek-R1 distilled models bring the thinking abilities of the main R1 model to more effective architectures based upon popular open designs like Qwen (1.5 B, 7B, 14B, and pediascape.science 32B) and Llama (8B and 70B). Distillation describes a procedure of training smaller, more effective designs to mimic the habits and reasoning patterns of the bigger DeepSeek-R1 design, utilizing it as a teacher design.

You can release DeepSeek-R1 model either through SageMaker JumpStart or Bedrock Marketplace. Because DeepSeek-R1 is an emerging model, we recommend releasing this model with guardrails in place. In this blog, we will utilize Amazon Bedrock Guardrails to present safeguards, avoid damaging content, and examine models against crucial security 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 produce numerous guardrails tailored to various use cases and apply them to the DeepSeek-R1 model, improving 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 examine if you have quotas for P5e, open the Service Quotas and under AWS Services, choose Amazon SageMaker, and verify you're utilizing 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 deploying. To request a limit increase, produce a limitation increase request and connect to your account group.

Because you will be releasing this design with Amazon Bedrock Guardrails, make certain you have the proper AWS Identity and Gain Access To Management (IAM) approvals to utilize Amazon Bedrock Guardrails. For directions, see Set up consents to use guardrails for material filtering.

Implementing guardrails with the ApplyGuardrail API

Amazon Bedrock Guardrails permits you to present safeguards, avoid hazardous content, and examine models against crucial security requirements. You can carry out precaution for the DeepSeek-R1 design utilizing the Amazon Bedrock ApplyGuardrail API. This enables you to apply 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 develop the guardrail, see the GitHub repo.

The general flow 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 out to the model for reasoning. After getting the design's output, another guardrail check is applied. If the output passes this last 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 happened at the input or output stage. The examples showcased in the following sections 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 composing this post, you can use 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 service provider and pick the DeepSeek-R1 design.

The model detail page offers essential details about the design's abilities, prices structure, and application standards. You can discover detailed usage directions, consisting of sample API calls and code bits for integration. The design supports numerous text generation jobs, including material creation, links.gtanet.com.br code generation, and concern answering, using its reinforcement finding out optimization and CoT thinking abilities. The page likewise consists of implementation alternatives 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 triggered to configure the deployment details for DeepSeek-R1. The design ID will be pre-populated. 4. For Endpoint name, get in 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 Instance type, select your instance type. For optimal performance with DeepSeek-R1, a GPU-based circumstances type like ml.p5e.48 xlarge is advised. Optionally, you can set up advanced security and infrastructure settings, including virtual private cloud (VPC) networking, service role approvals, and encryption settings. For a lot of utilize cases, the default settings will work well. However, for production deployments, you may desire to evaluate these settings to align with your organization's security and compliance requirements. 7. Choose Deploy to start using the model.

When the implementation is complete, you can evaluate DeepSeek-R1's abilities straight in the Amazon Bedrock play area. 8. Choose Open in playground to access an interactive interface where you can explore different prompts and change model specifications like temperature level and optimum length. When utilizing R1 with Bedrock's InvokeModel and Playground Console, use DeepSeek's chat template for ideal outcomes. For example, material for reasoning.

This is an outstanding method to explore the design's reasoning and text generation capabilities before integrating it into your applications. The play ground offers instant feedback, helping you understand how the model reacts to different inputs and letting you fine-tune your triggers for ideal outcomes.

You can quickly evaluate the design in the play area through the UI. However, to conjure up the released design programmatically with any Amazon Bedrock APIs, you require to get the endpoint ARN.

Run inference using guardrails with the released DeepSeek-R1 endpoint

The following code example shows how to perform reasoning utilizing a released DeepSeek-R1 model 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 produce the guardrail, see the GitHub repo. After you have developed the guardrail, use the following code to execute guardrails. The script initializes the bedrock_runtime client, sets up reasoning specifications, and sends out a request to create text based on 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 services that you can deploy with simply a few clicks. With SageMaker JumpStart, you can tailor pre-trained designs to your use case, with your data, and deploy them into production using either the UI or SDK.

Deploying DeepSeek-R1 model through SageMaker JumpStart offers two hassle-free approaches: using the instinctive SageMaker JumpStart UI or carrying out programmatically through the SageMaker Python SDK. Let's explore both techniques to help you pick the approach that finest 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 triggered to create a domain. 3. On the SageMaker Studio console, choose JumpStart in the navigation pane.

The design internet browser shows available models, with details like the service provider name and design capabilities.

4. Look for DeepSeek-R1 to view the DeepSeek-R1 model card. Each model card shows crucial details, including:

- Model name

  • Provider name
  • Task classification (for example, Text Generation). Bedrock Ready badge (if relevant), suggesting 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 see the model details page.

    The design details page includes the following details:

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

    The About tab includes crucial details, such as:

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

    Before you deploy the model, it's recommended to review the model details and license terms to verify compatibility with your usage case.

    6. Choose Deploy to continue with deployment.

    7. For Endpoint name, utilize the immediately generated name or create a custom one.
  1. For example type ¸ choose a circumstances type (default: ml.p5e.48 xlarge).
  2. For Initial instance count, go into the number of instances (default: 1). Selecting suitable instance types and counts is crucial for expense and performance 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 accuracy. For this model, we strongly advise sticking to SageMaker JumpStart default settings and making certain that network seclusion remains in location.
  4. Choose Deploy to deploy the model.

    The release procedure can take a number of minutes to complete.

    When implementation is complete, your endpoint status will change to InService. At this moment, the design is prepared to accept reasoning requests through the endpoint. You can monitor the implementation development on the SageMaker console Endpoints page, which will show appropriate metrics and status details. When the deployment is total, you can conjure up the model utilizing a SageMaker runtime client and integrate it with your applications.

    Deploy DeepSeek-R1 using the SageMaker Python SDK

    To get going with DeepSeek-R1 utilizing the SageMaker Python SDK, you will require to install the SageMaker Python SDK and wavedream.wiki make certain you have the required AWS authorizations and environment setup. The following is a detailed code example that demonstrates how to deploy and use DeepSeek-R1 for reasoning programmatically. The code for releasing the model is supplied in the Github here. You can clone the note pad and run 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 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 revealed in the following code:

    Clean up

    To prevent unwanted charges, complete the steps in this section to clean up your resources.

    Delete the Amazon Bedrock Marketplace implementation

    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, pick Marketplace implementations.
  5. In the Managed deployments 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 deleting the right 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 desire 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 design using Bedrock Marketplace and SageMaker JumpStart. Visit SageMaker JumpStart in SageMaker Studio or Amazon Bedrock Marketplace now to get going. 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 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 companies develop ingenious solutions using AWS services and sped up calculate. Currently, he is focused on establishing techniques for fine-tuning and enhancing the inference performance of big language models. In his leisure time, Vivek takes pleasure in treking, enjoying films, and attempting various foods.

    Niithiyn Vijeaswaran is a Generative AI Specialist Solutions Architect with the Third-Party Model Science team 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 Professional Solutions Architect working on generative AI with the Third-Party Model Science team at AWS.

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