記事一覧へ
著: Muratcan Koylan & Amit Kumthekar
掲載先: https://www.sully.ai/research/context-engineering-over-iteration
臨床AIシステムがエラーを犯したとき、そのコストは臨床医の時間で計られる。でっち上げられた薬剤名や誤った発言者の帰属は、臨床医が見つけて修正しなければならない。15分の診察では見直しの余裕は薄い。出力を一行ずつ監査する必要があるなら、どんなに素早く画面に表示されようと、そのシステムは失敗している。
これによって、精度がプロダクション段階での臨床AIの一次設計制約となる。速度も重要だが、それは臨床ワークフロー特有の理由による。診療件数の多いクリニックでは、臨床医は少ない移行時間で診察を移り渡り、診察終了60秒後に届く文書は次の患者への注意と競合する。入院診療では、適切なタイミングでの文書作成がケアコーディネーションに直接影響する——専門医のアセスメントはプライマリチームの回診前に参照できる状態でなければならないし、救急現場での引き継ぎ文書は患者安全に直接影響する。速度は臨床要件だ。しかし精度のない速度は、遅くても正確なものより悪い。
多くの臨床AIシステムはこのどちらか一方しか達成できていない。最も一般的なアプローチはシングルモデル呼び出しだ:プロンプト1つ、1パス、返ってきたものを受け入れる。速い。でも信頼性がない。モデルは薬剤をでっち上げ、発言者を誤って帰属し、セクション全体を欠落させる。臨床医はすぐに出力を信頼できないと学ぶ。
2つ目のアプローチはセーフティネットを追加する。ドラフトを生成し、ジャッジモデルでエラーを見つけ、違反を修正エージェントに送り、ジャッジが通るまで繰り返す。このパターンは、精度を重視するほとんどのプロダクションシステムに様々な形で存在する。私たちのシステムでも、このループは実際の問題を捕捉していた。ループを完全に除去した対照アブレーションを実施すると、臨床的次元全体で出力品質が11%低下した(内部評価スケールで3.17→2.85、n=126対n=114)。最大の低下は臨床安全性(+0.58)と根拠推論(+0.54)で、これらはエラーが最も高い臨床リスクをもたらす次元だ。ループは本物の臨床的役割を果たしていた。しかし各修正サイクルはシリアル計算に10〜15秒を要し、ループはパイプライン全体の半分以上の時間を消費していた。
私たちはループの品質と速度を同時に改善しようと何ヶ月も費やした。小型のジャッジモデル。よりタイトなプロンプト。反復回数の削減。改善は限界的だった。問題はループの速度ではなかった。問題は、ループが必要だったことそのものだった。
私たちが問い始めた質問:なぜ最初のパスは信頼性がないのか?
私たちの仮説は、弱い最初のパスはモデルの能力問題ではなかった、ということだ。タスク設計の問題だった。完全な臨床文書を生成する単一モデルは、同時に6〜8個の認知タスクをこなしている:長い書き起こしを解析する、情報を正しいセクションにルーティングする、セクション固有の文書化ルールを適用する、専門科ロジックを処理する、でっち上げを避ける、複雑なスキーマに一致する構造化出力を生成する。1つのモデルがこれらすべてを同時にこなすと、個々のタスクの精度が低下する。修正ループはその過負荷コンテキストを補償するために存在する。
これが以降のすべての形を決めた発見だ:コンテキストエンジニアリングと反復は補完関係ではなく、代替関係にある。複雑なタスクを焦点を絞ったサブタスクに分解すると、各コンポーネントは根本的に狭いコンテキストを見る。モデルは8つではなく1つのことをする。最初のパスが信頼性を持つようになる。修正ループは不要になる。そして焦点を絞ったコンポーネントは並列実行できるので、アーキテクチャは正確であることの構造的帰結として速い——その逆ではない。
私たちはこれを、各自が文書の狭いスライスを担当し、タスクに関連するコンテキストだけを見る並列専門コンポーネントを中心にパイプラインを再構築することでテストした。1回の品質チェックが反復ループに取って代わった。
10万件以上のプロダクション事例全体で、品質は維持または改善された:各コンポーネントの最初のパスは、過負荷アプローチが生成したものより正確だった。レイテンシはp50で37秒から7.5秒に、p95では100秒超から16.3秒に低下した。速いモデルを見つけたからではなく、パイプラインを遅くしていたアーキテクチャパターンを排除したからだ。
この発見はクリニカルドキュメンテーション以外にも拡張できる。出力が独立してアドレス可能なセクションを持ち、入力が注意を希薄化するほど長い構造化生成タスクなら、コンテキストエンジニアリングは反復修正より効果的なレバーだ。もしシステムに修正ループがあるなら、そのループが過負荷コンテキストを補償しているのではないか問うてみよう。
■ モノリシックエージェントが弱い最初のパスを生む理由
単一エージェントに複雑な複数部分の出力を求めると、1つのコンテキストウィンドウ内で競合する複数の認知タスクをこなさなければならない。1つのプロンプトに詰め込む目標が多いほど、個々の目標の実行は悪化する。これは競合する要求の下でのLanguage Modelのアテンションの一般的特性であり、マルチエージェントシステム設計のあらゆる実践的帰結を持つ。私たちはこれを臨床ドキュメンテーションを通じて最も明確に学んだが、構造化生成が長い入力と出会う場所ならどこでもパターンは当てはまる。
単一モデルが臨床文書を生成するとき、実際に何をしているか考えてみよう。典型的なノートには12以上のセクションがある:患者の病歴、系統別レビュー、薬剤、身体診察所見、アセスメントと治療計画、処置・診断コード、その他。各セクションには独自の文書化ルールがある。モデルはこれらすべての指示を同時に受け取る——完全な書き起こし(しばしば数千語)、EHRからの臨床コンテキスト、安全制約、各セクションのキーを持つ出力スキーマと一緒に。
1つのプロンプトに詰め込まれた少なくとも6つの同時認知タスク:
・長い非構造化会話を解析して誰が何の問題について何を言ったか特定する
・各情報を正しいセクションにルーティングする(この症状はHPIへ、あの所見は身体診察へ、この薬剤は薬剤リストへ)
・各セクションで異なるセクション固有の文書化ルールを適用する
・専門科ロジックを処理する(内分泌科のホルモン療法文書化ルール、整形外科の術部位仕様)
・全セクション同時でっち上げを避ける
・15キーの動的スキーマに一致する構造化JSON出力を生成する
最近の研究は私たちが実践で観察したことを定量化している。256モデルのテスト全体で、指示遵守精度は200トークンの指示で92%から4,000トークンで60%に低下する(Gupta et al., 2025)。最高のフロンティアモデルでさえ、500の同時指示を遵守する際に68%の精度しか達成できない(Jaroslawicz et al., 2025)。ポストトレーニングも推論チェーンも修正しない。競合する目標下でのアテンションの動作の根本的特性だ。
ジャッジ違反にその結果を見た。ジャッジは構造化エラーレポートを返した:どのセクションに問題があったか、どのテキストが間違っていたか、修正はどうすべきか。パターンは一貫していた。書き起こしの薬剤が間違ったセクションに現れた。帰属エラーがセクション全体で複合した——患者が報告した症状が臨床医の観察として文書化されていた。ナレーティブに関連するセクション(HPIとアセスメント)が互いに矛盾していた——モデルが単一の過負荷コンテキスト内でそれらを独立して処理したからだ。
ジャッジはこれらのエラーを捕捉した。しかし私たちが予期しなかったのは:修正エージェントが頻繁に悪化させたことだ。
修正ループが実際に何をしたかを理解するために約50件のプロダクショントレースを分析した。ジャッジがフラグを立てた違反の約45%を解決した——主にICD-10コーディングエラー、セクションコンテンツの欠落、薬剤ドキュメントのギャップといった素早い修正だ。しかし元のノートに存在しなかった新しい違反をほぼ同じ率で導入した:15件の新しい臨床精度エラー、13件の新しい構造・テンプレートコンプライアンスエラー、11件の新しいアセスメントと治療計画の精度問題。完全に解決されたのはトレースの8%のみ。39%では、ノートに改善が見られなかった。
パターンは一貫していた:修正は小さく明確に定義された問題(コードの欠落、不完全なセクション)を修正し、より大きな臨床精度と構造問題を扱えなかった——または積極的に悪化させた。セクションエージェントが薬剤を省略する。ジャッジがその省略をフラグする。修正エージェントが薬剤を追加し直すが、遭遇の間違った部分に帰属させるか、書き起こしに一度も言及されなかった用量を追加する。ノートは不完全から捏造へと変わる。
言語モデルの自己修正に関する研究がこのパターンを支持する。外部フィードバックなしにモデルが自分の出力を修正する内在的自己修正は、概して効果がないままだ。ジャッジと生成器は同じ盲点を共有する。一方に他方を修正させることは、同じ人に休憩後に自分の仕事をレビューさせることに近く、本物のセカンドオピニオンを得ることとは程遠い。
ジャッジアブレーションからの一つの詳細が私たちを驚かせた。セクションエージェントは、下流にジャッジループがあるかどうかに関わらずほぼ同一のパフォーマンスを示した。ジャッジあり:セクションはドラフトを+0.23ポイント改善;ジャッジなし:+0.33。セクションエージェントはどちらにしても自分の仕事をしていた。品質の差は完全に、ジャッジ/修正ループが後片付けをするために存在するかどうかから来ていた。これは、正しい問いが「どうジャッジをよくするか」ではなく「どうセクションを十分によくしてジャッジが不要になるか」だと教えてくれた。
この気づきがアプローチを変えた。私たちはジャッジを速くしようとするのをやめた。ジャッジを不要にしようとし始めた。
■ タスク分解をコンテキストエンジニアリングとして
修正策は、よりいいモデルでも、モノリシックエージェントへのより賢いプロンプトでもなかった。各エージェントが明確な単一目標を持つようにタスクを分解することだった。
これが私たちの研究の中心的発見であり、臨床ドキュメンテーションをはるかに超えて一般化する。Andrej Karpathyはコンテキストエンジニアリングを「次のステップのためにコンテキストウィンドウをちょうど正しい情報で満たす繊細な技芸と科学」と表現した。私たちはプロダクション側から同じ結論に至った:モデルが見るものをコントロールすることで、モデルが正しくするものをコントロールできる。
旧パイプラインでは、現在の病歴(HPI)セクションを生成するエージェントは、アセスメントと治療計画、系統別レビュー、処置コード、その他すべてのセクションの指示も見ていた。情報をルーティングし、15の異なるルールセットを適用し、15キーのJSONオブジェクトを生成しなければならなかった——10,000語の書き起こしを解析しながら。新パイプラインでは、HPIエージェントはHPI指示だけを、HPI出力キーだけを、そして同じ書き起こしを見る。1つのことだけをする。
書き起こしは同じ。モデルは同じでよい。しかしモデルのコンテキストウィンドウで見るものは根本的に狭い。
コンテキストの変化
各セクションエージェントは2カテゴリの情報を受け取る:
共有コンテキスト(全エージェントで同一):完全な書き起こし、EHRからの臨床人口統計、安全ルール(でっち上げ禁止指示、帰属ルール、情報欠落時のフォールバック動作)。これがノートの原材料だ。
焦点コンテキスト(エージェントごとに固有):担当セクションの指示のみ、担当セクションキーのみを持つ動的生成の出力スキーマ。Chief ComplaintとHPIを担当するエージェントは2キーのスキーマを得る。アセスメントと治療計画、CPTコード、ICD-10コードを担当するエージェントは3キーを得る。ドラフトエージェントの15キーと比較してほしい。
2キー対15キー。エージェントごとのタスク複雑度が5〜7倍低下する。目標が少なければ目標ごとの精度が高くなる。最初のパスの精度が高くなれば修正ループは不要になる。
出力スキーマ自体がコンテキストエンジニアリングの一形態だ。書き起こしを読む前にモデルに何を生成すべきかを告げる。chief_complaintとhistory_of_present_illnessというキーを持つスキーマは、暗黙的にタスクをスコープする。モデルはスキーマに従って書くのであって、それを避けながら書くのではない。
これがアーキテクチャ的に何を可能にするか
各エージェントが独立して焦点を絞っているとき、並列実行できる。ウォールクロック時間は最も遅い単一エージェントの時間になり、全ステージの合計にはならない。実際には、複数のセクションをより少数の並列スペシャリスト呼び出しにグループ化できる。正確なグループ化は原則よりも重要ではない:コンテキスト依存関係を共有するセクションは一緒に属し、無関係な作業は同一プロンプトで注意を競合させるべきではない。
プロダクションでは、これは具体的に現れる。50万回のセクションエージェント呼び出し全体で、セクションエージェントごとのp50レイテンシは2秒以下だ。完全に組み立てられたノートを見るQAエージェントはより時間がかかる——p50 4.3秒——しかし1回、すべてのセクションエージェントが並列完了後に実行する。総p50エンドツーエンドは7.5秒だ。短い書き起こし(1,000語以下)では4.3秒に下がる。
単一のQAエージェントがすべてのセクションエージェント完了後に結合ノートをレビューする。1回のパスでインラインで問題を検出・修正する。反復なし。
131件の複雑な臨床ケースの評価で、システムはわずか2%の重要問題で臨床項目の83%平均キャプチャ率を達成した。診断は95.6%精度、症状は95.0%、薬剤は93.0%でキャプチャされた。最も改善余地があった領域——患者指示とプラン項目——は最も広書き起こし横断合成を必要とするセクションに対応し、まさに焦点コンテキストが最高のレバレッジを持つタスクだ。省略(問題の43.6%)が捏造(11.4%)を支配したことは注目に値する——システムは臨床ドキュメンテーションにおいてより安全な失敗モードである不完全性に向かって誤り、臨床医レビューが自然に発見する。
■ コンテキストエンジニアリングと反復は代替関係
これを明示的に表現したい関係だ。
広いコンテキストと反復を持つことができる:1エージェントがすべてを見て弱い最初のパスを生成し、ジャッジループが複数ラウンドで修正する。これが私たちのV1だ。機能した。遅かった。
あるいは焦点コンテキストと単一パスを持てる:各エージェントは必要なものだけを見て信頼できる最初のパスを生成し、1つの軽量QAチェックが残りを捕捉する。これがV2だ。シリアル依存関係を排除するので5倍速い。
ジャッジループは間違っていなかった。正しい問題——品質保証——を間違ったレバーで解決していた。反復がコンテキストエンジニアリング問題を補償していた。根本原因を修正すると、症状が消えた。
Anthropicのエージェント向けコンテキストエンジニアリングに関する研究は、異なる方向から類似の結論に達している:「コンテキストは限られたリソースであり収穫逓減がある」、各エージェントのコンテキストをスコープするサブエージェントアーキテクチャは、より長いコンテキストウィンドウを持つモノリシックアプローチよりも良い結果を生む(Anthropic, 2025)。Cursorの自走式コードベースに関する研究も同じパターンを発見した:あまりにも多くの役割を与えられた単一エージェントは「病理的挙動を示した」そして「振り返ると、圧倒されていたのは理にかなっている」。役割を焦点を絞ったスペシャリストに分離することで問題が解決した(Cursor, 2026)。
このパターンは臨床AIの外でも成立する。出力が独立してアドレス可能なセクションを持ち、入力が注意を希薄化するほど長い構造化生成タスクなら成立する。文書生成、レポート組み立て、複数ファイルにまたがるコード生成、複数セクションのコンプライアンスレビュー。もしパイプラインに修正ループがあるなら、そのループが過負荷コンテキストを補償しているかどうかを問うてほしい。
■ いくつかの補足設計上の選択
ここでの核心的発見は分解であり、フレームワーク設計ではない。それでも、プロダクションでそのアイデアを素早く安全にテストすることを可能にした補足的選択がいくつかある。
統一エージェントインターフェース
私たちのシステムのすべてのエージェントは、オーケストレーターに同じインターフェースを提示する。オーケストレーターは呼び出しているエージェントの種類を知らない。型付き入力を送り、型付き出力を受け取り、実行メタデータを記録する。
これが重要な理由:旧パイプラインから新パイプラインへの移行にエージェントレイヤーへの変更はゼロで済んだ。同じエージェント、異なる配線。ドラフトステージを削除し、ジャッジループを削除し、QAエージェントを追加し、トポロジーを再配線した。エージェント自体は触れなかった。パイプラインアーキテクチャに関する仮説をテストするとき、エージェントへの変更と結果を混同したくない。統一インターフェースがその分離をきれいにした。
同じパターンがあらゆるマルチエージェントシステムに適用される。エージェントが特定のオーケストレーショントポロジーと密結合されていれば、すべてのアーキテクチャ実験が書き直しになる。交換可能なら、1日でトポロジーを入れ替えられる。
動的出力コントラクト
各エージェントは自分が生成するものを宣言する——入力からリクエスト時に生成される構造化スキーマ。8セクションのテンプレートは8キーのスキーマを生成する。単一セクションエージェントは1キーのスキーマを生成する。スキーマはリクエスト時に構築され、ハードコードされない。
これは2つの目的を果たす。モデルにとって、スキーマは生成をガイドする。2キーのスキーマに書くモデルは、15キーのスキーマに書くモデルにはない集中を保つ。システムにとって、スキーマはパース可能な出力を保証する。並列エージェントの結果を結合することは、各エージェントの出力が既知の構造にスロットインするので決定論的だ。ファンアウトは簡単だ。ファンインは並列システムが壊れる場所だ。動的コントラクトがファンインを信頼できるものにする。
■ 副次的発見:分解がモデル選択の方程式を変える
モノリシックパイプラインと分解パイプラインでモデルをベンチマークしたとき、予期しないことを発見した:アーキテクチャがどのモデルが実行可能かを変えた。
焦点タスクで品質ギャップが縮小する
完全なノート生成タスクでは、大型モデルが一貫して小型モデルを上回った。ギャップは有意で安定していた。セクションレベルのタスクでは、小型モデルがそのギャップを大幅に縮めた。パラメータ数の何分の一かのモデルが、焦点を絞った抽出と構造化で大型モデルに匹敵または上回った。
これを定量化するために、フロンティアクラスのモデルとより小型のオープンソースモデルを同じ分解アーキテクチャで比較する実験を行い、共有評価セット上の同一LLMジャッジで評価した。これは探索的比較であり、プロダクション判断ではなかった。目標は分解がモデル選択方程式を変える場所を理解することだった。
精度ギャップは均一ではないことを学んだ——それがこの発見を有用にしている。診断、症状、薬剤は小さなギャップを示す(5%未満)。最大の低下は書き起こし横断合成を必要とするセクションに集中する:フォローアップ、バイタル、プラン項目、患者指示。これらは焦点コンテキストとターゲットプロンプトエンジニアリングが最高のレバレッジを持つセクションであり、より大型モデルに切り替えることなくギャップが狭いことを意味する。
実験は、分解がモノリシックパイプラインがアクセスできない品質-速度トレードオフの領域を開くことを示した。エンドツーエンド生成には遅すぎるモデルが、複数の並列コンポーネントの1つであれば実行可能になる。アーキテクチャが単一モデル選択を強制しないこと、その柔軟性こそが実践的価値の所在だ。
これはより広い研究と一致する。ファインチューニングされた1Bモデルが焦点を絞った分類タスクでGPT-4.1に99%精度で匹敵し、18倍のスループット改善を達成した(arXiv:2510.21970)。Microsoftはファインチューニングされた小型モデルが検索関連性でGPT-4oを上回り、17倍速く19倍安いことを発見した(Kang et al., 2026)。臨床ドメインでは特に、ファインチューニングされた8Bモデルが4つのデータセット全体で人間レベルの精度(90%完全一致)を臨床情報抽出で達成し、デスクトップGPU1枚で動いた(Liu et al., Nature Scientific Reports, 2025)。
タスク複雑度こそがモデル能力ではなく出力品質を決定する。タスクを単純化すれば小型モデルが実行可能になる。分解はレイテンシ戦略であるだけでなく、モデル選択戦略でもある。
レイテンシ-品質フロンティアがシフトする
完全なノート生成に15秒かかるモデルが、複数の並列コンポーネントの1つであれば実行可能になる。5つのシリアル呼び出しではなく1つの呼び出しのレイテンシを支払う。アーキテクチャがモノリシックパイプラインではアクセスできない速度-品質トレードオフの領域を開く。
並列エージェントは単一呼び出しより総トークン数が多いが、各呼び出しはより小さい(焦点を絞った指示、小さいスキーマ)、これが重複を部分的に相殺する。そして私たちは自社推論インフラ(Nvidia, 2026)で実行しているので、コスト方程式はトークンごとのAPIプライシングではなく計算時間になる。
エージェント全体でのモデル多様性が実用的
異なるエージェントは異なる要件を持つ。焦点を絞った抽出を行うセクションエージェントは推論速度の速さから恩恵を受ける。横断セクション推論を行うQAエージェントはより強い分析能力から恩恵を受ける。私たちのアーキテクチャは異なるエージェントの役割に独立して異なるモデルを割り当てることをサポートする。
私たちの研究チームは昨年、異なるドメインでこの原則を探索した。コンセンサスメカニズム(Kumthekar et al., 2025)は医療推論にスペシャリスト分解を適用した:トリアージモデルがクエリを分類し、エキスパートモデルが専門科の視点から並列推論し、コンセンサスモデルが出力を統合する。アンサンブルは4つの医療ベンチマーク全体でOpenAIのO3-highを3.4〜8.2%上回った。アーキテクチャがそこでは異なることを可能にした——並列性によるレイテンシではなくスペシャリストの深さによる精度向上——しかし根本的な洞察は同じだ。タスクを分解する。各ピースを正しいモデルに割り当てる。結果を結合する。
小型モデルの品質限界に達しているなら、答えは大型モデルではないかもしれない。エージェントごとのより単純なタスクかもしれない。
■ 検証方法
旧パイプラインを新パイプラインに置き換えなかった。4ヶ月間、同じプロダクショントラフィックで並列実行した。
パイプライントポロジー、モデル選択、プロンプトを独立して変えることができ、患者ケアを危険にさらすことなく1度に1変数を分離できた。すべてのエージェント呼び出しはエンドツーエンドでトレースされた:モデル、プロンプトバージョン、トークン数、レイテンシ、リトライ、成否。合成ベンチマークは不要だった。プロダクショントラフィックが実験であり、可観測性レイヤーが評価ハーネスだった。
本稿執筆時点で、新パイプラインは10万件以上のプロダクションノートを処理している。プロダクション数値がその物語を語る:
レイテンシは書き起こし長と優雅にスケールする。短い事例(1K語以下)はp50 4.3秒で完了する。長い事例(5K語以上)はp50 11秒かかる。関係はほぼ線形で指数的でない——アーキテクチャに複雑度の崖がない。
初期の対照実験が品質はレイテンシ目標で維持されることを確認し、プロバイダーベンチマークはインフラ選択が同じ並列性で2〜3倍レイテンシをシフトすることを示した——インフラがアーキテクチャと同じくらい重要であることを確認。
研究からプロダクションへのサイクルは数四半期ではなく数日だった。2025年後半にアーキテクチャ研究を開始した。2026年初頭には新パイプラインがプロダクショントラフィックの大部分を処理していた。そのイテレーションの速度は、別のデプロイメントや評価スタックを立ち上げることなく本番トラフィックでアーキテクチャ変更を直接テストできたことから来ている。
コスト問題には正直な答えが必要だ。新パイプラインは複数のコンポーネントが同じ書き起こしを処理するため、ノートごとの総トークン数が多い。そのトレードオフは現実だ。品質とレイテンシの改善が実質的だったため、またインフラがそのトレードオフをトークンごとAPIモデルとは異なって管理できるため、私たちはそれを受け入れた。
■ トレードオフと現時点で不明なこと
品質と速度の改善は現実であり、10万件以上のプロダクションノートで測定されている。しかしまだ対処中のトレードオフがある。
速度は品質が維持される場合のみ重要
すべての顧客と専門科にわたって継続的評価を実行している。品質の後退はアラートをトリガーする。記述したアーキテクチャ比較——専門スペシャリストを優先してジャッジループを削除する——はレイテンシ削減とともに品質改善を生み出した。臨床医も気づいている:移行後、顧客満足度スコアが有意に増加し、プロバイダーはノートがより正確で以前より速く利用可能だと一貫して報告している。しかしその品質ラインを維持するには継続的投資が必要だ。
モデル比較実験では、フロンティアと小型モデルのギャップは最高複雑度セクション——プラン項目、指示、フォローアップ——で最大だった。これはプロンプトエンジニアリングと分解戦略が最大のレバレッジを持つ場所であり、アーキテクチャを変えることなくより強力なモデルをそれを必要とするセクションに割り当てることができる。
強化学習でファインチューニングされた小型言語モデルを特定のセクションタイプ向けに実験中であり、焦点を絞った抽出タスクの速度と精度をさらに改善することを目標としている。
シングルパスQAが十分でない場合
反復ジャッジループはシングルQAパスが時々見逃す横断セクション矛盾を捕捉した。セクションAがセクションBと矛盾する。治療計画に記載された薬剤が病歴に言及されていなかった。QAエージェントは完全に組み立てられたノートを見てその多くを捕捉するが、1回のパスで動作する。反復ジャッジは微妙な矛盾を見つける複数の機会を持っていた。
ジャッジアブレーションはセクションエージェントを超えてループが何に貢献したかを定量化している:テンプレートコンプライアンスで+0.27、指示コンプライアンスで+0.29、テンプレート指示違反で+0.23。これらはコンプライアンス次元だ——シングルQAパスが1回のチャンスしか持たない横断セクション一貫性チェックがまさにそれだ。特定の専門科にまたがる複雑な複数問題の事例では、まだ判断がついていない。これらのケースを綿密に監視しており、より安全な選択肢であり続ける場所では旧パイプラインを使用する能力を維持している。
プロンプト品質が荷重を担う
これは私たちの働き方を変えたトレードオフだ。セーフティネットとしてのジャッジループなしでは、各エージェントのプロンプトの品質が出力品質を直接決定する。旧パイプラインでは平凡なセクション指示が修正エージェントに修正されていた。新パイプラインでは、それが出荷される。
これはリスクであると同時に、プロンプトエンジニアリングをインフラとして投資する最大の動機だ。エージェントごと・組織ごとに組み立てられた構造化バージョン管理プロンプトブロックに大きく投資している。セクションエージェントが一貫したエラーパターンを生成するとき、それを引き起こした特定の指示ブロックに追跡し、そのブロックを修正する。
原則的な分解フレームワークを持っていない
どのセクションをグループ化すべきか?1エージェント1セクション?関連セクションの結合?最適な粒度はセクション複雑度、セクション間の情報依存関係、専門科に依存する。Chief ComplaintとHPIがグループ化されているのは、ナレーティブのつながりを共有するからだ。アセスメントと治療計画が処置・診断コードとグループ化されているのは、臨床推論がそれらの出力全体で一貫性を必要とするからだ。
これらのグループ化は経験的であり、データがどこに次のフォーカスを向けるかを教えてくれる。すべての評価全体で、アセスメントと治療計画は分解が最大のインパクトを持つセクションだ——モデルやパイプラインバリアントに関わらず、フラグされた項目の33〜46%を一貫して集中させる。HPIは15〜17%で2番目に複雑なセクションだ。これは予想通り:これらのセクションは最も書き起こし横断合成を必要とする。分解の粒度が合成複雑度が最高の場所で最も重要であり、A&Pへのプロンプトエンジニアリング投資が不均衡なリターンをもたらすことを教えてくれる。
テンプレートごと・専門科ごとに異なる構成をテストする。選択は臨床ワークフロー知識によって情報提供されプロダクションメトリクスで検証される。しかし正式なフレームワークから導出されているわけではない。
ここで共有したことは普遍的真実ではない。私たちのシステム、私たちのデータ、私たちの臨床ドキュメンテーションタスクで機能したパターンだ。あなたの分解境界は異なるだろう。最適な粒度も異なるだろう。しかしパイプラインに反復修正ループがあり最初のパスが信頼性がないなら、診断の問いは同じだ:反復が過負荷コンテキストを補償しているか?
■ 次のステップ
プロンプト品質が荷重を担うという発見が、私たちの臨床AIへの投資方法を変えた。
臨床医の文書作成が各エージェントの最初のパスの信頼性に依存するとき、それらのエージェントをガイドする指示は臨床インフラになる。異なる専門科は異なる文書化要件を持つ。異なる組織は異なるワークフローを持つ。内分泌科の診察で機能するプロンプトは整形外科のフォローアップで重要なことを見落とすかもしれない。コード変更なしに臨床コンテキストごとにカスタマイズ可能な、構成可能でバージョン管理された指示を作るシステムを構築している。
2つ目の投資は継続的改善にある。臨床医のフィードバックが一貫したエラーパターンを示すとき、プロンプト全体を書き直すのではなく、それを引き起こした特定の指示に追跡してその指示を修正する必要がある。臨床医のフィードバックがそれを必要とする特定のコンポーネントへのターゲットを絞った根拠に基づく改善を駆動するクローズドループシステムを構築している。目標は四半期ごとではなく毎週改善するプロンプト品質だ。
本稿で説明したアーキテクチャは最初のステップだった。速度で品質を高く維持することはコンテキストエンジニアリング問題だ。専門科と組織にわたって時間とともに品質を向上させ続けることは、より難しく臨床的に影響力のある作業が横たわる場所だ。

agent-opsharness-designai-thinking
コンテキスト設計が反復修正に勝る
♥ 27↻ 1
原文を表示 / Show original
Written by Muratcan Koylan & Amit Kumthekar
Also published on: https://www.sully.ai/research/context-engineering-over-iteration
When a clinical AI system makes an error, the cost is measured in clinician time. Every fabricated medication or misattributed statement is something the clinician has to find and fix. In a 15-minute visit, the margin for review is thin. If the output requires line-by-line auditing, the system has failed regardless of how fast it appeared on screen.
This makes accuracy the primary design constraint for clinical AI in production. Speed matters too, for reasons specific to clinical workflow. In high-volume clinics, clinicians move between visits with little transition time, and documentation that arrives 60 seconds after a visit ends competes with the next patient for attention. In inpatient settings, timely documentation affects care coordination directly: a specialist's assessment needs to be available before the primary team rounds, and handoff documentation in emergency settings has direct implications for patient safety. Speed is a clinical requirement. But speed without accuracy is worse than slow and correct.
Most clinical AI systems achieve one of these, not both. The most common approach is a single model call: one prompt, one pass, accept whatever comes back. It is fast. It is also unreliable. The model hallucinates medications, misattributes statements to the wrong speaker, drops entire sections. Clinicians learn quickly that they cannot trust the output.
A second approach adds a safety net. Generate a draft, run a judge model to find errors, send the violations to a refinement agent, repeat until the judge passes. This pattern exists, in various forms, in most production systems that care about accuracy. In our system, the loop caught real problems. When we ran a controlled ablation, removing the loop entirely, output quality dropped 11% across clinical dimensions (3.17 → 2.85 on our internal eval scale, n=126 vs n=114). The steepest drops were in clinical safety (+0.58) and evidence reasoning (+0.54), the dimensions where errors carry the highest clinical risk. The loop was doing real clinical work. But each correction cycle added 10-15 seconds of serial computation, and the loop consumed more than half the total pipeline time.
We spent months trying to make the loop both higher quality and faster. Smaller judge models. Tighter prompts. Fewer iterations. The improvements were marginal. The problem was not the speed of the loop. The problem was that we needed the loop at all.
The question we started asking: why was the first pass unreliable?
Our hypothesis was that a weak first pass was not a model capability issue. It was a task design issue. A single model generating a full clinical document performs six to eight concurrent cognitive tasks at once: parsing a long transcript, routing information to correct sections, applying section-specific documentation rules, handling specialty logic, avoiding fabrication, producing structured output matching a complex schema. When one model does all of this simultaneously, accuracy on any individual task degrades. The correction loop exists to compensate for that overloaded context.
This is the finding that shaped everything that followed: context engineering and iteration are substitutes, not complements. When you decompose a complex task into focused sub-tasks, each component sees a radically narrower context. The model does one thing instead of eight. The first pass becomes reliable. The correction loop becomes unnecessary. And because focused components can run in parallel, the architecture is fast as a structural consequence of being accurate, not the other way around.
We tested this by restructuring our pipeline around parallel specialist components, each responsible for a narrow slice of the document, each seeing only the context relevant to its task. A single quality check replaced the iterative loop.
Across more than 100,000 production encounters, quality held or improved: each component's first pass was more accurate than what the overloaded approach produced. Latency dropped from 37 seconds at p50 to 7.5 seconds, and from over 100 seconds at p95 to 16.3 seconds. Not because we found a faster model, but because we eliminated the architectural pattern that made the pipeline slow.
The findings extend beyond clinical documentation. For any structured generation task where the output has independently addressable sections and the input is long enough to dilute attention, context engineering is a more effective lever than iterative correction. If your system has a correction loop, ask whether the loop is compensating for an overloaded context.
Why monolithic agents produce weak first passes
When you ask a single agent to produce a complex, multi-part output, it must perform several competing cognitive tasks within one context window. The more objectives packed into one prompt, the worse each individual objective is executed. This is a general property of language model attention under competing demands, and it has practical consequences for any multi-agent system design. We learned this most clearly through clinical documentation, but the pattern applies wherever structured generation meets long input.
Consider what a single model generating a clinical document is actually doing. A typical note has over a dozen sections: the patient's history, review of systems, medications, physical exam findings, assessment and plan, procedure and diagnosis codes, and more. Each section has its own documentation rules. The model receives all of these instructions simultaneously, alongside a full transcript (often thousands of words), clinical context from the EHR, safety constraints, and an output schema with a key for every section.
It is at least six concurrent cognitive tasks packed into a single prompt:
Parse a long, unstructured conversation and identify who said what about which problem
Route each piece of information to the correct section (this symptom goes in HPI, that finding goes in Physical Exam, this medication goes in the medication list)
Apply section-specific documentation rules that differ for every section
Handle specialty logic (hormone therapy documentation rules for endocrinology, surgical site specifications for orthopedics)
Avoid fabrication across all sections simultaneously
Produce structured JSON output matching a 15-key dynamic schema
Recent research quantifies what we observed in practice. Across 256 models tested, instruction-following accuracy drops from 92% at 200 tokens of instructions to 60% at 4,000 tokens (Gupta et al., 2025). Even the best frontier models achieve only 68% accuracy when following 500 simultaneous instructions (Jaroslawicz et al., 2025). Post-training and reasoning chains do not fix it. It is a fundamental property of how attention works under competing objectives.
We saw the consequences in our judge violations. The judge returned structured error reports: which section had the problem, what text was wrong, what the fix should be. The patterns were consistent. Medications from the transcript appeared in the wrong section. Attribution errors compounded across sections — a symptom the patient reported would be documented as a clinician observation. Sections that were narratively related (HPI and Assessment) contradicted each other because the model processed them independently within a single overloaded context.
The judge caught these errors. But here is what we did not expect: the refinement agent often made them worse.
We analyzed ~50 production traces to understand what the refinement loop actually did. It resolved roughly 45% of the violations the judge flagged - primarily quick fixes like ICD-10 coding errors, missing section content, and medication documentation gaps. But it also introduced new violations at nearly the same rate: 15 new clinical accuracy errors, 13 new structural or template compliance errors, and 11 new Assessment and Plan accuracy issues that were not present in the original note. Only 8% of traces were fully resolved after refinement. In 39%, the note showed no improvement at all.
The pattern was consistent: refinement fixed small, well-defined problems (a missing code, an incomplete section) and struggled with — or actively worsened — larger clinical accuracy and structural issues. A section agent omits a medication. The judge flags the omission. The refinement agent adds the medication back, but attributes it to the wrong part of the encounter, or adds a dosage that was never mentioned in the transcript. The note goes from incomplete to fabricated.
Research on self-correction in language models supports this pattern. Intrinsic self-correction, where a model corrects its own output without external feedback, remains largely ineffective. The judge and the generator share the same blind spots. Asking one to fix the other is closer to asking the same person to review their own work after a coffee break than to getting a genuine second opinion.
One detail from the judge ablation surprised us. Section agents performed almost identically whether or not the judge loop was present downstream. With the judge, sections improved the draft by +0.23 points; without it, by +0.33. The section agents were doing their job either way. The quality difference came entirely from whether the judge/refinement loop existed to clean up afterward. This told us the right question was not "how do we make the judge better?" but "how do we make the sections good enough that we don't need it?"
This realization shifted our approach. We stopped trying to make the judge faster. We started trying to make the judge unnecessary.
Task decomposition as context engineering
The fix was not a better model or a cleverer prompt for the monolithic agent. It was decomposing the task so each agent has a single clear objective.
This is the central finding from our work, and it generalizes far beyond clinical documentation. Andrej Karpathy described context engineering as "the delicate art and science of filling the context window with just the right information for the next step." We arrived at the same conclusion from the production side: when you control what the model sees, you control what it gets right.
In our previous pipeline, an agent generating the History of Present Illness section also saw instructions for Assessment and Plan, Review of Systems, procedure codes, and every other section. It had to route information, apply 15 different rule sets, and produce a 15-key JSON object, all while parsing a 10,000-word transcript. In the new pipeline, the HPI agent sees only HPI instructions, only HPI output keys, and the same transcript. It does one thing.
The transcript is the same. The model can be the same. But what the model sees in its context window is radically narrower.
What changes in the context
Every section agent receives two categories of information:
Shared context, identical across all agents: the full transcript, clinical demographics from the EHR, and safety rules (no-fabrication directives, attribution rules, fallback behavior for missing information). This is the raw material of the note.
Focused context, unique per agent: only the instructions for its assigned sections, and a dynamically-generated output schema with only its section keys. An agent assigned Chief Complaint and HPI gets a schema with two keys. An agent assigned Assessment and Plan, CPT codes, and ICD-10 codes gets three. Compare this to the draft agent's 15.
Two keys versus fifteen. The task complexity per agent drops by 5-7x. Fewer objectives means higher per-objective accuracy. Higher first-pass accuracy means no correction loop.
The output schema itself is a form of context engineering. It tells the model what to produce before it reads the transcript. A schema with keys chief_complaint and history_of_present_illness implicitly scopes the task. The model writes to the schema, not around it.
What this enables architecturally
When each agent is independent and focused, they run simultaneously. Wall-clock time becomes the duration of the slowest single agent, not the sum of all stages. In practice, multiple sections can be grouped into a smaller number of parallel specialist calls. The exact grouping matters less than the principle: sections that share context dependencies belong together, and unrelated work should not compete for attention in the same prompt.
In production, this plays out concretely. Across half a million section agent calls, p50 latency per section agent is under 2 seconds. The QA agent, which sees the full assembled note, takes longer — p50 of 4.3 seconds — but it runs once, after all section agents have completed in parallel. The total p50 end-to-end is 7.5 seconds. For shorter transcripts (under 1,000 words), it drops to 4.3 seconds.
A single QA agent reviews the combined note after all section agents complete. It detects and fixes issues inline in one pass. No iteration.
In an evaluation of 131 complex clinical cases, the system achieved an 83% average capture rate for clinical items with only 2% critical issues. Diagnoses were captured at 95.6% accuracy, symptoms at 95.0%, medications at 93.0%. The areas with the most room for improvement — patient instructions and plan items — correspond to sections that require the most cross-transcript synthesis, exactly the task where focused context has the highest leverage. Notably, omissions (43.6% of issues) dominated over fabrications (11.4%), meaning the system errs toward incompleteness rather than hallucination, a safer failure mode in clinical documentation and one that clinician review catches naturally.
Context engineering and iteration are substitutes
This is the relationship we want to name explicitly.
You can have broad context and iteration: one agent sees everything, produces a weak first pass, and a judge loop corrects it over multiple rounds. This was our V1. It worked. It was slow.
Or you can have focused context and a single pass: each agent sees only what it needs, produces a reliable first pass, and one lightweight QA check catches the remainder. This is our V2. It is 5x faster because it eliminates serial dependencies.
The judge loop was not wrong. It was solving the right problem — quality assurance — with the wrong lever. Iteration compensated for a context engineering problem. When we fixed the root cause, the symptom disappeared.
Anthropic's research on context engineering for agents reaches a similar conclusion from a different direction: "context is a finite resource with diminishing marginal returns," and sub-agent architectures that scope each agent's context produce better results than monolithic approaches with longer context windows (Anthropic, 2025). Cursor's research on self-driving codebases found the same pattern: a single agent given too many roles "exhibited pathological behaviors" and "in retrospect, it makes sense it was overwhelmed." Separating roles into focused specialists resolved the problem. (Cursor, 2026)
The pattern holds outside clinical AI. It holds for any structured generation task where the output has independently-addressable sections and the input is long enough to dilute attention. Document generation, report assembly, code generation across multiple files, multi-section compliance reviews. If your pipeline has a correction loop, ask whether the loop is compensating for an overloaded context.
A few supporting design choices
The core finding here is decomposition, not framework design. Still, a few supporting choices made it possible to test that idea quickly and safely in production.
Uniform agent interface
Every agent in our system presents the same interface to the orchestrator. The orchestrator does not know what kind of agent it is calling. It sends typed input, receives typed output, and records execution metadata.
This matters because the transition from our old pipeline to the new one required zero changes to the agent layer. Same agents, different wiring. We removed the draft stage, removed the judge loop, added a QA agent, and rewired the topology. The agents themselves were untouched. When you are testing a hypothesis about pipeline architecture, you do not want to conflate the results with changes to the agents. The uniform interface made that separation clean.
The same pattern applies to any multi-agent system. If your agents are tightly coupled to a specific orchestration topology, every architectural experiment becomes a rewrite. If they are interchangeable, you can swap topologies in a day.
Dynamic output contracts
Each agent declares what it will produce — a structured schema generated per-request from the input. A template with 8 sections produces a schema with 8 keys. A single-section agent produces a schema with 1 key. The schema is built at request time, not hardcoded.
This serves two purposes. For the model, the schema guides generation. A model writing to a 2-key schema stays focused in a way that a model writing to a 15-key schema does not. For the system, the schema guarantees parseable output. Combining results from parallel agents is deterministic because each agent's output slots into a known structure. Fan-out is easy. Fan-in is where parallel systems break. Dynamic contracts make fan-in reliable.
A secondary finding: decomposition changes the model selection equation
When we benchmarked models on the monolithic pipeline versus the decomposed pipeline, we found something we did not expect: the architecture changed which models were viable.
The quality gap narrows on focused tasks
On the full note generation task, larger models consistently outperformed smaller ones. The gap was significant and stable. On section-level tasks, smaller models closed that gap substantially. A well-prompted model at a fraction of the parameter count matched or exceeded larger models on focused extraction and structuring.
To quantify this, we ran an experiment comparing a frontier-class model against a smaller open-source model on the same decomposed architecture, evaluated by the same LLM judge on a shared evaluation set. This was an exploratory comparison, not a production decision. The goal was to understand where decomposition changes the model selection equation.
We learned that the accuracy the gap is not uniform, and that is what makes the finding useful. Diagnoses, symptoms, and medications show small gaps (under 5%). The largest drops cluster in sections that require cross-transcript synthesis: follow-ups, vitals, plan items, patient instructions. These are the sections where focused context and targeted prompt engineering have the highest leverage, which means the gap is narrow without switching to a larger model.
The experiment showed that decomposition opens a region of the quality-speed tradeoff that monolithic pipelines cannot access. A model that is too slow for end-to-end generation becomes viable when it is one of several parallel components. The architecture does not force a single model choice, and that flexibility is where the practical value lies.
This is consistent with broader research. A fine-tuned 1B model matched GPT-4.1 at 99% accuracy on a focused classification task, with 18x throughput improvement (arXiv:2510.21970). Microsoft found that a fine-tuned small model outperformed GPT-4o on search relevance while being 17x faster and 19x cheaper (Kang et al., 2026). In the clinical domain specifically, a fine-tuned 8B model achieved human-level accuracy (90% exact match) on clinical information extraction across four datasets, using a single desktop GPU (Liu et al., Nature Scientific Reports, 2025).
Task complexity, not model capability, determines output quality. When you simplify the task, smaller models become viable. Decomposition is a model selection strategy, not just a latency strategy.
The latency-quality frontier shifts
A model that takes 15 seconds for full note generation becomes viable when it is one of several parallel components. You pay the latency of one call, not five sequential ones. The architecture opens up a region of the speed-quality tradeoff that monolithic pipelines cannot access.
Parallel agents use more total tokens than a single call but each call is smaller (focused instructions, smaller schema), which partially offsets the duplication. And because we run on our own inference infrastructure (Nvidia, 2026), the cost equation is compute-hours rather than per-token API pricing.
Model diversity across agents is practical
Different agents have different requirements. Section agents performing focused extraction benefit from fast inference speed. The QA agent performing cross-section reasoning benefits from stronger analytical capability. Our architecture supports assigning different models to different agent roles independently.
Our research team explored this principle in a different domain last year. The Consensus Mechanism (Kumthekar et al., 2025) applied specialist decomposition to medical reasoning: a triage model classifies the query, expert models reason from their specialty's perspective in parallel, and a consensus model synthesizes the outputs. The ensemble beat OpenAI's O3-high by 3.4-8.2% across four medical benchmarks. The architecture enabled a different thing there — improved accuracy through specialist depth rather than latency through parallelism — but the underlying insight is the same. Decompose the task. Assign each piece to the right model. Combine the results.
If you are hitting quality limits on smaller models, the answer might not be a bigger model. It might be a simpler task per agent.
How we validated this
We did not replace the old pipeline with the new one. We ran them side by side on the same production traffic for four months.
We could vary pipeline topology, model choice, and prompts independently, which let us isolate one variable at a time without risking patient care. Every agent call was traced end to end: model, prompt version, token counts, latency, retries, success or failure. We did not need synthetic benchmarks. Production traffic was the experiment, and the observability layer was the eval harness.
As of this writing, the new pipeline has processed over 100,000 production notes. The production numbers tell the story:
Latency scales gracefully with transcript length. Short encounters (under 1K words) complete at p50 of 4.3 seconds. Long encounters (5K+ words) take 11 seconds at p50. The relationship is roughly linear, not exponential — the architecture does not have a complexity cliff.
Earlier controlled experiments confirmed that quality holds at the latency target, and provider benchmarks [5] showed that infrastructure choice shifts latency by 2-3x at the same concurrency — confirming that infrastructure matters as much as architecture.
The research-to-production cycle was days, not quarters. We started the architectural research in late 2025. By early 2026, the new pipeline was serving the majority of production traffic. That speed of iteration came from being able to test architectural changes directly on live traffic without spinning up a separate deployment or evaluation stack.
The cost question deserves an honest answer. The new pipeline uses more total tokens per note because multiple components process the same transcript. That trade-off is real. We accepted it because the quality and latency improvements were substantial, and because our infrastructure lets us manage that trade-off differently than a per-call API model would.
Trade-offs and what we don't know yet
The quality and speed improvements are real, measured across more than 100,000 production notes. But they come with trade-offs we are still navigating.
The speed only counts if quality holds
We run continuous evaluation across every customer and specialty. Quality regressions trigger alerts. The architecture comparison we described — removing the judge loop in favor of focused specialists — produced a quality improvement alongside the latency reduction. Clinicians have noticed: customer satisfaction scores increased meaningfully after the transition, with providers consistently reporting that notes are more accurate and available faster than before. But maintaining that quality line requires ongoing investment.
In our model comparison experiments, the gap between frontier and smaller models was largest in the highest-complexity sections — plan items, instructions, follow-ups — which is exactly where prompt engineering and decomposition strategy have the most leverage. Per-agent model routing means we can assign stronger models to the sections that need them, and the architecture supports that without changing anything else.
We are also experimenting with small language models fine-tuned through reinforcement learning for specific section types, with the goal of further improving both speed and accuracy on focused extraction tasks.
When single-pass QA is not enough
The iterative judge loop caught cross-section inconsistencies that a single QA pass sometimes misses. Section A contradicts Section B. A medication listed in the plan was not mentioned in the history. The QA agent sees the full combined note and catches many of these, but it operates in one pass. The iterative judge had multiple chances to find subtle contradictions.
Our judge ablation quantifies what the loop contributed beyond section agents: +0.27 on template compliance, +0.29 on instruction compliance, +0.23 on template instruction violations. These are the compliance dimensions — exactly the cross-section consistency checks that a single QA pass has one shot to catch. For complex multi-problem encounters across certain specialties, the jury is still out. We monitor these cases closely and retain the ability to use the older pipeline where it remains the safer option.
Prompt quality becomes load-bearing
This is the trade-off that changed how we work. Without the judge loop as a safety net, the quality of each agent's prompt directly determines output quality. A mediocre section instruction in the old pipeline got corrected by the refinement agent. In the new pipeline, it ships.
This is both the biggest risk and the biggest motivation for investing in prompt engineering as infrastructure. We invest heavily in structured, versioned prompt blocks assembled per-agent and per-organization. When a section agent produces a consistent error pattern, we trace it to the specific instruction block that caused it and fix that block.
We do not have a principled decomposition framework
Which sections should be grouped together? One agent per section? Related sections combined? The optimal granularity depends on section complexity, information dependencies between sections, and specialty. Chief Complaint and HPI are grouped because they share a narrative thread. Assessment and Plan are grouped with procedure and diagnosis codes because clinical reasoning needs coherence across those outputs.
These groupings are empirical, and the data tells us where to focus next. Across all our evaluations, Assessment and Plan is the section where decomposition has the most impact — it consistently concentrates the largest share of improvement opportunities (33-46% of flagged items across experiments), regardless of model or pipeline variant. HPI is the second most complex section at 15-17%. This is expected: these sections require the most cross-transcript synthesis. It tells us that decomposition granularity matters most where synthesis complexity is highest, and that prompt engineering investment in A&P yields disproportionate returns.
We test different configurations per template and per specialty. The choices are informed by clinical workflow knowledge and validated by production metrics. But they are not derived from a formal framework.
None of what we have shared here is universal truth. These are the patterns that worked for our system, on our data, for our clinical documentation task. Your decomposition boundaries will differ. Your optimal granularity will differ. But if your pipeline has an iterative correction loop and your first pass is unreliable, the diagnostic question is the same: is the iteration compensating for an overloaded context?
What's next
The finding that prompt quality is load-bearing has changed how we invest in clinical AI.
When a clinician's documentation depends on each agent's first pass being reliable, the instructions that guide those agents become clinical infrastructure. Different specialties have different documentation requirements. Different organizations have different workflows. A prompt that works for an endocrinology visit may miss what matters in an orthopaedic follow-up. We are building systems that make these instructions composable, versioned, and customizable per clinical context without requiring code changes.
The second investment is in continuous improvement. When clinician feedback indicates a consistent error pattern, we need to trace it to the specific instruction that caused it and fix that instruction, not rewrite the entire prompt. We are building a closed-loop system where clinician feedback drives targeted, evidence-grounded improvements to the specific components that need them. The goal is prompt quality that improves weekly, not quarterly.
The architecture described in this paper was the first step. Keeping quality high at speed is a context engineering problem. Keeping quality improving over time, across specialties and organizations, is where the harder and more clinically impactful work lies.