Online Evaluation (Guardrails) | LangSmith Evaluations - Part 21
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
🔍 ランタイムオンライン評価の概要
ランス・ランチェーンがランスミス評価シリーズを続け、オンライン評価について掘り下げる。一般的な評価の考え方フレームワークを紹介し、データセットの種類と評価方法の違いに焦点を当てた。特に、プロダクショントラフィックでの評価方法に注目し、アプリが稼働している際に評価を行う方法について説明した。例えば、個人情報や有害なクエリを含むユーザー入力を検出する「毒性」の評価が重要であると指摘。プロジェクト「rag」を通じて、ユーザーからの質問をシミュレートし、入力された質問が個人情報や有害なものを含むかどうかを評価する新しいルールを作成するデモンストレーションを行い、オンライン評価の適用方法を示した。
Mindmap
Keywords
💡オンライン評価
💡データセット
💡評価フレームワーク
💡有害性
💡ルール
💡モデル
💡プロンプト
💡カスタムガードレール
💡評価結果
💡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
hi this is Lance Lan chain we're
continuing our Langs Smith evaluation
series we're going to be digging into
online evaluation here a bit more um so
if you recall this is kind of a
framework of how to think about
evaluation in General on the left here
you see different types of data sets
that you can work on so you can work on
kind of manually curated data sets you
can work on user logs different types of
evaluators and what I really want to
draw your attention to over here is the
differentiation in terms of how you can
apply evals you can apply evals on
production traffic so it's like I have
an app in production and as my app is
running I'm doing evaluations of some
sort on it or of course I can also do
evaluations on curated data sets or
assertions right so online evaluations
live in this top bucket and you can
really see it here so basically we're
focused on production traffic so I have
an app in production and I'm evaluating
something about that app while it's
running now common thing that people
like to evaluate is something like
toxicity so for example does the user
input contain any kind of personally
identifi information or toxic queries or
something along those lines so toxicity
is a thing that you know oftentimes you
want to be able to detect within an
application as as a developer so I'll
show an example of this and I have a
project that I've Set uh called rag
online evaluation and that's here a few
traces here you can see um and here's
basically my rag app so with this app
I'm basically simulating user questions
here so here's like an input question
here's an input question and those are
all logged to my project so that's all
it's going on now let's say I want to
create a new rule that'll evaluate
whether the input question contains any
toxic information or personal identif
identifiable information so all I have
to do is I go to rules and I basically
say add rule so this is going to allow
me to create a new online evaluator I
just simply click here online evaluation
create evaluator and I'm going to use
one of the suggested prompts that we
have already so right here you can see t
LM Generations so this is a prompt that
allows you to tag arbitrary inputs um
with uh a a lab or a score based upon
some specified criteria so you can see
in the prompt template it already is set
up and I can choose my model let's say I
want to use gp4 turbo um it already has
this kind of preset for me so you're
classifier they'll tag input text with a
score based on Supply criteria and
you're tagging based upon insults
threats negative comments any personally
identif reliable information right and
you pass in the text now what's pretty
neat about this is I can actually test
using this preview what this will look
like on my particular chain so with this
preview boom I can actually see the text
it's going to get is for example uh my
most recent Trace so in my case the most
recent Trace was this test case how do I
create a rag chain and I also um plum in
this open AI API key um as like a test
of an adversarial prompt or a prompt
that contains um personal identifiable
information like want a flag um I have
my score criteria down here so I'll
basically return a score one or zero and
I'll also return the explanation for the
score so that's set I just hit continue
here and then I'm going to name my uh
I'll name this uh toxicity or I'll call
this guard
rails um
input input guard rails
um and I'll save that so now I have a
new online evaluator called input
guardrails that'll run on the inputs to
my chain so I go back to my
app and I've passed in this open AI API
key and I want to see whether or not my
online evaluer can actually flag that so
I go back and now my runs or my traces
you can see here's my app here's the
runs within my app so this is kind of
the full Trace we're looking at we can
see it's tagged with feedback so the
feedback I get is a score in this casee
of one so if you look back at the prompt
one means that indeed there is a
personal identifiable information uh
within this prompt so we can even look
here we can look at the explanation for
this open the evaluator run and we can
go down and we can see yes the score it
is scored as one the text contains
personal aable information as includes
potential API key which is sens of
information that should not be shared
publicly so it's a good example of the
ability to set an online evaluator
against the simple project in this case
uh a mock rag app it can run on the
inputs of your app really easily and it
can establish any customizable guard
rails or things that you wanted to flag
for um in return kind of a very simple
and customizable score yes no one Zer uh
in order to identify that um the the
input contains information you want to
flag thanks
Browse More Related Video
RAG Evaluation (Document Relevance) | LangSmith Evaluations - Part 14
Single Step | LangSmith Evaluation - Part 25
Online Evaluation (RAG) | LangSmith Evaluations - Part 20
Evaluation Primitives | LangSmith Evaluations - Part 2
What is Critical Thinking?
【1000人のエリートを育てた爆伸びマネジメント】リクルート在籍29年で見出した仕事が出来る人の共通点/自律自転する組織を作るG-POPマネジメントとは?【MANAGEMENT SKILL SET】
5.0 / 5 (0 votes)