LangSmith を用いたペア評価の実装
LangChain が提供する LangSmith ツールにおけるペア評価機能の紹介により、開発者がモデル出力を比較・評価するプロセスを効率化する方法が解説されている。
キーポイント
ペア評価手法の導入
LangSmith を活用して、異なるモデルやプロンプトの出力を並列で比較する「ペア評価」アプローチが紹介される。
開発プロセスの効率化
従来の単一評価ではなく比較評価を行うことで、開発者が最適なモデル設定を見極める時間を短縮し、品質向上を図る手法が解説されている。
実用的な評価ワークフロー
具体的なツール操作やワークフローを通じて、定量的・定性的なフィードバックを統合した評価システムの実装方法が示唆される。
影響分析・編集コメントを表示
影響分析
この記事は、LLM アプリケーション開発現場において、モデル選定やプロンプト調整の判断基準を客観化する具体的な手段を提供する点で実用的価値が高い。LangSmith の機能強化により、大規模な評価タスクがより体系的かつ効率的に行えるようになり、開発者の生産性向上に寄与すると考えられる。
編集コメント
LLM アプリ開発の品質保証において、直感的な比較評価機能は不可欠であり、LangSmith のこのアップデートは現場の開発フローを大きく改善する可能性があります。

モデル出力の評価は、大規模言語モデル(LLM)アプリケーション開発における最も重要な課題の一つです。しかし、チャットや文章作成など多くのタスクにおける人間の嗜好を、一連のルールとして記述することは困難です。その代わりに、複数の候補となる LLM の回答に対するペアワイズ評価(pairwise evaluation)は、LLM に人間の嗜好を教えるためのより効果的な方法となり得ます。
以下では、ペアワイズ評価とは何か、なぜそれが必要なのか、そして LangSmith の最新のペアワイズ評価器を LLM アプリ開発ワークフローでどのように使用するかの実践例について解説します。
ペアワイズ評価の起源
ペアワイズ評価は、LLM モデルのパフォーマンスに関するテストやベンチマークの議論において、重要な役割を果たし始めています。例えば、人間のフィードバックからの強化学習(i.e. RLHF)は、LLM のアライメントにおいてペアワイズ評価の概念を採用しています。人間のトレーナーには、同じ入力に対する LLM の回答のペアが提示され、特定の基準(例えば、有用性、情報量、安全性など)によりよく合致している方を選択します。
最も人気のある LLM ベンチマークの一つである Chatbot Arena も、このアイデアを採用しています:特定のユーザープロンプトに対して、2 つの匿名の LLM 生成結果を提示し、ユーザーにどちらが優れているかを選んでもらう仕組みです。Chatbot Arena はペアワイズ評価のために人間のフィードバックに依存していますが、LLM-as-a-judge を用いて 人間の嗜好を予測 し、このペアワイズ評価プロセスを自動化することも可能です。
公共ベンチマークや LLM のアライメントにおいて人気が高いにもかかわらず、多くのユーザーはカスタムペアワイズ評価を使用して自身の LLM アプリケーションを改善する方法を知りません。この課題を踏まえ、LangSmith にペアワイズ評価機能を新設しました。
LangSmith におけるペアワイズ評価器
LangSmith のペアワイズ評価機能では、ユーザーが (1) 任意の基準を用いてカスタムの LLM-as-judge 評価器を定義し、(2) この評価器を使用して 2 つの LLM 生成結果を比較することができます。比較対象となるランを選択する代わりに、「Datasets and Testing」タブをクリックすると、「Pairwise Experiments」という新しいサブヘッダーが表示されます。
これは従来の「比較ビュー」とどう違うのか?
ここで疑問に思う方もいるかもしれません。「これは従来の『比較ビュー』とどう違うのでしょうか?」
もし見逃された方がいれば、数週間前に 回帰テスト 用の改善された比較ビューをリリースしました。これにより、2 つの実行を比較して回帰を検出できます。ペアワイズ評価も同様の目的を持っていますが、実装方法は大きく異なります。
以前の比較ビューでは、各実行を個別に評価した後にスコアを比較していました。例えば、1 から 10 のスケールで各実行に独立してグレードを与え、一方の実行が他方よりも高いグレードを得たケースを探すというものです。
ペアワイズ評価は結果を同時に見ます。これにより、2 つの結果を明示的に比較する評価器を定義できます。その後、そのペアに対してスコアが付与されます。各実行を個別に採点するわけではありません。
ペアワイズ評価を使用するのはどのような場合か?
この機能の動機づけとして、こちら の動画では、コンテンツ生成に関連する一般的なユースケースが紹介されています。この例では、LLM に学術論文を要約した魅力的なツイートを作成させたいと考えています。10 冊の異なる論文を例として含むデータセットを構築し (こちら)、4 つの異なる LLM から要約を生成しました。
LLM に生成させるべき単一の「正解」となる論文要約が存在しないため、criteria evaluator を使用し、この 評価プロンプトを用いて、絵文字の使用や魅力的なタイトルなどの 5 つの基準に基づき、要約されたツイートを 1(最悪)から 5(最良)まで採点しました。

この要約エンゲージメントスコア(summary_engagement_score)は、以下に示すようにデータセット内に記録されます。

しかし、これですぐに問題が浮き彫りになります。4 つの LLM のうち 3 つが、要約エンゲージメントスコアで満点を獲得しており、それらの間に差が見られません。単独で評価するだけでは、各 LLM を区別できる基準 evaluator を定義することが困難です。しかし、ペアワイズ評価(pairwise evaluation)は、この課題に取り組むための代替手段となります。
カスタムペアワイズ評価の使用
動画(ドキュメントはこちら)で示されている通り、LangSmith SDK ではカスタムペアワイズ評価器を使用し、LangSmith UI でペアワイズ評価の結果を可視化します。上記の問題に適用するには、まず、関心のある基準(例:タイトルや箇条書きなどに基づいて、2 つのツイート要約のうちどちらがより魅力的か)をエンコードしたペアワイズ評価プロンプトを定義します。その後、すでにデータセット上で実行済みの任意の 2 つの実験に対して、カスタム評価器 evaluate_pairwise を単に実行するだけです(使用した完全なコードはこちらをご覧ください)。
from langsmith.evaluation import evaluate_comparative
evaluate_comparative(
["summary-cmd-r-f692a55c", "summary-opus-21590361"],
evaluators=[evaluate_pairwise],
)
UI では、その後、データセットの「ペアワイズ実験」タブにすべてのペアワイズ評価の結果が表示されます。重要なのは、ペアワイズ評価では特定の LLM に対して明確な選好が示される一方で、単独基準評価ではほとんど差別化が見られない点です。

この UI を使用すると、各ペアワイズ実験(pairwise experiment)に詳しく入り込むことができ、私たちの基準に基づいてどの LLM 生成物が優先されるかを示します(列の上部には色と親指のアイコンが表示されます)。各回答の下にあるランク付けスコア(ranked_preference score)をクリックすることで、各評価トレース(evaluation trace)をさらに詳細に確認できます(例はこちら)。これにより、ランク付けの理由が説明されます(これは私たちのプロンプトで定義された通りです)。

結論
テキスト生成やチャットなど、多くの LLM のユースケースでは、評価に使用できる単一の特定の「正解」が存在しません。このような場合、人間または LLM が優先される回答を選択するペアワイズ評価は、非常に強力なアプローチです。
今回のブログ記事では、ツイート要約生成の評価という曖昧なタスクにおいてテストを行った方法と、単独の評価基準の欠点を明らかにしました。私たちの カスタムペアワイズ評価器 を用いることで、生成結果を直接互いに比較し、モデル間の明確な好みを浮き彫りにすることができました。
さらに詳しく知りたい方は、ペアワイズ評価に関する 動画 や ドキュメント をご覧ください。また、プロンプトのバージョン管理、デバッグ、人間の注釈をサポートした堅牢な実験と評価のために、今日から LangSmith の利用を開始 できます。これにより、LLM アプリケーションの開発中に本番環境での観測性を獲得することができます。
関連コンテンツ

LangSmith
コーディングエージェントの予測可能な動作を実現した方法

Martha Janicki
2026 年 6 月 15 日
分

LangSmith
エージェントに最適なサンドボックスを選ぶ方法

Rahul Verma
2026 年 6 月 12 日
分

LangSmith
エージェントに専用のコンピューターを与えよう

Amy Ru
2026 年 6 月 5 日
7
分
エージェントが実際に何をしているかを確認する
LangSmith は、エージェントエンジニアリングプラットフォームであり、開発者がすべてのエージェントの意思決定をデバッグし、評価の変更を行い、ワンクリックでデプロイできるように支援します。
原文を表示

Evaluating model outputs is one of the most important challenges in LLM application development. But human preference for many tasks (e.g., chat or writing) is difficult to encode in a set of rules. Instead, pairwise evaluation of multiple candidate LLM answers can be a more effective way to teach LLMs human preference.
Below, we explain what pairwise evaluation is, why you might need it, and present a walk-through example of how to use LangSmith’s latest pairwise evaluators in your LLM-app development workflow.
The origin of pairwise evaluation
Pairwise evaluation has started to play an important role in conversations on testing and benchmarking LLM model performance. For example, reinforcement learning from human feedback (i.e. RLHF) employs the concept of pairwise evaluation in LLM alignment. Human trainers are presented with pairs of LLM responses for the same input and select which one better aligns with certain criteria (e.g., helpfulness, informativeness, or safety).
One of the most popular LLM benchmarks, Chatbot Arena, also employs this idea: it presents two anonymous LLM generations for a given user prompt and allows the user to pick the better one. While the Chatbot Arena relies on human feedback for pairwise evaluation, it’s also possible to use LLM-as-a-judge to predict human preference and automate this pairwise evaluation process.
Despite its popularity in public benchmarking and LLM alignment, many users may not know how to use custom pairwise evaluation to improve their LLM applications. With this limitation in mind, we’ve added pairwise evaluation as a new feature in LangSmith.
Pairwise evaluators in LangSmith
LangSmith’s pairwise evaluation allows the user to (1) define a custom pairwise LLM-as-judge evaluator using any desired criteria and (2) compare two LLM generations using this evaluator. Instead of selecting runs to compare, you'll see a new sub-header called "Pairwise Experiments" when you click on the "Datasets and Testing" tab.
How is this different than the comparison view?
One question you may be asking is "how is this different than comparison view?"
In case you missed it, a few weeks ago we released an improved comparison view for regression testing. This allows you to compare two runs and identify regressions. Pairwise evaluation is similar in goal, but markedly different in implemention.
In the previous comparison view, you would evaluate each run individually and then compare the scores. For example, you would give each run a grade on a scale of 1-10 (independently) and then look for cases where one run got a higher grade than another.
Pairwise evaluation looks at the results at the same time. This allows you to define an evaluator that explicitly compares the two results. You then get a score for that pair. It is not scoring each run individually.
When might you use pairwise evaluation?
To motivate this feature, this video shows a common use-case related to content generation. In this example, we want an LLM to produce engaging Tweets summarizing academic papers. We built a dataset with 10 different papers as example (here) and generated summaries from 4 different LLMs.
Because there is no single “ground truth” paper summary that we want an LLM to generate, we used a criteria evaluator with this evaluation prompt to grade the summary Tweet from 1 (worst) to 5 (best) based upon 5 criteria (e.g., use of emojis, engaging title, etc).

We capture this summary_engagement_score in the dataset, as shown below.

However, this immediately highlights a problem: 3 of the 4 LLMs all have a perfect score on our summary_engagement_score, with no differentiation between them. In isolation, it can be difficult to define a criteria evaluator that distinguishes between the various LLMs. However, pairwise evaluation presents an alternative way to approach this challenge.
Using Custom Pairwise Evaluation
As shown in the video (docs here), we use custom pairwise evaluators in the LangSmith SDK and visualize the results of pairwise evaluations in the LangSmith UI. To apply these to the problem mentioned above, we first define a pairwise evaluation prompt that encodes the criteria we care about (e.g., which of the two Tweet summaries is more engaging based on the title, bullet points, etc). We then simply run our custom evaluator, evaluate_pairwise, on any two experiments that have been already run on our dataset (see full code used here).
from langsmith.evaluation import evaluate_comparative
evaluate_comparative(
["summary-cmd-r-f692a55c", "summary-opus-21590361"],
evaluators=[evaluate_pairwise],
)In the UI, we will then see the results of all pairwise evaluation in the Pairwise Experiments tab of our Dataset. Importantly, we see that pairwise evaluation shows clear preference for certain LLMs over others – unlike the stand-alone criteria evaluation, which shows little discrimination.

The UIallows us to dive into each pairwise experiment, showing which LLM generation is preferred based upon our criteria (with color and thumbs at the top of the column). By clicking on the ranked_preference score under each answer, we can drill further into each evaluation trace (see example here), which provides an explanation for the ranking (as defined in our prompt).

Conclusion
Many LLM use-cases, such as text generation or chat, don’t have a single or specific “correct” answer for use in evaluation. In these cases, pairwise evaluation with a human or LLM picking the preferred response is a powerful approach.
In this blog post, we showed how we were able to test on an ambiguous task of evaluating Tweet summary generation and revealed the shortcomings of a stand-alone evaluation criteria. Our custom pairwise evaluator allowed us to directly compare our generations against each other, highlighting a clear preference between models.
To dive deeper, check out our video and documentation on pairwise evaluation. And you can try out LangSmith today for robust experimentation and evaluation, with support for prompt versioning, debugging, and human annotations — so you can gain production observability as you build your LLM-apps.
Related content

LangSmith
How We Made Coding Agent Spend Predictable

Martha Janicki
June 15, 2026
min

LangSmith
How to Choose the Right Sandbox for Your Agent

Rahul Verma
June 12, 2026
min

LangSmith
Give your agent its own computer

Amy Ru
June 5, 2026
7
min
See what your agent is really doing
LangSmith, our agent engineering platform, helps developers debug every agent decision, eval changes, and deploy in one click.
関連記事
Fireworks を活用した 100 倍安価なトレース判定器の構築
LangChain が Fireworks の技術を活用し、従来の 100 分の 1 のコストで動作するトレース判定器を開発したと発表した。
Align Evals の紹介:LLM アプリケーション評価の効率化
LangChain が、大規模言語モデル(LLM)を用いたアプリケーションの評価プロセスを簡素化する新ツール「Align Evals」を発表した。
LangChain がコーディングエージェントの予測可能性を高める方法
LangChain は、コーディングエージェントがより予測可能な動作を行うための手法を開発・実装した。これにより、開発プロセスにおけるエージェントの挙動制御が可能となった。
今日のまとめ
AI日報で今日の重要ニュースをまとめ読み