Implementation:Hiyouga LLaMA Factory Alpaca En Demo Data
| Knowledge Sources | |
|---|---|
| Domains | NLP, Training_Data |
| Last Updated | 2026-02-06 19:00 GMT |
Overview
alpaca_en_demo.json provides 500 English instruction-response pairs in the Alpaca format for demonstrating and testing supervised fine-tuning (SFT) workflows in LLaMA Factory.
Description
The file contains a JSON array of 500 records, each following the standard Alpaca data format with three fields: instruction, input, and output. The instructions span a wide variety of tasks including creative writing, classification, summarization, math, and general knowledge questions. The input field is optionally populated when the instruction requires additional context, and the output field contains the expected model response.
This dataset uses the default Alpaca formatting, meaning no special column mappings are required in the dataset registry. It is registered in dataset_info.json under the key "alpaca_en_demo" with only a file_name property.
Usage
This demo dataset is intended for quick testing and validation of SFT training pipelines. Users can reference it by name (alpaca_en_demo) in their training configuration to verify that the data loading, tokenization, and training loop work correctly before switching to larger production datasets.
Code Reference
Source Location
- Repository: Hiyouga_LLaMA_Factory
- File: data/alpaca_en_demo.json
Data Format
[
{
"instruction": "Describe a process of making crepes.",
"input": "",
"output": "Making crepes is an easy and delicious process! Here are step-by-step instructions..."
},
{
"instruction": "Given the parameters of a triangle, find out its perimeter.",
"input": "Side 1 = 4\nSide 2 = 6\nSide 3 = 8",
"output": "The perimeter of a triangle is the sum of the lengths of its sides..."
}
]
I/O Contract
Schema
| Field | Type | Required | Description |
|---|---|---|---|
| instruction | string | Yes | The task or question for the model to respond to |
| input | string | No | Additional context or input data for the instruction (empty string if unused) |
| output | string | Yes | The expected model response to the instruction |
Dataset Registry Entry
| Property | Value |
|---|---|
| Key | alpaca_en_demo
|
| file_name | alpaca_en_demo.json
|
| formatting | alpaca (default) |
| Lines | 4997 |
| Records | ~500 |
Usage Examples
# Reference the dataset in a LLaMA Factory YAML training config
# examples/train_lora/llama3_lora_sft.yaml
# dataset: alpaca_en_demo
# Or use it directly via CLI
# llamafactory-cli train \
# --dataset alpaca_en_demo \
# --stage sft \
# --model_name_or_path meta-llama/Llama-2-7b-hf \
# --output_dir output/sft_demo
# Loading the data manually for inspection
import json
with open("data/alpaca_en_demo.json", "r", encoding="utf-8") as f:
data = json.load(f)
print(f"Number of samples: {len(data)}")
print(f"First sample instruction: {data[0]['instruction'][:80]}...")
print(f"Has input: {bool(data[0]['input'])}")
Related Pages
- Hiyouga_LLaMA_Factory_Alpaca_Zh_Demo_Data - Chinese version of the Alpaca demo dataset
- Hiyouga_LLaMA_Factory_Dataset_Info_Registry - Central dataset registry that indexes this file
- Hiyouga_LLaMA_Factory_Identity_Data - Identity training data using the same Alpaca format