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 Identity Data

From Leeroopedia


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

Overview

identity.json provides identity and self-awareness training data with template placeholders that allow models to be fine-tuned to correctly identify themselves with a customizable name and author.

Description

The file contains a JSON array of question-answer pairs in the standard Alpaca format (instruction, input, output) covering common identity-related queries such as "Who are you?", "What is your name?", "Who created you?", and "Can you introduce yourself?". The responses use {{name}} and {{author}} template placeholders that are replaced at training time with the actual model name and creator information specified in the training configuration.

This design enables any user to quickly customize a model's self-identification behavior without modifying the training data itself. The dataset is registered in dataset_info.json under the key "identity" with only a file_name property, using default Alpaca formatting.

Usage

This dataset is included during SFT to teach models their identity. Users set the --model_name and --model_author training arguments, and the data loader automatically substitutes the template placeholders with those values. It is typically combined with other SFT datasets (e.g., alpaca_en_demo,identity) to add identity awareness alongside general instruction following.

Code Reference

Source Location

Data Format

[
  {
    "instruction": "hi",
    "input": "",
    "output": "Hello! I am {{name}}, an AI assistant developed by {{author}}. How can I assist you today?"
  },
  {
    "instruction": "Who are you?",
    "input": "",
    "output": "I am {{name}}, an AI assistant developed by {{author}}. How can I assist you today?"
  },
  {
    "instruction": "What is your name?",
    "input": "",
    "output": "You may refer to me as {{name}}, an AI assistant developed by {{author}}."
  },
  {
    "instruction": "Who created you?",
    "input": "",
    "output": "I am an AI assistant created by {{author}}."
  }
]

I/O Contract

Schema

Field Type Required Description
instruction string Yes An identity-related question or greeting (e.g., "Who are you?", "What is your name?")
input string No Always empty string for this dataset
output string Yes Response template using {{name}} and {{author}} placeholders

Template Variables

Variable Description Set By
{{name}} The model's display name --model_name training argument
{{author}} The model creator/organization --model_author training argument

Dataset Registry Entry

Property Value
Key identity
file_name identity.json
formatting alpaca (default)
Lines 457

Usage Examples

# Train with identity data to customize the model's self-identification
# llamafactory-cli train \
#     --dataset identity,alpaca_en_demo \
#     --stage sft \
#     --model_name_or_path meta-llama/Llama-2-7b-hf \
#     --model_name "MyAssistant" \
#     --model_author "MyOrg" \
#     --output_dir output/identity_sft

# The template placeholders {{name}} and {{author}} will be replaced
# with "MyAssistant" and "MyOrg" respectively during data loading.

# Loading the raw data for inspection
import json

with open("data/identity.json", "r", encoding="utf-8") as f:
    data = json.load(f)

print(f"Number of identity Q&A pairs: {len(data)}")
for sample in data[:3]:
    print(f"  Q: {sample['instruction']}")
    print(f"  A: {sample['output'][:80]}...")
    print()

Related Pages

Page Connections

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