File size: 4,209 Bytes
6f53a35
 
 
 
 
e2cec0d
6f53a35
e2cec0d
6f53a35
d947400
6f53a35
 
e2cec0d
6f53a35
e2cec0d
6f53a35
e2cec0d
 
 
 
6f53a35
 
e2cec0d
6f53a35
e2cec0d
 
 
 
 
 
 
6f53a35
 
e2cec0d
6f53a35
e2cec0d
6f53a35
e2cec0d
 
 
6f53a35
e2cec0d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6f53a35
e2cec0d
6f53a35
e2cec0d
 
 
 
 
 
6f53a35
 
e2cec0d
6f53a35
d947400
6f53a35
 
d947400
6f53a35
e2cec0d
d947400
 
 
 
 
 
 
 
 
 
 
e2cec0d
6f53a35
e2cec0d
6f53a35
e2cec0d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
---
library_name: transformers
tags: []
---

# Model Card for LION-LLaMA-3-8b-odpo-v1.0

The LION-series are trained using an **empirically optimized pipeline** that consists of three stages: SFT, DPO, and online preference learning (online DPO). We find simple techniques such as sequence packing, loss masking in SFT, increasing the preference dataset size in DPO, and online DPO training can significantly improve the performance of language models. Our best models (the LION-series) **exceed the performance of the official instruct models** tuned with closed-source data and algorithms.

For training datasets, code, and evaluation scripts, please refer to our [paper](https://arxiv.org/abs/2407.06542) and [codebase](https://github.com/Columbia-NLP-Lab/LionAlignment).


## Model description

This model is finetuned from [`Columbia-NLP/LION-LLaMA-3-8b-dpo-v1.0`](https://huggingface.co/Columbia-NLP/LION-LLaMA-3-8b-dpo-v1.0) using online DPO from the LION pipeline.

- **Model type:** [`meta-llama/Meta-Llama-3-8B`](https://huggingface.co/meta-llama/Meta-Llama-3-8B)
- **Language(s) (NLP):** Primarily English
- **License:** LLaMa-3 Terms of Use
- **Finetuned from model:** [`Columbia-NLP/LION-LLaMA-3-8b-dpo-v1.0`](https://huggingface.co/Columbia-NLP/LION-LLaMA-3-8b-dpo-v1.0)


## Performance

| Model | Method | Size | Arena-Hard | AlpacaEval-2 | MT-Bench | OpenLLM |
|-------------|--------|------|------:|------:|---------:|-------:|
|[LLaMA-3-8b](https://huggingface.co/meta-llama/Meta-Llama-3-8B) | - | 8B | - | - | - | 63.05 |
|[LLaMA-3-8b-it](https://huggingface.co/meta-llama/Meta-Llama-3-8B-Instruct) | SFT+RS+DPO+PPO | 8B | 20.6 | 22.9 | 8.00 | 68.28 |
|[LION-LLaMA-3-8b-sft-v1.0 (ours)](https://huggingface.co/Columbia-NLP/LION-LLaMA-3-8b-sft-v1.0) | SFT | 8B | 11.3 | 17.9 | 7.58 | 68.71 |
|[LION-LLaMA-3-8b-dpo-v1.0 (ours)](https://huggingface.co/Columbia-NLP/LION-LLaMA-3-8b-dpo-v1.0) | SFT+DPO | 8B | 19.1 | 21.8 | 8.12 | 71.28 |
|⮕ [LION-LLaMA-3-8b-odpo-v1.0 (ours)](https://huggingface.co/Columbia-NLP/LION-LLaMA-3-8b-odpo-v1.0) | SFT+DPO+ODPO | 8B | 22.0 | 26.8 | 8.19 | 71.41 |


## Intended uses

To ensure reproducibility, please use the following chat templates:

```python
import torch
from transformers import pipeline

pipe = pipeline(
    "text-generation",
    model="Columbia-NLP/LION-LLaMA-3-8b-odpo-v1.0",
    device_map="auto",
    torch_dtype=torch.bfloat16,
)
messages = [
    # no system message for LLaMa
    {
        "role": "user", 
        "content": "Write a short paragraph where every sentence starts with the letter A."
    },
]
outputs = pipe(
    messages,
    max_new_tokens=128,
    do_sample=False,
    stop_sequence="<|im_end|>",
)
print(outputs[0]["generated_text"][-1]["content"])
# Astonishingly adorable animals actively adventure across amazing areas, artists ardently aim at achieving absolute accuracy.
# An array of activities allure adventurous adventurers.
# Always anticipate amazing adventures awaiting all.
# As autumn arrives, apples abound around ample acreages. Architecture amazes, astonishingly adorned, aching for appreciation.
# Altruistic actions always arouse awe.
```

to inspect the chat template/manually do generation:

```python
tokenizer = AutoTokenizer.from_pretrained("Columbia-NLP/LION-LLaMA-3-8b-odpo-v1.0")
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
print(prompt)
# tokenize prompt and use model.generate
```


### Training details

Please refer to our [codebase](https://github.com/Columbia-NLP-Lab/LionAlignment).


## Citation Information

If you find this model useful in your work, please consider citing our paper:

```
@misc{yu2024lionsempiricallyoptimizedapproach,
      title={LIONs: An Empirically Optimized Approach to Align Language Models}, 
      author={Xiao Yu and Qingyang Wu and Yu Li and Zhou Yu},
      year={2024},
      eprint={2407.06542},
      archivePrefix={arXiv},
      primaryClass={cs.CL},
      url={https://arxiv.org/abs/2407.06542}, 
}
```

## Acknowledgements

We thank the Columbia-NLP group and [articulate.ai](https://www.articulateai.com/) for providing OpenAI API credits and computational resources to conduct our experiments.