評価駆動開発による大規模言語モデルの信頼性向上への試行錯誤
Dosu の CEO が、確率的な LLM を基盤とする製品で信頼性を確保するために、LangSmith を活用した評価駆動型開発(EDD)の導入と実践事例を詳述している。
キーポイント
LLM 製品の信頼性課題と EDD の必要性
確率的な関数で動作する LLM プロダクトにおいて、従来の開発手法では信頼性の確保が困難であり、変更ごとの影響を把握するための評価駆動型開発(EDD)が不可欠である。
Dosu の開発背景と維持者の負担
オープンソースプロジェクトのメンテナとしての経験から、サポート業務の増加によるバーンアウトや issue 対応の遅延という課題を解決すべく、AI ティームメイト「Dosu」が構築された。
LangSmith を活用した EDD のスケーリング
LangChain の LangSmith を用いることで、ユーザー活動のモニタリングと検索を容易にし、変更ごとの影響評価を自動化・スケールさせることに成功し、自信を持ってリリースできる体制を整えた。
継続的改善によるプロダクト成熟
EDD の導入により、開発サイクルの中で継続的に検証と改善を行い、確率的な挙動を持つシステムでも生産レベルの信頼性を達成するアプローチが示された。
影響分析・編集コメントを表示
影響分析
この記事は、LLM アプリケーション開発における「ブラックボックス化」への懸念に対する具体的な解決策として、EDD の実践例を提供しています。特に LangSmith ツールチェーンを活用したアプローチは、開発者が確率的な挙動を定量的に評価し、信頼性の高いプロダクトを迅速にリリースするための標準的なプラクティスとして業界に浸透する可能性があります。
編集コメント
LLM の非確定的な性質を克服するための具体的な開発手法として、EDD と LangSmith の連携事例が示されており、実務家にとって非常に示唆に富む内容です。
*編集者注:以下は、Dosu の CEOであるDevin Stein氏によるゲストブログ記事です。* *Dosu は、ソフトウェアの開発、保守、サポートを支援するエンジニアリングチームメイトです。*
この時点で広く知られているように、本番環境で動作する LLM 製品の構築は困難です。信頼性はあらゆる製品が成功するために不可欠ですが、あなたの製品が一連の確率的関数によって支えられている場合、信頼性を確保することは決して単純ではありません。
Dosu では、私たちは継続的に製品を改善しています。私たちが行うすべての変更について、エンドユーザーへの影響を理解する必要があります。評価駆動型開発(Evaluation Driven Development: EDD)により、私たちは自信を持ってリリースを行うことができます。過去数ヶ月の間、LangSmith はDosu の活動を容易に監視・検索できるようにすることで、EDD のスケーリングを可能にしました。
Dosu とは何か?
LangChain の GitHub リポジトリで時間を過ごしたことがある方なら、すでにDosuにお会いになっているかもしれません。Dosu は、ソフトウェアプロジェクトの開発、保守、サポートを支援する AI チームメイトです。
Dosu は、私がオープンソースソフトウェアのメンテナとして過ごした時間から生まれました。これはやりがいのある役割ですが、 notoriously 時間がかかることで知られています。私の OSS プロジェクトが人気を集めるにつれ、私は新機能の開発よりもサポート業務に多くの時間を費やすようになってしまいました。
メンテナーにとって、この責任は頻繁にバーンアウトを引き起こし、一部の人がイシューの破産宣言を行うに至っています。これは、すべてのオープンなイシューとプルリクエストを単にクローズするプロセスです。OSS コミュニティもこの状況に苦しんでおり、人々はメンテナーが自分のイシューに応答するまで、数日、数週間、あるいは数ヶ月も待たされることがよくあります。
この現象はオープンソースに限ったことではありません。業界内では、開発者の時間の最大 85% が、アドホックな質問への回答、イシューのトリアージ、オーバーヘッド処理など、コーディング以外のタスクに費やされています。
Dosu はこれらのタスクを開発者の負担から取り除き、彼らが愛することに集中できるようにします。つまり、フロー状態を維持し、コードを書き、素晴らしい機能をリリースすることです。同時に、Dosu は OSS コミュニティにとってのリソースとなり、予期せぬ問題に直面したり、コードでしか答えられない新しい質問があったりする際に、コミュニティメンバーに即座にフィードバックを提供します。
初期の頃
Dosu は 2023 年 6 月末にローンチされました。当時、私たちの処理量は低く、すべての応答を一つずつ確認することができました。grep と print ステートメントのみを武器に、毎日丹念にログを検索し、改善すべき領域を特定していました。
この作業は骨の折れるものでしたが、Dosu のアーキテクチャを設計・開発する上で重要な役割を果たしました。これにより、私たちのチームは人々がどのように Dosu を利用しようとしているか、どの種類のリクエストに対して卓越した性能を発揮するか、またどこで不足しているかを深く理解することができました。
何を改善すべきかがわかった後、次なる課題は「どう改善するか」でした。従来のコード更新とは異なり、LLM のロジックを変更するのは単純ではありません。小さな変更が全体のパフォーマンスにどのような影響を与えるかを知ることは困難です。多くの場合、プロンプトをわずかに調整した結果、あるドメインでは結果が向上する一方で、別のドメインでは性能が後退するという現象が見られました。
私たちは変更の影響を測定する方法が必要でした。あらゆる変更に対して、以下のことを確実に実行したかったのです:
- すでに良好なパフォーマンスを発揮している領域での性能を維持すること
- 苦戦している領域での性能を向上させること
これらの初期の時期に、進捗をベンチマークするために評価駆動型開発(Evaluation Driven Development)へと舵を切りました。
評価駆動型開発
評価駆動型開発(EDD)は、テスト駆動型開発と同様に、開発に向けた明確なゴールを提供します。評価、あるいは「evals」と呼ばれるものは、更新や新機能を理解するための基準となります。EDD は、Dosu のコアロジック、モデル、またはプロンプトに対して行うあらゆる変更の影響を理解するのに役立ちます。
EDD を用いることで、Dosu を改善するための明確に定義されたプロセスが確立されます:
- 初期評価数少ない新しい挙動を作成
- 新しい挙動をユーザーに展開
- 本番環境での結果を監視し、失敗モードを特定
- 各失敗モードに対応する例をオフライン評価に追加
- 更新された評価に基づいて反復し、パフォーマンスを向上
- 再展開して繰り返し
この開発ワークフローは Dosu が始まった頃はうまく機能していましたが、利用が増えるにつれて、Dosu の活動に対応することが困難になりました。
スケールしても品質基準を高く保つ
現在、Dosu は数千のリポジトリにインストールされ、一日中いつでもレスポンスを生成しています。私たちは異なる種類のシナリオを知的に処理するために数十のサブモジュールを構築し、モデルや分野の研究が進化するにつれて問題解決のアプローチを絶えず改善しています。
Dosu の成長は興奮すべきものでしたが、同時に課題も伴いました。Dosu の活動増加により、本番環境でのレスポンス監視と失敗モードの特定がほぼ不可能になり、これは私たちの EDD(評価駆動開発)ワークフローにおいて極めて重要な要素です。
私たちは LLM モニタリングスタックをアップグレードする時期だと判断しました。Dosu の活動を監視できるだけでなく、既存のワークフローに柔軟に組み込めるツールを探しました。いくつかの基準には以下が含まれます:
- プロンプトは Git に保存すべきです — EDD の理念において、プロンプトはコードとして扱われます。プロンプトに対するあらゆる変更は、コードの変更と同じ基準で扱う必要があります。
- コードレベルでのトレーシング — Dosu は単なる LLM リクエストの連続ではありません。単一のトレーシング内における LLM リクエスト間のメタデータを追跡したかったのです。
- データのエクスポートが容易 — 既存の評価用データセットとツールリングを維持したかったので、そのための機能が必要でした。
- カスタマイズ性と拡張性 — LLM の分野は急速に進化しています。LLM アプリケーションを構築する標準的な方法は存在しません。どのメタデータを追跡するかを制御し、ニーズに合わせてツールを調整できる能力を求めていました。
私たちは LLM モニタリングと評価 の状況を調査し、要件を満たす製品を探しました。初期パートナーの一つである LangChain チームとの通話後、LangSmith がすべての条件を満たしていることを聞き、大変喜ばしく思いました。
SDK を介した LangSmith の実装
私たちが LangSmith に最も興奮したのは、その洗練された UI や豊富な機能セットではなく、実はその SDK でした。LangSmith SDK は、私たちが求めていた細粒度の制御とカスタマイズ性を提供してくれました。
LangSmith を試すには、LLM 関連の関数数個に @traceable デコレータを追加するだけで十分でした。インストゥルメンテーション(計装)にはわずか数分しかかからず、これらの変更を本番環境にプッシュした直後に、トレーシングが LangSmith UI に殺到しているのを確認できました。

@traceable デコレータの予期せぬ素晴らしい機能の一つは、関数と LLM(大規模言語モデル)呼び出しのトレースを LangSmith に送信できる点です。これにより、LangSmith UI 上で単一のトレース内に、生の関数入力、レンダリングされたプロンプトテンプレート、および LLM の出力をすべて確認できるようになります。

標準設定のままでも、LangSmith は Dosu のすべての活動に対する可視性を提供してくれました。次のステップは、LangSmith を活用して失敗モードを特定し、EDD(評価駆動開発)ワークフローに統合することです。
失敗の発見
Dosu はユーザーから多様なリクエストを受信します。コードベースに関する単純な質問から、新しいライブラリバージョンへのアップグレードに伴うエラートレース、機能の状態についての問い合わせまで、その範囲は広範です。Dosu に対する入力の可能性が増えるほど、失敗モードの可能性も増大します。
失敗モード、あるいは Dosu がうまく処理できていないリクエストを特定しようとする際、以下のようなさまざまなシグナルを確認する手段があります:
- 明示的フィードバック:ChatGPT が普及させた、古典的な「いいね」「よくないね」の形式によるフィードバック。
- ユーザーの感情:GitHub のイシューでユーザーが Dosu と対話する際、その反応から Dosu が役立ったかどうかを通常は把握できます。
- 内部エラー:LLM はさまざまな理由で失敗することがあります。入力または出力が大きすぎたのでしょうか?生成された応答が期待されるスキーマと一致しなかったのでしょうか?
- レスポンス時間:Dosu では品質を速度よりも優先していますが、なぜ応答が遅いのかを理解することは重要です。一部の要求には高速な応答が必要ですが、他の要求には低速でもより正確な応答が必要です。
LangSmith の高度な検索機能により、異常な挙動を簡単に特定できます。明示的なユーザーフィードバック、直近のエラー発生事例、応答時間の遅延、否定的な感情など、さまざまな基準を用いて検索を実行可能です。また、LangSmith を使用すれば、各トレースに追加のメタデータを付与して、検索機能をさらに拡張することもできます。

すでに、多くの予期せぬ障害モードを特定しています。例えば、ユーザーが数千行にわたるログや、OpenAI の埋め込みベクトルの生の浮動小数点値を共有した際に、極めて遅い応答が発生するパターンを発見しました。
チームのメンバーが最も好きな失敗事例の一つは、Dosu にプルリクエストのラベル付けを依頼した際のことでした。Dosu はプルリクエストにラベルを付ける代わりに、その夜行くことに興奮しているコンサートのことをユーザーに伝えようとしたのです。Dosu がスウィフト(Taylor Swift の熱烈なファン)なのかどうかについては、まだ結論が出ていません。

一度失敗モード(エラーの発生パターン)を見つけると、評価駆動型開発(Evaluation Driven Development: EDD)のワークフローは以前と同じです。
- LangSmith で追加の事例を検索する
- 評価用データセットにそれらを追加する
- 評価結果に対して反復改善を行う
- Dosu の新バージョンをリリースし、これを繰り返す
評価用データセット収集の自動化
Dosu における評価駆動型開発(EDD)の未来は明るいです。私たちのチームは、本番環境からのトラフィックから自動的に評価用データセットを構築できるようにするために、LangSmith をさらにカスタマイズしています。エンジニアが会話トピック、ユーザーセグメント、リクエストカテゴリなどに基づいてデータセットをキュレーションできる限りシンプルであることが望まれています。
Dosu と LangChain の協力関係には、面白いフライングホイール効果(好循環)があります。LangSmith は Dosu のパフォーマンス向上のために反復開発を迅速化します。Dosu への改善は直接的に、LangChain チームのメンテナンスおよびサポート負担の軽減につながり、彼らが LangSmith 向けの新機能の開発により多くの時間を割けるようになります。その結果、Dosu の開発スピードがさらに加速します。そしてこのプロセスは続くのです!
PS: Dosu で採用募集中です!jobs*@dosu.dev* までお問い合わせください。
原文を表示
*Editor's Note: the following is a guest blog post from the Devin Stein, CEO of *Dosu*.* *Dosu is an engineering teammate that helps you develop, maintain, and support software.*
It’s well known at this point that building production-grade LLM products is hard. Reliability is critical for any product to succeed, but when your product is underpinned by a series of probabilistic functions, ensuring reliability is far from straightforward.
At Dosu, we are continuously iterating on our product. For every change we make, we need to understand it’s impact on end users. Evaluation driven development (EDD) allow us to ship with confidence. Over the last few months, LangSmith has allowed us to scale EDD by enabling us to easily monitor and search Dosu’s activity.
What is Dosu?
If you’ve spent any time on the LangChain GitHub repository, you may have already met Dosu, an AI teammate that helps develop, maintain, and support software projects.
Dosu was born out of my time as an open source software maintainer, a rewarding, but notoriously time-consuming role. As my OSS project grew in popularity, I found myself spending far more time playing support instead of developing new features.
For maintainers, this responsibility frequently causes burnout and has driven some to declare issue bankruptcy, a process that involves simply closing all open issues and PRs. The OSS community also suffers from this situation, as people often wait days, weeks, or even months for a maintainer to respond to their issues.
This phenomenon isn’t exclusive to open source. Within the industry, up to 85% of developers’ time is spent on non-coding tasks, like answering ad-hoc questions, triaging issues, and processing overhead.
Dosu takes these tasks off developers’ plates, so they can do what they love: stay in flow, code, and ship great features. At the same time, Dosu is a resource to the OSS community, giving community members immediate feedback whenever they run into an unforeseen issue or have novel questions that only code can answer.
Early Days
Dosu launched in late June, 2023. Back then, our volume was low enough for us to inspect every single response. Each day, armed with just grep and print statements, we meticulously combed through logs to identify areas for improvement.
The work was painstaking, but it was important for designing and developing Dosu's architecture. It helped our team deeply understand how people were trying to use Dosu, which types of requests it excelled at, and ones where it fell short.
Once we knew what we needed to improve, the question was how to improve it. Unlike traditional code updates, changing LLM logic is not straightforward. It’s difficult to know how a small change might affect performance as a whole. Many times we saw that a slight tweak to a prompt led to better results in one domain but caused regression in another.
We needed a way to measure the impact of our changes. For every change, we wanted to make sure that we were:
- Maintaining performance in areas where we were doing well
- Improving performance in areas where we were struggling
It was during these early days that we turned to evaluation driven development to benchmark our progress.
Evaluation Driven Development
Evaluation driven development (EDD), like test driven development, gives us end goal to develop against. The evaluations — or “evals” — are our baseline for understanding updates and new functionality. EDD helps us understand the impact of any change we make to Dosu’s core logic, models, or prompts.
With EDD, we have a well-defined process for improving Dosu:
- Create a new behavior with a handful of initial evals
- Launch the new behavior to users
- Monitor results in production and identify failure modes
- Add examples for each failure mode to our offline evals
- Iterate on the updated evals to improve performance
- Relaunch & repeat
This development workflow worked well for us when Dosu started, but as our usage grew, it became difficult to keep up with Dosu’s activity.
Keeping the Quality Bar High at Scale
Today, Dosu is installed on thousands of repositories and generates responses at all hours of the day. We’ve built dozens of submodules to intelligently handle different types of scenarios, and we’re constantly iterating on our approach to problem solving as models and the research in the field evolve.
While the growth of Dosu was exciting, it came with challenges. Dosu’s increased activity made it nearly impossible to monitor responses and identify failure modes in production, which is critical to our EDD workflow.
We decided it was time to upgrade our LLM monitoring stack. We looked for a tool that could not only help us monitor Dosu’s activity, but that was flexible enough to fit into our existing workflow. Some of our criteria included:
- Prompts must live in Git — In the ethos of EDD, we treat prompts as code. Any changes to a prompt must be treated with the same standards as code changes.
- Code-level tracing — There is more to Dosu than a series of LLM requests. We wanted to track metadata between LLM requests within a single trace.
- Easy to export data — We had existing evaluation datasets and tooling that we wanted keep.
- Customizable and extensible - The LLM space is rapidly evolving. There is no standard way of building LLM apps. We wanted to have control over what metadata is tracked and the ability tailor the tool to meet our needs.
We explored the LLM monitoring and evaluation landscape, trying to find a product that satisfied our requirements. After a call with the LangChain team, one of our early partners, we were pleased to hear that LangSmith seemed to check all the boxes.
Implementing LangSmith via the SDK
What got us most excited about LangSmith wasn’t its sleek UI or extensive feature set, but actually its SDK. The LangSmith SDK gave us the fine-grain controls and customizability we were looking for.
To try out LangSmith, we just had to add a @traceable decorator to a few of our LLM-related functions. It only took us minutes to instrument, and immediately upon pushing these changes to production we saw traces flooding into the LangSmith UI.

An unexpectedly awesome feature of the @traceable decorator is it can send the function *and* LLM call traces to LangSmith. This allows us to see the raw function inputs, rendered prompt templates, and LLM output all in a single trace in the LangSmith UI.

Out-of-the-box, LangSmith gave us visibility into all of Dosu’s activity. The next step was to leverage LangSmith to identify failure modes and integrate it into our EDD workflow.
Finding Failures
Dosu receives a myriad of requests from users—everything from simple questions about a codebase, to error traces from upgrading to a new library version, to asking about the status of a feature. More possible inputs to Dosu means more possible failure modes.
When trying to identify failure modes, or requests that Dosu doesn’t handle well, we have a variety of signals to look for like:
- Explicit Feedback: The classic thumbs up/down feedback popularized by ChatGPT.
- User Sentiment: When users interact with Dosu on GitHub issues, their responses usually show whether or not Dosu was helpful
- Internal Errors: LLMs can fail for a number of reasons. Was the input or output too large? Did the generated response not match the desired schema?
- Response Time: At Dosu, we prioritize quality over speed; however, understanding why a response is slow matters. Some requests require a fast response, while others require a slower, but more precise response.
LangSmith's advanced search functionality makes it easy to identify anomalous behaviors. We can perform searches using a range of criteria, including: explicit user feedback, recent error incidents, response time delays, or negative sentiment. LangSmith also allows us to attach additional metadata to each trace to further extend its search capabilities.

Already, we’ve identified a number of unforeseen failure modes. For example, we found a pattern of extremely slow responses when users would share thousands of lines of logs or the raw float values of an OpenAI embedding.
One of our team’s favorite failures happened when Dosu was asked to label a pull request. Rather than labeling the pull request, Dosu decided it should tell the user about the concert it was excited to go to the concert that night. Jury is still out on whether Dosu is a Swiftie.

Once we find a failure mode, the EDD workflow is the same as before.
- We search LangSmith for additional examples
- Add them to our eval datasets
- Iterate against the evals
- Push a new version of Dosu, and repeat.
Automating Evaluation Dataset Collection
The future of evaluation driven development at Dosu is bright. Our team is customizing LangSmith even further to allow us to automatically build evaluation datasets from production traffic. We want it to be as simples as possible for engineers at Dosu to curate datasets based on conversation topics, user segments, request categories, and more.
There is a fun flywheel effect in Dosu’s collaboration with LangChain. LangSmith helps us iterate faster to improve Dosu’s performance. Improvements to Dosu directly translates to reducing the maintenance and support burden on the LangChain team, allowing them to spend more time shipping features for LangSmith, which in turn speeds up the development of Dosu. And so the process continues!
PS: Dosu’s hiring! Reach out at jobs*@dosu.dev*
関連記事
アリババのページエージェント:DOM を介して自然言語で Web インターフェースを制御する JavaScript 内蔵 GUI エージェント
大規模モジュラー LLM:デンマーク基盤モデルプロジェクトが FlexOlmo を活用し、機密データを共有せずに専門知識を集約する方法
美团发布长猫 2.0:1.6 兆パラメータのオープン MoE モデルがネイティブ 100 万トークンコンテキストと長猫スパースアテンションを実現
今日のまとめ
AI日報で今日の重要ニュースをまとめ読み