Upgrade to Pro — share decks privately, control downloads, hide ads and more …

OpenAI gpt-oss ファインチューニング入門

Avatar for kmotohas kmotohas
October 03, 2025

OpenAI gpt-oss ファインチューニング入門

AWS で実現する独自 LLM 構築

2025年10月2日 @ AWS Japan Startup Loft
https://aws.amazon.com/startups/events/openai-oss-finetuning-20251002

Avatar for kmotohas

kmotohas

October 03, 2025
Tweet

More Decks by kmotohas

Other Decks in Technology

Transcript

  1. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. 6 © 2025, Amazon Web Services, Inc. or its affiliates. All rights reserved. Amazon Confidential and Trademark. OpenAI gpt-oss ファインチューニング⼊⾨ AWS で実現する独⾃ LLM 構築 Kazuki Motohashi, Ph.D. GTM Specialist SA – AI/ML AWS Japan
  2. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. 8 • なぜ LLM のファインチューニングが注⽬されているのか • GPT OSS モデルの概要 • GPT OSS モデルのファインチューニング • Amazon SageMaker AI を⽤いたファインチューニングとホスティング 講義パートのアジェンダ
  3. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. 9 9 本橋 和貴, Ph.D. アマゾン ウェブ サービス ジャパン合同会社 機械学習ソリューション アーキテクト AWS の AI/ML サービスのお客様に対する技術的な ⽀援を⾏いながら市場開拓を推進しています。 オライリージャパン社「実践 AWS データサイエンス」 「AWS ではじめる⽣成 AI」翻訳・技術監修
  4. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. 10 オープンウェイト AI 活⽤の広がり が 2026 年までにオープンソース AI モデルをワークフローに統合する (2024 年は 25%) https://www.infoworld.com/article/3800992/open-source-trends-for-2025-and-beyond.html エンタープライズは 2026 年までに、検索拡張⽣成 (RAG)、エージェント、その他の⽣成 AI パターンに加えて https://gcore.com/blog/evolution-pretrained-models-2025/ 2027 年までに、エンタープライズが利⽤する は として 開発されたものになる (2023 年は 1%) https://www.enaks.io/state-of-ai-2025
  5. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. 12 ⾃動⾞業界における⽣成 AI ユースケース 製品・ソフトウェア 開発 調達 ⽣産 セールス & マーケティング コネクティッドカー サービス データ基盤 on AWS 設計⽤ ⽣成モデル ADAS シーン⽣成 モデル API 仕様 企業内 ライブラリ を理解した コード⽣成 モデル 購買交渉 モデル RFx 分析 モデル ブランドを 意識した マーケティング テキスト ⽣成モデル ⾞両 inpainting モデル ヒューマ ノイド ロボット 制御 モデル 計測器 テレメトリー 異常検知 モデル サプライ チェーン 分析 モデル ⾞内 AI アシスタント オーケスト レーション アフター セールス エージェント モデル Ultimate auto LLM (cross-functional domain model)
  6. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. 13 © 2025, Amazon Web Services, Inc. or its affiliates. All rights reserved. Amazon Confidential and Trademark. OpenAI GPT-OSS
  7. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. 14 GPT-OSS GPT-2 以来のオープン LLM Hugging Face, Amazon Bedrock, Amazon SageMaker などで利⽤可能 https://www.aboutamazon.com/news/aws/openai-models-amazon-bedrock-sagemaker
  8. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. 17 GPT-OSS 120b • Mixture of Expert MOE • 128 experts • 117b parameters with 5.1b parameters active per token • 4-bit quantization scheme using mxfp4 format. • fits in a single 80 GB GPU • for production, general purpose, high reasoning scenarios • Apache 2.0 license
  9. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. 18 GPT-OSS 20b • Mixture of Expert MOE • 32 experts • 21b parameters with 3.6b parameters active per token • 4-bit quantization scheme using mxfp4 format. • fits in a single 16 GB GPU • for lower latency, on-device and consumer hardware usage • Apache 2.0 license
  10. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. 21 GPT-OSS アーキテクチャー https://www.linkedin.com/posts/xiaolishen_llm-airesearch-transformers-activity-7358864067916152833-IS2I/
  11. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. 22 MXFP4 量⼦化と GPT-OSS https://huggingface.co/blog/RakshitAralimatti/learn-ai-with-me ブロック浮動⼩数点の⼀種である MXFP4 (Microscaling Floting Point 4) で量⼦化 • E2M1 フォーマット: (1 sign bit, 2 exponent bits, 1 mantissa bit) per parameter • 32 blocks ごとに 8bits のスケーリングファクターを共有 120B パラメーターモデルであっても H100 GPU 1 枚で推論可能
  12. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. 23 GPT-OSS のベンチマーク性能 https://openai.com/open-models/
  13. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. 24 © 2025, Amazon Web Services, Inc. or its affiliates. All rights reserved. Amazon Confidential and Trademark. GPT-OSS のカスタマイズ
  14. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. 25 Why fine-tuning?
  15. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. 26 特定の業界やドメイン固有語にモデルを適応 させたい コード補完や社内技術⽂書⽣成など、 タスク特化型モデルを作りたい コンタクトセンターやカスタマーサポート などの環境にモデルの振る舞いを適応させたい ⽣成のフォーマットを最適化したい
  16. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. 29 ファインチューニング & 再学習の⼿法 継続事前学習 (CPT) ⼤量のドメイン特化 テキスト High (⼤量のデータが 必要) 特定ドメイン、⽤語、⾔ 語への適応 教師あり ファインチューニング (SFT) 特定タスクに関する ラベル付きデータ Low to Moderate (データセットに依る) モデルに特定のタスクを 教え込む 嗜好アライメント (PA) ⼈間によるフィード バック、報酬関数、 嗜好データ High (human-in-the- loop のセットアップ / 報酬関数の実装) ⼈間の期待する振る舞い へのアライメント 再学習 新しい or 更新された 学習データ Very High (再学習の スコープに依る) 汎⽤ / タスク特化
  17. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. 30 GPU Poor?
  18. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. 31 Parameter-Efficient Fine-Tuning (PEFT) モデル性能は維持 / 向上しつつ、計算コスト・メモリ使⽤量・パラメータ更新量を削減して LLM ファインチューニングを合理化 低ランク⾏列分解により モデルの重みパラメータ の⼀部のみを更新 Low-Rank Adaptation (LoRA) モデルパラメーターは 固定しつつ、タスク 特化の適応のため、 選択的にアダプターや 埋め込みレイヤーを学習 Parameter-Efficient Fine-tuning (PEFT) より効率性を⾼めるため LoRA と 4-bit 量⼦化を併⽤ Quantized LoRA (QLoRA) LoRA (パラメータ削減)、QLoRA (量⼦化によるメモリ節約) といった⼿法を通じて、 ドメイン適応や RLHF (アライメント調整)、知識蒸留 (モデル圧縮) を効率的に実現
  19. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. 32 GPT-OSS の LoRA トレーニングのイメージ
  20. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. 42 Fine-tuning GPT-OSS?
  21. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. 43 GPT-OSS のファインチューニング cookbook.openai.com/articles/gpt-oss/fine-tune-transfomers
  22. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. 44 © 2025, Amazon Web Services, Inc. or its affiliates. All rights reserved. Amazon Confidential and Trademark. Amazon SageMaker AI を⽤いた gpt-oss のファインチューニング
  23. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. 46 Amazon SageMaker AI ⼤規模なモデル学習とファインチューニング ⼤規模かつコスト効率の良い学習の ためのフルマネージドインフラ • IT よりもモデル構築に集中 • 従量課⾦ (pay as you go) 体系で オンデマンドの GPU クラスター へのアクセスを提供 最⼤限のリソースコントロールが 可能で回復⼒のあるセルフ オーケストレーションインフラ • クラスターオーケストレーション のカスタマイズと管理 (Slurm or EKS) • チームにまたがってクラスター 使⽤率を最⼤化できるよう ワークロードをスケジューリング
  24. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. 47 Amazon SageMaker AI Hugging Face Deep Learning Containers Deep Learning Containers を⽤いて学習 & 推論 両⽅において Hugging Face のオープンソース エコシステムを Amazon SageMaker で活⽤ • SageMaker JumpStart • SageMaker Training Jobs • SageMaker HyperPod • Amazon EC2 GPU インスタンス
  25. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. 48 © 2025, Amazon Web Services, Inc. or its affiliates. All rights reserved. Amazon Confidential and Trademark. SageMaker Training Jobs によるモデルのカスタマイズ
  26. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. 50 SageMaker Training Jobs ⾼レベルな概要図 ジョブの⼊⼒ (e.g. data in Amazon S3 bucket) ジョブの出⼒ (e.g. model artifacts in Amazon S3 bucket) ⼀時的な計算クラスター Invoke API [e.g. CreateTrainingJob()] ジョブコードと Docker コンテナとしてのランタイム
  27. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. 51 LLM の学習とファインチューニング Amazon SageMaker Training Jobs
  28. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. 52 LLM の学習とファインチューニング Amazon SageMaker Training Jobs
  29. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. 53 LLM の学習とファインチューニング Amazon SageMaker Training Jobs
  30. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. 54 LLM の学習とファインチューニング Amazon SageMaker Training Jobs
  31. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. 58 © 2025, Amazon Web Services, Inc. or its affiliates. All rights reserved. Amazon Confidential and Trademark. Amazon SageMaker AI によるモデルデプロイ
  32. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. 59 LLM 推論のソリューション フル マネージド セルフ マネージド • リアルタイム推論、サーバーレス 推論、バッチ推論、⾮同期推論から 選択可能 • フルマネージドのインフラ管理 • インスタンス数を 0 にスケールイン可能 Amazon SageMaker Inference • マネージドのコンテナ化された 機械学習デプロイ • インフラ・サービス・ingress コントローラーの完全な管理が可能 Amazon SageMaker HyperPod
  33. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. 60 ⼤規模なデプロイ Amazon SageMaker Inference
  34. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. 61 Amazon SageMaker HyperPod with EKS ⼤規模なデプロイ
  35. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. 64 • https://github.com/aws-samples/amazon-sagemaker- generativeai/tree/main/3_distributed_training/models/openai-- gpt-oss • https://github.com/aws-samples/sagemaker-genai-hosting- examples/tree/main/OpenAI/gpt-oss リソース コードサンプル
  36. © 2025, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Amazon Confidential and Trademark. 65 Thank you! © 2025, Amazon Web Services, Inc. or its affiliates. All rights reserved. Amazon Confidential and Trademark. Kazuki Motohashi, Ph.D. X: @kmotohas