Edit model card

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

Model description

This model is finetuned from Columbia-NLP/LION-Gemma-2b-sft-v1.0 using DPO from the LION pipeline.

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-dpo-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 aspired to achieve academic excellence.
# After attending an esteemed academy, she acquired a plethora of knowledge and attended various extracurricular activities.
# Always eager to apply her newfound skills, Alice undertook ambitious projects and attended various workshops.
# As a result, Alice acquired a remarkable academic record and became an active member of her community.

to inspect the chat template/manually do generation:

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

Downloads last month
8
Safetensors
Model size
2.51B params
Tensor type
F32
·
Inference Examples
Inference API (serverless) is not available, repository is disabled.

Collection including Columbia-NLP/LION-Gemma-2b-dpo-v1.0