Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Evaluating RAG Pipelines #1101

Open
AkihikoWatanabe opened this issue Oct 29, 2023 · 1 comment
Open

Evaluating RAG Pipelines #1101

AkihikoWatanabe opened this issue Oct 29, 2023 · 1 comment

Comments

@AkihikoWatanabe
Copy link
Owner

AkihikoWatanabe commented Oct 29, 2023

https://blog.langchain.dev/evaluating-rag-pipelines-with-ragas-langsmith/

@AkihikoWatanabe
Copy link
Owner Author

AkihikoWatanabe commented Oct 29, 2023

RAG pipeline (retrieval + generation)を評価するライブラリRagasについて紹介されている。

評価に活用される指標は下記で、背後にLLMを活用しているため、大半の指標はラベルデータ不要。ただし、context_recallを測定する場合はreference answerが必要。
Ragasスコアとしてどのメトリックを利用するかは選択することができ、選択したメトリックのharmonic meanでスコアが算出される。
image

各種メトリックの内部的な処理は下記:

  • faithfullness
    • questionと生成された回答に基づいて、statementのリストをLLMで生成する。statementは回答が主張している内容をLLMが解釈したものだと思われる。
    • statementのリストとcontextが与えられたときに、statementがcontextにsupportされているかをLLMで評価する。
    • num. of supported statements / num. of statements でスコアが算出される
  • Answer Relevancy
    • LLMで生成された回答から逆に質問を生成し、生成された質問と実際の質問の類似度を測ることで評価
  • Context Relevancy
    • どれだけcontextにノイズが含まれるかを測定する。
    • LLMでcontextの各文ごとに回答に必要な文か否かを判断する
    • 回答に必要な文数 / 全文数 でスコアを算出
  • Context Recall
    • 回答に必要な情報を全てretrieverが抽出できているか
    • ground truthとなる回答からstatementをLLMで生成し、statementがcontextでどれだけカバーされているかで算出

また、LangSmithを利用して実験を管理する方法についても記述されている。
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant