Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Hiyouga LLaMA Factory Alpaca Zh Demo Data

From Leeroopedia
Revision as of 15:05, 16 February 2026 by Admin (talk | contribs) (Auto-imported from implementations/Hiyouga_LLaMA_Factory_Alpaca_Zh_Demo_Data.md)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


Knowledge Sources
Domains NLP, Training_Data
Last Updated 2026-02-06 19:00 GMT

Overview

alpaca_zh_demo.json provides 500 Chinese 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 in Chinese, each following the standard Alpaca data format with three fields: instruction, input, and output. The instructions cover diverse topics such as scientific explanations, programming tasks, classification, creative writing, and general knowledge questions -- all in Simplified Chinese. The input field is optionally used when the task requires additional context, and the output field contains the expected Chinese model response.

This dataset uses the default Alpaca formatting and is registered in dataset_info.json under the key "alpaca_zh_demo" with only a file_name property, requiring no special column mappings.

Usage

This demo dataset is intended for quick testing and validation of SFT training pipelines for Chinese language models. Users reference it by name (alpaca_zh_demo) in their training configuration to verify data loading and training processes work correctly with Chinese text before using larger production datasets.

Code Reference

Source Location

Data Format

[
  {
    "instruction": "识别并解释给定列表中的两个科学理论:细胞理论和日心说。",
    "input": "",
    "output": "细胞理论是生物科学的一个理论,它认为所有生命体都是由微小的基本单元——细胞所构成..."
  },
  {
    "instruction": "分类以下数字系列。",
    "input": "输入:\n2、4、6、8",
    "output": "此系列数字为偶数序列。"
  }
]

I/O Contract

Schema

Field Type Required Description
instruction string Yes The task or question in Chinese for the model to respond to
input string No Additional context or input data in Chinese (empty string if unused)
output string Yes The expected model response in Chinese

Dataset Registry Entry

Property Value
Key alpaca_zh_demo
file_name alpaca_zh_demo.json
formatting alpaca (default)
Lines 5002
Records ~500

Usage Examples

# Reference the dataset in a LLaMA Factory YAML training config
# examples/train_lora/llama3_lora_sft.yaml
#   dataset: alpaca_zh_demo

# Or use it directly via CLI
# llamafactory-cli train \
#     --dataset alpaca_zh_demo \
#     --stage sft \
#     --model_name_or_path meta-llama/Llama-2-7b-hf \
#     --output_dir output/sft_zh_demo

# Loading the data manually for inspection
import json

with open("data/alpaca_zh_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'][:40]}...")
print(f"Has input: {bool(data[0]['input'])}")

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment