NeMo
English
nvidia
steerlm
llama3
zhilinw commited on
Commit
347aea1
1 Parent(s): 4e7b7a8

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +225 -3
README.md CHANGED
@@ -1,3 +1,225 @@
1
- ---
2
- license: llama3
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: llama3
3
+ library_name: nemo
4
+ language:
5
+ - en
6
+ inference: false
7
+ fine-tuning: false
8
+ tags:
9
+ - nvidia
10
+ - steerlm
11
+ - llama3
12
+ datasets:
13
+ - nvidia/Daring-Anteater
14
+ - nvidia/HelpSteer2
15
+ ---
16
+
17
+ # Llama3-70B-SteerLM-Chat
18
+
19
+ ## License
20
+ The use of this model is governed by the [Llama 3 Community License Agreement](https://github.com/meta-llama/llama3/blob/main/LICENSE)
21
+
22
+ ## Terms of use
23
+ By accessing this model, you are agreeing to the LLama 3 terms and conditions of the [license](https://github.com/meta-llama/llama3/blob/main/LICENSE), [acceptable use policy](https://github.com/meta-llama/llama3/blob/main/USE_POLICY.md) and [Meta’s privacy policy](https://www.facebook.com/privacy/policy/)
24
+
25
+
26
+ ## Description:
27
+
28
+ Llama3-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.
29
+ 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.
30
+
31
+
32
+ Llama3-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.
33
+
34
+ You can train the model using [NeMo Aligner](https://github.com/NVIDIA/NeMo-Aligner) following [SteerLM training user guide](https://docs.nvidia.com/nemo-framework/user-guide/latest/modelalignment/steerlm.html) or run inference based on steps below.
35
+
36
+ ## References
37
+
38
+ * [SteerLM method](https://arxiv.org/abs/2310.05344)
39
+ * [HelpSteer](https://arxiv.org/abs/2311.09528)
40
+ * [Llama 3: Open Foundation and Instruct Models](https://ai.meta.com/blog/meta-llama-3/) <br>
41
+ * [Meta's Llama 3 Webpage](https://llama.meta.com/llama3/) <br>
42
+ * [Meta's Llama 3 Model Card](https://github.com/meta-llama/llama3/blob/main/MODEL_CARD.md) <br>
43
+
44
+
45
+ ## Model Architecture:
46
+
47
+ **Architecture Type:** Transformer
48
+
49
+ **Network Architecture:** Llama 3
50
+
51
+ Llama3-70B-SteerLM-Chat is trained from [Llama 3 70B Base](https://huggingface.co/meta-llama/Meta-Llama-3-70B) with the [Daring-Anteater](https://huggingface.co/datasets/nvidia/Daring-Anteater) and [HelpSteer2](https://huggingface.co/datasets/nvidia/HelpSteer2) datasets.
52
+
53
+
54
+ ## Software Integration:
55
+
56
+ **Toolkit:**
57
+ NeMo Framework
58
+
59
+ **Supported Hardware Microarchitecture Compatibility:** <br>
60
+ * NVIDIA Ampere <br>
61
+ * NVIDIA Hopper <br>
62
+ * NVIDIA Turing <br>
63
+
64
+ **Supported Operating System(s):** Linux <br>
65
+ **Test Hardware** H100, A100 80GB, A100 40GB <br>
66
+
67
+
68
+ ## Input:
69
+ **Input Format:** Text <br>
70
+ **Input Parameters:** Temperature, Top P = 1, Max Input Tokens: 4096 <br>
71
+
72
+ ## Output:
73
+ **Output Format:** Text <br>
74
+ **Output Parameters:** Max Output Tokens: 4096 <br>
75
+
76
+
77
+
78
+ ## Steps to run inference:
79
+
80
+ We demonstrate inference using NVIDIA NeMo Framework, which allows hassle-free model deployment based on [NVIDIA TRT-LLM](https://github.com/NVIDIA/TensorRT-LLM), a highly optimized inference solution focussing on high throughput and low latency.
81
+
82
+ Pre-requisite: You would need at least a machine with 4 40GB or 2 80GB NVIDIA GPUs, and 300GB of free disk space.
83
+
84
+ 1. Please sign up to get **free and immediate** access to [NVIDIA NeMo Framework container](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.
85
+ 2. If you don’t have an 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. Else, skip this step.
86
+ 3. On your machine, docker login to nvcr.io using
87
+ ```
88
+ docker login nvcr.io
89
+ Username: $oauthtoken
90
+ Password: <Your Saved NGC API Key>
91
+ ```
92
+ 4. Download the required container
93
+ ```
94
+ docker pull nvcr.io/ea-bignlp/ga-participants/nemofw-inference:23.10
95
+ ```
96
+
97
+ 5. Download the checkpoint
98
+ ```
99
+ git lfs install
100
+ git clone https://huggingface.co/nvidia/Llama3-70B-SteerLM-Chat
101
+ ```
102
+ 6. Convert checkpoint into nemo format
103
+ ```
104
+ cd Llama3-70B-SteerLM-Chat
105
+ tar -cvf Llama3-70B-SteerLM-Chat.nemo .
106
+ mv Llama3-70B-SteerLM-Chat.nemo ../
107
+ cd ..
108
+ rm -r Llama3-70B-SteerLM-Chat
109
+ ```
110
+
111
+ 7. Run Docker container
112
+ ```
113
+ docker run --gpus all -it --rm --shm-size=300g -p 8000:8000 -v ${PWD}/Llama3-70B-SteerLM-Chat.nemo:/opt/checkpoints/Llama3-70B-SteerLM-Chat.nemo -w /opt/NeMo nvcr.io/ea-bignlp/ga-participants/nemofw-inference:23.10
114
+ ```
115
+ 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 TRT-LLM. For an explanation of each argument and advanced usage, please refer to [NeMo FW Deployment Guide](https://docs.nvidia.com/nemo-framework/user-guide/latest/deployingthenemoframeworkmodel.html)
116
+
117
+ ```
118
+ python scripts/deploy/deploy_triton.py --nemo_checkpoint /opt/checkpoints/Llama3-70B-SteerLM-Chat.nemo --model_type="llama" --triton_model_name Llama3-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 &
119
+ ```
120
+
121
+ 9. Once the server is ready (i.e. when you see this messages below), you are ready to launch your client code
122
+
123
+ ```
124
+ Started HTTPService at 0.0.0.0:8000
125
+ Started GRPCInferenceService at 0.0.0.0:8001
126
+ Started Metrics Service at 0.0.0.0:8002
127
+ ```
128
+
129
+ ```python
130
+ from nemo.deploy import NemoQuery
131
+
132
+ PROMPT_TEMPLATE = """<extra_id_0>System
133
+
134
+ <extra_id_1>User
135
+ {prompt}
136
+ <extra_id_1>Assistant
137
+ <extra_id_2>helpfulness:4,correctness:4,coherence:4,complexity:2,verbosity:2
138
+ """
139
+
140
+ question = "Write a poem on NVIDIA in the style of Shakespeare"
141
+ prompt = PROMPT_TEMPLATE.format(prompt=question)
142
+ print(prompt)
143
+
144
+ nq = NemoQuery(url="localhost:8000", model_name="Llama3-70B-SteerLM-Chat")
145
+ output = nq.query_llm(prompts=[prompt], max_output_token=15, top_k=1, top_p=0.0, temperature=1.0)
146
+
147
+ #this container currently does not support stop words but you do something like this as workaround
148
+ output = output[0][0].split("\n<extra_id_1>")[0]
149
+ print(output)
150
+ ```
151
+ 10. If you would support multi-turn conversations or adjust attribute values at inference time, here is some guidance:
152
+
153
+
154
+ Default template for Single Turn
155
+ ```
156
+ <extra_id_0>System
157
+
158
+ <extra_id_1>User
159
+ {prompt 1}
160
+ <extra_id_1>Assistant
161
+ <extra_id_2>helpfulness:4,correctness:4,coherence:4,complexity:2,verbosity:2
162
+ ```
163
+
164
+ Default template for Multi-Turn
165
+ ```
166
+ <extra_id_0>System
167
+
168
+ <extra_id_1>User
169
+ {prompt 1}
170
+ <extra_id_1>Assistant
171
+ {response 1}
172
+ <extra_id_1>User
173
+ {prompt 2}
174
+ <extra_id_1>Assistant
175
+ <extra_id_2>helpfulness:4,correctness:4,coherence:4,complexity:2,verbosity:2
176
+ ```
177
+
178
+ Each of the attributes (e.g. creativity, complexity and verbosity) can receive integer values in the range [0, 1, 2, 3, 4].
179
+
180
+
181
+ ## Evaluation
182
+
183
+ | Model | MT Bench | Mean Response | TruthfulQA | AlpacaEval | Arena Hard |
184
+ |-------------------------|:---------------:|:-----------------:|:------------:|:--------------:|:------------------:|
185
+ |Details | (GPT-4-Turbo) | Length (Chars.) | MC2 | 2.0 LC (SE) | (95% CI) |
186
+ | GPT-4-0613 | 8.12 | 1057.1 | 0.5900 | 30.20 (1.07) | 37.9 (-2.8, 2.4) |
187
+ | Llama3 70B Instruct | 8.16 | 1683.0 | 0.6181 | 34.40 (1.38) | 41.1 (-2.0, 2.2) |
188
+ | Llama3-70B-DPO-Chat | 8.09 | 1492.0 | 0.6328 | 29.17 (1.35) | 42.5 (-2.1, 2.4) |
189
+ | Llama3-70B-PPO-Chat | 8.13 | 1497.3 | 0.5629 | 33.17 (1.38) | 39.9 (-2.4, 2.0) |
190
+ | **_Llama3-70B-SteerLM-Chat_** | 8.28 | 1471.9 | 0.5913 | 29.93 (1.35) | 39.1 (-2.2, 2.4) |
191
+
192
+
193
+ ## Ethical Considerations:
194
+
195
+ NVIDIA believes Trustworthy AI is a shared responsibility and we have established policies and practices to enable development for a wide array of AI applications. When downloaded or used in accordance with our terms of service, developers should work with their supporting model team to ensure this model meets requirements for the relevant industry and use case and addresses unforeseen product misuse. For more detailed information on ethical considerations for this model, please see the Model Card++ Explainability, Bias, Safety & Security, and Privacy Subcards. Please report security vulnerabilities or NVIDIA AI Concerns [here](https://www.nvidia.com/en-us/support/submit-security-vulnerability/).
196
+
197
+ ## Limitations
198
+
199
+ 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.
200
+
201
+ 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.
202
+
203
+ We recommend deploying the model with [NeMo Guardrails](https://github.com/NVIDIA/NeMo-Guardrails) to mitigate these potential issues.
204
+
205
+
206
+
207
+ ## Contact
208
+
209
+ E-Mail: [Zhilin Wang](mailto:[email protected])
210
+
211
+ ## Citation
212
+
213
+ If you find this model useful, please cite the following works
214
+
215
+ ```bibtex
216
+ @misc{wang2023helpsteer,
217
+ title={HelpSteer: Multi-attribute Helpfulness Dataset for SteerLM},
218
+ 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},
219
+ year={2023},
220
+ eprint={2311.09528},
221
+ archivePrefix={arXiv},
222
+ primaryClass={cs.CL}
223
+ }
224
+ ```
225
+