Skip to content

アプリケーション内で をクリックすると、お使いのDataRobotバージョンに関する全プラットフォームドキュメントにアクセスできます。

評価とモデレーションを設定

プレミアム機能

Evaluation and moderation guardrails are a premium feature. この機能を有効にする方法については、DataRobotの担当者または管理者にお問い合わせください。

機能フラグ:モデレーションのガードレールを有効にする(プレミアム)、モデルレジストリでグローバルモデルを有効にする(プレミアム)、予測応答で追加のカスタムモデル出力を有効にする

評価とモデレーションのガードレールは、組織がプロンプトインジェクションや、悪意のある、有害な、または不適切なプロンプトや回答をブロックするのに役立ちます。 また、ハルシネーションや信頼性の低い回答を防ぎ、より一般的には、モデルをトピックに沿った状態に保つこともできます。 さらに、これらのガードレールは、個人を特定できる情報(PII)の共有を防ぐことができます。 多くの評価およびモデレーションガードレールは、デプロイされたテキスト生成モデル(LLM)をデプロイされたガードモデルに接続します。 これらのガードモデルはLLMのプロンプトと回答について予測し、これらの予測と統計を中心的なLLMデプロイに報告します。 評価とモデレーションのガードレールを使用するには、まず、LLMのプロンプトや回答について予測するガードモデルを作成してデプロイします。たとえば、ガードモデルは、プロンプトインジェクションや有害な回答を識別することができます。 次に、ターゲットタイプがテキスト生成のカスタムモデルを作成する場合、評価とモデレーションのガードレールを1つ以上定義します。

重要な前提条件

LLMに評価とモデレーションのガードレールを設定する前に、ガードモデルをデプロイし、LLMのデプロイを設定する際には、以下のガイドラインに従ってください。

  • カスタムガードモデルを使用している場合、デプロイする前に、moderations.input_column_namemoderations.output_column_name登録モデルバージョンのタグ型キー値として定義します。 これらのキー値を設定しない場合、ガードモデルのユーザーは、入力列名と出力列名を手動で入力する必要があります。
  • 評価とモデレーションを設定するに、中心的なLLMの監視に使用するグローバルまたはカスタムガードモデルをデプロイします。
  • デプロイされたガードモデルとは異なる予測環境に、中心的なLLMをデプロイします。
  • デプロイされたLLMを介して予測を開始する前に、関連付けID{ target=blank }を設定して予測ストレージを有効にします。 _If you don't set an association ID and provide association IDs alongside the LLM's predictions, the metrics for the moderations won't be calculated on the Custom metrics tab.
  • 関連付けIDを定義後、関連付けIDの自動生成を有効にして、これらの指標がカスタム指標タブに表示されるようにできます。 この設定は、デプロイ やデプロイ に有効化できます。

予測方法に関する注意事項

When making predictions outside a chat generation Q&A application, evaluations and moderations are only compatible with real-time predictions, not batch predictions. In addition, when requesting streaming responses using the Bolt-on Governance API, evaluation and moderation negates the effect of streaming. Guardrails evaluate only the complete response of the LLM and therefore return the response text in one chunk.

評価およびモデレーションガードレールを選択および設定するには:

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

    モデレーションを使ってテキスト生成モデルを構築する場合、必要なランタイムパラメーター(資格情報など)の設定やリソース設定(パブリックネットワークへのアクセスなど)を必ず行います。 Finally, set the Base environment to a moderation-compatible environment; for example, [GenAI] Python 3.11 with Moderations:

    リソース設定

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

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

  3. In the Configuration summary, do either of the following:

    • Click View lineage to review how evaluations are executed in DataRobot. すべての評価とそれぞれのモデレーションは並行して実行されます。

    • Click General configuration to set the following:

      設定 説明
      モデレーションのタイムアウト モデレーションシステムが自動的にタイムアウトするまでの最大待機時間を設定します。
      タイムアウトアクション Define what happens if the moderation system times out: Score prompt / response or Block prompt / response.
  4. In the Configure evaluation and moderation panel, click one of the following metric cards to configure the required properties:

    評価指標 要件 説明
    カスタムデプロイ カスタムデプロイ 任意のデプロイを使用して、LLM(サポートされているターゲットタイプ:連続値、二値分類、多クラス、テキスト生成)の評価とモデレーションを行います。
    感情分類器 Emotions Classifier deployment Classify prompt or response text by emotion.
    忠実度 Playground LLM, vector database LLMの回答がソースと一致するかどうかを測定して、考えられるハルシネーションを識別します。
    PII検出 PresidioのPII検出 Microsoft Presidioライブラリを使用して、テキスト内の個人識別情報 (PII) を検出します。
    プロンプトインジェクション プロンプトインジェクション分類器 モデルの出力変更を意図した入力操作(システムプロンプトの上書きや変更など)を検出します。
    プロンプトトークン N/A LLMへの入力に関連付けられたトークンの数を追跡します。
    回答トークン N/A LLMからの出力に関連付けられたトークンの数を追跡します。
    Rouge 1 ベクターデータベース LLMブループリントから生成された回答とベクターデータベースから取得されたドキュメントの間で類似度を計算します。
    入力のトピックを維持 NVIDIA NeMo guardrails configuration NVIDIA NeMo Guardrailsを使用してトピックの境界を設定することで、プロンプトがトピックに関連し、禁止用語を使用しないようにします。
    出力のトピックを維持 NVIDIA NeMo guardrails configuration NVIDIA NeMo Guardrailsを使用してトピックの境界を設定することで、回答がトピックに関連し、禁止用語を使用しないようにします。
    トークン数 N/A LLMへの入力、LLMからの出力、ベクターデータベースから取得したテキストに関連付けられたトークンの数を追跡します。
    毒性 毒性分類器 コンテンツの有害性を分類してモデレーション技術を適用し、有害なコンテンツの拡散を防ぎます。

    The deployments required for PII detection, prompt injection detection, emotion classification, and toxicity classification are available as global models in the registry.

    Multiclass custom deployment metric limits

    Multiclass custom deployment metrics can have:

    • Up to 10 classes defined in the Matches list for moderation criteria.

    • Up to 100 class names in the guard model.

  5. 上記で選択した指標に応じて、次のフィールドを設定します。

    フィールド 説明
    全般的な設定
    名前 評価指標の複数のインスタンスを追加する場合は、一意の名前を入力します。
    適用先 評価指標に応じて、プロンプト回答のどちらか、または両方を選択します。 Note that when you select Prompt, it's the user prompt, not the final LLM prompt, that is used for metric calculation.
    Custom Deployment, PII Detection, Prompt Injection, Emotions Classifier, and Toxicity settings
    デプロイ名 ガードモデルによって計算された評価指標の場合、カスタムモデルデプロイを選択します。
    Custom Deployment settings
    入力列名 この名前は、カスタムモデルの作成者によって定義されます。 DataRobotによって作成されたグローバルモデルの場合、デフォルトの入力列名はtextです。 If the guard model for the custom deployment has the moderations.input_column_name key value defined, this field is populated automatically.
    出力列名 This name is defined by the custom model creator, and needs to refer to the target column for the model. The target name is listed on the deployment's Overview tab (and often has _PREDICTION appended to it). カスタムデプロイからCSVデータをエクスポートして表示することで、列名を確認できます。 カスタムデプロイのガードモデルにmoderations.output_column_nameキー値が定義されている場合、これらのフィールドには自動的に値が設定されます。
    Faithfulness settings
    LLM Select a Playground LLM for evaluation.
    Stay on topic for input/ouput settings
    LLMタイプ Select Azure OpenAI or OpenAI, and then, set the following:
    • For the Azure OpenAI LLM type, enter an OpenAI API base URL, OpenAI Credentials, and OpenAI API Deployment.
    • For the OpenAI LLM type, select Credentials.
    Credentials are defined on the Credentials management page.
    ファイル For the Stay on topic evaluations, next to a file, click to modify the NeMo guardrails configuration files. In particular, update prompts.yml with allowed and blocked topics and blocked_terms.txt with the blocked terms, providing rules for NeMo guardrails to enforce. The blocked_terms.txt file is shared between the input and output stay on topic metrics; therefore, modifying blocked_terms.txt in the input metric modifies it for the output metric and vice versa. Only two NeMo stay on topic metrics can exist in a custom model, one for input and one for output.
    モデレーション設定
    モデレーションの設定と適用 Enable this setting to expand the Moderation section and define the criteria that determines when moderation logic is applied.
  6. In the Moderation section, with Configure and apply moderation enabled, for each evaluation metric, set the following:

    設定 説明
    モデレーションの基準 If applicable, set the threshold settings evaluated to trigger moderation logic. For the Emotions Classifier, select Matches or Does not match and define a list of classes (emotions) to trigger moderation logic.
    モデレーション方法 Select Report, Report and block, or Replace (if applicable).
    モデレーションのメッセージ If you select Report and block, you can optionally modify the default message.
  7. After configuring the required fields, click Add to save the evaluation and return to the evaluation selection page. Then, select and configure another metric, or click Save configuration.

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

テキスト生成カスタムモデルにガードレールを追加した後、モデルを テスト登録、および デプロイして本番環境で予測を作成できます。 予測を作成した後、 カスタム指標 タブで評価指標を表示し、 データ探索タブでプロンプト、回答、およびフィードバック(設定されている場合)を表示できます。

「トレース」タブ

LLMデプロイにモデレーションを追加すると、データ探索 > トレースタブでカスタム指標データを行ごとに表示することはできません。

Global models for evaluation metric deployments

The deployments required for PII detection, prompt injection detection, emotion classification, and toxicity classification are available as global models in the registry. 次のグローバルモデルを使用できます。

モデル タイプ ターゲット 説明
プロンプトインジェクション分類器 二値 インジェクション テキストをプロンプトインジェクションまたは正当なものとして分類します。 このモデルには、分類するテキストを含むtextという名前の列が1つ必要です。 詳しくは、 deberta-v3-base-injectionモデルの詳細を参照してください。
毒性分類器 二値 毒性 テキストを有毒か無毒に分類します。 このモデルには、分類するテキストを含むtextという名前の列が1つ必要です。 詳しくは、 toxic-comment-modelの詳細を参照してください。
センチメント分類器 二値 センチメント テキストのセンチメントを肯定的か否定的に分類します。 このモデルには、分類するテキストを含むtextという名前の列が1つ必要です。 詳しくは、 distilbert-base-uncased-finetuned-sst-2-englishモデルの詳細を参照してください。
感情分類器 多クラス ターゲット テキストを感情で分類します。 これは多ラベルモデルです。つまり、複数の感情をテキストに適用できます。 このモデルには、分類するテキストを含むtextという名前の列が1つ必要です。 詳しくは、 roberta-base-go_emotions-onnxモデルの詳細を参照してください。
拒否スコア 連続値 ターゲット プロンプトがモデルに設定されている回答範囲を超えているために、LLMがクエリーへの回答を拒否したケースのリストと、入力を比較して、最大類似度スコアを出力します。
PresidioのPII検出 二値 contains_pii テキスト内の個人を特定できる情報(PII)を検出して置き換えます。 このモデルには、分類するテキストを含むtextという名前の列が1つ必要です。 必要に応じて、検出するPIIのタイプをコンマ区切りの文字列として列'entities'に指定できます。 この列が指定されていない場合は、サポートされているすべてのエンティティが検出されます。 エンティティのタイプは、PresidioがサポートするPIIエンティティのドキュメントに記載されています。

検出結果に加えて、モデルはanonymized_text列を返します。この列には、検出されたPIIがプレースホルダーに置き換えられた更新バージョンの入力が含まれています。

詳細については、Presidio: Data Protection and De-identification SDKのドキュメントを参照してください。
ゼロショット分類器 二値 ターゲット ユーザー指定のラベルを持つテキストに対してゼロショット分類を実行します。 このモデルでは、textという名前の列に分類されたテキストが必要であり、labelsという名前の列にコンマ区切りの文字列としてクラスラベルが必要です。 すべての行に同じラベルセットが必要であるため、最初の行にあるラベルが使用されます。 詳しくは、 deberta-v3-large-zeroshot-v1モデルの詳細を参照してください。
Pythonダミー二値分類 二値 ターゲット Positiveクラスでは、常に0.75となります。 詳しくは、 python3_dummy_binaryモデルの詳細を参照してください。

評価およびモデレーションガードレールの表示

ガードレールを含むテキスト生成モデルが登録およびデプロイされると、 登録済みモデルの概要タブと デプロイの概要タブで設定済みのガードレールを表示できます。

View evaluation and moderation logs

For a deployed LLM with evaluation and moderations configured, on the deployment's Service health tab, under Recent activity you can click Evaluations and moderations to view a history of evaluation and moderation-related events for the deployment. These events can help diagnose issues with a deployment's evaluations and moderations:


更新しました February 5, 2025