Attach evaluators to datasets | LangSmith Evaluations - Part 9

LangChain
16 Apr 202406:55

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

00:00

ビデオスクリプトの紹介とデータセットの設定

この段落では、ランスがビデオのシリーズの9番目のエピソードとして、Lang chainという名前のプロジェクトについて説明しています。彼は、以前のビデオでI'll show overという名前のデータセットを設定する方法について話していたそうです。このデータセットには、文書テキスト、質問の例、そしてその質問が文書に関連しているかどうかを示す真値の評価が含まれています。ランスは、このデータセットを使って、さまざまなLLMs(Language Models)をテストし、その結果をデータセットに記録する方法について説明しています。また、プロンプト・チューブ(Prompt Tub)という仕組みを使って、データセットを簡単に取り出すことができ、様々なLLMsを試すことができます。

05:00

自動評価器の活用とデータセットへの紐付け

この段落では、ランスは自動評価器(LLM based grader)の活用方法について説明しています。彼は、データセットに自動評価器をアタッチする方法を紹介し、実験を実行するたびに、自動的に結果を評価しスコアを付けることができます。この方法を使うことで、一度設定すれば、手動での結果のレビューが不要になり、効率的に実験を繰り返すことができます。ランスは、この機能を使って、多数の実験を行い、どのLMが特定のタスクに適しているかを判断する方法について説明しています。また、自動評価器の設定方法や、その役立つことについても詳細に説明しています。

Mindmap

Keywords

💡Lang chain

「Lang chain」は、このビデオスクリプトで言及されている、言語処理や自然言語理解の分野における一連の技術やアルゴリズムを指す概称です。このキーワードは、ビデオの主題である言語モデルの評価方法に関する議論に関連しています。

💡Langs Smith

「Langs Smith」は、このスクリプトにおいて、評価シリーズの一部である9番目の動画を制作している人物やグループの名前です。このキーワードは、動画の制作者やそのシリーズの名称を特定するのに役立ちます。

💡test cases

「test cases」とは、ソフトウェア開発や言語処理の分野で、システムが正しく動作しているかどうかを確認するために使用される一連のテスト用例のことです。このキーワードは、ビデオの主題である言語モデルの評価において、どのようにテストケースが設定され、使用されるかを説明する上で重要です。

💡relevance grade

「relevance grade」とは、ある質問が与えられたテキストに対してどの程度関連しているかを評価するためのグレードです。このキーワードは、ビデオの主題である言語モデルの評価方法において、質問とテキストの関連性を定量的に評価する方法を示しています。

💡document grading

「document grading」とは、文書の内容や質を評価するプロセスです。このキーワードは、ビデオの主題である言語モデルの評価において、文書の評価方法や基準を示す上で重要です。

💡prompt tub

「prompt tub」は、このスクリプトにおいて、言語モデルを用いて各種実験を実行するための環境やツールを指す用語です。このキーワードは、ビデオの主題である言語モデルの評価方法において、どのように実験が行われるかを理解する上で重要です。

💡LLMs

「LLMs」は、「Large Language Models」の略で、大規模な言語モデルを指します。これらのモデルは、自然言語処理のタスクで高い性能を発揮し、このビデオではその応用方法や評価方法が議論されています。

💡evaluators

「evaluators」とは、システムやモデルの性能を評価するツールやメカニズムを指します。このキーワードは、ビデオの主題である言語モデルの評価方法において、どのように評価が行われるかを説明する上で重要です。

💡Json evaluator

「Json evaluator」とは、Json形式のデータを評価するためのツールやメカニズムを指します。このキーワードは、ビデオの主題である言語モデルの評価において、Jsonデータの正確さや適切さを確認する方法を示しています。

💡correctness

「correctness」とは、システムやモデルの出力を評価する際に、期待される結果にどの程度一致しているかを示す指標です。このキーワードは、ビデオの主題である言語モデルの評価方法において、出力を正確に評価し、改善するための重要な要素です。

💡experiments

「experiments」とは、科学的な手法で仮説を検証するために行われる実験のことです。このキーワードは、ビデオの主題である言語モデルの評価において、どのようにして言語モデルの性能を検証するかを示す上で重要です。

💡automatic grading

「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

play00:00

hi this is Lance from Lang chain this is

play00:03

the ninth video in our Langs Smith

play00:04

evaluation Series so the prior video

play00:08

talked about setting up I'll show over

play00:10

here a set of test cases in a data set

play00:14

so here's a data set we set up of called

play00:16

relevance grade and it had three test

play00:18

cases um I can show you each test case

play00:21

basically has an input document text an

play00:24

example question and as output like a

play00:27

ground truth assessment of of is this

play00:31

question relevant to the text so this is

play00:35

a a rag challenge that I you know I work

play00:37

on quite a bit where you want to do

play00:39

document grading in line with your rag

play00:41

flow and what I showed previously is

play00:43

testing various llms on this challenge

play00:46

directly from the prompt tub so you kind

play00:49

of Sol over here we have the prompt

play00:50

playground here this is my greater

play00:53

prompt again it takes the inputs that we

play00:55

just saw in our data set and I can

play00:57

easily pull up the data set here in the

play00:59

promp tub I can just run with various

play01:01

LMS you can see over here against this

play01:04

and those are all logged to uh to their

play01:07

to our uh data set um and we can go

play01:11

inspect those results so that is kind of

play01:13

the workflow we talked through now we

play01:17

talked previously a lot about different

play01:19

kinds of evaluators that we can use to

play01:22

automate evaluations like llm based

play01:24

graders and it can be really useful to

play01:30

run these experiments but actually have

play01:33

an llm based grader automatically

play01:35

perform grading right because if you

play01:37

remember we're in the prompt tub here we

play01:41

kicked off an experiment against the

play01:43

data set we selected here but then we

play01:45

have to go and manually review those

play01:47

results ourselves what if for every

play01:49

experiment I run here

play01:52

automatically uh I have some LM grer

play01:54

that will just run on those results so I

play01:56

can inspect so that's possible and if I

play01:59

go over to my data set here so here's

play02:02

the data set here's my examples if you

play02:05

look up here at evaluators here you

play02:08

actually can set these so you see this

play02:10

add evaluator this is where I can

play02:12

basically Define my evaluator um I can

play02:16

set a evaluator model and the key point

play02:19

is I basically can customize some

play02:21

evaluation prompt right um and this can

play02:25

be whatever is relevant for the task I

play02:26

care about and when you basically set

play02:29

this evaluator it'll always run when an

play02:32

experiment is is initiated against this

play02:34

data set so I've actually already done

play02:36

this um so I have this Json evaluator

play02:39

and we can kind of have a look here you

play02:41

can edit it which is actually really

play02:42

nice so this is using open AI I'm using

play02:45

35 because it's nice and fast and so

play02:49

this is what I'm going to use to grade

play02:51

the

play02:52

responses uh that we basically generated

play02:56

here in the prompt playground by testing

play02:58

different llms right so for each

play03:01

llm we kick off an experiment and this

play03:04

greater than will assess you can you can

play03:06

kind of see here the results are logged

play03:08

or written all here and they're of

play03:10

course logged to our data set but we can

play03:12

actually grade them using an LM based

play03:14

grader automatically which is quite nice

play03:16

and now here's the prompt you know

play03:18

you're a grader you're going to be shown

play03:20

a student submission for a Json string

play03:22

and a reference of value that should be

play03:25

present in that string um you single key

play03:28

score so anyway you're out the logic of

play03:30

what you want the thing to assess really

play03:33

what's Happening Here is I just wanted

play03:34

to assess is it valid Json is there no

play03:37

Preamble does it contain the right value

play03:39

for score that's really all that's going

play03:40

on right so I can set this evaluator

play03:43

it's now attached to my data set and

play03:45

when I ran those experiments in the hub

play03:48

now if I go to the experiments you'll

play03:50

see this correctness column so this is

play03:54

automatically then populated for you

play03:56

every time you run an experiment from

play03:57

The Hub and if I zoom in correctness

play04:01

captures uh what that automatic

play04:03

evaluator assessed about the output so I

play04:05

don't have to manually review them per

play04:07

se in this case the llm based grer which

play04:09

I defined and pinned to my data set

play04:11

automatically runs a each example and if

play04:14

you recall we've shown this previously

play04:15

but you can actually click on these and

play04:18

open up the grer traces you can actually

play04:20

look and see what exactly what the

play04:22

grater saw so this is a prompt that the

play04:24

grader saw you're a

play04:26

grer uh you this is the pre this is what

play04:29

we saw before now here's what's

play04:30

interesting it actually inputs the

play04:33

reference from the data set and this the

play04:36

the submission from our experiment so

play04:38

the submission is what the LM produced

play04:40

the reference is like the correct uh

play04:43

value um and again this just shows like

play04:46

the logic you know ensure that's proper

play04:48

Json and so forth and then we can

play04:50

actually look at the scoring um so in

play04:52

this case correctness means it is indeed

play04:55

it passes the test so for this case if

play04:58

you kind of sity check it look right

play05:00

right these are all Json strings that's

play05:02

good there's no Preamble and the value

play05:04

here matches uh the ground truth so

play05:07

that's good yes yes no yes yes no so

play05:10

that's actually great um and we can

play05:12

actually just go back and we can look

play05:14

this was for example open II so that's

play05:16

cool we can look at anthropic also that

play05:18

got 100% so that's great now here what's

play05:21

interesting we see chat fireworks llama

play05:23

13B gets a zero and we actually kind of

play05:26

saw this previously but we can D dig in

play05:29

and see why is it because it has this

play05:31

Preamble right and that's we don't want

play05:33

that and so it's actually the greater

play05:34

doing the right thing it's catching that

play05:36

and telling us that you know uh indeed

play05:38

this is uh this should be scored zero as

play05:40

it is so this is actually a really nice

play05:42

trick you can basically pin an evaluator

play05:44

to a data set it can automatically run

play05:46

when you kick off these experiments in

play05:47

the hub that evaluator just runs behind

play05:50

the scenes for each experiment and

play05:52

automatically scores the results really

play05:54

convenient um and of course I still like

play05:56

to manually review in some cases but

play05:58

imagine I'm kicking up a large number of

play06:00

experiments the greater gives me a very

play06:02

quick way to kind of Sanity check so for

play06:04

example if I go back here let's say this

play06:06

was like 20 different experiments on

play06:08

different nms I can use that correctness

play06:10

column from the automated grader to

play06:12

sanity check and say okay which ones

play06:14

look good and bad so I could like drill

play06:16

in and decide which LM I actually want

play06:18

to use for this particular task so the

play06:20

two video The Press video and this one

play06:22

kind of pair really well together shows

play06:24

how to use llm based uh graders with

play06:27

data sets to automatically perform

play06:29

grading for any experiment you kick off

play06:31

in the hub all with no code very

play06:33

convenient so I I do like to use this

play06:35

when I'm making determinations about

play06:37

what LM to use for example for this

play06:38

grading task which I've used in a lot of

play06:40

rag

play06:41

tutorials uh I I like using LM graders

play06:44

to sanity check quickly that give me

play06:47

like good candidates to then drill into

play06:48

so that's really kind of how this can be

play06:50

used together with promp based

play06:52

experimentation thanks

Rate This

5.0 / 5 (0 votes)

Related Tags
LangChain評価シリーズデータセットLLM自動評価テストケースPrompt TubJson評価器効率化チュートリアル
Do you need a summary in English?