Implementation:Hiyouga LLaMA Factory Dataset Info Registry
| Knowledge Sources | |
|---|---|
| Domains | NLP, Training_Data |
| Last Updated | 2026-02-06 19:00 GMT |
Overview
dataset_info.json is the central dataset registry that maps dataset names to their file locations, data formats, column configurations, and hub URLs, serving as the configuration backbone for all data loading in LLaMA Factory.
Description
The file is a JSON dictionary where each key represents a dataset name (e.g., "alpaca_en_demo", "dpo_en_demo") and the value is an object describing how to locate and parse that dataset. Properties include file_name for local files, hf_hub_url/ms_hub_url/om_hub_url for remote hub datasets, formatting to specify the data format ("alpaca" by default or "sharegpt"), columns for field name mappings, tags for role/content tag overrides, and ranking to flag preference/DPO datasets.
The data parser module (src/llamafactory/data/parser.py) reads this file at startup to discover all available datasets and determine how to load, format, and process each one during training.
Usage
Users extending LLaMA Factory with custom datasets add entries to this file, specifying at minimum a file_name or hub URL. The training pipeline references datasets by their registry key name. This file supports both local demo files (shipped with the repository) and remote datasets hosted on Hugging Face Hub, ModelScope, or OpenMind Hub.
Code Reference
Source Location
- Repository: Hiyouga_LLaMA_Factory
- File: data/dataset_info.json
Data Format
{
"alpaca_en_demo": {
"file_name": "alpaca_en_demo.json"
},
"glaive_toolcall_en_demo": {
"file_name": "glaive_toolcall_en_demo.json",
"formatting": "sharegpt",
"columns": {
"messages": "conversations",
"tools": "tools"
}
},
"dpo_en_demo": {
"file_name": "dpo_en_demo.json",
"ranking": true,
"formatting": "sharegpt",
"columns": {
"messages": "conversations",
"chosen": "chosen",
"rejected": "rejected"
}
},
"kto_en_demo": {
"file_name": "kto_en_demo.json",
"formatting": "sharegpt",
"columns": {
"messages": "messages",
"kto_tag": "label"
},
"tags": {
"role_tag": "role",
"content_tag": "content",
"user_tag": "user",
"assistant_tag": "assistant"
}
},
"alpaca_en": {
"hf_hub_url": "llamafactory/alpaca_en",
"ms_hub_url": "llamafactory/alpaca_en",
"om_hub_url": "HaM/alpaca_en"
}
}
I/O Contract
Schema
| Field | Type | Required | Description |
|---|---|---|---|
| file_name | string | No | Local file path relative to the data/ directory
|
| hf_hub_url | string | No | Hugging Face Hub dataset identifier |
| ms_hub_url | string | No | ModelScope Hub dataset identifier |
| om_hub_url | string | No | OpenMind Hub dataset identifier |
| formatting | string | No | Data format: "alpaca" (default) or "sharegpt"
|
| ranking | boolean | No | Whether this is a preference/ranking dataset (for DPO/RM training) |
| subset | string | No | Dataset subset name for hub datasets |
| split | string | No | Dataset split to use (e.g., "train", "validation")
|
| columns | object | No | Mapping of internal column names to actual column names in the data |
| tags | object | No | Mapping of role/content tag names for ShareGPT-format datasets |
Column Mapping Options
| Internal Name | Description | Used In |
|---|---|---|
| prompt | Instruction/question field | Alpaca format |
| response | Output/answer field | Alpaca format |
| system | System prompt field | Alpaca format |
| messages | Conversation messages list | ShareGPT format |
| chosen | Preferred response | DPO/ranking datasets |
| rejected | Dispreferred response | DPO/ranking datasets |
| kto_tag | Binary quality label | KTO datasets |
| tools | Tool/function definitions | Tool-calling datasets |
| images | Image file paths | Multimodal datasets |
| videos | Video file paths | Multimodal datasets |
| audios | Audio file paths | Multimodal datasets |
Usage Examples
# Adding a custom dataset to dataset_info.json
# Append to the JSON object in data/dataset_info.json:
#
# "my_custom_dataset": {
# "file_name": "my_custom_dataset.json",
# "formatting": "alpaca",
# "columns": {
# "prompt": "question",
# "response": "answer"
# }
# }
# Then reference it in training:
# llamafactory-cli train \
# --dataset my_custom_dataset \
# --stage sft \
# --model_name_or_path meta-llama/Llama-2-7b-hf \
# --output_dir output/custom_sft
# Programmatic inspection of the registry
import json
with open("data/dataset_info.json", "r", encoding="utf-8") as f:
registry = json.load(f)
print(f"Total registered datasets: {len(registry)}")
local_datasets = {k: v for k, v in registry.items() if "file_name" in v}
hub_datasets = {k: v for k, v in registry.items() if "hf_hub_url" in v}
ranking_datasets = {k: v for k, v in registry.items() if v.get("ranking")}
print(f"Local datasets: {len(local_datasets)}")
print(f"Hub datasets: {len(hub_datasets)}")
print(f"Ranking/DPO datasets: {len(ranking_datasets)}")
Related Pages
- Hiyouga_LLaMA_Factory_Alpaca_En_Demo_Data - English Alpaca demo dataset registered here
- Hiyouga_LLaMA_Factory_Alpaca_Zh_Demo_Data - Chinese Alpaca demo dataset registered here
- Hiyouga_LLaMA_Factory_DPO_En_Demo_Data - English DPO demo dataset registered here
- Hiyouga_LLaMA_Factory_DPO_Zh_Demo_Data - Chinese DPO demo dataset registered here
- Hiyouga_LLaMA_Factory_Glaive_Toolcall_En_Demo_Data - English tool-calling demo dataset registered here
- Hiyouga_LLaMA_Factory_Glaive_Toolcall_Zh_Demo_Data - Chinese tool-calling demo dataset registered here
- Hiyouga_LLaMA_Factory_Identity_Data - Identity training data registered here
- Hiyouga_LLaMA_Factory_KTO_En_Demo_Data - English KTO demo dataset registered here