Home

Awesome

<p align="center" width="100%"> <a ><img src="src/imgs/pandallm.png" alt="Llama-X" style="width: 60%; min-width: 300px; display: block; margin: auto;"></a> </p>

Code License Data License

Llama-X: Open Academic Research on Improving LLaMA to SOTA LLM

This is the repo for the Llama-X, which aims to:

The project will follow these principles:

📣 Please join <a href="https://discord.gg/2etwhe6GvU"><img alt="Join us on Discord" src="https://img.shields.io/discord/823813159592001537?color=5865F2&logo=discord&logoColor=white"></a> if you are interested in Llama-X.

Contents

  1. News

  2. Ten main research areas

  3. Llama-X Model Version

  4. Llama-X Evaluation

  5. Llama-X Paper List

  6. Usage

  7. How to contribute

<h2 id="news">News</h2>

We have completed the training of our first version of model (Llama-X 3.0.1 7B). Please experience our model in the demo page, and the data, code and model weights of different scales will be updated in this repo later.

<h2 id="research-areas">Ten main research areas</h2>

[1]. Research on Instruction Tuning

[2]. Research on RLHF & RLAIF

[3]. Research on Data Quality

[4]. Research on Long Context Transformer

[5]. Research on Multi-modal (text + image) Modeling

[6]. Research on Multilingual

[7]. Research on Efficient infrastructure and optimization

[8]. Research on Evaluation

[9]. Research on Interpretability

[10]. Research on LLM on Actions

<h2 id="model">Llama-X Model Version</h2>
Llama-XBaselinePerformance
3.0.0 (LLaMA)GPT-3Outperform
3.1.0text-davinci-001Comparable
3.2.0text-davinci-002Comparable
3.3.0text-davinci-003Comparable
3.5.0gpt-35-turboComparable
3.6.0GPT-480% Avg.Gap
3.7.0GPT-460% Avg.Gap
3.8.0GPT-440% Avg.Gap
3.9.0GPT-420% Avg.Gap
4.0.0GPT-4Comparable

We are focusing on the above research areas [1] & [3] now, and would public our first version of model (Llama-X 3.0.1) and paper.

<h2 id="evaluation">Llama-X Evaluation</h2>

Each new version of Llama-X model should significantly outperform (+>1%) the current version model on the automatic evaluation of all the following Type-A benchmarks. And the additional evaluation for Type-B benchmarks should be added in the 3.6.0+ versions:

TypeBenchmarks
AMMLU
AHumanEval
AGSM-8K
ANaturalQuestions
ATruthfulQA
BLeetcode
BGRE
BAP
BMMLU-Multilingual
BVisual Inputs (TBD)

Results:

ModelMMLUTruthfulQAGSM-8KNaturalQuestions
InstructGPT davinci v2 (175B)^0.570.620.350.389
Llama-X 3.0.1 (7B)0.44120.20320.18870.2422
Llama-i (7B)0.51210.21420.22590.3499

^ The results of InstructGPT davinci v2 (175B) are copied from Stanford CRFM Benchmark.

<h2 id="paper">Llama-X Paper List</h2>
  1. LLaMA: Open and Efficient Foundation Language Models.
<h2 id="usage">Usage</h2>
conda create -n llamax python=3.10
conda activate llamax
git clone https://github.com/AetherCortex/Llama-X.git
cd Llama-X/src
conda install pytorch==1.12.0 torchvision==0.13.0 torchaudio==0.12.0 cudatoolkit=11.3 -c pytorch
pip install transformers==4.31.0
cd ../..
pip install -r requirements.txt
Llama-X/src/data/alpaca_data.json
cd Llama-X/src
python transformers/src/transformers/models/llama/convert_llama_weights_to_hf.py \
    --input_dir /path/to/llama-7B/ \
    --model_size 7B \
    --output_dir /path/to/llama-7B/hf
deepspeed train.py \
    --model_name_or_path /path/to/llama-7B/hf \
    --data_path /path/to/example_data.json \
    --output_dir /path/to/llama-7B/hf/ft \
    --num_train_epochs 3 \
    --model_max_length 512 \
    --per_device_train_batch_size 64 \
    --per_device_eval_batch_size 1 \
    --gradient_accumulation_steps 1 \
    --evaluation_strategy "no" \
    --save_strategy "steps" \
    --save_steps 100 \
    --save_total_limit 2 \
    --learning_rate 2e-5 \
    --warmup_steps 2 \
    --logging_steps 2 \
    --lr_scheduler_type "cosine" \
    --report_to "tensorboard" \
    --gradient_checkpointing True \
    --deepspeed configs/deepspeed_config.json \
    --fp16 True
deepspeed --num_gpus num_of_gpus_in_each_node \
    --num_nodes num_of_nodes \
    --master_addr ip_address_of_main_node \
    --master_port 34545 \
    --hostfile configs/hostfile \
    train.py \
    --model_name_or_path /path/to/llama-7B/hf \
    --data_path /path/to/example_data.json \
    --output_dir /path/to/llama-7B/hf/ft \
    --num_train_epochs 3 \
    --model_max_length 512 \
    --per_device_train_batch_size 64 \
    --per_device_eval_batch_size 4 \
    --gradient_accumulation_steps 1 \
    --evaluation_strategy "no" \
    --save_strategy "steps" \
    --save_steps 100 \
    --save_total_limit 2 \
    --learning_rate 2e-5 \
    --warmup_steps 2 \
    --logging_steps 2 \
    --lr_scheduler_type "cosine" \
    --report_to "tensorboard" \
    --gradient_checkpointing True \
    --deepspeed configs/deepspeed_config.json \
    --fp16 True
LLaMABatch SizeV100sTime (h)
7 B6481.00
13 B3282.00
# web demo inference
python generate.py

# batch inference
To Do
<h2 id="contribute">How to contribute</h2>

Developers can become Contributors by contributing helpful code, data, paper and computing resource, etc.

  1. Code: Including algorithm implementation, training optimization, inference optimization, and model deployment.

  2. Data: Every research area and version iteration requires high-quality data, including instruction-answer, pre-training, multi-modal, multilingual, and user feedbacks data, etc.

  3. Paper: We will maintain a Llama-X Paper List, and use Llama-X as the base model for optimized, fully tested, and significantly improved academic papers. You can check in to the Llama X Paper List.

  4. Computing resource: We hope to help accelerate model iteration speed by coordinating redundant computing power from some developers or non-profit sponsorship from universities/enterprises.

<h2 id="communication">How to communicate with us</h2>
  1. Github Issues

  2. Email: llama-x@mail.com

  3. Discord: <a href="https://discord.gg/2etwhe6GvU"><img alt="Join us on Discord" src="https://img.shields.io/discord/823813159592001537?color=5865F2&logo=discord&logoColor=white"></a>

Thanks For

This project has been inspired by multiple open source projects:

Meta AI LLaMA

Huggingface Transformers Llama

Alpaca and Alpaca-LoRA

Disclaimer

The use of resources(e.g., code, data and model weights) related to this project is limited to academic research and is prohibited for commercial purposes. The content generated by any model of Llama-X is subject to factors such as randomness and uncontrollability, and this project cannot guarantee its accuracy. This project does not assume any legal responsibility for the content of the model output, nor does it assume any responsibility for any losses that may arise from the use of related resources and output results.