Attach evaluators to datasets | LangSmith Evaluations - Part 9
Summary
TLDRランスが言語モデル(LM)を用いた自動採点システムの使い方を紹介する動画の要約です。動画では、テストケースを含むデータセットを設定し、そのデータセットを使って様々な言語モデルをテストする方法を説明しています。さらに、自動採点を行うために、データセットに評価モデルをアタッチし、実験が開始されるたびに自動的に実行されるプロンプトをカスタマイズする方法も紹介されています。自動採点システムは、実験結果を迅速に確認し、言語モデルの選択を決定する際に非常に役立ちます。
Takeaways
- 📚 データセットの設定とテストケースの例示:スクリプトでは、関連性と評価をテストするための「relevance grade」というデータセットの設定とテストケースの紹介がありました。
- 🧠 LLM(Language Model)のテスト:スクリプトでは、異なるLLMを直接プロンプトチューブからテストし、その結果をデータセットに記録する方法が説明されています。
- 🔄 自動評価のワークフロー:スクリプトでは、データセットを用いて自動評価を行うワークフローについて説明されており、LLMベースの評価器を自動的に実行する方法が紹介されています。
- 💻 評価器のカスタマイズ:スクリプトでは、プロンプトチューブ内で評価器をカスタマイズし、特定のタスクに関連する評価プロンプトを設定する方法が説明されています。
- 📈 自動評価の実行:スクリプトでは、データセットに対して実験を開始するたびに自動的に実行されるLLMベースの評価器について説明されています。
- 📊 結果の自動記録:スクリプトでは、自動評価が実行されると、その結果がデータセットに自動的に記録されることについて説明されています。
- 🔎 結果の詳細なレビュー:スクリプトでは、自動評価の結果を手動で確認する方法が紹介されており、grer tracesをクリックして評価器が見た内容を詳細に確認することができます。
- 🗂 データセットに評価器をアタッチ:スクリプトでは、データセットに評価器をアタッチし、Hubから実験を実行するたびに自動的に評価が行われることについて説明されています。
- 📉 正確性のスコアリング:スクリプトでは、自動評価が行われた結果の正確性を示すスコアリング方法が説明されています。
- 🚀 異なるLLMの比較:スクリプトでは、異なるLLMを比較し、特定のタスクに最適なLMを選択するための自動評価の利便さが説明されています。
- 📚 チュートリアルでのLLM評価器の活用:スクリプトでは、LLM評価器をチュートリアルで活用し、適切なLMを選択する方法が紹介されています。
Q & A
ランスが紹介しているシリーズは何シリーズですか?
-ランスが紹介しているシリーズは「Langs Smith Evaluation Series」です。
データセット「relevance grade」には何が含まれていますか?
-「relevance grade」データセットには、入力文書テキスト、例問題、そして出力として、その問題がテキストに対して関連性があるかどうかの真実値が含まれています。
プロンプトプレイグラウンドとは何ですか?
-プロンプトプレイグラウンドは、ランスが様々なLLM(Large Language Models)をテストするために使用するプラットフォームで、入力データセットを簡単に取り込んだり、様々なLLMを実行・テストすることができます。
自動評価を行うために使用できる評価者とは何ですか?
-自動評価を行うためには、LLMベースのグレーダーを使用することができます。これは実験を自動化し、効率的に評価を行うのに役立ちます。
データセットにアタッチされた評価モデルとは何ですか?
-データセットにアタッチされた評価モデルとは、実験が開始されるたびに自動的に実行されるLLMベースのグレーダーのことです。これにより、手動での結果のレビューが不要になります。
評価モデルが使用するプロンプトはどのようにカスタマイズできますか?
-評価モデルが使用するプロンプトは、ユーザーがタスクに応じて必要に応じてカスタマイズすることができます。プロンプトは、グレーダーが生成した結果を評価する際に使用されます。
自動グレーダーが行う評価とはどのようなものですか?
-自動グレーダーが行う評価とは、実験で生成された結果が妥当なJSON形式かどうか、また期待される値が含まれているかどうかを確認するものです。
実験結果を手動でレビューすることはできますか?
-はい、自動グレーダーが行った評価結果を手動でレビューすることができます。グレーダートレースをクリックして、グレーダーが何を見たのか、そしてどのようにスコアリングしたのかを詳しく確認できます。
実験結果の「正確さ」とは何を意味しますか?
-「正確さ」とは、自動グレーダーが行った評価に基づいて、実験結果が期待される出力を正確に生成できたかどうかを意味します。
異なるLLMに対して複数の実験を実行する際に、どのLLMが良い選択であるかを判断するためには?
-異なるLLMに対して複数の実験を実行する際には、自動グレーダーが提供する「正確さ」の列を用いて、どのLLMが期待される結果を生成しているかを Sanity Check することができます。
プロンプトベースの実験とLLMベースのグレーダーを組み合わせて使用する利点は何ですか?
-プロンプトベースの実験とLLMベースのグレーダーを組み合わせて使用することで、コーディングなしにデータセットを使った自動グレーディングを実行できます。これにより、迅速かつ効率的に、特定のタスクに最適なLLMを選ぶことができます。
Outlines
ビデオスクリプトの紹介とデータセットの設定
この段落では、ランスがビデオのシリーズの9番目のエピソードとして、Lang chainという名前のプロジェクトについて説明しています。彼は、以前のビデオでI'll show overという名前のデータセットを設定する方法について話していたそうです。このデータセットには、文書テキスト、質問の例、そしてその質問が文書に関連しているかどうかを示す真値の評価が含まれています。ランスは、このデータセットを使って、さまざまなLLMs(Language Models)をテストし、その結果をデータセットに記録する方法について説明しています。また、プロンプト・チューブ(Prompt Tub)という仕組みを使って、データセットを簡単に取り出すことができ、様々なLLMsを試すことができます。
自動評価器の活用とデータセットへの紐付け
この段落では、ランスは自動評価器(LLM based grader)の活用方法について説明しています。彼は、データセットに自動評価器をアタッチする方法を紹介し、実験を実行するたびに、自動的に結果を評価しスコアを付けることができます。この方法を使うことで、一度設定すれば、手動での結果のレビューが不要になり、効率的に実験を繰り返すことができます。ランスは、この機能を使って、多数の実験を行い、どのLMが特定のタスクに適しているかを判断する方法について説明しています。また、自動評価器の設定方法や、その役立つことについても詳細に説明しています。
Mindmap
Keywords
💡Lang chain
💡Langs Smith
💡test cases
💡relevance grade
💡document grading
💡prompt tub
💡LLMs
💡evaluators
💡Json evaluator
💡correctness
💡experiments
💡automatic grading
Highlights
Lang chain's ninth video in Langs Smith evaluation series.
Setting up test cases in a data set called 'relevance grade'.
Each test case includes an input document, example question, and ground truth assessment.
Document grading challenge integrated with rag flow.
Testing various LLMs (Language Models) directly from the prompt tub.
Using a prompt playground to run experiments with different LLMs.
Automating evaluations with LLM-based graders.
Customizing evaluation prompts for specific tasks.
Evaluator model can be set to run automatically when an experiment is initiated.
JSON evaluator is used for grading responses based on a defined logic.
Automatic grading provides a correctness column in the experiment results.
The grader assesses the validity of JSON, absence of preamble, and the correct value for 'score'.
Automatic grader traces can be inspected for detailed evaluation logic.
Chat fireworks and Llama 13B's performance in the grading task.
Pin an evaluator to a data set for automatic scoring in the hub.
Automated grading as a quick sanity check for multiple experiments.
Using automated graders with prompt-based experimentation for efficient LM selection.
Transcripts
hi this is Lance from Lang chain this is
the ninth video in our Langs Smith
evaluation Series so the prior video
talked about setting up I'll show over
here a set of test cases in a data set
so here's a data set we set up of called
relevance grade and it had three test
cases um I can show you each test case
basically has an input document text an
example question and as output like a
ground truth assessment of of is this
question relevant to the text so this is
a a rag challenge that I you know I work
on quite a bit where you want to do
document grading in line with your rag
flow and what I showed previously is
testing various llms on this challenge
directly from the prompt tub so you kind
of Sol over here we have the prompt
playground here this is my greater
prompt again it takes the inputs that we
just saw in our data set and I can
easily pull up the data set here in the
promp tub I can just run with various
LMS you can see over here against this
and those are all logged to uh to their
to our uh data set um and we can go
inspect those results so that is kind of
the workflow we talked through now we
talked previously a lot about different
kinds of evaluators that we can use to
automate evaluations like llm based
graders and it can be really useful to
run these experiments but actually have
an llm based grader automatically
perform grading right because if you
remember we're in the prompt tub here we
kicked off an experiment against the
data set we selected here but then we
have to go and manually review those
results ourselves what if for every
experiment I run here
automatically uh I have some LM grer
that will just run on those results so I
can inspect so that's possible and if I
go over to my data set here so here's
the data set here's my examples if you
look up here at evaluators here you
actually can set these so you see this
add evaluator this is where I can
basically Define my evaluator um I can
set a evaluator model and the key point
is I basically can customize some
evaluation prompt right um and this can
be whatever is relevant for the task I
care about and when you basically set
this evaluator it'll always run when an
experiment is is initiated against this
data set so I've actually already done
this um so I have this Json evaluator
and we can kind of have a look here you
can edit it which is actually really
nice so this is using open AI I'm using
35 because it's nice and fast and so
this is what I'm going to use to grade
the
responses uh that we basically generated
here in the prompt playground by testing
different llms right so for each
llm we kick off an experiment and this
greater than will assess you can you can
kind of see here the results are logged
or written all here and they're of
course logged to our data set but we can
actually grade them using an LM based
grader automatically which is quite nice
and now here's the prompt you know
you're a grader you're going to be shown
a student submission for a Json string
and a reference of value that should be
present in that string um you single key
score so anyway you're out the logic of
what you want the thing to assess really
what's Happening Here is I just wanted
to assess is it valid Json is there no
Preamble does it contain the right value
for score that's really all that's going
on right so I can set this evaluator
it's now attached to my data set and
when I ran those experiments in the hub
now if I go to the experiments you'll
see this correctness column so this is
automatically then populated for you
every time you run an experiment from
The Hub and if I zoom in correctness
captures uh what that automatic
evaluator assessed about the output so I
don't have to manually review them per
se in this case the llm based grer which
I defined and pinned to my data set
automatically runs a each example and if
you recall we've shown this previously
but you can actually click on these and
open up the grer traces you can actually
look and see what exactly what the
grater saw so this is a prompt that the
grader saw you're a
grer uh you this is the pre this is what
we saw before now here's what's
interesting it actually inputs the
reference from the data set and this the
the submission from our experiment so
the submission is what the LM produced
the reference is like the correct uh
value um and again this just shows like
the logic you know ensure that's proper
Json and so forth and then we can
actually look at the scoring um so in
this case correctness means it is indeed
it passes the test so for this case if
you kind of sity check it look right
right these are all Json strings that's
good there's no Preamble and the value
here matches uh the ground truth so
that's good yes yes no yes yes no so
that's actually great um and we can
actually just go back and we can look
this was for example open II so that's
cool we can look at anthropic also that
got 100% so that's great now here what's
interesting we see chat fireworks llama
13B gets a zero and we actually kind of
saw this previously but we can D dig in
and see why is it because it has this
Preamble right and that's we don't want
that and so it's actually the greater
doing the right thing it's catching that
and telling us that you know uh indeed
this is uh this should be scored zero as
it is so this is actually a really nice
trick you can basically pin an evaluator
to a data set it can automatically run
when you kick off these experiments in
the hub that evaluator just runs behind
the scenes for each experiment and
automatically scores the results really
convenient um and of course I still like
to manually review in some cases but
imagine I'm kicking up a large number of
experiments the greater gives me a very
quick way to kind of Sanity check so for
example if I go back here let's say this
was like 20 different experiments on
different nms I can use that correctness
column from the automated grader to
sanity check and say okay which ones
look good and bad so I could like drill
in and decide which LM I actually want
to use for this particular task so the
two video The Press video and this one
kind of pair really well together shows
how to use llm based uh graders with
data sets to automatically perform
grading for any experiment you kick off
in the hub all with no code very
convenient so I I do like to use this
when I'm making determinations about
what LM to use for example for this
grading task which I've used in a lot of
rag
tutorials uh I I like using LM graders
to sanity check quickly that give me
like good candidates to then drill into
so that's really kind of how this can be
used together with promp based
experimentation thanks
5.0 / 5 (0 votes)