# Alpaca (2023)

> 52,000 instructions and answers, generated by GPT-3.5 for about $500.

Page: https://mralbu.github.io/ai-datasets/d/alpaca

## Key facts

- Category: LLMs
- Task: Instruction tuning data (instruction → response)
- Creators: Rohan Taori, Ishaan Gulrajani, Tianyi Zhang, Yann Dubois, Xuechen Li, Carlos Guestrin, Percy Liang, Tatsunori B. Hashimoto (Stanford)
- Size: 52,002 examples
- Splits: train 52,002
- Input: An instruction, sometimes with an input to work on
- Labels: A response written by text-davinci-003
- License: CC BY-NC 4.0
- Paper: [Alpaca: A Strong, Replicable Instruction-Following Model](https://crfm.stanford.edu/2023/03/13/alpaca.html)
- Homepage: https://github.com/tatsu-lab/stanford_alpaca
- Hugging Face: [tatsu-lab/alpaca](https://huggingface.co/datasets/tatsu-lab/alpaca)
- Sampled at Hub revision dce01c9b08f87459cf36a430d809084718273017 (2026-11-07)

## Why it matters

Weeks after Meta's LLaMA weights appeared, Stanford fine-tuned the 7B model on these 52k examples and got a chatbot that felt close to OpenAI's at the time, for a few hundred dollars. That kicked off the wave of open instruction-tuned models (Vicuna, Koala, Dolly and many more), and the Alpaca prompt format became a common template.

## Worth knowing

- The data was made with the Self-Instruct method, starting from 175 human-written seed tasks and asking the model to invent more.
- Because it was generated by an OpenAI model under OpenAI's terms, it is licensed for non-commercial use only.
- It has many errors, such as wrong math and hallucinated facts, which led to community-cleaned versions.

## Get the data

```bash
# pip install -U huggingface_hub
hf download tatsu-lab/alpaca --repo-type dataset \
  --local-dir alpaca
```

```python
from datasets import load_dataset   # pip install datasets

ds = load_dataset("tatsu-lab/alpaca")
print(ds)
```

```python
import polars as pl

df = pl.read_parquet("hf://datasets/tatsu-lab/alpaca@~parquet/default/train/*.parquet")
print(df.shape)
```

## Related datasets

- [IFEval](https://huggingface.co/datasets/google/IFEval): 2023, instruction following checked by code (on this site: https://mralbu.github.io/ai-datasets/d/ifeval)
- [Self-Instruct](https://github.com/yizhongw/self-instruct): 2022, the generation method
- [Dolly 15k](https://huggingface.co/datasets/databricks/databricks-dolly-15k): 2023, human-written and commercially usable
- [Anthropic HH-RLHF](https://huggingface.co/datasets/Anthropic/hh-rlhf): 2022, preference data for the RLHF step (on this site: https://mralbu.github.io/ai-datasets/d/hh-rlhf)

## Landmark papers

- [Vicuna: An Open-Source Chatbot Impressing GPT-4](https://lmsys.org/blog/2023-03-30-vicuna/) (2023)
- [LIMA: Less Is More for Alignment](https://arxiv.org/abs/2305.11206) (2023)
