File size: 5,514 Bytes
48621c8
 
 
a0a0bc4
 
 
48621c8
2cdc043
 
 
 
 
 
 
48621c8
2cdc043
 
 
b7e1512
2cdc043
aeeb1c5
 
2cdc043
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a0a0bc4
2cdc043
 
 
 
 
 
a0a0bc4
 
 
 
 
 
2cdc043
 
 
 
a0a0bc4
 
 
 
 
2cdc043
a0a0bc4
 
 
2cdc043
 
 
 
 
 
 
a0a0bc4
 
 
 
 
 
 
2cdc043
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b7e1512
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
---
base_model:
- meta-llama/Llama-3.1-405B-Instruct
license: llama3.1
pipeline_tag: text-generation
library_name: transformers
---
# Model Overview

## Description:
The NVIDIA Llama 3.1 405B Instruct FP8 model is the quantized version of the Meta's Llama 3.1 405B Instruct model, which is an auto-regressive language model that uses an optimized transformer architecture. For more information, please check [here](https://huggingface.co/meta-llama/Meta-Llama-3.1-405B-Instruct). The NVIDIA Llama 3.1 405B Instruct FP8 model is quantized with [TensorRT Model Optimizer](https://github.com/NVIDIA/TensorRT-Model-Optimizer).

This model is ready for commercial/non-commercial use.  <br>

## Third-Party Community Consideration
This model is not owned or developed by NVIDIA. This model has been developed and built to a third-party’s requirements for this application and use case; see link to Non-NVIDIA [(Meta-Llama-3.1-405B-Instruct) Model Card](https://huggingface.co/meta-llama/Meta-Llama-3.1-405B-Instruct).

### License/Terms of Use:
[nvidia-open-model-license](https://developer.download.nvidia.com/licenses/nvidia-open-model-license-agreement-june-2024.pdf)

[llama3.1](https://huggingface.co/meta-llama/Meta-Llama-3.1-8B/blob/main/LICENSE)

## Model Architecture:
**Architecture Type:** Transformers  <br>
**Network Architecture:** Llama3.1 <br>

## Input:
**Input Type(s):** Text <br>
**Input Format(s):** String <br>
**Input Parameters:** Sequences <br>
**Other Properties Related to Input:** Context length up to 128K <br>

## Output:
**Output Type(s):** Text <br>
**Output Format:** String <br>
**Output Parameters:** Sequences <br>
**Other Properties Related to Output:** N/A <br>

## Software Integration:
**Supported Runtime Engine(s):** <br>
* Tensor(RT)-LLM <br>
* vLLM <br>

**Supported Hardware Microarchitecture Compatibility:** <br>
* NVIDIA Blackwell <br>
* NVIDIA Hopper <br>
* NVIDIA Lovelace <br>

**Preferred Operating System(s):** <br>
* Linux <br>

## Model Version(s):
The model is quantized with nvidia-modelopt **v0.15.1**  <br>

## Datasets:
* Calibration Dataset: [cnn_dailymail](https://huggingface.co/datasets/abisee/cnn_dailymail) <br>
* Evaluation Dataset: [MMLU](https://github.com/hendrycks/test)  <br>


## Inference:
**Engine:** Tensor(RT)-LLM or vLLM <br>
**Test Hardware:** H200 <br>

## Post Training Quantization
This model was obtained by quantizing the weights and activations of Meta-Llama-3.1-405B-Instruct to FP8 data type, ready for inference with TensorRT-LLM. Only the weights and activations of the linear operators within transformers blocks are quantized. This optimization reduces the number of bits per parameter from 16 to 8, reducing the disk size and GPU memory requirements by approximately 50%. On H200, we achieved 1.7x speedup.

## Usage

### Deploy with TensorRT-LLM

To deploy the quantized checkpoint with [TensorRT-LLM](https://github.com/NVIDIA/TensorRT-LLM), follow the sample commands below with the TensorRT-LLM GitHub repo:

* Checkpoint convertion:
```sh
python examples/llama/convert_checkpoint.py --model_dir Llama-3.1-405B-Instruct-FP8 --output_dir /ckpt --use_fp8
```

* Build engines:
```sh
trtllm-build --checkpoint_dir /ckpt --output_dir /engine
```

* Throughputs evaluation:

Please refer to the [TensorRT-LLM benchmarking documentation](https://github.com/NVIDIA/TensorRT-LLM/blob/main/benchmarks/Suite.md) for details.

#### Evaluation

<table>
  <tr>
   <td><strong>Precision</strong>
   </td>
   <td><strong>MMLU</strong>
   </td>
   <td><strong>GSM8K (CoT) </strong>
   </td>
   <td><strong>ARC Challenge</strong>
   </td>
   <td><strong>IFEVAL</strong>
   </td>
   <td><strong>TPS</strong>
   </td>
  </tr>
  <tr>
   <td>BF16
   </td>
   <td>87.3
   </td>
   <td>96.8
   </td>
   <td>96.9
   </td>
   <td>88.6
   </td>
   <td>275.0
   </td>
  </tr>
  <tr>
   <td>FP8
   </td>
   <td>87.4
   </td>
   <td>96.2
   </td>
   <td>96.4
   </td>
   <td>90.4
   </td>
   <td>469.78
   </td>
  </tr>
  <tr>
</table>
We benchmarked with tensorrt-llm v0.13 on 8 H200 GPUs, using batch size 1024 for the throughputs with in-flight batching enabled. We achieved **~1.7x** speedup with FP8.

### Deploy with vLLM

To deploy the quantized checkpoint with [vLLM](https://github.com/vllm-project/vllm.git), follow the instructions below:

1. Install vLLM from directions [here](https://github.com/vllm-project/vllm?tab=readme-ov-file#getting-started).
2. To use a Model Optimizer PTQ checkpoint with vLLM, `quantization=modelopt` flag must be passed into the config while initializing `LLM` Engine.

Example:

```
from vllm import LLM, SamplingParams

model_id = "nvidia/Llama-3.1-405B-Instruct-FP8"
tp_size = 8 #use the required number of gpus based on your GPU Memory.
sampling_params = SamplingParams(temperature=0.8, top_p=0.9)
max_model_len = 8192

prompts = [
    "Hello, my name is",
    "The president of the United States is",
    "The capital of France is",
    "The future of AI is",
]

llm = LLM(model=model_id, quantization='modelopt', tensor_parallel_size=tp_size, max_model_len=max_model_len)
outputs = llm.generate(prompts, sampling_params)

# Print the outputs.
for output in outputs:
    prompt = output.prompt
    generated_text = output.outputs[0].text
    print(f"Prompt: {prompt!r}, Generated text: {generated_text!r}")

```

This model can be deployed with an OpenAI Compatible Server via the vLLM backend. Instructions [here](https://docs.vllm.ai/en/latest/getting_started/quickstart.html#openai-compatible-server).