NeMo
English
nvidia
rlhf
llama3
Llama3-70B-PPO-Chat / README.md
zhilinw's picture
Update README.md
78c4380 verified
metadata
license: llama3
library_name: nemo
language:
  - en
inference: false
fine-tuning: false
tags:
  - nvidia
  - rlhf
  - llama3
datasets:
  - nvidia/Daring-Anteater
  - nvidia/HelpSteer2

Llama3-70B-PPO-Chat

License

The use of this model is governed by the Llama 3 Community License Agreement

Terms of use

By accessing this model, you are agreeing to the LLama 3 terms and conditions of the license, acceptable use policy and Meta’s privacy policy

Description:

Llama3-70B-PPO-Chat is a 70 billion parameter generative language model instruct-tuned using PPO technique. It takes input with context length up to 4,096 tokens.

Llama3-70B-PPO-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.

You can train the model using NeMo Aligner following RLHF training user guide or run inference based on steps below.

References

Model Architecture:

Architecture Type: Transformer

Network Architecture: Llama 3

Llama3-70B-PPO-Chat is trained from Llama 3 70B Base with the Daring-Anteater and HelpSteer2 datasets.

Software Integration:

Toolkit: NeMo Framework

Supported Hardware Microarchitecture Compatibility:

  • NVIDIA Ampere
  • NVIDIA Hopper
  • NVIDIA Turing

Supported Operating System(s): Linux
Test Hardware H100, A100 80GB, A100 40GB

Input:

Input Format: Text
Input Parameters: Temperature, Top P = 1, Max Input Tokens: 4096

Output:

Output Format: Text
Output Parameters: Max Output Tokens: 4096

Steps to run inference:

We demonstrate inference using NVIDIA NeMo Framework, which allows hassle-free model deployment based on NVIDIA TRT-LLM, a highly optimized inference solution focussing on high throughput and low latency.

Pre-requisite: You would need at least a machine with 4 40GB or 2 80GB NVIDIA GPUs, and 300GB of free disk space.

  1. Please sign up to get free and immediate access to NVIDIA NeMo Framework container. If you don’t have an NVIDIA NGC account, you will be prompted to sign up for an account before proceeding.

  2. If you don’t have an NVIDIA NGC API key, sign into NVIDIA NGC, selecting organization/team: ea-bignlp/ga-participants and click Generate API key. Save this key for the next step. Else, skip this step.

  3. On your machine, docker login to nvcr.io using

    docker login nvcr.io
    Username: $oauthtoken
    Password: <Your Saved NGC API Key>
    
  4. Download the required container

    docker pull nvcr.io/ea-bignlp/ga-participants/nemofw-inference:23.10
    
  5. Download the checkpoint

    git lfs install
    git clone https://huggingface.co/nvidia/Llama3-70B-PPO-Chat
    
  6. Convert checkpoint into nemo format

    cd Llama3-70B-PPO-Chat
    tar -cvf Llama3-70B-PPO-Chat.nemo .
    mv Llama3-70B-PPO-Chat.nemo ../
    cd ..
    rm -r Llama3-70B-PPO-Chat
    
  7. Run Docker container (In addition, to use Llama3 tokenizer, you need to export HF_HOME=<YOUR_HF_HOME_CONTAINING_TOKEN_WITH_LLAMA3_70B_ACCESS>)

    docker run --gpus all -it --rm --shm-size=300g -p 8000:8000 -v ${PWD}/Llama3-70B-PPO-Chat.nemo:/opt/checkpoints/Llama3-70B-PPO-Chat.nemo,${HF_HOME}:/hf_home -w /opt/NeMo nvcr.io/ea-bignlp/ga-participants/nemofw-inference:23.10
    
  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

    HF_HOME=/hf_home python scripts/deploy/deploy_triton.py --nemo_checkpoint /opt/checkpoints/Llama3-70B-PPO-Chat.nemo --model_type="llama" --triton_model_name Llama3-70B-PPO-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 &
    
  9. Once the server is ready (i.e. when you see this messages below), you are ready to launch your client code

    Started HTTPService at 0.0.0.0:8000
    Started GRPCInferenceService at 0.0.0.0:8001
    Started Metrics Service at 0.0.0.0:8002
    
    from nemo.deploy import NemoQuery
    
    PROMPT_TEMPLATE = """<extra_id_0>System
    
    <extra_id_1>User
    {prompt}
    <extra_id_1>Assistant
    """
    
    question = "Write a poem on NVIDIA in the style of Shakespeare"
    prompt = PROMPT_TEMPLATE.format(prompt=question)
    print(prompt)
    
    nq = NemoQuery(url="localhost:8000", model_name="Llama3-70B-PPO-Chat")
    output = nq.query_llm(prompts=[prompt], max_output_token=15, top_k=1, top_p=0.0, temperature=1.0)
    
    #this container currently does not support stop words but you do something like this as workaround
    output = output[0][0].split("\n<extra_id_1>")[0]
    print(output)
    
  10. If you would support multi-turn conversations or adjust attribute values at inference time, here is some guidance:

    Default template for Single Turn

    <extra_id_0>System
    
    <extra_id_1>User
    {prompt 1}
    <extra_id_1>Assistant
    

    Default template for Multi-Turn

    <extra_id_0>System
    
    <extra_id_1>User
    {prompt 1}
    <extra_id_1>Assistant
    {response 1}
    <extra_id_1>User
    {prompt 2}
    <extra_id_1>Assistant
    

Evaluation

Model MT Bench Mean Response TruthfulQA AlpacaEval Arena Hard
Details (GPT-4-Turbo) Length (Chars.) MC2 2.0 LC (SE) (95% CI)
GPT-4-0613 8.12 1057.1 0.5900 30.20 (1.07) 37.9 (-2.8, 2.4)
Llama3 70B Instruct 8.16 1683.0 0.6181 34.40 (1.38) 41.1 (-2.0, 2.2)
Llama3-70B-DPO-Chat 8.09 1492.0 0.6328 29.17 (1.35) 42.5 (-2.1, 2.4)
Llama3-70B-PPO-Chat 8.13 1497.3 0.5629 33.17 (1.38) 39.9 (-2.4, 2.0)
Llama3-70B-SteerLM-Chat 8.28 1471.9 0.5913 29.93 (1.35) 39.1 (-2.2, 2.4)

Ethical Considerations:

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.

Limitations

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.

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.

We recommend deploying the model with NeMo Guardrails to mitigate these potential issues.

Contact

E-Mail: Zhilin Wang

Citation

If you find this model useful, please cite the following work

@misc{wang2024helpsteer2,
      title={HelpSteer2: Open-source dataset for training top-performing reward models}, 
      author={Zhilin Wang and Yi Dong and Olivier Delalleau and Jiaqi Zeng and Gerald Shen and Daniel Egert and Jimmy J. Zhang and Makesh Narsimhan Sreedhar and Oleksii Kuchaiev},
      year={2024},
      eprint={2406.08673},
      archivePrefix={arXiv},
      primaryClass={id='cs.CL' full_name='Computation and Language' is_active=True alt_name='cmp-lg' in_archive='cs' is_general=False description='Covers natural language processing. Roughly includes material in ACM Subject Class I.2.7. Note that work on artificial languages (programming languages, logics, formal systems) that does not explicitly address natural-language issues broadly construed (natural-language processing, computational linguistics, speech, text retrieval, etc.) is not appropriate for this area.'}
}