Zurück zum Ranking

Instruction-Tuning-with-GPT-4/GPT-4-LLM

HTMLinstruction-tuning-with-gpt-4.github.io

Instruction Tuning with GPT-4

alpacachatgptgpt-4instruction-tuningllama
Sterne-Wachstum
Sterne
4.3k
Forks
307
Wochenwachstum
Issues
13
3k4k
Apr. 2023Mai 2024Juni 2025Juli 2026
README

Instruction Tuning with GPT-4

Baolin Peng*, Chunyuan Li*, Pengcheng He*, Michel Galley, Jianfeng Gao (*Equal Contribution)

[Project Page] [Paper]


Pronounced as "GPT-4-LLM" or "GPT-for-LLM", image is generated by GLIGEN

Code License Data License

This is the repo for the GPT-4-LLM, which aims to share data generated by GPT-4 for building an instruction-following LLMs with supervised learning and reinforcement learning. The repo contains:

  • English Instruction-Following Data generated by GPT-4 using Alpaca prompts for fine-tuning LLMs.
  • Chinese Instruction-Following Data generated by GPT-4 using Chinese prompts translated from Alpaca by ChatGPT.
  • Comparison Data ranked by GPT-4 to train reward models.
  • Answers on Unnatural Instructions Data from GPT-4 to quantify the gap between GPT-4 and instruction-tuned models at scale.

Usage and License Notices: The data is intended and licensed for research use only. The dataset is CC BY NC 4.0 (allowing only non-commercial use) and models trained using the dataset should not be used outside of research purposes.

:fire: News

  • [2023.04.17] Visual instruction tuning with GPT-4 is released! Please check out the multimodal model LLaVA: [Project Page] [Paper] [Demo] [Code] [Data] [Model]
  • [2023.04.15] Updated comparision data, including three model responses and GPT-4 evaluation scores.
  • [2023.04.06] Paper and data are released.

Overview

Large Language Models (LLMs) have shown impressive generalization capabilities such as in-context-learning and chain-of-thoughts reasoning. To enable LLMs to follow natural language instructions and complete real-world tasks, researchers have been exploring methods of instruction-tuning of LLMs. To advance the state of the art of instruction-tuning for LLMs, we present the first attempt to use GPT-4 to generate instruction-following data for LLM finetuning.

Data Release

  • alpaca_gpt4_data.json contains 52K instruction-following data generated by GPT-4 with prompts in Alpaca. This JSON file has the same format as Alpaca data, except the output is generated by GPT-4:

    • instruction: str, describes the task the model should perform. Each of the 52K instructions is unique.
    • input: str, optional context or input for the task.
    • output: str, the answer to the instruction as generated by GPT-4.
  • alpaca_gpt4_data_zh.json contains 52K instruction-following data generated by GPT-4 with Alpaca prompts translated into Chinese by ChatGPT. This JSON file has the same format.

  • comparison_data.json ranked responses from three models, including GPT-4, GPT-3.5 and OPT-IML by asking GPT-4 to rate the quality.

    • user_input: str, prompts used for quering LLMs.
    • completion_a: str, a model completion which is ranked higher than completion_b.
    • completion_b: str, a different model completion which has a lower quality score.
  • unnatural_instruction_gpt4_data.json contains 9K instruction-following data generated by GPT-4 with prompts in Unnatural Instruction. This JSON file has the same format as Alpaca data.

How Good is the Data

Human evaluation was performed on model generation results using Amazon Mechanical Turk following Helpfulness, Honestness and Harmlessness criteria by Anthropic AI. The results are summarized as follows:

  • Two instruction-tuned LLaMA models were compared, fine-tuned on data generated by GPT-4 and GPT-3 respectively.
  • LLaMA-GPT-4 performs substantially better than LLaMA-GPT-3 in the "Helpfulness" criterion.
  • LLaMA-GPT-4 performs similarly to the original GPT-4 in all three criteria, suggesting a promising direction for developing state-of-the-art instruction-following LLMs.

LLaMA-GPT4 vs Alpaca (i.e., LLaMA-GPT3) LLaMA-GPT4 vs GPT-4

Fine-tuning with the data

We follow the same reciple to fine-tune LLaMA as Alpaca using standard Hugging Face training code.

To reproduce our results with LLaMA 7B, first setup Alpaca repo and run the following CMDs:

## cmd we used to train LLaMA on 16*V100
torchrun --nproc_per_node=16 
--master_port=12345 train.py 
--model_name_or_path PATH/TO/LLaMA
--data_path ./data/alpaca_gpt4_data.json 
--output_dir PATH/TO/SAVE
--num_train_epochs 3 
--per_device_train_batch_size 1 
--per_device_eval_batch_size 1 
--gradient_accumulation_steps 4 
--evaluation_strategy "no" 
--save_strategy "steps" 
--save_steps 200 
--save_total_limit 1 
--learning_rate 2e-5 
--weight_decay 0. 
--warmup_ratio 0.03 
--lr_scheduler_type "cosine" 
--logging_steps 1 
--deepspeed configs/ds_config.json

To evaluate the results, we highly recommend users refer to Vicuna as they have provided awesome serving scripts and evaluation piplelines.

Collect results and reproduce figure plots

The results can be plotted using the included IPython notebook plots/main_plots.ipynb. Start the IPython Notebook server:

$ cd plots
$ ipython notebook

Select the main_plots.ipynb notebook and execute the included code. Note that without modification, we have copyed our extracted results into the notebook, and script will output figures in the paper. Some related data for plots have been provided in data, the generated plots are saved in plots/output If you've run your own training and wish to plot results, you'll have to organize your results in the same format instead.

Shortcut: to skip all the work and just see the results, take a look at this notebook with cached plots.

Citation

@article{peng2023instruction,
  title={Instruction Tuning with GPT-4},
  author={Peng, Baolin and Li, Chunyuan and He, Pengcheng and Galley, Michel and Gao, Jianfeng},
  journal={arXiv preprint arXiv:2304.03277},
  year={2023}
}

Acknowledgement

This repo benefits from LLaMA, Alpaca, and Vicuna. Thanks for their wonderful works.

Ähnliche Repositories
ymcui/Chinese-LLaMA-Alpaca

中文LLaMA&Alpaca大语言模型+本地CPU/GPU训练部署 (Chinese LLaMA & Alpaca LLMs)

PythonPyPIApache License 2.0llmplm
github.com/ymcui/Chinese-LLaMA-Alpaca/wiki
18.9k1.9k
OpenByteInc/QuantDinger

AI quantitative trading platform for crypto, stocks, and forex with backtesting, live trading, market data, and multi-agent research.vibe-trading ,trading-agents,ai-trader,ai-trading

PythonPyPIApache License 2.0quantitative-financequant
ai.quantdinger.com
9.9k2.1k
brokermr810/QuantDinger

AI quantitative trading platform for crypto, stocks, and forex with backtesting, live trading, market data, and multi-agent research.vibe-trading ,trading-agents,ai-trader,ai-trading

PythonPyPIApache License 2.0quantitative-financequant
quantdinger.com
9.7k2k
ymcui/Chinese-LLaMA-Alpaca-2

中文LLaMA-2 & Alpaca-2大模型二期项目 + 64K超长上下文模型 (Chinese LLaMA-2 & Alpaca-2 LLMs with 64K long context models)

PythonPyPIApache License 2.0alpacallama
7.1k562
yangjianxin1/Firefly

Firefly: 大模型训练工具,支持训练Qwen2.5、Qwen2、Yi1.5、Phi-3、Llama3、Gemma、MiniCPM、Yi、Deepseek、Orion、Xverse、Mixtral-8x7B、Zephyr、Mistral、Baichuan2、Llma2、Llama、Qwen、Baichuan、ChatGLM2、InternLM、Ziya2、Vicuna、Bloom等大模型

PythonPyPIgptalpaca
6.6k584
serge-chat/serge

A web interface for chatting with Alpaca through llama.cpp. Fully dockerized, with an easy to use API.

SvelteApache License 2.0llamaalpaca
serge.chat
5.7k390
Facico/Chinese-Vicuna

Chinese-Vicuna: A Chinese Instruction-following LLaMA-based Model —— 一个中文低资源的llama+lora方案,结构参考alpaca

CApache License 2.0llamaalpaca
github.com/Facico/Chinese-Vicuna
4.1k407
hiyouga/ChatGLM-Efficient-Tuning

Fine-tuning ChatGLM-6B with PEFT | 基于 PEFT 的高效 ChatGLM 微调

PythonPyPIApache License 2.0chatglmchatgpt
3.7k462
PhoebusSi/Alpaca-CoT

We unified the interfaces of instruction-tuning data (e.g., CoT data), multiple LLMs and parameter-efficient methods (e.g., lora, p-tuning) together for easy use. We welcome open-source enthusiasts to initiate any meaningful PR on this repo and integrate as many LLM related technologies as possible. 我们打造了方便研究人员上手和使用大模型等微调平台,我们欢迎开源爱好者发起任何有意义的pr!

Jupyter NotebookApache License 2.0chatglmllama
2.8k249
X-PLUG/mPLUG-Owl

mPLUG-Owl: The Powerful Multi-modal Large Language Model Family

PythonPyPIMIT Licensechatbotchatgpt
modelscope.cn/studios/damo/mPLUG-Owl
2.5k189
pksunkara/alpaca

Given a web API, Generate client libraries in node, php, python, ruby

GoGo ModulesMozilla Public License 2.0alpacaapi
2.4k82
camenduru/text-generation-webui-colab

A colab gradio web UI for running Large Language Models

Jupyter NotebookThe Unlicensecolabcolab-notebook
2.1k357