Online Evaluation (Guardrails) | LangSmith Evaluations - Part 21

LangChain
22 May 202404:51

Summary

TLDRランス・ランチェーンは、オンライン評価に関するシリーズを続けています。このビデオでは、一般的な評価方法のフレームワークを紹介し、特にプロダクショントラフィックに対するオンライン評価に焦点を当てています。例えば、ユーザーからの入力が個人情報や有害なクエリを含むかどうかを検出する「毒性」を評価することが重要です。彼は「rag」というプロジェクトを通じて、ユーザーからの質問を模擬し、オンライン評価ツールを使って入力が個人情報を含むかどうかを検証します。新しいルールを作成し、モデルgp4 turboを使用して、侮辱、脅迫、否定的なコメント、個人情報を含むかどうかをスコア付けします。オンライン評価ツールを使って、実際のアプリケーションに対して簡単にカスタムガードレールを設定し、入力が特定の情報を含むかどうかを検出することができます。

Takeaways

  • 📈 オンライン評価は、プロダクショントラフィックに対してリアルタイムで行われることに注意深く注目します。
  • 🔍 データセットの種類(手動キュレーションされたデータセットやユーザーログなど)に基づいて、評価の方法を区別することが重要です。
  • 🛡️ アプリケーションで検出する必要があるのは、毒性や個人識別情報などの特定の要素です。
  • 📝 オンライン評価を使用して、アプリケーションの入力に含まれる毒性や個人情報を評価できます。
  • 💻 「rag」というプロジェクトを使用して、ユーザーの質問をシミュレートし、ログに記録しています。
  • 🆕 ルールを作成して、入力された質問に毒性情報や個人識別情報が含まれているかどうかを評価する新しいオンラインエバリュエーターを追加できます。
  • 📝 オンライン評価のプロンプトテンプレートを使用して、入力テキストにタグやスコアを付けることができます。
  • 📈 gp4 turboなどのモデルを使用して、侮辱、脅威、否定的なコメント、個人識別情報に基づいてテキストをタグ付けします。
  • 📊 プレビュー機能を使用して、特定のチェーンに適用されるテキストのタグ付けをテストできます。
  • 🚧 新しいオンラインエバリュエーター「input guardrails」を作成し、アプリケーションの入力に対して実行できます。
  • 🔑 入力にOpen AI APIキーなどの個人識別情報が含まれているかどうかを検証するために、オンラインエバリュエーターを使用できます。
  • ✅ オンラインエバリュエーターは、アプリケーションの入力に対してカスタマイズ可能なガードレールを設定し、簡単で柔軟なスコアリングを提供します。

Q & A

  • ランス・ランチェーンが紹介したオンライン評価とはどのようなものですか?

    -オンライン評価とは、アプリケーションが稼働している際にリアルタイムで評価を行うプロセスのことです。例えば、アプリに入力されたテキストが有害なものかどうかを検出するなど、様々な評価基準に基づいて行われます。

  • ランスが紹介したフレームワークにおいて、データセットとはどのようなものがありますか?

    -フレームワークでは、手動でキュレーションされたデータセットやユーザーログなど、様々な種類のデータセットが挙げられます。これらは評価に使用されるデータ源として機能します。

  • オンライン評価と手動での評価の違いは何ですか?

    -オンライン評価は、アプリケーションが稼働している間にリアルタイムで評価を行うのに対し、手動での評価はキュレーションされたデータセットやアサーションに対して行われます。オンライン評価はリアルタイムでの迅速なフィードバックが可能である点が特徴です。

  • 有害性(toxicity)とはどのような評価基準を指しますか?

    -有害性とは、ユーザーが入力したテキストに個人を特定できる情報や有害なクエリが含まれているかどうかを評価する基準です。これはアプリケーション内で検出することが望ましい問題です。

  • ランスが作成した「rag」アプリとは何ですか?

    -「rag」アプリは、ユーザーからの質問をシミュレートするアプリケーションです。このアプリは、入力された質問をログに記録し、それに基づいて評価を行っています。

  • 新しいルールを作成する際に使用する「オンライン評価」とは何ですか?

    -オンライン評価は、アプリケーションが稼働している間に入力されたテキストを評価するためのプロセスです。新しいルールを作成することで、例えば有害情報を含むかどうかを検出する機能をアプリに追加することができます。

  • 「gp4 turbo」モデルを使用する際の利点は何ですか?

    -「gp4 turbo」モデルは、入力テキストに対して特定の基準に基づいてスコアを割り当てる分類器を備えています。これにより、侮辱、脅迫、否定的なコメント、個人を特定できる情報などに基づく評価が可能になります。

  • 「入力ガードレール」とはどのような評価器ですか?

    -「入力ガードレール」は、アプリの入力に対して実行される新しいオンライン評価器です。この評価器は、入力されたテキストに個人を特定できる情報やAPIキーなどの有害情報が含まれているかどうかを検出します。

  • 評価結果として「1」または「0」が返される理由は何ですか?

    -評価結果として「1」が返される場合、入力されたテキストに個人を特定できる情報が含まれていることを示します。一方、「0」は含まれていないことを意味します。これにより、有害な情報の有無を簡単に判断できます。

  • オンライン評価器の「入力ガードレール」が機能する仕組みを教えてください。

    -「入力ガードレール」は、アプリに入力されたテキストを監視し、個人を特定できる情報や有害なクエリが含まれているかどうかを評価します。評価結果はスコア「1」または「0」と共に説明文を返すことで、有害な情報の有無をリアルタイムで検出できます。

  • オンライン評価を実装する際に必要な主なステップは何ですか?

    -オンライン評価を実装する際には、まずルールを作成し、オンライン評価を作成する必要があります。次に、モデルを選択し、評価に使用するプロンプトを設定します。その後、プレビューを使用して評価結果を確認し、評価器に名前を付けて保存します。

  • オンライン評価器をテストするために使用される「プレビュー」機能とは何ですか?

    -「プレビュー」機能を使用すると、オンライン評価器が特定のテキストに対してどのような結果を返すかを事前に確認できます。これにより、評価器が期待通りに機能するかをテストし、必要に応じて調整することができます。

  • オンライン評価器がリアルタイムで動作する利点は何ですか?

    -オンライン評価器がリアルタイムで動作する利点は、アプリが稼働している間も含め、常に入力されたテキストを監視し、有害情報を含むかどうかを迅速に検出できる点です。これにより、問題が発覚した際すぐに対処することができ、アプリのセキュリティと信頼性を高めることができます。

Outlines

00:00

🔍 ランタイムオンライン評価の概要

ランス・ランチェーンがランスミス評価シリーズを続け、オンライン評価について掘り下げる。一般的な評価の考え方フレームワークを紹介し、データセットの種類と評価方法の違いに焦点を当てた。特に、プロダクショントラフィックでの評価方法に注目し、アプリが稼働している際に評価を行う方法について説明した。例えば、個人情報や有害なクエリを含むユーザー入力を検出する「毒性」の評価が重要であると指摘。プロジェクト「rag」を通じて、ユーザーからの質問をシミュレートし、入力された質問が個人情報や有害なものを含むかどうかを評価する新しいルールを作成するデモンストレーションを行い、オンライン評価の適用方法を示した。

Mindmap

Keywords

💡オンライン評価

オンライン評価とは、実際の運用環境で動作するアプリケーションをリアルタイムに評価するプロセスのことです。ビデオでは、オンライン評価を使用して、アプリケーションが運用中にどのようなデータを生成しているかを評価し、そのデータを分析することで、アプリケーションのパフォーマンスや問題点を特定することができると説明されています。例えば、オンライン評価は、ユーザーからの入力が有害な情報を含むかどうかを検出するのに役立ちます。

💡データセット

データセットは、評価のために使用されるデータの集まりを指します。ビデオでは、手動でキュレーションされたデータセットやユーザーログなど、異なるタイプのデータセットを使用して評価を行うことができると紹介されています。データセットは、モデルのトレーニングやテストに欠かせない要素であり、オンライン評価においても重要な役割を果たしています。

💡評価フレームワーク

評価フレームワークとは、評価を実施するための一連の方法論や手順を指します。ビデオでは、一般的な評価を行うためのフレームワークが紹介されており、その中でオンライン評価がどのように位置づけられるかが説明されています。フレームワークは、効果的な評価を実施するために必要なガイドラインを提供し、評価プロセスを体系化するものです。

💡有害性

有害性は、アプリケーションが受け取る入力が個人を特定できる情報や有害なクエリを含むかどうかを指します。ビデオでは、有害性が高い入力を検出する機能が重要であると強調されており、オンライン評価を使用してアプリケーションが受け取る入力を監視し、個人を特定できる情報や有害なクエリを検出することができると説明されています。

💡ルール

ルールは、オンライン評価において特定の基準に従って入力を評価する条件を定めたもののことです。ビデオでは、新しいルールを作成し、入力が有害な情報を含むかどうかを評価するオンライン評価器を実装するプロセスが紹介されています。ルールは、オンライン評価器がどのように入力を評価し、どの条件に基づいてフラグを立てるかを決定する重要な要素です。

💡モデル

モデルとは、機械学習やディープラーニングの分野で、データから学習し予測や分類を行うシステムを指します。ビデオでは、gp4 turboというモデルを使用して、入力テキストに有害性スコアを割り当てる方法が説明されています。モデルは、オンライン評価において、入力データを分析し、評価基準に基づいて判断を行うための核心です。

💡プロンプト

プロンプトは、モデルが特定のタスクを実行するための入力または指示です。ビデオでは、プロンプトテンプレートを使用して、入力テキストを評価し、個人を特定できる情報を含むかどうかを判断するプロセスが紹介されています。プロンプトは、モデルがどのようにデータを解釈し、どのような基準に基づいて評価を行うかを決定する重要な要素です。

💡カスタムガードレール

カスタムガードレールとは、アプリケーションの特定の要件に基づいてカスタマイズされたルールセットのことです。ビデオでは、オンライン評価を使用して、入力データに個人を特定できる情報があるかどうかを検出するカスタムガードレールを作成するプロセスが説明されています。カスタムガードレールは、アプリケーションのセキュリティや品質を確保するために重要な役割を果たします。

💡評価結果

評価結果とは、オンライン評価器が行った評価に基づく結果を指します。ビデオでは、評価結果としてスコア(1または0)とそのスコアの説明が提供されており、それが個人を特定できる情報を含むかどうかを判断するのに使われます。評価結果は、アプリケーションの運用状況を監視し、問題を特定し解決する上で重要な情報を提供します。

💡APIキー

APIキーは、アプリケーションプログラミングインターフェース(API)にアクセスするための一意の識別子です。ビデオでは、オンライン評価器をテストするためにOpen AI APIキーを使用する例が紹介されています。APIキーは、オンライン評価において、外部サービスや機能にアクセスするために必要な認証情報を提供する重要な要素です。

Highlights

Continuing the Langs Smith evaluation series with a focus on online evaluation.

Exploring the framework for general evaluation including different types of datasets and evaluators.

Differentiating how evaluations can be applied on production traffic or curated datasets.

Focusing on the top bucket of online evaluations which involve production traffic.

Evaluating toxicity in user input for applications to detect personal information or toxic queries.

Demonstrating a project setup called 'rag online evaluation' with simulated user questions.

Creating a new rule to evaluate if input questions contain toxic or personal identifiable information.

Using an online evaluation tool to create a new evaluator with a specified prompt.

Selecting a model, 'gp4 turbo', for tagging input text with a score based on criteria.

Tagging criteria includes insults, threats, negative comments, and personal identifiable information.

Preview feature allows testing of the evaluator against the specific chain.

Using a test case to simulate an adversarial prompt with personal identifiable information.

Scoring system returns a score and explanation for flagged content.

Naming the new online evaluator 'input guardrails' to run on app inputs.

Demonstrating the online evaluator's ability to flag inputs containing sensitive information.

Explanation of the evaluator's scoring and its application in identifying flagged input.

The simplicity and customizability of setting up online evaluators for app inputs.

The practical application of online evaluation in flagging undesirable content in real-time.

Transcripts

play00:01

hi this is Lance Lan chain we're

play00:02

continuing our Langs Smith evaluation

play00:04

series we're going to be digging into

play00:05

online evaluation here a bit more um so

play00:08

if you recall this is kind of a

play00:10

framework of how to think about

play00:11

evaluation in General on the left here

play00:13

you see different types of data sets

play00:14

that you can work on so you can work on

play00:16

kind of manually curated data sets you

play00:18

can work on user logs different types of

play00:20

evaluators and what I really want to

play00:22

draw your attention to over here is the

play00:25

differentiation in terms of how you can

play00:26

apply evals you can apply evals on

play00:28

production traffic so it's like I have

play00:30

an app in production and as my app is

play00:32

running I'm doing evaluations of some

play00:34

sort on it or of course I can also do

play00:37

evaluations on curated data sets or

play00:39

assertions right so online evaluations

play00:42

live in this top bucket and you can

play00:44

really see it here so basically we're

play00:46

focused on production traffic so I have

play00:48

an app in production and I'm evaluating

play00:50

something about that app while it's

play00:52

running now common thing that people

play00:54

like to evaluate is something like

play00:56

toxicity so for example does the user

play00:59

input contain any kind of personally

play01:01

identifi information or toxic queries or

play01:04

something along those lines so toxicity

play01:06

is a thing that you know oftentimes you

play01:08

want to be able to detect within an

play01:09

application as as a developer so I'll

play01:12

show an example of this and I have a

play01:15

project that I've Set uh called rag

play01:17

online evaluation and that's here a few

play01:19

traces here you can see um and here's

play01:23

basically my rag app so with this app

play01:26

I'm basically simulating user questions

play01:28

here so here's like an input question

play01:29

here's an input question and those are

play01:31

all logged to my project so that's all

play01:33

it's going on now let's say I want to

play01:35

create a new rule that'll evaluate

play01:37

whether the input question contains any

play01:39

toxic information or personal identif

play01:41

identifiable information so all I have

play01:43

to do is I go to rules and I basically

play01:46

say add rule so this is going to allow

play01:48

me to create a new online evaluator I

play01:51

just simply click here online evaluation

play01:53

create evaluator and I'm going to use

play01:55

one of the suggested prompts that we

play01:56

have already so right here you can see t

play02:00

LM Generations so this is a prompt that

play02:02

allows you to tag arbitrary inputs um

play02:06

with uh a a lab or a score based upon

play02:09

some specified criteria so you can see

play02:11

in the prompt template it already is set

play02:13

up and I can choose my model let's say I

play02:15

want to use gp4 turbo um it already has

play02:19

this kind of preset for me so you're

play02:21

classifier they'll tag input text with a

play02:22

score based on Supply criteria and

play02:25

you're tagging based upon insults

play02:27

threats negative comments any personally

play02:29

identif reliable information right and

play02:32

you pass in the text now what's pretty

play02:35

neat about this is I can actually test

play02:37

using this preview what this will look

play02:39

like on my particular chain so with this

play02:41

preview boom I can actually see the text

play02:44

it's going to get is for example uh my

play02:47

most recent Trace so in my case the most

play02:50

recent Trace was this test case how do I

play02:52

create a rag chain and I also um plum in

play02:56

this open AI API key um as like a test

play03:00

of an adversarial prompt or a prompt

play03:02

that contains um personal identifiable

play03:05

information like want a flag um I have

play03:07

my score criteria down here so I'll

play03:09

basically return a score one or zero and

play03:11

I'll also return the explanation for the

play03:13

score so that's set I just hit continue

play03:17

here and then I'm going to name my uh

play03:19

I'll name this uh toxicity or I'll call

play03:22

this guard

play03:24

rails um

play03:27

input input guard rails

play03:30

um and I'll save that so now I have a

play03:32

new online evaluator called input

play03:34

guardrails that'll run on the inputs to

play03:36

my chain so I go back to my

play03:38

app and I've passed in this open AI API

play03:42

key and I want to see whether or not my

play03:44

online evaluer can actually flag that so

play03:46

I go back and now my runs or my traces

play03:51

you can see here's my app here's the

play03:53

runs within my app so this is kind of

play03:55

the full Trace we're looking at we can

play03:57

see it's tagged with feedback so the

play03:59

feedback I get is a score in this casee

play04:01

of one so if you look back at the prompt

play04:04

one means that indeed there is a

play04:07

personal identifiable information uh

play04:09

within this prompt so we can even look

play04:10

here we can look at the explanation for

play04:12

this open the evaluator run and we can

play04:15

go down and we can see yes the score it

play04:18

is scored as one the text contains

play04:20

personal aable information as includes

play04:22

potential API key which is sens of

play04:23

information that should not be shared

play04:24

publicly so it's a good example of the

play04:27

ability to set an online evaluator

play04:28

against the simple project in this case

play04:31

uh a mock rag app it can run on the

play04:33

inputs of your app really easily and it

play04:35

can establish any customizable guard

play04:37

rails or things that you wanted to flag

play04:38

for um in return kind of a very simple

play04:41

and customizable score yes no one Zer uh

play04:44

in order to identify that um the the

play04:48

input contains information you want to

play04:49

flag thanks

Rate This

5.0 / 5 (0 votes)

Etiquetas Relacionadas
オンライン評価データセット評価フレームワークアプリ監視個人情報有害情報評価ルールAPIキーカスタムガードレール入力監査
¿Necesitas un resumen en inglés?