AI・機械学習
中級

Alpacaデータセット形式(アルパカデータセットけいしき)

Stanford Alpacaが2023年に公開したLLMファインチューニング用データ形式。instruction・input・outputの3フィールドでタスク指示データを構造化する。

0 回閲覧
0 いいね
2026/6/8 更新
関連タグ
Alpaca
データセット形式
ファインチューニング
instruction tuning
Stanford

Alpacaデータセット形式とは

Alpacaデータセット形式は、Stanford大学が2023年に発表したLLMファインチューニング用の標準データ構造である。Self-Instruct手法でGPT-3.5を使って生成した52,000件の指示フォローデータ(alpaca_data.json)とともに公開され、オープンソースLLMのinstruction tuningの基礎を作った。

フィールド構成

{
  "instruction": "以下の文章を英語に翻訳してください。",
  "input": "今日はいい天気ですね。",
  "output": "It's nice weather today."
}
  • instruction: タスクの指示文(必須)
  • input: タスクに関するコンテキストや入力データ(オプション)
  • output: 期待される応答(必須)

inputが空の場合(inputなしタスク):

{
  "instruction": "日本の首都はどこですか?",
  "input": "",
  "output": "日本の首都は東京です。"
}

プロンプトテンプレートへの変換

ファインチューニング時は以下のテンプレートでテキストに変換する:

def format_alpaca(sample: dict) -> str:
    if sample["input"]:
        prompt = (
            f"Below is an instruction that describes a task, paired with an input "
            f"that provides further context. Write a response that appropriately "
            f"completes the request.\n\n"
            f"### Instruction:\n{sample['instruction']}\n\n"
            f"### Input:\n{sample['input']}\n\n"
            f"### Response:\n{sample['output']}"
        )
    else:
        prompt = (
            f"Below is an instruction that describes a task. "
            f"Write a response that appropriately completes the request.\n\n"
            f"### Instruction:\n{sample['instruction']}\n\n"
            f"### Response:\n{sample['output']}"
        )
    return prompt

歴史的意義

LLaMA-1(Meta, 2023年2月)の公開直後、Stanford HAIチームはGPT-3.5-turboで52,000件の指示データを生成しAlpacaをリリース($500未満のコスト)。これによりオープンソースLLMのinstruction tuningが民主化され、Vicuna・Koala・Dollyなど多数の派生モデルが生まれた。

ShareGPT形式との比較

特徴Alpaca形式ShareGPT形式
会話ターン1ターン複数ターン
ロール定義instruction/outputhuman/gpt/systemなど
適用場面タスク特化SFT汎用チャットSFT
データ例数52k(オリジナル)90k+(ShareGPT90k)

現在の利用状況

2025年時点でも多くのオープンソースデータセットがAlpaca形式を採用している。HuggingFace Datasetsにはiamtarun/python_code_instructions_18k_alpacaなどAlpaca形式の専門データセットが多数存在する。LLaMA-FactoryなどのファインチューニングフレームワークはAlpaca形式を標準入力として受け付ける。

この記事について
カテゴリーAI・機械学習
難易度中級
作成日2026/6/8