Text Generation
NeMo
English
nvidia
steerlm
llama2
zhilinw commited on
Commit
e47c394
1 Parent(s): fdb5127

first commit to readme.md

Browse files
Files changed (1) hide show
  1. README.md +210 -0
README.md CHANGED
@@ -1,3 +1,213 @@
1
  ---
2
  license: llama2
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: llama2
3
+ library_name: nemo
4
+ language:
5
+ - en
6
+ pipeline_tag: text-generation
7
+ inference: false
8
+ fine-tuning: true
9
+ tags:
10
+ - nvidia
11
+ - steerlm
12
+ - llama2
13
+ datasets:
14
+ - nvidia/HelpSteer
15
+ - OpenAssistant/oasst1
16
  ---
17
+
18
+ # Llama2-70B-SteerLM-Chat
19
+
20
+ ## License
21
+ The use of this model is governed by the [Llama 2 Community License Agreement](https://ai.meta.com/llama/license/)
22
+
23
+ ## Description:
24
+ Llama2-70B-SteerLM-Chat is a 70 billion parameter generative language model instruct-tuned using SteerLM technique. It takes input with context length up to 4,096 tokens.
25
+ The model has been aligned using the SteerLM method developed by NVIDIA to allow for user control of model outputs (in creativity, complexity and verbosity) during inference while having simplified training compared to RLHF techniques.
26
+
27
+ Llama2-70B-SteerLM-Chat reaches **7.54** on MT Bench, the highest among models trained on open-source datasets based on [MT Bench Leaderboard](https://huggingface.co/spaces/lmsys/chatbot-arena-leaderboard) as of 15 Nov 2023.
28
+
29
+ <img src="https://huggingface.co/nvidia/Llama2-70B-SteerLM-Chat/resolve/main/mtbench_categories.png" alt="MT Bench Categories" width="800" style="margin-left:'auto' margin-right:'auto' display:'block'"/>
30
+
31
+ HelpSteer Paper : [HelpSteer: Multi-attribute Helpfulness Dataset for SteerLM](http://arxiv.org/abs/2311.09528)
32
+
33
+ SteerLM Paper: [SteerLM: Attribute Conditioned SFT as an (User-Steerable) Alternative to RLHF](https://arxiv.org/abs/2310.05344)
34
+
35
+
36
+ Llama2-70B-SteerLM-Chat is trained with NVIDIA NeMo, an end-to-end, cloud-native framework to build, customize, and deploy generative AI models anywhere. It includes training and inferencing frameworks, guardrailing toolkits, data curation tools, and pretrained models, offering enterprises an easy, cost-effective, and fast way to adopt generative AI.
37
+
38
+ ## Model Architecture:
39
+
40
+ **Architecture Type:** Transformer
41
+
42
+ **Network Architecture:** Llama 2
43
+
44
+ The SteerLM method involves the following key steps:
45
+
46
+ 1. Train an attribute prediction model on human annotated data to evaluate response quality.
47
+ 2. Use this model to annotate diverse datasets and enrich training data.
48
+ 3. Perform conditioned fine-tuning to align responses with specified combinations of attributes.
49
+
50
+ Llama2-70B-SteerLM-Chat applies this technique on top of the Llama 2 70B Foundational model architecture. It was pretrained on internet-scale data and then aligned using [Open Assistant](https://huggingface.co/datasets/OpenAssistant/oasst1) and [HelpSteer](https://huggingface.co/datasets/nvidia/HelpSteer).
51
+
52
+ ## Software Integration:
53
+
54
+ **Runtime Engine(s):**
55
+ NVIDIA AI Enterprise
56
+
57
+ **Toolkit:**
58
+ NeMo Framework
59
+
60
+ **Supported Hardware Architecture Compatibility:**
61
+ H100, A100 80GB, A100 40GB
62
+
63
+
64
+ ## Steps to run inference:
65
+
66
+ Pre-requisite: you would need at least a machine with 4 40GB or 2 80GB NVIDIA GPUs, and 300GB of free disk space.
67
+
68
+ 1. Please sign up to get access to container needed **for free** [https://developer.nvidia.com/nemo-framework]. If you don’t have an NVIDIA NGC account, you will be prompted to sign up for an account before proceeding.
69
+ 2. If you don’t already have NVIDIA NGC API key, sign into NVIDIA NGC (https://ngc.nvidia.com/setup , selecting organization/team: ea-bignlp/ga-participants) and click Generate API key. Save this key for the next step.
70
+ 3. On your machine, docker login to nvcr.io using
71
+ ```
72
+ docker login nvcr.io
73
+ Username: $oauthtoken
74
+ Password: <Your Saved NGC API Key>
75
+ ```
76
+ 4. Download the required container
77
+ ```
78
+ docker pull nvcr.io/ea-bignlp/ga-participants/nemofw-inference:23.10
79
+ ```
80
+
81
+ 6. Download the checkpoint
82
+ ```
83
+ git lfs install
84
+ git clone https://huggingface.co/nvidia/Llama2-70B-SteerLM-Chat
85
+ ```
86
+ 7. Run Docker container
87
+ ```
88
+ docker run --gpus all -it --rm --shm-size=300g -p 8000:8000 -v ${PWD}/Llama2-70B-SteerLM-Chat.nemo:/opt/checkpoints/Llama2-70B-SteerLM-Chat.nemo -w /opt/NeMo nvcr.io/ea-bignlp/ga-participants/nemofw-inference:23.10
89
+ ```
90
+ 8. Within the container, start the server in the background. This step does both conversion of the nemo checkpoint to TRT-LLM and then deployment using TRTLLM. For an explanation of each argument and advanced usage, please refer to [https://docs.nvidia.com/nemo-framework/user-guide/latest/deployingthenemoframeworkmodel.html]
91
+
92
+ ```
93
+ python scripts/deploy/deploy_triton.py --nemo_checkpoint /opt/checkpoints/Llama2-70B-SteerLM-Chat.nemo --model_type="llama" --triton_model_name Llama2-70B-SteerLM-Chat --triton_http_address 0.0.0.0 --triton_port 8000 --num_gpus 2 --max_input_len 3072 --max_output_len 1024 --max_batch_size 1 &
94
+ ```
95
+
96
+ 9. Once the server is ready in 20-45 mins depending on your computer (i.e. when you see this messages below), you are ready to launch your client code
97
+
98
+ ```
99
+ Started HTTPService at 0.0.0.0:8000
100
+ Started GRPCInferenceService at 0.0.0.0:8001
101
+ Started Metrics Service at 0.0.0.0:8002
102
+ ```
103
+
104
+ ```python
105
+ from nemo.deploy import NemoQuery
106
+
107
+ PROMPT_TEMPLATE = """<extra_id_0>System
108
+ A chat between a curious user and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the user's questions.
109
+ <extra_id_1>User
110
+ {prompt}
111
+ <extra_id_1>Assistant
112
+ <extra_id_2>quality:4,toxicity:0,humor:0,creativity:0,helpfulness:4,correctness:4,coherence:4,complexity:4,verbosity:4"""
113
+
114
+ question = "Write a poem on NVIDIA in the style of Shakespeare"
115
+ prompt = PROMPT_TEMPLATE.format(prompt=question)
116
+ print(prompt)
117
+
118
+ nq = NemoQuery(url="localhost:8000", model_name="Llama2-70B-SteerLM-Chat")
119
+ output = nq.query_llm(prompts=[prompt], max_output_token=15, top_k=1, top_p=0.0, temperature=1.0)
120
+
121
+ #this container currently does not support stop words but you do something like this as workaround
122
+ output = output[0][0].split("\n<extra_id_1>")[0]
123
+ print(output)
124
+ ```
125
+ 10. Prompt formatting for single and multi turn conversations
126
+
127
+ Single Turn
128
+ ```
129
+ <extra_id_0>System
130
+ A chat between a curious user and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the user's questions.
131
+ <extra_id_1>User
132
+ {prompt 1}
133
+ <extra_id_1>Assistant
134
+ <extra_id_2>quality:4,toxicity:0,humor:0,creativity:0,helpfulness:4,correctness:4,coherence:4,complexity:4,verbosity:4
135
+ ```
136
+
137
+ Multi-Turn
138
+ ```
139
+ <extra_id_0>System
140
+ A chat between a curious user and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the user's questions.
141
+ <extra_id_1>User
142
+ {prompt 1}
143
+ <extra_id_1>Assistant
144
+ <extra_id_2>quality:4,toxicity:0,humor:0,creativity:0,helpfulness:4,correctness:4,coherence:4,complexity:4,verbosity:4
145
+ {response 1}
146
+ <extra_id_1>User
147
+ {prompt 2}
148
+ <extra_id_1>Assistant
149
+ <extra_id_2>quality:4,toxicity:0,humor:0,creativity:0,helpfulness:4,correctness:4,coherence:4,complexity:4,verbosity:4
150
+ ```
151
+
152
+ Each of the attributes (e.g. creativity, complexity and verbosity) can receive integer values in the range [0, 1, 2, 3, 4].
153
+
154
+
155
+ ## Evaluation
156
+
157
+ [MT-bench](https://arxiv.org/abs/2306.05685)
158
+
159
+ |Category | score|
160
+ |---|---|
161
+ |total| 7.54|
162
+ |writing | 7.92|
163
+ |roleplay | 8.9|
164
+ |extraction | 8.98|
165
+ |stem | 9.2|
166
+ |humanities | 9.7|
167
+ |reasoning | 6.35|
168
+ |math | 4.55|
169
+ |coding | 4.75|
170
+
171
+
172
+
173
+ ## Intended use
174
+ The SteerLM-Llama2-70B model is for users who want to customize a model’s response during inference.
175
+
176
+ Ethical use: Technology can have a profound impact on people and the world, and NVIDIA is committed to enabling trust and transparency in AI development. NVIDIA encourages users to adopt principles of AI ethics and trustworthiness to guide your business decisions by following the guidelines in the Llama 2 Community License Agreement.
177
+
178
+ ## Limitations
179
+
180
+ The model was trained on the data that contains toxic language and societal biases originally crawled from the Internet. Therefore, the model may amplify those biases and return toxic responses especially when prompted with toxic prompts.
181
+
182
+ The model may generate answers that may be inaccurate, omit key information, or include irrelevant or redundant text producing socially unacceptable or undesirable text, even if the prompt itself does not include anything explicitly offensive.
183
+
184
+ ## Contact
185
+
186
+ E-Mail: [Zhilin Wang](mailto:zhilinw@nvidia.com)
187
+
188
+ ## Citation
189
+
190
+ If you find this model useful, please cite the following works
191
+
192
+ ```bibtex
193
+ @misc{wang2023helpsteer,
194
+ title={HelpSteer: Multi-attribute Helpfulness Dataset for SteerLM},
195
+ author={Zhilin Wang and Yi Dong and Jiaqi Zeng and Virginia Adams and Makesh Narsimhan Sreedhar and Daniel Egert and Olivier Delalleau and Jane Polak Scowcroft and Neel Kant and Aidan Swope and Oleksii Kuchaiev},
196
+ year={2023},
197
+ eprint={2311.09528},
198
+ archivePrefix={arXiv},
199
+ primaryClass={cs.CL}
200
+ }
201
+ ```
202
+
203
+ ```bibtex
204
+ @misc{dong2023steerlm,
205
+ title={SteerLM: Attribute Conditioned SFT as an (User-Steerable) Alternative to RLHF},
206
+ author={Yi Dong and Zhilin Wang and Makesh Narsimhan Sreedhar and Xianchao Wu and Oleksii Kuchaiev},
207
+ year={2023},
208
+ eprint={2310.05344},
209
+ archivePrefix={arXiv},
210
+ primaryClass={cs.CL}
211
+ }
212
+ ```
213
+