Regression Testing | LangSmith Evaluations - Part 15

LangChain
1 May 202408:08

Summary

TLDRこのビデオスクリプトでは、言語モデル(LLM)のパイプラインを構築し、評価するためのレグレッションテストについて説明されています。最近発表された新しいオープンソースLLM、例えばLLaMa 3や53などを使って、既存のLLM(例:GPT-4)と比較して、特定のユースケースに最適なLLMを選ぶ方法が紹介されています。レグレッションテストは、評価セットを構築し、異なるLLMで生成された結果を基準値と比較することで、改善点や悪化点を特定できるという利点を強調しています。また、評価セットの作成方法や、異なるLLMを指定して実行する方法、結果を比較し、基準値に比べて改善または悪化している箇所を特定する方法が詳しく説明されています。最適なLLMを選択し、言語モデルアプリケーションを構築する際に非常に役立つプロセスとツールが紹介されています。

Takeaways

  • 📈 **レグレッションテストの重要性**: レグレッションテストは、新しい言語モデル(LLM)を導入した場合に、既存のベースラインと比較して、パフォーマンスが向上または下落しているかどうかを特定するのに役立ちます。
  • 🔍 **評価セットの構築**: 評価セットを作成し、それを使用して異なるLLMをテストすることで、特定の使用ケースにおいてのパフォーマンスを評価できます。
  • 🔧 **ラギングパイプラインの変更**: LLMを変更する場合、レグレッションテストを使用して、新しいLLMが既存のベースラインと比較してどのように機能するかを判断できます。
  • 🆕 **オープンソースLLMの活用**: 最近出された新しいオープンソースLLM(例:LLaMa 3、53)を使用して、既存のベースライン(例:GPT-4)と比較することができます。
  • 📚 **ドキュメントのインデックス作成**: ラギングパイプラインで使用されるドキュメントをインデックス化し、その大きさや構成を最適化することが重要です。
  • 📝 **評価指標の設定**: 回答のグラウンドトゥルースに沿っているかどうかなど、回答の質を評価するための基準を設定することが可能です。
  • 🟢⚠ **結果の可視化**: レグレッションテストの結果を視覚的に確認できることで、パフォーマンスが向上している箇所と下落している箇所を迅速に特定できます。
  • 🔬 **詳細な分析**: 個々のケースをクリックして、詳細な分析やスコアリングの理由を確認することが可能です。
  • 📊 **メトリックスの確認**: トークン使用状況やレイテンシなどのメトリックスを確認することで、パフォーマンスをさらに理解できます。
  • 🔄 **改善と悪化の繰り返し**: レグレッションテストを繰り返し行い、改善と悪化を特定し、その理由を分析することで、より良いLLMアプリケーションを構築できます。
  • 🛠️ **柔軟なパイプラインの拡張**: ラギングパイプラインは、異なるLLMを指定できる柔軟性を持っており、必要に応じて簡単に拡張できます。
  • 🔗 **オープンソースとの連携**: オープンソースLLMをローカルで実行し、プロバイダーとしてOpenAIと比較することができます。

Q & A

  • ラングスミス評価シリーズの15番目のビデオで扱われている主題は何ですか?

    -回帰テストに焦点を当てたラングスミス評価シリーズの15番目のビデオでは、リグレッションテストについて説明されています。

  • リグレッションテストとは何ですか?

    -リグレッションテストは、特定の基準やベースラインに対して、システムのパフォーマンスが改善されたり劣化したりしているかどうかを評価するプロセスです。

  • ビデオでは、どのような新しいオープンソースLLMが紹介されましたか?

    -ビデオでは、最近発表された新しいオープンソースLLMとして、LLaMA 3とLLaMA 53が紹介されました。

  • ベースラインモデルとして使用されていたものは何ですか?

    -ビデオでは、GPT-4がベースラインモデルとして使用されていたと説明されています。

  • 評価セットの作成に使用される言語は何ですか?

    -評価セットの作成に使用される言語は、Line Change Expression Languageです。

  • ビデオで説明されているRAGパイプラインとは何ですか?

    -RAGパイプラインとは、Retrieve And Generate(検索と生成)という意味で、情報検索と生成タスクを組み合わせたプロセスです。

  • 評価の際に使用される主要な指標は何ですか?

    -評価の際に使用される主要な指標は、回答が真実に基づいており、基準点からどれだけ離れているかを示すスコアです。

  • ビデオで説明されているエバリュエーターの役割は何ですか?

    -エバリュエーターは、回答の質を評価し、基準点に対してスコアを割り当てることで、回答がどれだけ優れたものかを判断する役割を果たします。

  • ビデオの最後で述べられている、リグレッションテストの強力な点は何ですか?

    -リグレッションテストの強力な点は、異なるモデルや異なるチャンクサイズなどの異なるバリエーションで、チェーンが改善されたり劣化したりしているケースを特定できることです。

  • ビデオで説明されているAMAとは何ですか?

    -AMAとは、複数のオープンソースLLMをローカルで実行できるようにするツールであり、ビデオではLLaMA 3やLLaMA 53をローカルで実行するために使用されています。

  • 評価結果を分析する際に使用される色分けは何を意味していますか?

    -評価結果を分析する際に使用される色分けでは、赤色はベースラインよりもパフォーマンスが劣っていることを示し、緑色は改善されていることを示します。

  • ビデオで説明されているRAG QA LCLとは何ですか?

    -RAG QA LCLとは、評価セットの名前であり、ビデオで使用される特定の問い合わせと回答のセットを指します。

Outlines

00:00

😀 ランダムアクセスメモリ(RAM)の評価と回帰テストの紹介

この動画スクリプトは、ランダムアクセスメモリ(RAM)の評価シリーズの15番目のビデオであり、回帰テストに焦点を当てています。以前のビデオでは、RAMチェーンの評価方法について語り合いました。例えば、参照文書やドキュメントに対しての回答の質、または問いに対する検索の関連性などです。ここでは、RAMパイプラインを構築する際によくある問題が1つ挙げられます。つまり、新しいオープンソースのLLMが登場した場合、それを自分のベースラインとして使用することができます。回帰テストは、さまざまな例で評価セットを実行し、基準と比較して改善または悪化しているケースを特定する能力を提供します。また、評価セットの構築方法や、インデックスの作成方法、そしてRAMパイプラインのレイアウト方法についても説明しています。

05:01

📊 LLMの性能比較と回帰テストの活用

この段落では、評価セットを使ってLLMの性能を比較し、基準と比較して改善または悪化しているケースを特定する方法が説明されています。赤いセルは基準より悪いパフォーマンスを意味し、緑のセルは良いパフォーマンスを意味します。また、評価ランをクリックすることで、特定のスコアがなぜ与えられたのかを監査することができます。さらに、表示設定でトークン使用状況やレイテンシーなどの追加メトリックを確認することができ、生成物の全文も表示可能です。回帰テストは、異なるモデルやチャンクサイズなどの変更によって、RAMチェーンがどのように変わるかに注目する強力な方法です。

Mindmap

Keywords

💡ラングスミス評価

ラングスミス評価とは、言語モデルの性能を評価するプロセスを指します。このビデオでは、ラングスミス評価の一環として、回帰テストに焦点を当てています。回帰テストは、言語モデルの変更前後で回答の質を比較し、性能が向上または下落しているかを判断する手法です。

💡回帰テスト

回帰テストは、既存のシステムに変更を加えた場合に、その変更が既存の機能に悪影響を及ぼしていないことを確認するテスト手法です。ビデオでは、言語モデルの変更を評価するために回帰テストが使用されており、新しい言語モデルがベースラインモデルと比較して改善点や悪化点を特定することができます。

💡LLM (Large Language Model)

LLMとは、大規模言語モデルの略で、自然言語処理のタスクに使用される高度な機械学習モデルです。ビデオでは、オープンソースのLLMであるLLaMa 3と53が、既存のベースラインモデルであるGPT-4と比較評価されています。

💡評価セット

評価セットとは、システムやモデルの性能を評価するために使用されるデータの集合体のことです。ビデオでは、RAG QA LCLという名前の新しい評価セットが構築され、異なるLLMによる生成ステップの性能を比較するために使用されています。

💡インデックス

インデックスは、データベースや検索エンジンで使用される情報の整理された表現です。ビデオでは、ラインチェンジ式言語の文書をインデックス化し、検索や参照の効率を向上させるために使用されています。

💡RAG パイプライン

RAG パイプラインとは、Retrieval-Augmented Generationの略で、検索と生成を組み合わせた手法です。ビデオでは、RAG パイプラインを構築し、異なるプロバイダーのLLMを使用して実行することで、回答の質を向上させる方法が探求されています。

💡評価基準

評価基準とは、モデルの性能を測定するための基準を定義するプロセスです。ビデオでは、ラベル付きスコア文字列評価器を使用して、アシスタントの回答が真実に基づいていたかどうかを評価し、1から10までのスコアで評価しています。

💡ベースライン

ベースラインとは、比較の基準として使用される既存のモデルやシステムのことです。ビデオでは、GPT-4が以前のベースラインであり、新しいLLMがこの基準に対してどのように比較されるかが示されています。

💡改善点

改善点とは、システムやモデルの性能を向上させる可能性がある領域を指します。ビデオでは、回帰テストを通じて、新しいLLMがベースラインモデルよりも良いスコアを獲得した箇所が特定され、改善点が明らかになります。

💡悪化点

悪化点とは、システムやモデルの性能が下落している箇所を指します。ビデオでは、赤いセルが悪化点を示しており、ベースラインモデルよりも低いスコアを獲得している場合に特定されます。

💡トレース

トレースとは、システムの実行過程を記録したもので、問題の特定やデバッグに役立ちます。ビデオでは、トレースを通じて、特定の生成結果がどのように導かれたかを監査し、悪化点や改善点を詳細に分析することができます。

Highlights

The video focuses on regression testing in the context of LangSmith evaluation series.

Discusses the evaluation of the rag chain answer against a reference or the documents for hallucinations and retrieval relevance.

Explains the scenario of wanting to change the LLM in a rag pipeline and how to determine the suitability of new models like LLaMa 3 or 53.

Introduces the concept of regression testing to identify improvements or regressions relative to a baseline model.

Demonstrates building a new evaluation set called RAG QA LCL using the same line change expression language documentation.

Mentions indexing a large chunk of the documentation with no major changes from previous rag videos.

Details a slight modification in the rag pipeline to specify different providers, allowing for the use of various open-source LLMs.

Shows how to run the rag chain with different LLMs, including Open AI, LLaMa 3, and LLaMa 53, using the AMA tool.

Presents an evaluator for answers that assesses if the assistant's answer is grounded in the ground truth answer with a scoring system.

Runs evaluations on Open AI, LLaMa 3, and LLaMa 53 and discusses analyzing the dataset RAB QA LCL.

Illustrates the use of a comparison mode to view the three experiments and identify performance relative to the baseline.

Highlights the visual indicators (red or green cells) that represent performance worse or better than the baseline.

Shows how to audit the evaluator run to understand why a particular score was given.

Discusses the convenience of preserving the baseline and its importance in the evaluation process.

Introduces the feature to highlight only cases that improve or regress relative to the baseline.

Mentions the ability to view additional metrics like token usage and latencies for a deeper analysis.

Explains how to view the full text of generations and audit the entire chain for a specific case.

Emphasizes the usefulness of regression testing in identifying cases where the chain is getting worse or better with different models or perturbations.

Encourages the audience to use regression testing as it is extremely useful and helpful in building LLM applications.

Transcripts

play00:06

this is last L chain this is the 15th

play00:08

video in our Langs Smith evaluation

play00:10

series we're going to focusing on

play00:12

regression testing so the past few

play00:14

videos talked a lot about rag evaluation

play00:16

just to refresh for example we talked

play00:18

about how to evaluate the rag chain

play00:20

answer versus a reference or the answer

play00:23

versus the documents for hallucinations

play00:25

or even the documents relative to the

play00:26

question for kind of retrieval relevance

play00:30

now here's a common situation that comes

play00:31

up when I think about building a rag

play00:33

pipeline what if I want to change the

play00:36

llm so you know good example is some

play00:39

pretty cool and interesting new open

play00:41

source LMS have recently come out like

play00:42

llama 3 53 how can I know whether or not

play00:46

I can replace for example gbd4 as my

play00:48

Baseline with one of these for my

play00:49

particular use case and my particular

play00:51

rag

play00:52

pipeline this is where there a notion of

play00:54

aggression testing comes in so we

play00:56

previously had talked about building an

play00:57

eal set running it on you know for

play00:59

example are answers and evaluating

play01:02

answer relevance or or answer you know

play01:05

accuracy in this case relative to uh

play01:07

ground truth answer um regression

play01:10

testing allows me to run this on a few

play01:12

different examples like let's say

play01:14

different llms that perform the

play01:16

generation step and to identify cases

play01:19

that either improve or regress relative

play01:22

to my Baseline so the key point of

play01:24

regression testing is the ability to

play01:25

isolate instances in your eval set they

play01:27

even getting better or worse so that's

play01:28

kind of the main intuition

play01:30

so to kick this off I'm just going to

play01:32

build a new eval set so that's all

play01:34

defined here it's going to be called rag

play01:36

QA LCL so it's going to use the same uh

play01:39

line change expression language

play01:40

documentation I used for the prior rag

play01:42

videos just a few other you get a few

play01:44

slightly different questions so I've

play01:46

built that and I've built my index um so

play01:49

again we're just indexing the line CH

play01:51

expression language documentation again

play01:52

I'm choosing a large chunk size just

play01:54

like we saw before no major

play01:56

changes um so I've laid out my rag

play01:59

pipeline and this looks very similar we

play02:01

saw before the only difference is I've

play02:02

added a slight modification where I can

play02:05

specify different providers so in this

play02:07

case I can choose AMA uh which allows me

play02:09

to run a number of Open Source llms

play02:11

locally along with open Ai and again

play02:14

just like rag prompts for the open

play02:15

source models versus open AI um but you

play02:19

know again not no major differences here

play02:21

really I'm just extending my rag model

play02:23

or my rag chain so I can run with

play02:25

different llms that's all I'm doing here

play02:27

and I'm defining three of them so I have

play02:29

my ra chain with open AI rag chain with

play02:31

llama 3 and rag chain with 53 again

play02:34

llama 3 and 53 we use open AI as a

play02:36

provider and I'm just specifying the

play02:38

model I've already downloaded these

play02:40

locally just with simply AMA pull llama

play02:42

3 orama pull 53 and it'll just run

play02:45

locally on my laptop so that's a whole

play02:47

separate thing but that's a pretty cool

play02:48

nice thing about

play02:50

AMA um so I've defined an evaluator for

play02:54

answers so we saw this previously this

play02:57

labeled score string evaluator basically

play02:59

lets me Supply some criteria so in this

play03:01

case you know I'm asking is the

play03:03

assistant answer grounded in the ground

play03:05

truth answer and I give it you know some

play03:08

criteria for scoring one through 10 10

play03:10

being the best one being the worst so

play03:12

that's all all that's going on here and

play03:14

I kick off my eval right so I run eval

play03:17

on open AI first I run eval on llama 3 I

play03:22

run eval on th3 so those evals have run

play03:25

now let's go over and look at my data

play03:26

set so here is the data set we created

play03:28

again RAB QA LCL let's just confirm that

play03:30

here yeah so this is the this is evil

play03:32

set we're running on and it's the evil

play03:34

set we created up here so that's right

play03:36

here so we created our eval set now we

play03:39

can look at our experiments so this is

play03:41

what we saw before right so this is our

play03:43

experiment page no major changes here

play03:46

right we can see our three experiments

play03:48

run here now what I'm going to do is I'm

play03:50

going to select these three experiments

play03:52

so I'm going to go one two three and I'm

play03:54

going to open this comparison mod this

play03:56

is where things are going to get kind of

play03:57

interesting we're going to see some

play03:59

things that are a bit new here and let

play04:01

me just scroll over a little bit so

play04:04

first we're going to see is the three

play04:06

experiments we selected are all here

play04:09

okay and we're seeing this idea of a

play04:11

baseline so what does Baseline mean the

play04:13

Baseline is basically our reference so

play04:15

in my particular case so let's just say

play04:18

gbd4 was my prior Baseline right so gbd4

play04:21

was the model that I had been using and

play04:24

I want to see how th3 and llama 3

play04:26

compare to GPD 4 so what I can do really

play04:30

easily is so these are our three

play04:31

examples just like we saw so again I can

play04:34

click on this and this will basically

play04:36

open up the example so I can see here's

play04:38

the question here's the answer so that's

play04:40

just like you know uh we we've kind of

play04:42

gone through that

play04:43

before um so here's the input here's

play04:46

reference output and now here's my three

play04:48

experiments and you can see just like

play04:50

before we've set a

play04:52

baseline um and I can see the scores

play04:55

from my evaluator here now what's

play04:58

interesting is I can scroll over and I

play05:01

can look at my two other experiments so

play05:03

llama 3 here 53 here so what's pretty

play05:07

cool is immediately your attention is

play05:09

drawn to these red or green cells and

play05:12

this simply means if it's a red cell it

play05:13

means the performance is worse than my

play05:15

Baseline if it's a green I me it's

play05:16

better so in this case right my Baseline

play05:19

was 0.1 in this case 53 actually for the

play05:22

second example does better it got a

play05:24

score of 0.5 so that's why it's green um

play05:27

otherwise you can see there's

play05:28

regressions across the board um for uh

play05:32

questions one and three for both of the

play05:34

models now I can do a few different

play05:36

things here first like we saw before I

play05:38

can always click on this button and that

play05:41

that actually opens up the evaluator run

play05:43

itself so I can audit the evaluator so

play05:46

that's again we we talked about that

play05:47

previously it's really useful you can

play05:48

kind of see why particular score was

play05:50

given so that's really

play05:52

cool uh and I can go back and you can

play05:56

see my Baseline is still preserved so

play05:59

that's actually very convenient um now

play06:01

this thing at the top tells me the

play06:03

number of total regressions or

play06:05

progressions or improvements relative to

play06:06

my Baseline so I can click this and

play06:08

it'll highlight only the cases that

play06:10

improve click this it'll highlight only

play06:12

the cases that regress again likewise

play06:14

here um so again it's really useful and

play06:18

nice way to drill into the cases that

play06:19

are improving or getting worse relative

play06:22

to a baseline in this case there's only

play06:24

three examples but in realistic cases

play06:26

you may have an eal set of maybe dozens

play06:28

or hundreds of examples so this can very

play06:30

easily be used to isolate your

play06:32

progressions or your improvements and

play06:34

your regressions so you know it's it's

play06:36

it's really helpful I do want to also

play06:38

show here if you go to the display you

play06:40

can actually open up um you know

play06:43

additional metrics this can show you

play06:44

like this will show you token usage this

play06:46

will show you uh latencies so you can

play06:48

kind of close that down to make lesser

play06:50

of those uh you can see the full text of

play06:52

the generations if you want to see that

play06:54

but again it's it's by default of

play06:56

removed so it's like way cleaner um

play07:00

and that's probably the main things I'd

play07:03

like to show you there you can of course

play07:04

choose different experiments or

play07:06

additional experiments if they're not

play07:07

all Chen here it's easy to add

play07:08

experiments so anyway this is a really

play07:11

useful and convenient thing I I do this

play07:13

all the time so I'm always running

play07:15

experiments with different llms I always

play07:17

want to isolate cases that are improving

play07:18

or regressing and I want to dig into why

play07:21

and basically using these filters I can

play07:23

very easily isolate the cases that are

play07:24

for example getting worse drill into y

play07:27

again in each of these cases you can see

play07:28

you actually can look at the trace again

play07:30

so you this will drill into the trace

play07:32

that resulted in the generation I can go

play07:34

down I can audit the entire chain so

play07:36

this is like my cadow Lama uh invocation

play07:39

here this is like the prompt which

play07:40

contains yeah the context my rag answer

play07:43

so again a lot of things you can play

play07:46

with here really useful uh and

play07:47

regression testing is obviously super

play07:50

powerful uh for identifying cases that

play07:53

your chain for example is getting worse

play07:55

or better with different pertubations

play07:57

like different models uh different

play07:59

chunks or other things so definitely

play08:01

play with us it's extremely useful and

play08:04

and helpful in building llm applications

play08:06

thanks

Rate This

5.0 / 5 (0 votes)

Related Tags
ランダムアクセスメモリレグレッションテストオープンソースLLM評価方法比較分析AIパイプラインデータセット評価セット改善点問題点技術解説アルゴリズムプログラミング
Do you need a summary in English?