Skip to content

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

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

本機能の提供について

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

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

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

Important considerations

Before you configure evaluation and moderation guardrails, you should follow these guidelines while deploying guard models, creating your custom model, and configuring your LLM deployment:

  • Create the LLM custom model using larger resource bundles with more memory and CPU resources.
  • Deploy the central LLM on a different prediction environment than the deployed guard models.
  • Set an association ID and enable prediction storage before you start making predictions through the deployed LLM.

To select and configure evaluation and moderation guardrails:

  1. In the Model workshop, open the Assemble tab of a custom model with the Text Generation target type and assemble a model, either manually from a custom model you created outside of DataRobot or automatically from a model built in a Use Case's LLM playground:

    When you assemble a text generation model with moderations, ensure you configure any required runtime parameters (for example, credentials) or resource settings (for example, public network access). Finally, set the Base environment to [GenAI] Python 3.11 with Moderations:

  2. After you've configured the custom model's required settings, navigate to the Evaluation and Moderation section and click Configure:

  3. In the Configure evaluation and moderation panel, on the Evaluation tab, click one of the following metric cards to configure the required properties:

    Evaluation metric Deployment or API connection 説明
    Custom Deployment Custom deployment Use any deployment to evaluate and moderate your LLM (supported target types: regression, binary classification, multiclass, text generation).
    忠実度 OpenAI API Measure if the LLM response matches the source to identify possible hallucinations.
    PII検出 PresidioのPII検出 Detect Personally Identifiable Information (PII) in text using the Microsoft Presidio library.
    Prompt Injection プロンプトインジェクション分類器 Detect input manipulations, such as overwriting or altering system prompts, intended to modify the model's output.
    Rouge 1 N/A LLMブループリントから生成された回答とベクターデータベースから取得されたドキュメントの間で類似度を計算します。
    センチメント分類器 センチメント分類器 テキストのセンチメントを肯定的か否定的に分類します。
    Stay on topic for inputs NVIDIA NeMo Guardrails API Use NVIDIA NeMo Guardrails to provide topic boundaries, ensuring prompts are topic-relevant and do not use blocked terms.
    Stay on topic for output NVIDIA NeMo Guardrails API Use NVIDIA NeMo Guardrails to provide topic boundaries, ensuring responses are topic-relevant and do not use blocked terms.
    トークン数 N/A LLMへの入力、LLMからの出力、ベクターデータベースから取得したテキストに関連付けられたトークンの数を追跡します。
    毒性 毒性分類器 Classify content toxicity to apply moderation techniques, safeguarding against dissemination of harmful content.

    グローバルモデル

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

  4. Depending on the metric selected above, configure the following fields:

    フィールド 説明
    名前 Enter a unique name if adding multiple instances of the evaluation metric.
    適用先 Select one or both of Prompt and Response, depending on the evaluation metric.
    デプロイ名 For evaluation metrics calculated by a guard model, select the model deployment. For a Custom Deployment, you must also configure the Input column name and Output column name. The column names should be suffixed with _PREDICTION, as they rely on the CSV data exported from the deployment. You can confirm the column names by exporting and viewing the CSV data from the custom deployment.
    OpenAI API For the Faithfulness evaluation metric, enter an OpenAI API base URL, OpenAI API key, and OpenAI API Deployment.
    NVIDIA API For the Stay on topic evaluations, enter an NVIDIA NeMo Guardrails API key.
    ファイル For the Stay on topic evaluations, modify the NeMo guardrails configuration files.
    モデレーションの基準 Define the criteria that determines when moderation logic is applied.
  5. After configuring the required fields, click Add to save the evaluation and return the Evaluation tab. Select and configure another metric, or click Next to proceed to the Moderation tab to configure a moderation strategy.

  6. On Moderation tab, set a Moderation strategy for Prompt moderation and Response moderation. For each evaluation metric, select a Moderation method—either Report or Block (if applicable).

    When you select Block, you can optionally configure the default Display message.

  7. Click Save configuration.

    The guardrails you selected appear in the Evaluation and moderation section of the Assemble tab.

After you add guardrails to a text generation custom model, you can test, register, and deploy the model to make predictions in production. 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.

Data quality tab

When you add moderations to an LLM deployment, you can't view custom metric data by row on the Data exploration > Data quality tab.

View evaluation and moderation guardrails

When a text generation model with guardrails is registered and deployed, you can view the configured guardrails on the registered model's Overview tab and the deployment's Overview tab:


更新しました May 14, 2024