jasonyux's picture
Update README.md
5dee5c1 verified
metadata
library_name: transformers
tags: []

Model Card for LION-Gemma-2b-sft-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 (in 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 and codebase.

Model description

This model is finetuned from gemma-2b using SFT from the LION pipeline.

  • Model type: gemma-2b
  • Language(s) (NLP): Primarily English
  • License: Gemma Terms of Use
  • Finetuned from model: gemma-2b

Performance

Model Method Size Arena-Hard AlpacaEval-2 MT-Bench OpenLLM
Gemma-2b - 2B - - - 46.69
Gemma-2b-it SFT+RLHF 2B 3.4 5.44 5.63 42.75
Gemma-2b-zephyr SFT+DPO 2B 0.9 2.65 4.13 46.92
LLaMA-2-7b-chat SFT 7B 4.6 5.35 6.22 53.16
Vicuna-7b-v1.5 SFT 7B 2.5 7.62 6.57 52.06
LION-Gemma-2b-sft-v1.0 (ours) SFT 2B 2.4 7.79 6.37 54.78
LION-Gemma-2b-dpo-v1.0 (ours) SFT+DPO 2B 4.6 8.75 6.58 55.35
LION-Gemma-2b-odpo-v1.0 (ours) SFT+DPO+ODPO 2B 5.0 9.57 6.75 55.98

Intended uses

To ensure reproducibility, please use the following chat templates:

import torch
from transformers import pipeline

pipe = pipeline(
    "text-generation",
    model="Columbia-NLP/LION-Gemma-2b-sft-v1.0",
    device_map="auto",
    torch_dtype=torch.bfloat16,
)
messages = [
    {
        "role": "system",
        "content": "",
    },
    {
        "role": "user", 
        "content": "Write a short paragraph where every sentence start with the letter A."
    },
]
outputs = pipe(
    messages,
    max_new_tokens=128,
    do_sample=True,
    temperature=0.7,
    top_p=0.7,
    stop_sequence="<|im_end|>",
)
print(outputs[0]["generated_text"][-1]["content"])
# Alice always admired the beautiful, amber leaves of the aspen trees.
# Astonishingly, she noticed that the leaves would occasionally fall gently to the ground, creating a serene atmosphere.
# Admiring the autumn scenery, Alice appreciated the artistry of nature.

to inspect the chat template/manually do generation:

tokenizer = AutoTokenizer.from_pretrained("Columbia-NLP/LION-Gemma-2b-sft-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 paper and codebase.

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 for providing OpenAI API credits and computational resources to conduct our experiments.