LLM-as-a-Judge を人間の嗜好に整合させる研究
LangChain は、LLM-as-a-Judge の評価精度を向上させるため、人間の修正フィードバックをfew-shot例として自動蓄積・活用する「自己改善」機能を LangSmith に実装したと発表した。
キーポイント
LLM-as-a-Judge の課題と解決策
従来の LLM-as-a-Judge は評価者自体のプロンプトエンジニアリングが必要という新たな課題を抱えていたが、LangSmith がこの問題を解決する新機能を導入した。
自己改善(Self-Improvement)機能の仕組み
人間による LLM-as-a-Judge の出力修正を少数ショット例として保存し、将来的な評価プロンプトに自動フィードバックさせることで、評価器が徐々に精度を高める。
自然言語評価の自動化と効率化
簡潔さや正しさなどハードコードルールで判定困難な自然言語出力の評価プロセスを、継続的な学習によってより正確かつ容易に行えるようになった。
影響分析・編集コメントを表示
影響分析
この機能は、LLM アプリケーション開発における評価フェーズのボトルネックである「評価器自体の設計コスト」を解消し、大規模な自然言語出力の評価を自動化・最適化する道を開く。特に、実運用環境での品質保証(QA)や継続的改善プロセスにおいて、人間の介入を最小限に保ちつつ精度を高めるための重要な技術的転換点となる。
編集コメント
評価器の設計コストという隠れた課題を、機械学習的なフィードバックループで解決するアプローチは、実務現場での LLM アプリ品質管理に即座に役立つ画期的な改善です。
主要リンク:
- 技術ドキュメント
- ビデオ解説
Evaluation は、LLM アプリケーションを継続的に改善 するプロセスです。これには、アプリケーションのパフォーマンスを測定する方法が必要です。
LLM アプリケーションは自然言語で出力を生成することが多く、ハードコードされたルールでは判断が困難です。例えば、簡潔さや参照出力に対する正確性といった属性は、通常の単体テストとして表現するのが難しい 場合があります。
「LLM-as-a-Judge」を活用して、LLM アプリケーションからの自然言語出力を評価する方法が一般的です。これは、生成された出力(およびその他の情報)を別の LLM に渡し、その LLM に対して出力の判定を依頼するプロセスを含みます。この手法は複数の文脈で有用であることが証明されていますが、興味深い課題も提起します:つまり、LLM-as-a-Judge が良好に機能するようにするために、追加の プロンプトエンジニアリングラウンドを実行する必要が生じる点です。
LangSmith は、この高まる問題に対する革新的な解決策を提示しています。LangSmith の評価器には現在、「自己改善」機能が備わっており、LLM-as-a-Judge への出力に対する人間の修正が少数ショット例として保存され、それが将来のイテレーションにおいてプロンプトにフィードバックされます。
💡
その結果、プロンプトエンジニアリングを一切行わずに、あなたの好みを正確に反映する LLM-as-a-Judge 評価器を作成しやすくなり、LangSmith でネイティブに対話する過程で時間とともに適応していくことが可能になります。
本稿では、LLM-as-a-Judge 評価器の台頭について、この解決策に至るまでの動機となる研究について、そしてその実装方法を詳しく解説します。実際に試してみたい方は、こちらから無料で LangSmith にサインアップ してください。
LLM-as-a-Judge(LLM を裁判官として)
LLM の出力をプログラムで評価するのは、しばしば困難です。その大きな理由の一つは、適切な指標が不足していることです。確かに、分類や名前付きエンティティ抽出、あるいはその他の「伝統的」な機械学習タスクを行う場合であれば、標準的な機械学習の指標を使用できます。しかし、より「生成」的なタスク(多くのアプリケーションで一般的に該当します)を行っている場合は、優れた選択肢はあまりありません。
そして評価は非常に重要です!アプリケーションをリリースして運を天に任せるのではなく、実データ上でそのパフォーマンスを評価し、アプリに対して変更を加え、その変更が後退(regression)を引き起こしていないことを確認する必要があります。私たちは、ビルダーたちがオンラインおよびオフラインの両方の評価段階に多くの時間を費やしている様子を目にしており、LangSmith はそれに応じて構築されました。
LangSmith は、使用する指標について特定の立場をとるものではありません(ほぼすべてのチームが独自のカスタム指標を定義していることが確認されています)。Elastic や Rakuten といった素晴らしいチームと協力し、彼らがどのように評価を行っているかを直接目撃してきました。その中で気づいたことのひとつが、「LLM-as-a-Judge(大規模言語モデルを裁判官として用いる手法)」と呼ばれる評価器の利用が増加しているという点です。
「LLM-as-a-Judge」評価器とは、出力に対して LLM を用いて採点を行う評価器のことであり、プログラムによる評価が困難な場合や、人間によるラベル付け以外の手段がない場合に特に有用です。私たちが確認した主なユースケースは以下の通りです。
- RAG(Retrieval-Augmented Generation:検索拡張生成)におけるハルシネーション(幻覚・虚偽生成)の検出(オンライン評価)
- RAG における正答性の検出(オフライン評価)
- LLM が有害または不適切な回答を生成したかどうかの検出(オンラインおよびオフライン評価)
なぜこれが機能するのでしょうか?そもそも回答を生成しているのが LLM であるなら、なぜ結果を採点するためにも LLM を使用することが実際に有効なのでしょうか。
2 つの要因が働いています。第一に、評価プロセスにおいて LLM は生成時とは異なる情報にアクセスできる可能性があります。例えば、RAG の正しさを判断する際、評価用 LLM に正解(ground truth)を与えて比較させることがあります。明らかに、これはその瞬間には持っていなかった情報です。第二に、LLM にとって回答の正しさを判断することは、自ら正しい回答を生成することよりも容易です。この「タスクの単純化」が、LLM-as-a-Judge を実現可能にしています。
このプロセスはうまく機能することもありますが、複雑さもあります。評価用プロンプトに対して追加のプロンプトエンジニアリングを行う必要があり、これは時間がかかるうえ、チームが適切な評価システムを構築するのを妨げる要因にもなり得ます。LangSmith では、この評価プロセスを合理化することを目指しています。
動機となった研究
私たちが解決策を実装するに至った動機となった研究は 2 つありました。
1 つ目は新しいことではありません:言語モデルは Few-shot Learning に長けています。LLM に正しく行われた事例の例を与えれば、それらは正しい行動を模倣します。この手法は当社のクライアントの LLM アプリケーションで広く採用されており、特に指示で LLM の振る舞いを説明するのが難しい場合や、出力に特定の形式が求められる場合に効果的です。評価はこの 2 つの条件の両方を満たしています!
もう一つの研究は新しいものです:バークレー校の Shreya Shankar 氏による論文『Who Validates the Validators? Aligning LLM-Assisted Evaluation of LLM Outputs with Human Preferences』[https://arxiv.org/pdf/2404.12272?ref=blog.langchain.com] です。この論文は同じ課題に取り組んでおり、私たちが提案する解決策とは異なるアプローチを提示していますが、LLM による評価を人間のプロファイルにプログラム的に整合させるためのフィードバック収集の活用を促す上で大きな役割を果たしました。
では、これらの二つのアイデアをどう組み合わせて「自己改善型」の評価器を構築したのでしょうか?
私たちの解決策:LangSmith における自己改善型評価
最近の研究と、LLM-as-a-Judge(LLM を裁判官とする)評価器の広範な採用に基づき、私たちは LangSmith 評価器のための革新的な「自己改善型」システムを開発しました。このアプローチは、LLM による評価を人間のプロファイルに整合させるプロセスを簡素化し、大規模なプロンプトエンジニアリングの必要性を排除することを目指しています。仕組みは以下の通りです。
まず、LLM-as-a-Judge(LLM を裁判官とする)を設定します(オンラインまたはオフライン): ユーザーは LangSmith で オンライン評価またはオフライン評価用の LLM-as-a-Judge 評価器を簡単に設定できます。この初期設定では最小限の構成で済み、システムは時間とともに改善されるように設計されています。設定時には、few-shot 例(少サンプル学習)をプロンプトにどのように組み込むかを指定できます。
To start, set up LLM as a judge (online or offline): Users can easily set up an LLM-as-a-Judge evaluator in LangSmith for either online or offline evaluation. This initial setup requires minimal configuration, as the system is designed to improve over time. When setting it up you can specify how few-shot examples should be formatted into the prompt.

必ず JSON 形式で返してください。translation フィールドのみ。他のフィールド (technical_terms 等) は一切追加しないこと — 余計なフィールドを書こうとして本文翻訳がトークン上限で打ち切られる事故を防ぐため:
{"translation": "翻訳全文"}
- フィードバックを残させる:LLM 評価者は、生成された出力に対してフィードバックを提供し、正しさ、関連性、または前段階で判事として指定されたその他の基準などの要因を評価します。
- ユーザーはアプリ内でそのフィードバックに直接修正を加えることができます:ユーザーが LLM の評価を確認する際、LangSmith インターフェース内でフィードバックを直接変更したり修正したりできます。このステップは、人間の嗜好や判断を取り込むために極めて重要です。
- これらの修正はフューショット例として保存されます:LangSmith はこれらの人間の修正を自動的にフューショット例(few-shot examples)として保存します。これにより、チームまたはアプリケーション固有の嗜好と基準を反映した、人間に整合した評価データのセットが徐々に蓄積されていきます。また、このフローの一環として、修正に対する説明も残すことができます。
- 次の評価実行時には、それらの例(および任意の説明)が保存され、生成に活用されます:後続の評価実行において、システムはこれらの保存された例を LLM-as-a-Judge のプロンプトに取り込みます。言語モデルのフューショット学習能力を活用することで、評価者は時間とともに人間の嗜好とより整合するようになります。
より技術的な手順については、こちらの手順ガイド をご覧ください。
この自己改善サイクルにより、LLM-as-a-Judge は実世界のフィードバックに基づいて評価を適応・洗練させることができ、手動のプロンプト調整や時間のかかるプロンプトエンジニアリングが不要になります。これにより、チームは必要に応じて評価のレビューと修正に集中でき、その入力が時間の経過とともにシステムの性能向上に直接寄与することを理解できます。
結論
LLM-as-a-Judge(大規模言語モデルによる審査員)評価ツールは生成 AI システムの評価において強力な手段ですが、プロンプトエンジニアリングや人間の嗜好との整合性という新たな課題も生み出しています。LangSmith の自己改善型評価器は、few-shot learning(少サンプル学習)とユーザーの修正を活用して、人間からのフィードバックを統合し、絶え間ない手動介入なしに正確で関連性の高い評価を実現するエレガントな解決策を提供します。
AI が急速に進化する中、自己改善型評価器は機械の能力と人間の期待とのギャップを埋める上で不可欠となります。LangSmith により、チームは AI アプリケーションの構築、評価、洗練をより高い自信と効率性を持って行えるようになります。まだ登録されていない方は、こちら から無料で LangSmith の利用を開始してください。
原文を表示
Key Links:
- Technical documentation
- Video walkthrough
Evaluation is the process of continuously improving your LLM application. This requires a way to measure your application’s performance.
LLM applications often produce outputs in natural language, which are difficult to judge using hard-coded rules. For example, attributes like conciseness or correctness relative to a reference output are difficult to express as typical unit tests.
Using an “LLM-as-a-Judge” is a popular way to grade natural language outputs from LLM applications. This involves passing the generated output (and other information) to a separate LLM and asking it to judge the output. Although this has proven useful in several contexts, it raises an interesting problem: you now have to do another round of prompt engineering to make sure the LLM-as-a-Judge is performing well.
LangSmith presents a novel solution to this rising problem. LangSmith evaluators now feature “self-improvement” whereby human corrections to LLM-as-a-Judge outputs are stored as few-shot examples, which are then fed back into the prompt in future iterations.
💡
The net impact is that it is easier to create LLM-as-a-Judge evaluators that accurately reflect your preferences with no prompt engineering, and have them adapt over time as you interact natively with LangSmith.
In this post we will talk about the rise of LLM-as-a-Judge evaluators, some motivating research that led us to this solution, and then deep dive into how exactly this is implemented. If you want to try it out, you can sign up for LangSmith for free here.
LLM-as-a-Judge
It’s often hard to evaluate LLM output programmatically. A big part of this is a lack of good metrics. Sure, if you are doing classification or named entity extraction or other “traditional” ML tasks then there’s standard ML metrics to use. But if you are doing more “generative” tasks (which most applications often are) then there aren’t many great options.
And evaluation is super important! You can’t just launch an application and hope for the best - you should be evaluating its performance on real data, making changes to your app, and then making sure the changes don’t cause regressions. We see builders spending significant time on both the online and offline evaluation stages - and built LangSmith accordingly.
LangSmith is not opinionated in what metrics you use (we see that nearly everyone defines their own custom metric). We've worked with fantastic teams like Elastic and Rakuten, seeing firsthand how they are doing evaluation – and one of the things we’ve noticed is a rise in the usage of “LLM-as-a-Judge” evaluators.
An “LLM-as-a-Judge” evaluator is simply an evaluator that uses an LLM to score the output. This is often useful when it’s tough to programmatically evaluate an application and the only other recourse would be human labels. Key use cases we’ve seen involve:
- Detecting RAG hallucinations (online evaluation)
- Detecting RAG correctness (offline evaluation)
- Detecting whether the LLM generated a toxic or inappropriate answer (offline and online evaluation)
Why does this work? If LLMs are generating the answers in the first place, then why does using an LLM to score the results actually work at all?
There are two factors at play. First, during evaluation the LLM may have access to information it didn’t have at the time of generation. For example, when judging RAG correctness, you give the evaluator LLM the ground truth answer and ask it to compare to that. Obviously, this is some information you didn’t have in the moment. Second, judging the correctness of an answer is easier for an LLM than generating a correct answer itself. This “simplifying” of the task makes LLM-as-a-Judge feasible.
While this process can work well, it has complications. You still have to do another round of prompt engineering for the evaluator prompt, which can time-consuming and hinder teams from setting up a proper evaluation system. With LangSmith, we've aimed to streamline this evaluation process.
Motivating research
There were two pieces of motivating research that led us to implement a solution.
The first piece is nothing new: language models are adept at few-shotlearning. If you give LLMs examples of things done correctly, they will imitate the correct behavior. This method is widely-adopted in our client LLM applications; it's particularly effective in cases where it's tough to explain in instructions how the LLM should behave, and where the output is expected to have a particular format. Evaluations fit both these criteria!
The other piece of research is new: a paper out of Berkeley by Shreya Shankar titled Who Validates the Validators? Aligning LLM-Assisted Evaluation of LLM Outputs with Human Preferences. This paper addresses the same problem, and, though it proposes a different solution than ours, it helped motivate our usage of feedback collection as a way to programmatically align LLM evaluations with human preferences.
So - how did we take these two ideas and build our “self-improving” evaluators?
Our solution: Self-improving evaluation in LangSmith
Building on recent research and the widespread adoption of LLM-as-a-Judge evaluators, we've developed a novel "self-improving" system for LangSmith evaluators. This approach aims to streamline the process of aligning LLM evaluations with human preferences, eliminating the need for extensive prompt engineering. Here's how it works:
To start, set up LLM as a judge (online or offline): Users can easily set up an LLM-as-a-Judge evaluator in LangSmith for either online or offline evaluation. This initial setup requires minimal configuration, as the system is designed to improve over time. When setting it up you can specify how few-shot examples should be formatted into the prompt.

- Have it leave feedback: The LLM evaluator provides feedback on the generated outputs, assessing factors such as correctness, relevance, or any other criteria specified as part of the judge in the prior step.
- Users can make corrections on that feedback natively in the app: As users review the LLM's evaluations, they can directly modify or correct the feedback within the LangSmith interface. This step is crucial for capturing human preferences and judgments.
- These corrections will be stored as few-shot examples: LangSmith automatically stores these human corrections as few-shot examples. This creates a growing dataset of human-aligned evaluations that reflect the specific preferences and standards of your team or application. You can also leave explanations for your corrections as part of this flow.
- The next time an evaluator runs, it will store those examples (and optionally, the explanations) and use those to inform its generation: In subsequent evaluation runs, the system incorporates these stored examples into the prompt for the LLM-as-a-Judge. By leveraging the few-shot learning capabilities of language models, the evaluator becomes increasingly aligned with human preferences over time.
For more of a technical walkthrough, see this how-to guide.
This self-improving cycle allows the LLM-as-a-Judge to adapt and refine its evaluations based on real-world feedback, eliminating manual prompt adjustments or time-consuming prompt engineering. Now, teams can focus on reviewing and correcting evaluations when necessary, knowing that their input directly improves the system's performance over time.
Conclusion
LLM-as-a-Judge evaluators are powerful tools for assessing generative AI systems but have posed new challenges in prompt engineering and human preference alignment. LangSmith's self-improving evaluators provide an elegant solution to this problem, leveraging few-shot learning and user corrections to integrate human feedback for accurate, relevant evaluations without constant manual intervention.
As AI rapidly advances, self-improving evaluators will be crucial in bridging the gap between machine capabilities and human expectations. With LangSmith, we're empowering teams to build, assess, and refine their AI applications with greater confidence and efficiency. If you haven’t already - sign up for LangSmith for free here.
関連記事
今日のまとめ
AI日報で今日の重要ニュースをまとめ読み