Skip to content

Use NVIDIA NeMo Guardrails with DataRobot moderation

プレミアム機能

DataRobotでNVIDIA Inference Microservices(NIM)を利用するには、GenAIのエクスペリメントとGPUを使用した推論のためのプレミアム機能にアクセスする必要があります。 NVIDIA NeMo Guardrails are a premium feature. この機能を有効にする方法については、DataRobotの担当者または管理者にお問い合わせください。

Additional feature flags: Enable Moderation Guardrails (Premium), Enable Global Models in the Model Registry (Premium), Enable Additional Custom Model Output in Prediction Responses

DataRobot provides out-of-the-box guardrails and lets you customize your applications with simple rules, code, or models. Use NVIDIA Inference Microservices (NIM) to connect NVIDIA NeMo Guardrails to text generation models in DataRobot, allowing you to guard against off-topic discussions, unsafe content, and jailbreaking attempts. The following NVIDIA NeMo Guardrails are available and can be implemented using the associated evaluation metric type:

モデル名 評価指標の種類
llama-3.1-nemoguard-8b-content-safety カスタムデプロイ
llama-3.1-nemoguard-8b-topic-control Stay on topic for input / Stay on topic for output
nemoguard-jailbreak-detect カスタムデプロイ

Use a deployed NIM with NVIDIA NeMo guardrails

To use a deployed llama-3.1-nemoguard-8b-topic-control NVIDIA NIM with the Stay on topic evaluation metrics, register and deploy the NVIDIA NeMo Guardrail. Once you have created a custom model with the text generation target type, configure the Stay on topic evaluation metric.

To select and configure NVIDIA NeMo Guardrails for topic control:

  1. モデルワークショップで、テキスト生成ターゲットタイプを持つカスタムモデルのアセンブルタブを開き、 DataRobotの外部で作成したカスタムモデルから手動で、または ユースケースのLLMプレイグラウンドで作成されたモデルから自動的に モデルを構築します。

    モデレーションを使ってテキスト生成モデルを構築する場合、必要なランタイムパラメーター(資格情報など)の設定やリソース設定(パブリックネットワークへのアクセスなど)を必ず行います。 最後に、基本環境をモデレーション互換の環境([GenAI] Python 3.12 with Moderationsなど)に設定します。

    リソース設定

    DataRobotでは、より多くのメモリーおよびCPUリソースを備えた、より大きなリソースバンドルを使用してLLMカスタムモデルを作成することをお勧めします。

  2. カスタムモデルに必須の設定を行った後、評価とモデレーションセクションに移動し、 設定をクリックします。

  3. In the Configure evaluation and moderation panel, locate the metrics tagged with NVIDIA NeMo guardrail, and then click Stay on topic for input or Stay on topic for output.

    評価指標 要件 説明
    入力のトピックを維持 NVIDIA NeMoガードレールの設定 NVIDIA NeMo Guardrailsを使用してトピックの境界を設定することで、プロンプトがトピックに関連し、禁止用語を使用しないようにします。
    出力のトピックを維持 NVIDIA NeMoガードレールの設定 NVIDIA NeMo Guardrailsを使用してトピックの境界を設定することで、回答がトピックに関連し、禁止用語を使用しないようにします。
  4. On the Configure evaluation and moderation page for the Stay on topic for input/ouput metric, in the LLM Type list, select NIM. Then, set the following:

    フィールド 説明
    基本URL Enter the base URL for the NVIDIA NIM deployment, for example: https://app.datarobot.com/api/v2/deployments/<deploymentId>/.
    資格情報
    ファイル
  5. モデレーションセクションで、モデレーションの設定と適用を有効にして、評価指標ごとに以下を設定します。

    フィールド 説明
    モデレーション方法 レポートまたはレポートとブロックを選択します。
    モデレーションのメッセージ レポートとブロックを選択すると、オプションでデフォルトのメッセージを変更できます。
  6. 必須フィールドを設定した後、追加をクリックして評価を保存し、評価選択ページに戻ります。 Then, select and configure another metric, or click Save configuration.

    選択したガードレールは、アセンブルタブの評価とモデレーションセクションに表示されます。

Use a deployed NIM as a custom model guardrail

To use a deployed llama-3.1-nemoguard-8b-content-safety or nemoguard-jailbreak-detect NVIDIA NIM with the Custom Deployment evaluation metric, first, register and deploy the NVIDIA NeMo Guardrails, then, when you create a custom model with the text generation target type, configure the Custom Deployment evaluation metric.

To select and configure NVIDIA NeMo Guardrails for content safety and jailbreaking detection:

  1. モデルワークショップで、テキスト生成ターゲットタイプを持つカスタムモデルのアセンブルタブを開き、 DataRobotの外部で作成したカスタムモデルから手動で、または ユースケースのLLMプレイグラウンドで作成されたモデルから自動的に モデルを構築します。

    モデレーションを使ってテキスト生成モデルを構築する場合、必要なランタイムパラメーター(資格情報など)の設定やリソース設定(パブリックネットワークへのアクセスなど)を必ず行います。 最後に、基本環境をモデレーション互換の環境([GenAI] Python 3.12 with Moderationsなど)に設定します。

    リソース設定

    DataRobotでは、より多くのメモリーおよびCPUリソースを備えた、より大きなリソースバンドルを使用してLLMカスタムモデルを作成することをお勧めします。

  2. カスタムモデルに必須の設定を行った後、評価とモデレーションセクションに移動し、 設定をクリックします。

  3. 評価とモデレーションの設定パネルで、カスタムデプロイメントをクリックします。

  4. On the Configure Custom Deployment page, configure the settings depending on the guard model you're connecting to the LLM: llama-3.1-nemoguard-8b-content-safety or nemoguard-jailbreak-detect.

    For llama-3.1-nemoguard-8b-content-safety, configure the custom deployment as follows:

    フィールド 説明
    名前 Enter a descriptive name for the custom deployment metric you're creating.
    デプロイ名 In the list, locate the name of the llama-3.1-nemoguard-8b-content-safety model registered and deployed in DataRobot and click the deployment name.
    入力列名 Enter text as the input column name.
    出力列名 Enter content_PREDICTION as the output column name.

    For nemoguard-jailbreak-detect, configure the custom deployment as follows:

    フィールド 説明
    名前 Enter a descriptive name for the custom deployment metric you're creating.
    デプロイ名 In the list, locate the name of the nemoguard-jailbreak-detect model registered and deployed in DataRobot and click the deployment name.
    入力列名 Enter text as the input column name.
    出力列名 Enter jailbreak_True_PREDICTION as the output column name.
  5. モデレーションセクションで、モデレーションの設定と適用を有効にして、評価指標ごとに以下を設定します。

    フィールド 説明
    モデレーション方法 レポートまたはレポートとブロックを選択します。
    モデレーションのメッセージ レポートとブロックを選択すると、オプションでデフォルトのメッセージを変更できます。
  6. 必須フィールドを設定した後、追加をクリックして評価を保存し、評価選択ページに戻ります。

  7. 別の指標を選択して設定するか、設定を保存をクリックします。

    選択したガードレールは、アセンブルタブの評価とモデレーションセクションに表示されます。


テキスト生成カスタムモデルにガードレールを追加した後、モデルを テスト登録、および デプロイして本番環境で予測を作成できます。 After making predictions, you can view the evaluation metrics on the Custom metrics tab and prompts, responses, and feedback (if configured) on the Data exploration tab.