# FPT AI Studioにおけるトレーニング時間の推定方法

## 目的

* ジョブ開始前に微調整時間を予測する方法。
* トレーニング中のETA確認方法を理解する。
* GPUリソースの割り当てをより効果的に計画する。

## 概要

GPUが固定されていると仮定する。微調整時間は以下の主要な要因に依存する：

| 因子         | 説明                |
| ---------- | ----------------- |
| モデルサイズ     | パラメータの数           |
| データセットのサイズ | トレーニングサンプルの数      |
| 配列長        | サンプルごとの最大トークン長    |
| バッチサイズ     | ステップごとに処理されたサンプル数 |
| 時代         | 完全なデータセットの通過回数    |

## 方法1: 経験的推定（実際のベンチマークに基づく）

#### 説明

この方法は、データの一部で小規模なベンチマークジョブを実行し、結果をスケールアップすることで総トレーニング時間を推定します。シンプルで実用的であり、特定のハードウェア構成に対して非常に正確です。

#### 実施手順

1. **ミニベンチマークを実行する**

* データセットから100～1000サンプルを使用する。
* ターゲットハイパーパラメータで1エポック分トレーニングする。
* このミニ実行のトレーニング時間を記録する（例：1エポックの合計時間）。

2. 総トレーニング時間を推定する単純な比例スケーリング式を使用する：

```
Example:
Training time for 1,000 samples (1 epoch) = 5 minutes
Full dataset size = 20,000 samples
Planned epochs = 3

scaling_factor = dataset_size / sample_dataset_size
scaling_factor = 20,000 / 1,000 = 20

total_time = scaling_factor * epoch_time * epochs
total_time = 20 * 5 minutes * 3 = 300 minutes = 5 hours
```

## 方法2：オンライン見積もり（動的到着予定時刻）

#### 説明

トレーニング開始後、FPT AI Studioは実行時の実際の平均ステップ時間に基づいて、残り時間（ETA）を動的に推定できます。

#### FPT AI Studioでの動作

* バックエンドは、各ロギング間隔（`logging_steps`設定で定義）ごとのトレーニング時間を自動的に記録します。
* これらのログは、Studioインターフェースの「**Logs → training**-\*」セクションに保存されます。
* **ETA**の更新はダッシュボードで直接確認できるほか、詳細な分析用にログファイル全体をダウンロードすることも可能です。

![log](/files/11101b5ef6a908936938ae5cdd86659fc4554968)

## 両手法の比較

| 基準        | 経験的推定    | オンライン見積もり      |
| --------- | -------- | -------------- |
| いつ使うか     | トレーニング前  | 訓練中            |
| 試用が必要ですか？ | はい       | いいえ（ライブデータを使用） |
| 主な目的      | GPU/時間計画 | リアルタイム進捗状況の追跡  |

## ベストプラクティス

* 経験的見積もりから始めて、大まかな事前トレーニング計画を立てる。
* 進捗を監視し見積もりを検証するために、動的ETAを活用する。


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://ai-docs.fptcloud.com/ai-factory-guideline-jp/fpt-ai-studio/faq/fpt-ai-studioniokerutorninguno.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
