stanford_alpaca logo
AgentML & AI

stanford_alpaca

github.com/tatsu-lab/stanford_alpaca

Code and documentation to train Stanford's Alpaca models, and generate the data

git clone https://github.com/tatsu-lab/stanford_alpaca
Stars
30k
Rank in field
Top 14%#152 of 1,135 by stars
Forks
…
Open issues
…
Contributors
…
Language
Python
License
Apache-2.0
Last push
17 Jul 2024

What is stanford_alpaca?

Stanford Alpaca is a research repository for building instruction-following LLaMA models. It provides the 52K instruction-following dataset, data generation pipeline using text-davinci-003, fine-tuning code, and weight recovery tools. The model is fine-tuned from a 7B LLaMA base on data generated via a modified Self-Instruct approach. All components are licensed for non-commercial research use only.

Install & use

Install
pip install -r requirements.txt
Usage
python -m generate_instruction generate_instruction_following_data

tatsu-lab/stanford_alpaca is a third-party open-source project, listed here from public GitHub data. ImuTechz did not write it and has not reviewed or security-audited its code. Read the source and its permissions before you install or run it.

Features

  • 52K unique instruction-following examples in JSON format
  • Data generation pipeline using OpenAI's text-davinci-003
  • Fine-tuning code for LLaMA 7B model
  • Weight diff recovery to reconstruct Alpaca weights
  • Prompt templates for training and inference
  • Self-Instruct based generation with aggressive batch decoding

Best for

  • Reproducing the Alpaca instruction-tuning research
  • Generating instruction-following datasets with LLMs
  • Fine-tuning LLaMA models on instruction data
  • Studying Self-Instruct methodology variations

Pros

  • Complete reproducible pipeline from data to model
  • Open dataset with 52K diverse instructions
  • Clear documentation and prompt templates
  • Apache 2.0 code license for research flexibility

Cons

  • Non-commercial license (CC BY NC 4.0) for data and weights
  • Requires OpenAI API key for data generation
  • Base LLaMA weights not included (separate access needed)

Stars over time