Amazon Novaモデル蒸留でビデオ意味検索の意図を最適化
本文の状態
日本語全文を表示中
詳細モードで約10分の本文を読めます。
同じ出来事の情報源
6媒体で確認
宝玉的分享 · InfoQ · AWS Machine Learning Blog · TechCrunch AI · Simon Willison Blog · The Decoder
各社の報じ方を比較 ↓AWSは、Amazon Bedrock上でAmazon Novaモデル蒸留を活用し、ビデオ意味検索システムの精度、コスト、遅延のバランスを最適化する方法を紹介した。
Source Article
元記事を日本語で読む
本文に関係しない購読案内、埋め込み通知、サイト内プロモーションは除いています。
- Prepare training data — 10,000 synthetic labeled examples using Nova Premier and upload the dataset to Amazon Simple Storage Service (Amazon S3) in Bedrock distillation format
- Run distillation training job — Configure the job with teacher and student model identifiers and submit via Amazon Bedrock
- Deploy the distilled model — Deploy the custom model using on-demand inference for flexible, pay-per-use access
- Evaluate the distilled model — Compare routing quality against the base Nova Micro and the original Claude Haiku baseline using Amazon Bedrock Model Evaluation
The complete notebook, training data generation script, and evaluation utilities are available in the GitHub repository.
Prepare training data
One of the key reasons we chose モデル蒸留(model distillation) over other customization techniques like 教師ありファインチューニング(supervised fine-tuning, SFT) is that it does not require a fully labeled dataset. With SFT, every training example needs a human-generated response as 正解データ(ground truth). With distillation, you only need prompts. Amazon Bedrock automatically invokes the ティーチャーモデル(teacher model) to generate high-quality responses. It applies データ合成およびデータ拡張技術(data synthesis and augmentation techniques) behind the scenes to produce a diverse training dataset of up to 15,000 prompt-response pairs.
That said, you can optionally provide a labeled dataset if you want more control over the 学習信号(training signal). Each record in the JSONLファイル(JSONL file) follows the bedrock-conversation-2024スキーマ(bedrock-conversation-2024 schema), where the ユーザーロール(user role) (the input prompt) is required, and the アシスタントロール(assistant role) (the desired response) is optional. See the following examples, and reference Prepare your training datasets for distillation for more detail:
{
"schemaVersion": "bedrock-conversation-2024",
"system": [{ "text": "指定された動画検索クエリに対して、視覚・音声・文字起こし・メタデータの重み(合計=1.0)および推論理由をJSON形式で返してください。" }],
"messages": [
{
"role": "user",
"content": [{ "text": "貧困の中で育ったことについて語るオリビア" }]
},
{
"role": "assistant",
"content": [{ "text": " {"visual": 0.2, "audio": 0.1, "transcription": 0.6, "metadata": 0.1, "reasoning": "クエリは音声コンテンツ('語る')に焦点を当てているため、文字起こしが最も重要となります。視覚および音声要素は文脈をサポートする二次的なものであり、メタデータは最小限です。"}"}]
}
]
}
本記事では、Novaファミリーの中で最大かつ最も高性能なNova Premierを使用して、1万件の合成ラベル付き例を作成しました。データは、視覚、音声、文字起こし、メタデータの各信号クエリにわたってバランスの取れた分布で生成されています。この例は、期待される検索入力の全範囲をカバーし、異なる難易度を表し、エッジケースやバリエーションを含み、狭いクエリパターンへの過学習を防ぐものです。以下のチャートは、4つのモーダリティチャンネルにわたる重み分布を示しています。
image
Figure 2: The weight distribution across the 10,000 training examples
追加の例が必要、またはクエリ分布を独自のコンテンツドメインに適応させたい場合は、提供されている generate_training_data.py スクリプトを使用して、Nova Premier でさらに多くのトレーニングデータを合成生成することができます。
Run distillation training job
トレーニングデータをAmazon S3にアップロードしたら、次のステップは蒸留ジョブを送信することです。モデル蒸留(Model Distillation)は、まずプロンプトを使用して教師モデル(Teacher Model)から応答を生成し、その後、そのプロンプトと応答のペアを使用して学生モデル(Student Model)をファインチューニングする手法です。本プロジェクトでは、教師がNova Premier、学生が高速でコスト効率に優れ、高スループット推論(High-Throughput Inference)向けに最適化されたNova Microです。教師のルーティング判断が、学生の動作を形成するトレーニング信号となります。
Amazon Bedrockは、トレーニングオーケストレーション(Training Orchestration)とインフラストラクチャ全体を自動的に管理します。クラスタープロビジョニング(Cluster Provisioning)、ハイパーパラメータ調整(Hyperparameter Tuning)、教師から学生へのモデルパイプラインの設定は不要です。教師モデル、学生モデル、トレーニングデータへのS3パス、および必要な権限を持つAWS Identity and Access Management (IAM) ロールを指定するだけで、Bedrockが残りの処理を行います。以下は、蒸留トレーニングジョブをトリガーするコードスニペットの例です:
import boto3
from datetime import datetime
bedrock_client = boto3.client(service_name="bedrock")
teacher_model = "us.amazon.nova-premier-v1:0"
student_model = "amazon.nova-micro-v1:0:128k"
job_name = f"video-search-distillation-{datetime.now().strftime('%Y-%m-%d-%H-%M-%S')}"
model_name = "nova-micro-video-router-v1"
response = bedrock_client.create_model_customization_job(
jobName=job_name,
customModelName=model_name,
roleArn=distillation_role_arn,
baseModelIdentifier=student_model,
customizationType="DISTILLATION",
trainingDataConfig={"s3Uri": training_s3_uri},
outputDataConfig={"s3Uri": output_s3_uri},
customizationConfig={
"distillationConfig": {
"teacherModelConfig": {
"teacherModelIdentifier": teacher_model,
"maxResponseLengthForInference": 1000
}
}
}
)
job_arn = response['jobArn']
ジョブは非同期で実行されます。Amazon BedrockコンソールのFoundation models > Custom models(ファウンデーションモデル > カスタムモデル)で進捗状況を確認するか、プログラム的に監視できます:
status = bedrock_client.get_model_customization_job(
jobIdentifier=job_arn)['status']
print(f"Job status: {status}") # 学習中、完了、または失敗
学習時間はデータセットのサイズと選択した学生モデル(スチューデントモデル)によって異なります。Nova Microで10,000件のラベル付きサンプルを使用する場合、ジョブは数時間以内に完了する見込みです。
Deploy the distilled model
蒸留ジョブが完了すると、カスタムモデルはAmazon Bedrockアカウント内で利用可能になり、デプロイの準備が整います。Amazon Bedrockはカスタムモデルに対して2つのデプロイオプションを提供します:Provisioned Throughput(プロビジョンドスループット)で予測可能な高ボリュームのワークロードに対応し、On-Demand Inference(オンデマンド推論)で事前のコミットメントなしに柔軟な従量課金アクセスを提供します。
新規で取り組み始めるチームのほとんどにとって、オンデマンド推論が推奨されるパスです。エンドポイントのプロビジョニングは不要で、時間単位のコミットメントや最低利用要件もありません。以下がデプロイコードです:
import uuid
deployment_name = f"nova-micro-video-router-{datetime.now().strftime('%Y-%m-%d')}"
response = bedrock_client.create_custom_model_deployment(
modelDeploymentName=deployment_name,
modelArn=custom_model_arn,
description="Distilled Nova Micro for video search modality weight prediction (4 weights)",
tags=[
{"key": "UseCase", "value": "VideoSearch"},
{"key": "Version", "value": "v2-4weights"},
],
clientRequestToken=f"deployment-{uuid.uuid4()}",
)
deployment_arn = response['modelDeploymentArn']
print(f"Deployment ARN: {deployment_arn}")
ステータスがInService(サービス稼働中)と表示されたら、標準のInvokeModelまたはConverse APIを使用して、他の基本モデル(ベースモデル)と同様に蒸留済みモデルを呼び出すことができます。Nova Microの推論レートに基づき、消費したトークンに対してのみ課金されます:入力1,000トークンあたり$0.000035、出力1,000トークンあたり$0.000140です。
import boto3
import json
bedrock_runtime = boto3.client(service_name="bedrock-runtime")
custom_model_arn = bedrock_client.get_model_customization_job(
jobIdentifier=job_arn
)['outputModelArn']
response = bedrock_runtime.converse(
modelId=custom_model_arn,
messages=[
{
"role": "user",
"content": [{"text": query}]
}
]
)
routing_weights = json.loads(
response['output']['message']['content']['text']
)
print(routing_weights)
{"visual": 0.7, "audio": 0.1, "transcription": 0.1, "metadata": 0.1}
Evaluate the distilled model
オリジナルのルーターと比較する前に、モデル蒸留(distillation)によってベースモデル(base model)がルーティングタスク(routing task)を遂行する能力が向上したことを検証しておく価値があります。以下の表は、ベースのNova Microと蒸留されたNova Microで同じプロンプトを実行した結果を並べて示しています。
クエリ
蒸留されたNova Micro
ベースのNovaMicro
"CEOが四半期決算について語っている"
{"visual": 0.2, "audio": 0.3, "transcription": 0.4, "metadata": 0.1, "reasoning": "クエリは決算に関する音声コンテンツ(transcription)に焦点を当てていますが、視覚的手がかり(CEOの外見)や音声(トーン/明瞭さ)も重要です..."}
ご要望のCEOが四半期決算について語っている動画検索クエリに関する情報のJSON表現は以下の通りです:
`json{ "video": { "visual": 0.3, "audio": 0.3, "transcription": 0.2, "metadata": 0.1, "reasoning": "視覚コンポーネントにはCEOのpres....
"山々を背景にした夕焼け"
{"visual": 0.8, "audio": 0.0, "transcription": 0.0, "metadata": 0.2, "reasoning": "クエリは視覚シーン(山々を背景にした夕焼け)に焦点を当てており、音声やトランスクリプションの要素はありません。メタデータには場所や時間に関連するタグが含まれる可能性があります。"}
視覚、音声、トランスクリプション、メタデータの重み(合計=1.0)、および推論を含む「山々を背景にした夕焼け」の動画検索クエリに関するJSON表現は以下の通りです:
`json{ "query": "山々を背景にした夕焼け", "results": [ { "video_id": "123456", "visual": 0.4, "audio": 0.3 ....
ベースモデルは指示と出力形式の両方で一貫性に課題を抱えています。自由テキストの応答、不完全なJSON、数値ではない重み値を生成します。一方、蒸留モデルはルーティングパイプラインが必要とするスキーマに一致する、合計が1.0となる4つの数値重みを持つ整形式のJSONを常に返します。
元のClaude Haikuルーター(Claude Haiku router)との比較では、Nova Premierによって生成された100件のラベル付き例のホールドアウトセットに対して両モデルが評価されます。私たちは、構造化された管理されたワークフローで比較を実行するためにAmazon Bedrock Model Evaluation を使用します。標準的な指標を超えてルーティング品質を評価するため、グラウンドトゥース(ground truth)に対する重みの正確さと推論の品質という2つの次元で各予測をスコアリングするようClaude Sonnetに指示するカスタムのOverallQualityルブリック(OverallQuality rubric)を定義しました。各次元は具体的な5段階の閾値にマッピングされるため、このルブリックは数値のズレと定型化した推論の両方にペナルティを科します。
"rating_scale": [
{"definition": "参照値から0.05以内の重み。推論が具体的で一貫性がある。",
"value": {"floatValue": 5.0}},
{"definition": "参照値から0.10以内の重み。推論が明確でほぼ一貫性がある。",
"value": {"floatValue": 4.0}},
{"definition": "主要なモーダリティが一致。平均エラー 0.15以下。推論が曖昧または一貫性がない。",
"value": {"floatValue": 2.0}},
{"definition": "解析できないJSON、キーの欠落、またはエラー > 0.30。有用な推論なし。",
"value": {"floatValue": 1.0}},
]
蒸留されたNova Microモデルは、大規模言語モデル(LLM)ジャッジスコアで5段階中4.0を獲得し、遅延時間(latency)が約半分であるにもかかわらず、Claude 4.5 Haikuとほぼ同等のルーティング品質(routing quality)を達成しました。コスト面での優位性も同様に顕著です。オンデマンド課金(on-demand pricing)において事前のコミットメントが不要な状態で、蒸留されたNova Microモデルに切り替えることで、入力トークン(input tokens)と出力トークン(output tokens)の両方で推論コスト(inference costs)を95%以上削減できます。注: LLMジャッジによる評価は非確定的(non-deterministic)な性質を持つため、実行ごとにスコアがわずかに変動する場合があります。
image
Figure 3: モデルパフォーマンス比較(Distilled Nova Micro対Claude 4.5 Haiku)
以下は、並列比較結果のテーブルまとめです:
| 指標 | 蒸留Nova Microモデル | Claude 4.5 Haiku |
|---|---|---|
| LLMジャッジスコア | 4.0 / 5 | 4.0 / 5 |
| 平均遅延時間 | 833ms | 1,741ms |
| 入力トークンコスト | $0.00035 / 1K | $0.80–$1.00 / 1K |
| 出力トークンコスト | $0.000140 / 1K | $4.00–$5.00 / 1K |
同じ出来事を6媒体で確認
同じ出来事を扱う別媒体の記事です。見出しと公開時刻を比較できます。
関連記事
今日のまとめ
AIデイリーブリーフで今日の重要ニュースをまとめ読み