Pre-Built Evaluators | LangSmith Evaluations - Part 5

LangChain
8 Apr 202408:37

Summary

TLDRこの動画スクリプトは、データセットの作成と評価方法について説明しています。データセットには、質問と回答のペアが含まれており、それをもとにLang Chain Evaluatorを用いてモデルの正確性を評価します。特に注目すべきは、Chain of Thought reasoningを使用したCoot QA Evaluatorの活用方法で、モデルの生成と正解の一致を評価することができます。このプロセスは、データセットの品質とモデルの性能を正確に把握するために非常に有用であり、次回の動画でさらに深堀される予定です。

Takeaways

  • 📚 データセットの重要性と興味深さについて説明された。
  • 🛠️ データセットの作成方法が紹介され、手動で整理された質問と回答のペアから始まる。
  • 🔍 データセットの評価方法について学ぶ。入力と出力を比較し、評価器を用いてスコアを算出する。
  • 📈 評価器の世界は広範で、カスタム評価器や組み込み評価器が存在する。
  • 🏆 CoT (Chain of Thought) 評価器の利点が強調された。理論的思考を用いて回答を評価する。
  • 🔧 データセットの名前が「dbrx」で、SDKを使って作成された。
  • 🔎 ユーザーログからデータセットを構築する方法も提案されている。実際のユーザーデータからデータセットを作成する。
  • 📊 評価結果は、遅延、P99、P50、P99などのメトリックとともに表示される。
  • 👀 各テスト結果を詳細に調査でき、入力の質問、参考答案、モデルの出力、そして評価器のスコアが確認できる。
  • 🛠️ 評価器の設定や使用方法が説明され、オープンAIを使用しての設定例が示されている。
  • 📝 データセットの定義、評価器の選択、テストの実行、結果の分析までがスクリプト内で説明されている。

Q & A

  • なぜラグ(lags)が重要で興味深いのか説明されていますか?

    -初めのビデオでは、lagsが重要な理由と興味深い点について説明されています。

  • データセットを作成するために使用される主なLang Primitivesは何ですか?

    -第二のビデオでは、データセットを作るために使用される主なLang Primitivesが説明されています。

  • データセットの作成方法について説明されていますか?

    -はい、手動でキュレートされた質問と回答のペアからデータセットを作成する方法について説明されています。

  • dbrxデータセットはどのようにして作成されましたか?

    -dbrxデータセットは、特定のブログ記事に基づいて手動で多くの質問と回答のペアを作成し、それらをデータセットに追加することで作成されました。

  • ユーザーログからデータセットをどのように作成するか説明されていますか?

    -はい、ユーザーの質問を実際のユーザーデータとして取り、それを真理応答付きのデータセットに変換する方法について説明されています。

  • データセットができたら、どうやってLMを評価するか説明されていますか?

    -データセットとLMの出力を評価器に渡し、その評価結果とスコアを返す方法について説明されています。

  • 評価器の世界はどのくらい広範囲にわたっているか説明されていますか?

    -はい、カスタム評価器、組み込み評価器、ラベルがある場合やない場合の評価方法について触れられています。

  • CoQA評価器の特徴は何ですか?

    -CoQA評価器は、Chain of Thought推理を使用して、LMが生成した答えと真実の答えを比較し、一致するかどうかを評価するという特徴があります。

  • 実際にCoQA評価器を使用してLMを評価する方法について説明されていますか?

    -はい、CoQA評価器を使用して、データセットの質問と回答ペアに対してLMを評価し、そのプロセスと結果を詳しく説明しています。

  • 評価結果を確認する方法について説明されていますか?

    -はい、データセットのテスト結果を確認し、Latency、Error Rateなどのメトリックスを確認する方法について説明されています。

  • 評価結果を深く掘り下げて分析する方法について説明されていますか?

    -はい、各テスト結果をクリックして詳細を確認し、評価器がどのように動作したかを理解する方法について説明されています。

Outlines

00:00

📌 データセットの構築と評価方法の紹介

この段落では、データセットの構築方法とモデルの評価方法について説明されています。データセットには、質問と回答のペアが含まれており、それをもとにモデルの性能を評価する方法が紹介されています。また、データセットの構築において、ブログ記事からの手動データセット作成やユーザーログからのデータセット作成の方法が触れられています。評価方法については、データセットの入力と出力ペアを用いて、アプリが出力と比較し、スコアを返すプロセスが解説されています。

05:02

📈 評価結果の分析とエラーの理解

この段落では、評価結果の分析方法とエラーの理解について説明されています。評価結果から、レイテンシやエラー率などのメトリックが得られ、それらを通じてモデルの性能を把握することができます。また、具体的な質問と回答のペアを用いて、モデルがどのように動作し、どの程度正確な回答を生成しているかを確認することができます。さらに、Chain of Thought reasoningを使った評価方法についても触れられており、その方法は、モデルの生成と正解の比較を通じて最終的な評価を行うというものです。

Mindmap

Keywords

💡Lag Chain

「Lag Chain」とは、このビデオスクリプトにおいて、データセットの作成と評価に使用される技術やプロセスのことを指します。特に、この文脈では、データセットから生成された入力と出力のペアを用いて、言語モデル(LM)の性能を評価する方法を指しています。

💡Evaluation

「Evaluation」とは、このビデオスクリプトにおいて、構築されたデータセットに対して言語モデルのパフォーマンスを測定することを指します。このプロセスは、実際の出力とデータセット内の正解との比較を通じて、モデルの精度や性能を評価するものです。

💡Data Set

「Data Set」とは、このビデオスクリプトにおいて、問題と回答のペアを含むデータの集合を指します。これらのデータセットは、言語モデルのトレーニングや評価に使われることが一般的で、この例では手動で作成されたものです。

💡Question Answer Pairs

「Question Answer Pairs」とは、このビデオスクリプトにおいて、一連の問題とそれに対する回答から成るデータセットの要素を指します。言語モデルの評価において、これらのペアは模型が生成した出力と比較され、正確性やロジックの整合性をチェックするために使用されます。

💡Built-in Evaluators

「Built-in Evaluators」とは、このビデオスクリプトにおいて、あらかじめ構築された評価ツールやメカニズムを指します。これらのエバリュエーターは、特定のタスクや目的に合わせて調整され、モデルのパフォーマンスを測定するために使用されます。

💡Chain of Thought Reasoning

「Chain of Thought Reasoning」とは、このビデオスクリプトにおいて、問題解決や判断を行う際に、一連の論理的思考過程を示すことを指します。この思考過程は、言語モデルが生成した答えと正解との比較に役立ち、モデルが論理的に正しい答えを導くことができるかどうかを評価するために使用されます。

💡Ground Truth

「Ground Truth」とは、このビデオスクリプトにおいて、データセット内の正解や実際の真実を表す情報を指します。言語モデルの評価においては、モデルの出力とGround Truthとの比較を通じて、モデルの正確性や信頼性を判断することができます。

💡SDK

「SDK」とは、このビデオスクリプトにおいて、ソフトウェア開発キット(Software Development Kit)の略称であり、特定のソフトウェアやサービスを開発するためのツールやライブラリのセットを指します。この文脈では、データセットを作成するために使用されるツールやライブラリを指しています。

💡User Logs

「User Logs」とは、このビデオスクリプトにおいて、ユーザーの行動やリクエストを記録したログを指します。これらのログは、実際のユーザーデータに基づいたデータセットを作成するために使用され、言語モデルのトレーニングや評価に役立ちます。

💡Latency

「Latency」とは、このビデオスクリプトにおいて、システムがリクエストを受け取ってから応答を提供するまでにかかる時間を指します。言語モデルの評価においては、Latencyはモデルの応答速度を測定し、ユーザーエクスペリエンスに影響を与える重要な要素となります。

💡Error Rate

「Error Rate」とは、このビデオスクリプトにおいて、言語モデルが誤った結果を生成する確率を指します。この指標は、モデルのパフォーマンスを評価する際に重要であり、誤った回答を生成する可能性が高いほど、エラー率が高くなります。

Highlights

The importance and interest of lags are discussed in the first video.

The core Lang Primitives are introduced in the second video.

A dataset is built from manually curated question-answer pairs based on a blog post about the new databricks model.

The dataset created is named dbrx and was built using the SDK.

Another method for dataset building is from user logs, which is useful for creating datasets with ground truth responses.

Evaluation of a language model (LM) against a dataset is explained, involving an app that produces output and an evaluator that performs assessment.

Evaluators can be custom or built-in, and there are various types available for different use cases.

The evaluator 'CoQA' is highlighted for its Chain of Thought reasoning capabilities.

CoQA is particularly effective for question-answer pairs and can compare the LM-generated answer to the ground truth.

Powerful models like CLA Opus or OpenAI GPT-4 can be used with CoQA for high-level evaluation.

The process of evaluating the LM involves plumbing questions into the LM, obtaining answers, and comparing them to ground truth.

Metrics such as latency, error rate, and evaluation scores are provided by the evaluator.

The evaluator output includes reasoning and a final score, allowing for easy auditing of the LM's performance.

The transcript outlines a clear and efficient method for LM evaluation using built-in evaluators and datasets.

The use of built-in language evaluators simplifies the process and avoids the need for reimplementation from scratch.

The practical application of the method is demonstrated through the use of the dbrx dataset and the CoQA evaluator.

Transcripts

play00:00

hi this is last lag chain this is our

play00:02

fifth video on lags with evaluations so

play00:05

our first video kind of laid out whys

play00:07

are important and interesting our second

play00:09

video of laid out kind of of core Lang

play00:11

of Primitives that we're going be

play00:12

working with we just talked through two

play00:15

two important concept so building a data

play00:17

set from like a set of manually curated

play00:19

in our case question answer

play00:21

pairs um we buil a data set based on

play00:24

this blog post about the new datab

play00:26

brecks model and I basically manually

play00:29

built a number of question answer pairs

play00:31

from that blog post I add them to my own

play00:34

data set that data set then was called

play00:38

dbrx and I use the SDK to create it so

play00:42

that should be it I also showed how to

play00:44

build a DAT set from user logs which is

play00:46

really useful for you know if you want

play00:48

to take a bunch of actual user data like

play00:51

user questions um and convert them into

play00:53

like a data set with ground truth

play00:55

responses for future testing so that's

play00:57

another you know really useful and

play00:58

common technique for data set

play01:01

building so now let's get

play01:03

into uh evaluation so here's a question

play01:06

I build my data set how do I actually

play01:09

evaluate my LM against it so in the

play01:12

second video we talked about this

play01:13

information flow but I'll just reiterate

play01:15

it briefly so we have a data set the

play01:17

data set has examples in my case the

play01:20

data set has input output pairs question

play01:22

answer what I'm going to do is I'm have

play01:25

an app and we'll see that shortly I have

play01:27

like a little example app um

play01:30

that app sees an input from my data set

play01:32

produces an output I also have the

play01:34

ground truth output in the data set I

play01:37

pass the user or the the ground truth

play01:39

output and the app output to an

play01:42

evaluator and it'll perform some

play01:44

evaluation and return a score that's it

play01:48

now here's where it gets a bit

play01:49

interesting the world of evaluators is

play01:51

is actually pretty Broad and we we've

play01:52

actually touched on this a few other uh

play01:54

videos so there's custom evaluators

play01:57

there's built-in evaluators within

play01:59

built-in evalu there's valat for labels

play02:01

or not labels in my particular case I

play02:04

have labels and I want to use a built-in

play02:07

Lang withth a valuator so we have a

play02:09

bunch of them listed here and I I'll go

play02:11

over and show you so offthe shelf L Lang

play02:14

chain evaluators is is like really uh

play02:17

nice way to go um so you don't have to

play02:19

kind of reimplement something from

play02:21

scratch for question answering again my

play02:24

data set is question answer pairs so on

play02:26

an evaluator that operates on question

play02:28

answer pairs right here's a few

play02:30

different ones that are popular QA

play02:31

Contex QA coot

play02:33

QA the high Lev the point is this Co

play02:37

coot QA is often um a very nice

play02:40

evaluator um because it'll use Chain of

play02:42

Thought reasoning um to basically look

play02:46

at the llm generate answer versus the

play02:49

ground truth and to evaluate whether or

play02:52

not uh they they match um and so

play02:55

typically in for the greater llm you use

play02:58

a very powerful model like maybe CLA

play03:00

Opus or you might use you know open AI

play03:03

gbd4 for example but that's the high

play03:05

level idea you're using Chain of Thought

play03:07

reasoning to determine the final verdict

play03:10

so let's actually just walk through

play03:12

what's going on here I'm going to pick

play03:14

that coot QA as my evaluator remember I

play03:17

built my data set dbrx let's actually go

play03:20

over and have a quick look at that so if

play03:22

I go over to my lag Smith um I'm going

play03:24

to go data syst testing dbrx search for

play03:27

it here it is I have my set I've done no

play03:31

evaluations against it it has four

play03:32

examples so this is kind of where I am

play03:35

currently now that's my data set name

play03:39

remember I built this function answered

play03:40

data Bri questions so I Define that up

play03:43

here us using open AI very

play03:46

simple um I'm pluming in my data set

play03:48

name I'm Plumbing my evaluator I'm

play03:50

adding a little prefix like this is test

play03:53

QA open Ai and I'm also adding some meta

play03:56

metadata like I'm you know website

play03:58

context into y gp35 turbo so anyway

play04:01

that's all going on here and this

play04:03

evaluate is all I need so I kick this

play04:06

off this will kick off an evaluation so

play04:08

again think about what's happening look

play04:10

at the float here all that's happening

play04:12

is I have those four questions each of

play04:14

those questions is going in going to my

play04:16

my basic llm which is this answer chain

play04:19

right so that's this thing so each

play04:22

question is getting plumbed into this

play04:24

here's a good example right right here

play04:26

we Plumb in a question we get an answer

play04:27

out it's just doing that behind the

play04:29

scenes means so we take those four

play04:31

questions we Plum them in we get answers

play04:33

out for every one of those answers out I

play04:36

go to that data set I fetch the ground

play04:38

truth answer again we can see them here

play04:41

right look here's one of our inputs so

play04:43

this input gets plumbed into our llm and

play04:46

we have this ground truth output that's

play04:49

it so let's go back hopefully that ran

play04:53

it

play04:54

ran now here's where I do I go to my

play04:56

data set I look at tests now I'm going

play04:59

to move my my little head here so now I

play05:01

have a test you see this prefix that we

play05:04

added uh it is now right this this thing

play05:07

right here we can see you know our name

play05:10

has that prefix in it we can see some

play05:12

metrics here latency P99 p50

play05:16

P99 um and we can see things like error

play05:18

rate we can see our metric and so forth

play05:21

so let's actually just dive in

play05:22

here so this is where you can really

play05:26

have a lot of fun and do a lot of kind

play05:29

of

play05:30

inspection of your results so here's

play05:33

what's going

play05:34

on the input here is the question that I

play05:37

plummed in right go back to our flow the

play05:41

input is this thing it's just my

play05:42

question all right the reference output

play05:45

go back to the flow is this thing it's

play05:47

just basically the correct answer okay

play05:50

so I have the input question I have the

play05:52

reference output now here's what my

play05:55

model returned so this is what we're

play05:57

assessing we're assessing this reference

play05:58

versus what I what I returned using that

play06:02

coot QA evaluator so behind the scenes

play06:05

uh let's actually dig into that so

play06:09

there's two things I can click on here

play06:10

this open runs thing opens up just my

play06:15

chain okay so this is my chain um again

play06:20

which we defined up here so it's this

play06:22

answered question with open AI thing so

play06:26

that's just this running on our input

play06:29

there's all the

play06:30

context and here's the question that got

play06:33

plumed in here's the answer so if I kind

play06:35

of go back um that's what that run is

play06:39

that's all it's happening there now I

play06:41

might want to know what did this gr how

play06:42

did the grader work what actually

play06:44

happened there so if I click on this

play06:46

little arrow it'll take me to the

play06:47

evaluator run and that's going to open

play06:49

up right here so this is the evaluator

play06:53

that we used off the shelf we didn't

play06:54

have to write this or anything we can

play06:57

actually go we can see we're using open

play06:58

AI as the eval which is fine and here's

play07:01

actually The Prompt this is very useful

play07:02

your teacher beinging a quiz blah blah

play07:04

blah it gives you a bunch of like

play07:07

criteria um okay so

play07:10

basically um what's happening is this is

play07:14

the greater

play07:16

prompt and you're seeing the question

play07:21

and the context and the student answer

play07:25

so the context gives you the ground

play07:27

truth answer the student answer is what

play07:28

the model turned and then here's the

play07:32

output here's like the reasoning and

play07:34

here's the score so this is really nice

play07:37

you can audit the greater really easily

play07:39

so if I go back let's Zoom all the way

play07:41

back out what's going on here I Define

play07:44

the data set my inputs are here my

play07:46

reference outputs are here my L

play07:48

Generations are here my scores are all

play07:51

listed one or zero in this case and I

play07:54

can dig into each one to understand what

play07:55

the evaluator did I can also dig into my

play07:58

Generations using this open run to see

play08:01

how they work so if I zoomed all the way

play08:03

back out the stack what are we doing

play08:05

here we're doing evaluation against our

play08:08

data set with a built-in L LS with

play08:11

evaluator um this was the information

play08:13

flow and if I go all the way down what

play08:15

do we just do we had our data set of uh

play08:18

data bricks examples questions four of

play08:20

them we used LM as a judge using a

play08:23

built-in line chain evaluator against

play08:25

those ground truth answers that we

play08:27

provided in our data set and we basic

play08:30

just did an llm evaluation that's it so

play08:33

we're going to be kind of building on

play08:34

this in the next video thanks

Rate This

5.0 / 5 (0 votes)

Related Tags
言語モデルデータセット評価技術Chain of ThoughtQA評価人工知能オープンAIデータ分析機械学習精度向上
Do you need a summary in English?