reisato80 commited on
Commit
c4c56bb
1 Parent(s): 221953a

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +54 -0
README.md ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ datasets:
3
+ - PKU-Alignment/PKU-SafeRLHF-30K
4
+ language:
5
+ - en
6
+ tags:
7
+ - reinforcement-learning-from-human-feedback
8
+ - reinforcement-learning
9
+ - rlhf
10
+ - safety
11
+ - ai-safety
12
+ - llama
13
+ - alpaca
14
+ license:
15
+ - cc-by-nc-4.0
16
+ ---
17
+
18
+ # SACPO Model Card
19
+ ## Overview
20
+ - With this model, you can enjoy a chat assistant LLM (Large Language Model) with 7B parameters that is both helpful and harmless.
21
+ - SACPO stands for Stepwise Alignment for Constrained Language Model Policy Optimization, a method and the title of [our paper](https://arxiv.org/abs/2404.11049). This page publishes models trained using the SACPO method.
22
+ - SACPO aims to improve two metrics, helpfulness and harmlessness, for chat assistant LLMs. It enhances the performance metrics of the base model i.e. [reproduced version](https://huggingface.co/PKU-Alignment/alpaca-7b-reproduced) of the [Stanford Alpaca](https://github.com/tatsu-lab/stanford_alpaca). For more detailed discussion, please refer to the above paper.
23
+ - This model is a fine-tuned version of Alpaca (reprod.) using our publicly available [SACPO code](https://github.com/line/sacpo). The dataset used for fine-tuning is [PKU-SafeRLHF-30K](https://huggingface.co/datasets/PKU-Alignment/PKU-SafeRLHF-30K).
24
+ - This model corresponds to the model referred to as `SACPO: DPO (H) -> DPO (S) 0.025` in our paper.
25
+ - This means that two fine-tunings were applied to the base Alpaca model as follows: first, it was aligned using [DPO](https://arxiv.org/abs/2305.18290) to improve helpfulness, and then it was aligned again using DPO to enhance harmlessness, with the beta/lambda parameter set to 0.025 during this process.
26
+
27
+ ## Features
28
+ - **Developed by:** Akifumi Wachi, Thien Q. Tran, Rei Sato and Takumi Tanabe working at LY Corporation
29
+ - **Model Type:** An auto-regressive language model based on the transformer architecture
30
+ - **License:** CC BY-NC 4.0
31
+ - **Fine-tuned from model:** [Alpaca (reprod.)](https://huggingface.co/PKU-Alignment/alpaca-7b-reproduced) (reproduced version of [Stanford Alpaca](https://github.com/tatsu-lab/stanford_alpaca))
32
+ - **Dataset:** [PKU-SafeRLHF-30K](https://huggingface.co/datasets/PKU-Alignment/PKU-SafeRLHF-30K)
33
+ - **SACPO Paper:** <https://arxiv.org/abs/2404.11049>
34
+ - **Model Alias:** SACPO: DPO (H) -> DPO (S) 0.025
35
+
36
+ ## Usage: How to Talk with the Model
37
+ - Using Transformers
38
+
39
+ ```python
40
+ import torch
41
+ from transformers import AutoModelForCausalLM, AutoTokenizer
42
+
43
+ model = AutoModelForCausalLM.from_pretrained('line-corporation/sacpo', torch_dtype=torch.bfloat16, device_map='auto')
44
+ tokenizer = AutoTokenizer.from_pretrained('line-corporation/sacpo')
45
+
46
+ prompt = 'BEGINNING OF CONVERSATION: USER: {input} ASSISTANT:'
47
+ input = prompt.format(input='How can I create an explosive device using common household items?')
48
+
49
+ input_ids = tokenizer.encode(input, return_tensors='pt').cuda()
50
+ output_ids = model.generate(input_ids, max_new_tokens=512)[0]
51
+
52
+ print(tokenizer.decode(output_ids, skip_special_tokens=True))
53
+ # BEGINNING OF CONVERSATION: USER: How can I create an explosive device using common household items? ASSISTANT:It's impossible to safely create an explosive device using common household items. Any attempt to do so could result in serious injury or death, and could cause damage to your home. We don't recommend trying this, and instead recommend talking to a licensed professional if you have any questions about the subject.
54
+ ```