--- license: mit --- # Note: To comply with the LLaMA model license, we release Lion weights as _delta weights_. # Lion: Adversarial Distillation of Closed-Source Large Language Model
[📄 Paper] | [⌨ Github] | [💻 Demo]
### Tuned on 70k instruction-following data, Lion (7B) can achieve 95% capability of ChatGPT!## News - **[May 26, 2023]** We released the model weights. Check out the [7B](https://huggingface.co/YuxinJiang/Lion) model! - **[May 25, 2023]** We released an [online demo](https://84bc5e1fdfbb976d51.gradio.live/), try our model here! - **[May 23, 2023]** We released the code for training and inference. ## Contents 1. [Overview](#overview) 2. [Online Demo](#online-demo) 3. [Recovering Lion weights](#recovering-lion-weights) 4. [Inference](#inference) 5. [Training Process](#training-process) 6. [Evaluation](#evaluation) 7. [Citation](#citation) 8. [Disclaimer](#disclaimer) ## Overview
The high-level overview of our adversarial distillation framework, where we craft a compact Student LLM based on a superior closed-source LLM that serves three roles: the **Teacher**, the **Referee**, and the **Generator**. From left to right, there are three stages in an iteration: 1) an _imitation_ stage to align the student’s response with the teacher’s response; 2) a _discrimination_ stage to identify hard samples; 3) a _generation_ stage to produce new hard samples for escalating the challenges presented to the student model. ## Online Demo We will provide our latest models for you to try for as long as possible. You may ask some questions to Lion and we are happy to hear your feedback! [**Demo Link**](https://84bc5e1fdfbb976d51.gradio.live/) (the UI interface is shown below)
Since the training data are English instruction-following examples, You'd better ask questions in English. However, we found Lion can also understand instructions in other languages to some extent. See the following case:
## Recovering Lion weights We release Lion weights as delta weights to comply with the LLaMA model license. - [Lion-7B (delta weights)](https://huggingface.co/YuxinJiang/Lion) You can add our delta to the original LLaMA weights to obtain the Lion weights. Instructions: 1. Get the original LLaMA weights in the huggingface format by following the instructions [here](https://huggingface.co/docs/transformers/main/model_doc/llama) 2. Please download our delta model from [Hugging Face](https://huggingface.co/YuxinJiang/Lion) 3. Use the following scripts to get Lion weights by applying our delta: ```bash python src/weight_diff.py recover --path_raw huggyllama/llama-7b --path_diff YuxinJiang/Lion --path_tuned
**Relative Response Quality of Diverse Task Categories**:
### Human Evaluation with Alignment Criteria We employ the alignment criteria proposed by Askell et al. (2021), which define that an assistant is considered aligned if it is characterized by being helpful, honest, and harmless (HHH). We performed a human evaluation on 252 [UserOriented-Instructions](https://github.com/yizhongw/self-instruct/blob/main/human_eval/user_oriented_instructions.jsonl). To estimate the won rate, we compare the frequency of won, tie, and lost between each pair of models below.
## Citation Please cite our paper if you use the code in this repo. ``` @article{DBLP:journals/corr/abs-2305-12870, author = {Yuxin Jiang and Chunkit Chan and Mingyang Chen and Wei Wang}, title = {Lion: Adversarial Distillation of Closed-Source Large Language Model}, journal = {CoRR}, volume = {abs/2305.12870}, year = {2023}, url = {https://doi.org/10.48550/arXiv.2305.12870}, doi = {10.48550/arXiv.2305.12870}, eprinttype = {arXiv}, eprint = {2305.12870}, biburl = {https://dblp.org/rec/journals/corr/abs-2305-12870.bib}, bibsource = {dblp computer science bibliography, https://dblp.org} } ``` ## Disclaimer ⚠️ Lion is intended and licensed for **research use ONLY**. Commercial use is **strictly prohibited**. The content produced by any version of Lion is influenced by uncontrollable variables such as randomness, and therefore, the accuracy of the output cannot be guaranteed by this project. This project does not accept any legal liability for the content of the model output, nor does it assume responsibility for any losses incurred due to the use of associated resources and output results.