エージェント技術の習得:AI エージェントのカスタマイズ
NVIDIA は、汎用モデルを特定業務に特化させるための 9 つの手法と選定基準を解説し、実務における AI エージェントのカスタマイズ戦略を体系的に提示した。
キーポイント
カスタマイズの必要性
ファウンデーションモデルは汎用的な能力を持つが、専門的なワークフローには制約や独自コンテキストが必要であり、エージェントの推論方法やツール選択を調整するカスタマイズが不可欠である。
9 つのカスタマイズ手法
単純なプロンプト変更から強化学習(RL)に至るまで、コスト、複雑さ、能力のトレードオフに応じた 9 つの技術的アプローチが紹介されている。
手法選定の基準
より良い情報提供が必要か、指示の改善が必要か、あるいは根本的な行動の信頼性向上が必要かに応じて最適なカスタマイズ手法を選択する枠組みが示された。
プロンプトエンジニアリングの柔軟性と限界
推論時のプロンプト変更のみで動作する最もアクセスしやすいカスタマイズ手法ですが、複雑な推論や長大な指示では性能が低下し、モデルのコア能力を拡張することはできません。
RAG による知識制限の克服
外部知識ソースから関連情報を動的に取得・注入することで、ハルシネーション(幻覚)を大幅に減らし、モデルの再学習なしで独自または急速に変化するドメインへの回答を可能にします。
ツールとスキルの定義
ツールは外部ソフトウェアと連携する呼び出し可能な関数であり、スキルはタスク完了のためのドメイン固有の指示です。
モデルカスタマイズの効率化
これらはモジュール化された再利用可能なコンポーネントとして機能し、モデルの重みを変更せずに汎用モデルを専門分野向けにカスタマイズすることを可能にします。
影響分析・編集コメントを表示
影響分析
この記事は、AI エージェントの実装において「汎用モデルをそのまま使う」から「業務特化型に調整する」への転換点を明確にし、開発者が技術選定を行うための具体的なフレームワークを提供している。特に、プロンプトエンジニアリングから強化学習までの手法のトレードオフを対比させることで、現場での実装コストと効果のバランスを取る際の意思決定支援として機能する。
編集コメント
汎用モデルの限界を補い、実務で使えるエージェントを構築するための実践的なロードマップが示されており、開発者にとって即座に活用できる重要な指針です。特に手法選定の基準(情報・指示・信頼性)は、技術選定における迷いを解消する価値があります。
自律型 AI エージェントは、物流ファームのルーティング、サポートチケットのトリアージ、コード生成、マルチステップワークフローのオーケストレーションなど、ビジネスにおけるあらゆる種類の業務を担うようになっています。汎用モデルを特定のタスクで卓越させるにはどうすればよいのでしょうか?カスタマイズにより、エージェントに適切な能力を与えることができます。
本稿では、AI エージェントのカスタマイズに用いる 9 つの手法と、ユースケースに応じて最適な手法を選択するための基準について解説します。
なぜ AI エージェントのカスタマイズが必要なのか
ファウンデーションモデル は、使用されるトレーニングデータセットに基づき、あらゆるユースケースやモダリティにわたる広範な言語および推論能力を備えています。これらのモデルは言語を理解し指示に従うことができますが、専門的なワークフローには、制限された、専門的、または独自性の高い文脈が必要とされることがあります。
エージェントのカスタマイズは、制約下での推論方法、選択するツール、出力の構造化、およびドメインワークフローの実行信頼性を形作ることで、この課題を解決します。
エージェントのカスタマイズに用いられる手法は何か
エージェントのカスタマイズ手法は、単純なプロンプトの変更から 強化学習 (RL) のような高度な技術まで多岐にわたり、それぞれコスト、複雑さ、能力においてトレードオフが存在します。最適なアプローチは、より良い情報が必要なのか、指示の改善が必要なのか、それとも根本的に信頼性の高い動作が必要なのかによって異なります。以下のセクションでは主要なアプローチを解説します。
プロンプトエンジニアリングとシステムプロンプト
プロンプトエンジニアリングは、推論時にエージェントに対するプロンプトを変更するだけで済む手法です。最もアクセスしやすく、通常、エージェントの動作をカスタマイズするために最初に適用される技術です。標準的なエージェントでは、人間によるシステムプロンプトの手動調整が必要となる場合があります。一方、OpenClaw のような高度で自己進化型のエージェントは、時間とともにメモリや指示を修正する際に自身によって更新されるプロンプトを使用し、結果として自己カスタマイズ型エージェントを実現します。
仕組み
あなたは、エージェントの役割、利用可能なツール、出力形式、および行動制約を定義するシステムプロンプトを作成します。モデルは既存の能力を用いてこれらの指示に従います。
以下にサンプルのシステムプロンプトを示します:
あなたは熟練した CLI アシスタントです。ユーザーのリクエストを構造化された JSON ツール呼び出しに変換してください。応答は JSON オブジェクトのみとしてください。使用しないフラグは null に設定してください。
適用すべきタイミング
- エージェントの動作を素早く反復して改善する場合
- 自然言語で明確に記述されたカスタムタスクに取り組む場合
- さらに投資を行う前にプロトタイプを作成したり実験を行ったりする場合
制限事項
- プロンプトは複雑な推論チェーンにおいて脆くなる可能性があります
- 指示が長くなり、より微妙なニュアンスを含んだ場合、パフォーマンスは低下します
- モデルは複雑な書式要件を一貫して遵守しない場合があります
- モデルの中核的な能力を拡張するものではありません
- エージェントを支えるモデルを変更する場合、プロンプトの再テストが必要です
すべてのエージェントプロジェクトには、反復的なプロンプトエンジニアリングと精緻化が不可欠です。ただし、エージェントが構造化された出力を確実に生成したり、ドメイン固有のロジックに従ったり、エッジケースを処理したりするためには、さらなる精緻化が必要になる場合があります。自己進化型エージェントは、ハーン(harness)を使用して自身のプロンプトを精緻化する点に注意してください。
検索拡張生成 (Retrieval-augmented generation)
検索拡張生成 (RAG) は、外部の知識ソース(例えば ベクトルデータベース)から関連する最新情報を動的に取得することで、基盤モデルの知識制限を解決します。この取得されたコンテンツは、推論時にモデルのコンテキストに注入されることでエージェントを根拠付けます。これにより、ハルシネーション(幻覚)が大幅に削減され、モデルの再学習なしでカスタム、独自、または急速に変化するドメインに関する質問に応答することが可能になります。
仕組み
ユーザーがエージェントシステムにクエリを送信すると、システムはそのクエリに関連するデータをベクトルデータベースまたはドキュメントストアから検索します。取得されたコンテンツはその後、ユーザーのクエリと共にモデルへ送信され、モデルは両者を推論して根拠のある回答を返します。
使用すべきタイミング
- エージェントに最新情報や機密知識へのアクセス権を与える場合
- 信頼できる情報源に基づいて回答を行うことで、ハルシネーション(幻覚)を低減する場合
- 頻繁に変化するナレッジベースを扱い、再学習が現実的でない場合
制限事項
- 検索プロセスによりレイテンシが増加する
- 新しい推論能力を追加するものではなく、推論対象となる新しい情報を追加するだけである
- コンテキストウィンドウの制限により、使用可能な取得情報の量が制約される
標準的な RAG(Retrieval-Augmented Generation:検索拡張生成)は、エージェントが自律的にどのドキュメントを取得するか、どのクエリを再構成するか、そして十分な情報を収集したと判断するタイミングを決定する「アジェンティック RAG」へと進化しつつあります。ブラウザ内でインタラクティブなコーディング体験を行いたい場合は、How to Build an Agentic RAG Application の学習モジュールをご覧ください。
エージェントツールおよびスキル注入
ツールおよびスキルの注入は、エージェントにツールやスキルを提供することでその能力を拡張します:
- ツール:外部ソフトウェアと相互作用する呼び出し可能な関数
- スキル:タスク完了のためのドメイン固有の指示
これらのモジュール化され再利用可能なコンポーネントにより、基本となる重みを変更することなく、汎用モデルを専門分野向けにカスタマイズすることが容易になります。
仕組み
ウェブ検索、ファイル入出力、シェル実行、API 呼び出しなどのツールは、エージェントのシステムプロンプトまたはコンテキスト内で定義されます。指示、スクリプト、リソースを含むスキルは、エージェントのコンテキストに読み込まれます。
以下は、インシデントトライアージにおいてスキルが配置される可能性のあるファイルディレクトリの例です:
skills/
incident-triage/
SKILL.md
README.md
scripts/
collect_logs.sh
parse_logs.py
summarize_findings.py
templates/
triage_report.md
examples/
sample_incident.json
SKILL.md は、以下のような内容になる可能性があります:
スキル: インシデントトライアージ (ログ収集 + 要約)
目的
特定のサービスの診断ログを収集し、主要なエラー信号を抽出して、以下の要素を含む簡潔なトライアージレポートを作成します:
- 疑われる根本原因
- 上位のエラーシグネチャ
- タイムラインのハイライト
- 直ちに実行すべき次のステップ
使用タイミング
ユーザーが以下を要求した場合にこのスキルを使用してください:
- 停止または回帰の調査
- 2 つの時系列の間にあるサービスのログ要約
- 迅速なインシデントレポートの作成
入力 (必須)
- service_name: 文字列 (例: "payments-api")
- start_time: ISO8601 形式の文字列 (例: "2026-03-05T10:00:00Z")
- end_time: ISO8601 形式の文字列 (例: "2026-03-05T11:00:00Z")
入力 (オプション)
- environment: 文字列 (デフォルトは "prod")
- log_source: string (デフォルト "journald") # "file", "cloud" など也可以是
- output_dir: string (デフォルト "./out")
- redact: boolean (デフォルト true)
Outputs
- {output_dir}/raw_logs.txt
- {output_dir}/events.jsonl
- {output_dir}/summary.md
Workflow
1) ログの収集:
scripts/collect_logs.shを実行して、時間範囲内の生ログを取得します。
2) ログを構造化されたイベントに解析:
scripts/parse_logs.pyを実行して、JSONL 形式のイベント(タイムスタンプ、レベル、メッセージ、シグネチャ)を出力します。
3) サマリー作成:
templates/triage_report.mdテンプレートを使用して、Markdown レポートを生成するためにscripts/summarize_findings.pyを実行します。
Commands (How to Call)
Step 1: Collect
bash scripts/collect_logs.sh \
--service payments-api \
--start "2026-03-05T10:00:00Z" \
--end "2026-03-05T11:00:00Z" \
--env prod \
--out ./out/raw_logs.txt
When to use
- エージェントの推論方法ではなく、エージェントができることを拡張する場合
- エージェントシステムを外部ソフトウェア、API、または他のサードパーティコンポーネントに接続する場合
- モジュール化され、組み合わせ可能な機能をエージェントに提供する場合
Limitations
- 本モデルはツール呼び出しを基本機能として必要とします。
- 複雑なツールのオーケストレーションには、信頼性を確保するためにファインチューニングが必要になる場合があります。
- スキル定義はコンテキストウィンドウのスペースを消費します。
Supervised fine-tuning
教師ありファインチューニング(SFT: Supervised Fine-Tuning)とは、ラベル付きデータセットを用いてモデルの重みを調整することで、事前学習済みモデルの動作を変更する手法です。推論時にエージェントの動作をカスタマイズする以前の技術とは異なり、SFT はトレーニング時に行われ、基盤となるモデルの動作そのものを変更します。
How it works
入力(自然言語によるリクエスト)と理想的な出力(構造化された JSON ツール呼び出しなど)を含む例からなるデータセットを構築します。モデルはこの例を用いて訓練され、示された動作の再現を学習します。
NVIDIA NeMo Data Designer などの 合成データ生成 (SDG) ツールは、このプロセスを加速できます。特に手動でラベル付けされた例が不足している低リソース領域において有効です。すべての訓練例を手書きする代わりに、チームはデータスキーマを定義し、大規模言語モデル (LLM) を用いて多様で高品質な訓練ペアを生成できます。その後、NVIDIA NeMo framework などの高度なファインチューニングフレームワークを用いて、生成されたデータセットで SFT(Supervised Fine-Tuning:教師あり微調整)を実施します。
使用すべきタイミング
- 出力例を持つ明確に定義されたタスクに対して、アクセス可能なデータを扱う場合
- ラベル付けされた例が限られており、高品質な合成データを生成してファインチューニング用データセットの基盤とする必要がある低リソース領域向けにモデルをカスタマイズする場合
- モデルが特定の出力形式(JSON スキーマ、ツール呼び出し、構造化データ)を確実に生成する必要がある場合
制限事項
- 品質は訓練データの品質に完全に依存します。モデルは善悪にかかわらず模倣して学習します
- データが多様性に欠ける場合、訓練分布に対して過学習し、壊滅的な忘却(catastrophic forgetting)を引き起こす可能性があります
- トレーニングに必要な計算リソース
SFT(Supervised Fine-Tuning)は、エージェントカスタマイズパイプラインにおける最初のトレーニングベースのステップであることが多い。これは、後続のアライメント手法が微調整できるための基準となる振る舞いを確立する。
パラメータ効率的ファインチューニング
90 億パラメータモデルのようなフルファインチューニングでは、すべての重みを調整するために大量の GPU リソースが必要となる。Low-Rank Adaptation (LoRA) や Quantized Low-Rank Adaptation (QLoRA) に代表されるパラメータ効率的ファインチューニング(PEFT)手法は、SFT と組み合わせて使用できる更新メカニズムの一種を指し、モデルの重みの大部分を凍結したまま、ごく一部の参数のみを変更するものである。
このアプローチは、フルトレーニングの利点のほとんどを維持しつつ、複数の specialized AI モデルにおけるストレージオーバーヘッドを劇的に削減する。PEFT は現在、実用的なエージェントファインチューニングの標準となっている。
仕組み
LoRA は、モデルのアテンション層とフィードフォワード層に小さなトレーニング可能な行列を注入する。大規模モデル内のすべてのパラメータを更新するのではなく、ごく一部の部分のみを訓練すればよい。例えば、NVIDIA Nemotron 3 Nano は合計 300 億のパラメータを持つが、フォワードパスあたり約 35 億のアクティブパラメータしか使用しない。LoRA を用いれば、大規模なベースモデルはそのまま維持したまま、異なるタスク、ドメイン、または顧客に対して異なるアダプターを差し替えることができる。
QLoRA は、ベースモデルを 4 ビット精度に量子化することでこれを拡張し、従来であれば利用可能な GPU メモリを超えてしまうようなモデルのファインチューニングを可能にします。実際には、LoRA を用いた SFT(Supervised Fine-Tuning)の選択は、ファインチューニング全体にかかるコストなしに有用なカスタマイズを実現するための迅速な手段となります。
フルファインチューニングには複数のハイエンド GPU が必要となるモデルでも、単一の GPU で LoRA によるチューニングが可能な場合が多くあります。これにより、大規模な計算リソース予算を持たないチームにもカスタマイズの機会が開かれます。
使用すべきタイミング
- GPU リソースに制限がある場合
- ベースモデルの複数の専門化されたバージョンを維持する必要がある場合
- 迅速な反復と高速なトレーニングサイクルが求められる場合
限界
- モデル重みの一部のみを再学習させるため、実現可能な変更の度合いに限界が生じます(品質の上限)
Direct Preference Optimization (DPO)
SFT が良い例を模倣するのに対し、Direct Preference Optimization(DPO)はモデルをペアごとの比較に基づく選好データで訓練します。この選好信号は、人間のアノテーター、LLM による判定器、ルールベースの検証器、あるいは合成生成された選好データから得ることができます。DPO は選好信号のソースに依存しないためです。RLHF(Reinforcement Learning from Human Feedback)とは異なり、DPO は別途報酬モデルを必要としないため、SFT ベースラインが存在した後の微調整ステップとして効果的です。
仕組み
同じ入力に対して、1 つは好ましく、もう 1 つは拒否されたというレスポンスのペアを収集または生成します。これらのペアは、手動で作成するか、実際のユーザーインタラクションから選別して作成するか、合成データ生成ワークフローを用いて生成することができます。
例えば、リソースが限られたドメインでは、LLM がルールの基準やスキーマ、検証者に基づいて候補となるレスポンスと優先度のラベルを生成し、その後人間がその結果の品質を検証またはサンプリング監査します。DPO アルゴリズムは、ペアワイズ対照損失(pairwise contrastive loss)を用いて好ましいレスポンスに高い確率を割り当て、拒否されたレスポンスに対する相対的な対数尤度(log-probability)を最大化します。
使用すべきタイミング
- 主観的なレスポンスの品質(トーン、スタイル、有用性、安全性)を利用する場合
- 複数の有効な出力が存在するが、その中で一部が他よりも明確に優れている場合
- 完全な RLHF の複雑さを伴わずに、好みの方向へアライメントさせる必要がある場合
- SFT(Supervised Fine-Tuning:教師あり微調整)を実行した後に、さらに出力品質を洗練させたい場合
制限事項
- 人間が作成したものか合成データかのいずれかにせよ、高品質な優先度ペアが必要である
- 検証が行われない場合、合成の優先度データには審査者のバイアスや不十分な基準、非現実的な例が含まれる可能性がある
- 厳密に正解が検証可能なタスクに対しては効果が低い
リンforcement learning(強化学習)
強化学習(Reinforcement Learning: RL)技術は、機械学習のサブクラスを構成します。以下で取り上げる技術は、エージェントのカスタマイズや、それらを駆動する LLM のカスタマイズに特化して使用できる RL のバリエーションです。
人間フィードバックからの強化学習
RLHF は、言語モデルを人間の嗜好に合わせるための最も強力な手法の一つですが、同時にリソース集約型でもあります。この手法は 2 つの段階からなるプロセスを使用します:まず、人間の嗜好を予測する報酬モデル(別のニューラルネットワーク)をトレーニングし、次にそのモデルを自動化された審査員として使用して、RL トレーニング中に出力にスコアリングを行います。これにより、トーン、有用性、安全性といった微妙な品質基準を捉えることが可能になります。
仕組みについて
人間の注釈担当者がモデルの出力を品質に基づいてランク付けします。これらのランク付けは、人間の嗜好を予測する報酬モデルをトレーニングするために使用されます。その後、エージェントは RL アルゴリズムを使用してトレーニングされ、元の行動に近づきながら報酬モデルのスコアを最大化するように調整されます。
使用するべきタイミング
- シンプルな指標では捉えられない複雑な整合性目標の調整
- 十分な量の人間による注釈リソースを活用できる場合
- 安全性、有用性、有害性の回避など、微妙な行動形成が必要な場合
制限事項
- 実装が複雑であること—複数のモデル(ポリシー、参照、報酬、批評家など)を同時に管理する必要がある
- 計算コストが高く、トレーニングの不安定さに陥りやすい
- 報酬モデルがゲーム化されたり、誤設定されたりする可能性がある(報酬ハッキング)
検証可能な報酬を用いた強化学習
RLHF スタイルのアプローチは、学習された報酬モデルに依存しており、これらは訓練コストが高く、不正確であったりゲーム化されたりする可能性があります。報酬モデルを設計するプロセスとシステムは広範にわたります。明確な正解・不正解が存在するタスク(有効な JSON、正しい API 呼び出し、テストの合格など)においては、検証可能な報酬を持つ強化学習(RLVR: Reinforcement Learning with Verifiable Rewards)が、信頼できる検証者から監査可能で反復可能な報酬シグナルを提供し、これらの学習された報酬モデルに由来する曖昧さの一部を軽減することができます。
仕組みについて
人間の嗜好に基づいて報酬モデルを訓練するのではなく、RLVR は出力の正しさを客観的かつ透明性を持って評価できる決定論的な検証関数を使用します。
自然言語を CLI コマンドに変換するように訓練されたエージェントを想定してください。検証関数はモデルの JSON 出力を解析し、コマンドが正しいかを確認し、各フラグを期待値と比較して、正確な報酬スコアを計算します:
- 完全一致: 報酬 = +1.0
- コマンドは正しいがフラグの一部のみ: 報酬はフラグの精度に比例
- 間違ったコマンドまたは無効な JSON: 報酬 = -1.0
このアプローチは、NVIDIA NeMo Gym で使用されており、訓練中にモデルの出力を正解(ground truth)と比較してスコアリングする検証エンドポイントを提供しています。
使用するべきタイミング
- 構造化データ、CLI コマンド、コード、数学的推論、ツール呼び出しなど、客観的に検証可能な正しい出力を持つタスクに取り組んでいる場合
- 透明性があり監査可能な報酬シグナルを必要とする場合
- 表面レベルの回答能力を超えて、推論品質を向上させる必要性
制限事項
- 決定論的な正解基準を持つタスクにのみ適用可能
- 創造的、主観的、または自由な生成を要するタスクには適さない
- 検証インフラの構築が必要(ただし NeMo Gym などのフレームワークはこれを簡素化する)
RLVR は DeepSeek-R1 の画期的な推論能力を支える重要な技術であり、検証可能な報酬がモデルに高度な問題解決戦略を教示できることを実証しています。場合によっては、教師あり微調整(Supervised Fine-Tuning: SFT)を起点とすることなくも可能です。NVIDIA NeMo RL や NeMo Gym などのオープンソースライブラリは、開発者が大規模なトレーニングを行うのを支援します。
グループ相対ポリシー最適化
グループ相対ポリシー最適化(Group Relative Policy Optimization: GRPO)は、RLVR と自然に組み合わさる効率的なポリシー最適化アルゴリズムです。これはプロンプトごとに複数の完成文を生成し、PPO の批評家ネットワーク(Critic Network)の代わりに、改善を導くためのグループ相対ベースラインを採用します。これにより計算オーバーヘッドが削減され、トレーニングの安定性と有効性が保たれます。
仕組み
各トレーニングプロンプトに対して、GRPO は現在のポリシーから複数の完成結果(通常は 4 から 64)を生成します。各完成結果は報酬関数によって評価されます。PPO が行うようなクリティックネットワークを用いてベースラインを推定するのではなく、GRPO は各完成結果の報酬をグループ平均と標準偏差で正規化することで、そのアドバンテージを計算します。平均以上のアドバンテージを持つ完成結果は強化され、それ未満のものは抑制されます。
使用すべきタイミング
- RLVR(Reinforcement Learning with Verifiable Rewards)を適用し、効率的な最適化アルゴリズムが必要である場合
- 計算リソースが制約となっている環境で作業している場合
- PPO のクリティックのような複雑さを伴わずに、安定した RL トレーニングを実現する必要がある場合
制限事項
- 各プロンプトに対して複数の完成結果を生成する必要があり、教師あり学習手法と比較してステップあたりの計算コストが増加します
- グループベースのベースラインはグループサイズが小さい場合にノイズが大きくなるため、グループサイズのハイパーパラメータ追加調整が必要になる場合があります
- その有効性は設計された報酬関数の質に依存しており、不適切に指定された報酬は不十分なポリシー更新をもたらします
GRPO は DeepSeek-R1 のトレーニングを支えた最適化アルゴリズムです。特に検証可能な報酬と組み合わせて使用される際、RL ベースの AI エージェントカスタマイズにおけるデフォルト選択肢としてますます採用されています。
AI エージェントのカスタマイズにおけるマルチステージパイプラインとは何か?
実際には、最も効果的なエージェントカスタマイズは、複数の技術を順次組み合わせることで実現されます。代表的なパイプラインの段階は以下の通りです。
ステージ 1:プロンプトエンジニアリング、ツール、スキル、および RAG を組み合わせたアプローチ
システムプロンプト、ツールとスキルの定義、そして検索機能から始め、ベースラインの動作を確立します。
ステージ 2:SDG(Synthetic Data Generation)
プロンプト、ツール、ベクトルデータベースだけでは達成できないカスタム機能を備えるために、データを生成してエージェントをトレーニングを通じてカスタマイズします。
ステージ 3:SFT(Supervised Fine-Tuning)
SFT は、モデルに対してカスタムタスクの基本的な語彙、フォーマット、構造を教えます。
ステージ 4:RLVR/GRPO または DPO
模倣学習では達成できないレベルの品質向上を目指し、選好ベースまたは強化学習(Reinforcement Learning)を用いて SFT モデルを洗練させます。手法の選択と順序はタスクに依存します。
- DPO は一般的により安価で安定しており、人間や LLM 判定器、ルールベース検証機から得られる選好ペアが存在するが、信頼できるスカラー報酬がない場合に効果的です。
- GRPO を用いた RLVR(Reinforcement Learning with Verifiable Rewards)は、出力が客観的に検証可能であり、選好学習だけでは到達できない推論品質のさらなる向上が必要な場合に最適なツールです。
これらは厳密な互換選択肢ではありません。一般的なパターンとして「SFT → DPO → RLVR」があります。まず SFT ポリシーの上にフォーマットとスタイルを安価に整合させるために DPO を使用し、次に検証可能な報酬が存在する領域で推論能力のさらなる向上を推進するために RLVR を適用します。順序は設計上の選択であり、固定されたレシピではありません。
ステージ 5:評価と反復
タスク成功率、ツール呼び出しの精度、およびその他の必要な指標を測定します。得られた結果をもとにカスタマイズステージを反復し、目標とするパフォーマンスを達成するまで改善を続けます。
このパイプラインは、分野が収束している原則を反映しています:軽量に始め、厳密に測定し、データが必要と示す場合にのみ複雑さを追加する。
適切なエージェントカスタマイズ手法の選び方
カスタマイズ手法に影響を与える3 つの要因があります:タスクの特徴、利用可能なリソース、およびプロジェクトの成熟度です。
タスクの特徴
エージェントの出力が客観的に検証可能である場合(正しい JSON、合格するテスト、有効な API 呼び出し)、GRPO を用いた RLVR が最も効果的な手法となる可能性が高いです。品質が主観的な場合は DPO の方が適切です。タスクが明確に定義されているが、モデルが単に例を模倣する必要があるだけの場合は、SFT で十分である可能性があります。
利用可能なリソース
フル RLHF(強化学習による人間フィードバック)には、相当な計算資源と人間の注釈付け予算が必要です。LoRA ベースの SFT は単一の GPU で実行可能です。プロンプトエンジニアリングには計算資源は不要です。手法をインフラストラクチャに合わせて選定してください。
プロジェクトの成熟度
初期段階のプロジェクトでは、プロンプトエンジニアリング、評価基盤、およびツール定義への投資が重要です。明確な指標を特定し、失敗モードを把握し、それに対処するための十分なデータを保有した時点で、トレーニングベースのカスタマイズが最も大きな価値をもたらします。
image*図 1. 適切な AI エージェントカスタマイズ手法を選択するための要因*
AI エージェントカスタマイズの始め方
エージェントのカスタマイズは、効果的に適用された場合に相乗効果を発揮するアプローチのスペクトラムを包含しています。最も成功しているチームは、軽量な手法から始め、早期に評価に投資し、測定結果が必要とされる場所にトレーニングベースの技術を段階的に追加します。
カスタマイズと評価は、より良い成果を導くために連携して機能します。測定できないものを改善することはできません。プロンプトの微調整から GRPO トレーニングの実行に至るまで、すべてのカスタマイズの決定は明確な指標によって駆動され、実世界の性能に対して検証されるべきです。
エージェントのカスタマイズをお考えですか?NVIDIA NeMo を活用して開発を加速しましょう。同製品は以下を含む統合ツールキットを提供します:
- NeMo Data Designer による合成データ生成
- NeMo Automodel、NeMo Megatron-Bridge、および NeMo RL によるモデルカスタマイズ
- NeMo Gym による検証可能な報酬インフラストラクチャ
- NeMo Agent Toolkit によるエージェントのオーケストレーションと評価
これらのツールは、既存のエージェントフレームワークとの統合を目的として設計されており、ゼロから再構築する必要なく、カスタマイズ、評価、最適化機能を追加できます。
原文を表示
Autonomous AI agents are taking on all types of work for businesses: routing logistics fleets, triaging support tickets, generating code, and orchestrating multistep workflows. How do you take a general-purpose model and make it excel at your specific task? Customization provides an agent with the right capabilities.
This post explains nine techniques for customizing AI agents, along with criteria for selecting the right techniques for your use case.
Why is it necessary to customize an AI agent?
Foundation models come with broad language and reasoning capabilities across use cases and modalities based on the training datasets used. Models understand language and can follow instructions, but specialized workflows often require context that is restricted, specialized, or proprietary.
Customizing an agent solves this challenge by shaping how the agent reasons under constraints, which tools it selects, how it structures its outputs, and how reliably it executes domain workflows.
What techniques are used for agent customization?
Agent customization techniques span from simple prompt changes to advanced techniques like reinforcement learning (RL), each with tradeoffs in cost, complexity, and capability. The best approach depends on whether you need better information, instructions, or fundamentally more reliable behavior. The following sections cover the main approaches.
Prompt engineering and system prompts
Prompt engineering only requires changing the prompt to the agent at inference time. It’s the most accessible and typically the first technique applied to customize agent behavior. Standard agents may require human tuning of system prompts. Advanced, self-evolving agents like OpenClaw use prompts that get updated by the agent itself as it revises memory and instructions over time, resulting in a self-customizing agent.
How it works
You write a system prompt that defines the agent’s role, available tools, output format, and behavioral constraints. The model follows these instructions using its existing capabilities.
The following is a sample system prompt:
You are an expert CLI assistant. Translate user requests into structured JSON tool
calls. Respond with ONLY a JSON object. Set unused flags to null.
When to use
- Iterating quickly on agent behavior
- Working on a custom task that is described clearly in natural language
- Prototyping or experimenting before investing further
Limitations
- Prompts can become brittle for complex reasoning chains
- Performance degrades as instructions grow longer, more nuanced
- Model may not consistently follow complex formatting requirements
- Doesn’t extend the model’s core capabilities
- Switching the model powering the agent requires retesting prompts
Every agent project requires iterative prompt engineering and refinement. However, getting the agent to reliably produce structured outputs, follow domain-specific logic, or handle edge cases may require refinement. Note that self-evolving agents refine their own prompts using a harness.
Retrieval-augmented generation
Retrieval-augmented generation (RAG) solves the knowledge limitation of foundation models by dynamically retrieving relevant, up-to-date information from external knowledge sources (vector databases, for example). This retrieved content grounds the agent at inference time, when it is injected into the model’s context. This significantly reduces hallucinations and enables answering questions about custom, proprietary, or rapidly changing domains without model retraining.
How it works
When a user queries the agent system, the system searches a vector database or document store for data relevant to the query. Retrieved content is then sent alongside the user query to the model, which reasons over both and returns a grounded response.
When to use
- Giving agent access to up-to-date or proprietary knowledge
- Reducing hallucinations by grounding responses in authoritative sources
- Working with a knowledge base that changes frequently and retraining would be impractical
Limitations
- Adds latency due to retrieval
- Doesn’t add new reasoning capabilities, only new information to reason about
- Context window limits constrain how much retrieved information can be used
Standard RAG is increasingly evolving into agentic RAG, where the agent autonomously decides which documents to retrieve, which queries to reformulate, and when it has gathered enough information. For an interactive coding experience within your browser, check out the How to Build an Agentic RAG Application learning module.
Agent tool and skill injection
Tool and skill injection extends an agent’s capabilities by providing the agent with tools or skills:
- Tools: Callable functions that interact with external software
- Skills: Domain-specific instructions for completing tasks
These modular, reusable components make it easy to customize a general-purpose model for specialized domains without modifying its underlying weights.
How it works
Tools such as web search, file I/O, shell execution, and API calls are defined in the agent’s system prompt or context. Skills, which may include instructions, scripts, and resources, are loaded into the agent’s context.
The following example file directory is where a skill might be located for incident triage:
skills/
incident-triage/
SKILL.md
README.md
scripts/
collect_logs.sh
parse_logs.py
summarize_findings.py
templates/
triage_report.md
examples/
sample_incident.json
The SKILL.md might look like the following:
# Skill: Incident Triage (Log Collection + Summary)
## Purpose
Collect diagnostic logs for a given service, extract key error signals, and produce a short
triage report with:
- suspected root cause(s)
- top error signatures
- timeline highlights
- immediate next steps
## When to Use
Use this skill when the user asks to:
- investigate an outage / regression
- summarize logs for a service between two timestamps
- produce a quick incident report
## Inputs (Required)
- service_name: string (e.g., "payments-api")
- start_time: ISO8601 string (e.g., "2026-03-05T10:00:00Z")
- end_time: ISO8601 string (e.g., "2026-03-05T11:00:00Z")
## Inputs (Optional)
- environment: string (default "prod")
- log_source: string (default "journald") # could be "file", "cloud", etc.
- output_dir: string (default "./out")
- redact: boolean (default true)
## Outputs
- {output_dir}/raw_logs.txt
- {output_dir}/events.jsonl
- {output_dir}/summary.md
## Workflow
1) Collect logs:
- Run scripts/collect_logs.sh to fetch raw logs for the time window
2) Parse logs into structured events:
- Run scripts/parse_logs.py to emit JSONL events (timestamp, level, message, signature)
3) Summarize:
- Run scripts/summarize_findings.py to produce a markdown report using templates/triage_report.md``
## Commands (How to Call)
### Step 1: Collect
`bash</code></p><p><code>bash scripts/collect_logs.sh \</code></p><p><code> </code><code>--service payments-api \</code></p><p><code> </code><code>--start "2026-03-05T10:00:00Z" \</code></p><p><code> </code><code>--end "2026-03-05T11:00:00Z" \</code></p><p><code> </code><code>--env prod \</code></p><p><code> </code><code>--out ./out/raw_logs.txt</code></p><p><code>`
When to use
- Extending what an agent can do, not how it reasons
- Connecting your agent system to external software, APIs, or other third-party components
- Providing agent with modular, composable capabilities
Limitations
- Model requires tool-calling as a base capability
- Complex tool orchestration may require fine-tuning for reliability
- Skill definitions consume context window space
Supervised fine-tuning
Supervised fine-tuning (SFT) is for modifying a pretrained model’s behavior by tuning model weights with labelled datasets. Unlike previous techniques that customize agent behavior at inference time, SFT is performed at training time, modifying the underlying model’s behavior.
How it works
You assemble a dataset of examples—each containing an input (a natural language request) and the ideal output (such as a structured JSON tool call). The model trains on these examples, learning to replicate the demonstrated behavior.
Synthetic data generation (SDG) tools like NVIDIA NeMo Data Designer can accelerate this process, especially in low-resource domains where manually labelled examples are scarce. Instead of hand-authoring every training example, teams can define a data schema and use LLMs to generate diverse, high-quality training pairs. Then, conduct SFT using that generated dataset using an advanced fine-tuning framework like NVIDIA NeMo framework.
When to use
- Working with accessible data for well-defined tasks with output examples
- Customizing a model for a low-resource domain where labelled examples are limited, and high-quality synthetic data can be generated to bootstrap the fine-tuning dataset
- Requiring the model to reliably produce specific output formats (JSON schemas, tool calls, structured data)
Limitations
- Quality depends entirely on training data quality; the model learns to imitate, for better or worse
- May overfit to training distribution if data isn’t diverse enough (catastrophic forgetting)
- Needs compute resources for training
SFT is often the first training-based step in an agent customization pipeline. It establishes a baseline behavior that downstream alignment methods can refine.
Parameter-efficient fine-tuning
Full fine-tuning, such as on a 9-billion-parameter model, requires significant GPU resources to tune all weights. Parameter-efficient fine-tuning (PEFT) methods, such as Low-Rank Adaptation (LoRA) and Quantized Low-Rank Adaptation (QLoRA), describe a type of update mechanism that can be used with SFT to freeze the majority of model weights while only modifying a tiny fraction of parameters.
This approach maintains most of the benefits of full training while drastically reducing storage overhead for multiple specialized AI models. PEFT is now the standard for practical agent fine-tuning.
How it works
LoRA injects small, trainable matrices into the model’s attention and feed-forward layers. Instead of updating all parameters in a large model, you only train a small fraction. For example, NVIDIA Nemotron 3 Nano has 30 billion total parameters with ~3.5 billion active per forward pass. With LoRA, the large base model stays the same, and you swap in different adapters for different tasks, domains, or customers.
QLoRA extends this by quantizing the base model to 4-bit precision, enabling fine-tuning of models that would otherwise exceed available GPU memory. In practice, choosing SFT using LoRA is a fast path to useful customization without the full cost of fine-tuning.
A model that would require multiple high-end GPUs for full fine-tuning can often be LoRA-tuned on a single GPU. This democratizes customization for teams without massive compute budgets.
When to use
- Working with limited GPU resources
- Maintaining multiple specialized versions of a base model
- Requiring quick iterations and fast training cycles
Limitations
- Retraining a subsection of the model weights limits the degree of change possible (quality ceiling)
Direct Preference Optimization
While SFT imitates good examples, Direct Preference Optimization (DPO) trains the model on pairwise preference comparisons. The preference signal can come from human annotators, an LLM judge, rule-based verifiers, or synthetically generated preference data, since DPO is agnostic to the source of the preference signal. Preference signals eliminate the need for a separate reward model, unlike reinforcement learning from human feedback (RLHF), making DPO effective as a refinement step after an SFT baseline exists.
How it works
You collect or generate pairs of responses for the same input: one preferred and one rejected. These pairs can be produced manually, curated from real user interactions, or generated with synthetic data generation workflows.
For example, in a low-resource domain, an LLM can generate candidate responses and preference labels according to a rubric, schema, or verifier, then humans can review or sample-audit the results for quality. The DPO algorithm assigns higher probability to preferred responses using a pairwise contrastive loss, maximizing the relative log-probability of the preferred response over the rejected one.
When to use
- Using subjective response quality (tone, style, helpfulness, safety)
- Working with multiple valid outputs but some are measurably better than others
- Requiring alignment with preferences without the complexity of full RLHF
- Refining output quality further after performing SFT
Limitations
- Requires high-quality preference pairs, whether human-authored or synthetic
- Synthetic preference data can encode judge bias, weak rubrics, or unrealistic examples if not validated
- Less effective for tasks with strictly verifiable correct answers
Reinforcement learning
Reinforcement learning (RL) techniques comprise a subclass of machine learning. The following techniques covered are variations of RL that can be used specifically to customize agents, and the LLMs that power them.
Reinforcement learning from human feedback
RLHF is one of the most powerful yet resource-intensive techniques for aligning language models with human preferences. It uses a two-stage process: first, training a reward model (a separate neural network) to predict human preference, and then using that model as an automated judge to score outputs during RL training. This helps capture nuanced quality criteria like tone, helpfulness, and safety.
How it works
Human annotators rank model outputs by quality. These rankings train a reward model that predicts human preferences. The agent is then trained using a RL algorithm to maximize the reward model’s scores while staying close to its original behavior.
When to use
- Coordinating complex alignment objectives that can’t be captured by simple metrics
- Working with substantial human annotation resources
- Requiring nuanced behavioral shaping (safety, helpfulness, harm avoidance)
Limitations
- Complex implementation—requires managing multiple models simultaneously (e.g. policy, reference, reward, critic)
- Computationally expensive and prone to training instabilities
- Reward model can be gamed or misspecified (reward hacking)
Reinforcement learning with verifiable rewards
RLHF-style approaches rely on learned reward models, which are expensive to train and can be imprecise or gameable. The process and system of designing reward models is extensive. For tasks with clear right/wrong answers—like valid JSON, correct API calls, or passing tests—reinforcement learning with verifiable rewards (RLVR) can provide auditable, repeatable reward signals from reliable verifiers that reduce some of the ambiguity that derives from these learned reward models.
How it works
Instead of training a reward model from human preferences, RLVR uses deterministic verification functions that can objectively and transparently assess an output’s correctness.
Consider an agent trained to translate natural language into CLI commands. A verification function parses the model’s JSON output, checks whether the command is correct, compares each flag against the expected values, and computes a precise reward score:
- Exact match: Reward = +1.0
- Correct command, partial flags: Reward proportional to flag accuracy
- Wrong command or invalid JSON: Reward = -1.0
This approach is used by NVIDIA NeMo Gym, which provides verification endpoints that score model outputs against ground truth during training.
When to use
- Working with a task that has objectively verifiable correct outputs (structured data, CLI commands, code, mathematical reasoning, tool calls)
- Requiring transparent, auditable reward signals
- Needing to improve reasoning quality, beyond surface-level answering capabilities
Limitations
- Only applicable to tasks with deterministic correctness criteria
- Not suitable for creative, subjective, or open-ended generation
- Requires building verification infrastructure (though frameworks like NeMo Gym simplify this)
RLVR is a key technique behind DeepSeek-R1’s breakthrough reasoning capabilities, demonstrating that verifiable rewards can teach models sophisticated problem-solving strategies—sometimes even without any supervised fine-tuning as a starting point. Open libraries such as NVIDIA NeMo RL and NeMo Gym help developers train at scale.
Group Relative Policy Optimization
Group Relative Policy Optimization (GRPO) is an efficient policy optimization algorithm that pairs naturally with RLVR. It generates multiple completions per prompt and replaces PPO’s critic network with a group-relative baseline to guide improvement. This cuts computational overhead, keeping training stable and effective.
How it works
For each training prompt, GRPO generates multiple completions (typically 4 to 64) from the current policy. Each completion is scored by the reward function. Instead of using a critic network to estimate baselines (as PPO does), GRPO computes the advantage of each completion by normalizing its reward against the group mean and standard deviation. Completions with above-average advantage are reinforced; those below are suppressed.
When to use
- Applying RLVR and need an efficient optimization algorithm
- Working with computational resources that are a constraint
- Needing stable RL training without the complexity of a PPO critic
Limitations
- Requires generating multiple completions per prompt, increasing training compute per step compared to supervised methods
- Group-based baselines can be noisy with small group sizes, requiring additional tuning of the group size hyperparameter
- Effectiveness depends on a well-designed reward function; poorly specified rewards produce poor policy updates
GRPO is the optimization algorithm that powered DeepSeek-R1 training. It is increasingly becoming the default choice for RL-based agent customization, particularly when paired with verifiable rewards.
What is a multistage pipeline for AI agent customization?
In practice, the most effective agent customization combines multiple techniques in sequence. The stages of a representative pipeline are outlined below.
Stage 1: Prompt engineering plus tools and skills plus RAG
Start with system prompts, tool and skill definitions, and retrieval to establish baseline behavior.
Stage 2: SDG
For custom capabilities that prompting, tools, and vector databases alone can’t achieve, generate data to customize the agent through training.
Stage 3: SFT
SFT teaches the model the basic vocabulary, format, and structure of custom tasks.
Stage 4: RLVR/GRPO or DPO
Refine the SFT model using preference-based or RL to improve quality beyond what imitation learning can achieve. The choice and ordering depends on the task:
- DPO is typically cheaper and more stable, and works well when there are preference pairs (from humans, an LLM judge, or rule-based verifiers) but no reliable scalar reward.
- RLVR with GRPO is the right tool when outputs are objectively verifiable and there is a need to push reasoning quality further than preference learning alone can reach.
These aren’t strict alternatives. A common pattern is SFT → DPO → RLVR. DPO is used first to affordably align format and style on top of the SFT policy, then RLVR drives harder reasoning gains where verifiable rewards exist. The order is a design choice, not a fixed recipe.
Stage 5: Evaluation plus iteration
Measure task success rate, tool call accuracy, and any other desired metrics. Use results to iterate on customization stages until you achieve desired performance.
This pipeline reflects a principle that the field is converging on: start lightweight, measure rigorously, and add complexity only where the data shows it’s needed.
How to choose the right agent customization approach
Three factors impact customization methods: task characteristics, available resources, and project maturity.
Task characteristics
If your agent’s outputs can be objectively verified (correct JSON, passing tests, valid API calls), RLVR with GRPO is likely your highest-leverage technique. If quality is subjective, DPO is more appropriate. If the task is well-defined but the model just needs examples to imitate, SFT may be sufficient.
Available resources
Full RLHF requires substantial compute and human annotation budgets. LoRA-based SFT can run on a single GPU. Prompt engineering requires no compute. Match your technique to your infrastructure.
Project maturity
Early-stage projects should invest in prompt engineering, evaluation infrastructure, and tool definitions. Training-based customization delivers the most value once you have clear metrics, identified failure modes, and sufficient data to address them.

Get started with AI agent customization
Agent customization ecompasses a spectrum of approaches that compound in effectiveness when applied thoughtfully. The most successful teams start with lightweight methods, invest early in evaluation, and layer in training-based techniques where measurement shows they’re needed.
Customization and evaluation work together to drive better outcomes. You can’t improve what you can’t measure. Every customization decision—from a prompt tweak to a GRPO training run—should be driven by clear metrics and validated against real-world performance.
Ready to customize your agents? Accelerate development with NVIDIA NeMo, which provides an integrated toolkit spanning:
- Synthetic data generation with NeMo Data Designer
- Model customization with NeMo Automodel, NeMo Megatron-Bridge, and NeMo RL
- Verifiable reward infrastructure with NeMo Gym
- Agent orchestration and evaluation with NeMo Agent Toolkit
These tools are designed to integrate with existing agent frameworks—adding customization, evaluation, and optimization capabilities without requiring you to rebuild from scratch.
関連記事
今日のまとめ
AI日報で今日の重要ニュースをまとめ読み