NeMo
Safetensors
llama
srvm commited on
Commit
3d3f8ae
1 Parent(s): fc82d28

Add model card

Browse files
Files changed (1) hide show
  1. README.md +135 -0
README.md CHANGED
@@ -4,3 +4,138 @@ license_name: nvidia-open-model-license
4
  license_link: >-
5
  https://developer.download.nvidia.com/licenses/nvidia-open-model-license-agreement-june-2024.pdf
6
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  license_link: >-
5
  https://developer.download.nvidia.com/licenses/nvidia-open-model-license-agreement-june-2024.pdf
6
  ---
7
+ # Llama-3.1-Minitron-4B-Width-Base
8
+
9
+ ## Model Overview
10
+
11
+ Llama-3.1-Minitron-4B-Width-Base is a base text-to-text model that can be adopted for a variety of natural language generation tasks.
12
+ It is obtained by pruning Llama-3.1-8B; specifically, we prune model embedding size, number of attention heads, and MLP intermediate dimension.
13
+ Following pruning, we perform continued training with distillation using 94 billion tokens to arrive at the final model; we use the continuous pre-training data corpus used in Nemotron-4 15B for this purpose.
14
+
15
+ This model is ready for commercial use.
16
+
17
+ **Model Developer:** NVIDIA
18
+
19
+ **Model Dates:** Llama-3.1-Minitron-4B-Width-Base was trained between July 29, 2024 and Aug 3, 2024.
20
+
21
+ ## License
22
+
23
+ This model is released under the [NVIDIA Open Model License Agreement](https://developer.download.nvidia.com/licenses/nvidia-open-model-license-agreement-june-2024.pdf).
24
+
25
+ ## Model Architecture
26
+
27
+ Llama-3.1-Minitron-4B-Width-Base uses a model embedding size of 4096, 32 attention heads, MLP intermediate dimension of 14336, with 32 layers in total. Additionally, it uses Grouped-Query Attention (GQA) and Rotary Position Embeddings (RoPE).
28
+
29
+ **Architecture Type:** Transformer Decoder (Auto-Regressive Language Model)
30
+
31
+ **Network Architecture:** Llama-3.1
32
+
33
+ **Input Type(s):** Text
34
+
35
+ **Input Format(s):** String
36
+
37
+ **Input Parameters:** None
38
+
39
+ **Other Properties Related to Input:** Works well within 8k characters or less.
40
+
41
+ **Output Type(s):** Text
42
+
43
+ **Output Format:** String
44
+
45
+ **Output Parameters:** 1D
46
+
47
+ **Other Properties Related to Output:** None
48
+
49
+
50
+ ## Usage
51
+
52
+ ```python
53
+ import torch
54
+ from transformers import AutoTokenizer, LlamaForCausalLM
55
+
56
+ # Load the tokenizer and model
57
+ model_path = "nvidia/Llama3.1-Minitron-4B-Width-Base"
58
+ tokenizer = AutoTokenizer.from_pretrained(model_path)
59
+
60
+ device = 'cuda'
61
+ dtype = torch.bfloat16
62
+ model = LlamaForCausalLM.from_pretrained(model_path, torch_dtype=dtype, device_map=device)
63
+
64
+ # Prepare the input text
65
+ prompt = 'Complete the paragraph: our solar system is'
66
+ inputs = tokenizer.encode(prompt, return_tensors='pt').to(model.device)
67
+
68
+ # Generate the output
69
+ outputs = model.generate(inputs, max_length=20)
70
+
71
+ # Decode and print the output
72
+ output_text = tokenizer.decode(outputs[0])
73
+ print(output_text)
74
+ ```
75
+
76
+ ## Software Integration
77
+ **Runtime Engine(s):**
78
+ * NeMo 24.05
79
+
80
+ **Supported Hardware Microarchitecture Compatibility:** <br>
81
+ * NVIDIA Ampere
82
+ * NVIDIA Blackwell
83
+ * NVIDIA Hopper
84
+ * NVIDIA Lovelace
85
+
86
+
87
+ **[Preferred/Supported] Operating System(s):** <br>
88
+ * Linux
89
+
90
+ ## Dataset & Training
91
+
92
+ **Data Collection Method by Dataset:** Automated
93
+
94
+ **Labeling Method by Dataset:** Not Applicable
95
+
96
+ **Properties:**
97
+ The training corpus for Llama-3.1-Minitron-4B-Width-Base consists of English and multilingual text, as well as code. Our sources cover a variety of document types such as: webpages, dialogue, articles, and other written materials. The corpus spans domains including legal, math, science, finance, and more. In our continued training set, we introduce a small portion of question-answering, and alignment style data to improve model performance.
98
+
99
+ **Data Freshness:** The pretraining data has a cutoff of June 2023.
100
+
101
+ ## Evaluation Results
102
+
103
+ ### Overview
104
+ _5-shot performance._ Language Understanding evaluated using [Massive Multitask Language Understanding](https://arxiv.org/abs/2009.03300):
105
+
106
+ | Average |
107
+ | :---- |
108
+ | 60.5 |
109
+
110
+ _Zero-shot performance._ Evaluated using select datasets from the [LM Evaluation Harness](https://github.com/EleutherAI/lm-evaluation-harness) with additions:
111
+
112
+ | HellaSwag | Winogrande | GSM8K| ARC-Challenge | XLSum |
113
+ | :---- | :---- | :---- | :---- | :---- |
114
+ | 76.1 | 73.5 | 41.2 | 55.6 | 28.7
115
+
116
+ _Code generation performance._ Evaluated using [MBPP](https://github.com/google-research/google-research/tree/master/mbpp):
117
+ | Score |
118
+ | :---- |
119
+ | 32.0 |
120
+
121
+ ## Inference
122
+
123
+ **Engine:** TensorRT-LLM
124
+
125
+ **Test Hardware:** NVIDIA A100
126
+
127
+ **DType:** BFloat16
128
+
129
+
130
+ ## Limitations
131
+
132
+ The model was trained on data that contains toxic language, unsafe content, 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.
133
+
134
+ ## Ethical Considerations
135
+
136
+ 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 internal model team to ensure this model meets requirements for the relevant industry and use case and addresses unforeseen product misuse.
137
+
138
+ Please report security vulnerabilities or NVIDIA AI Concerns [here](https://www.nvidia.com/en-us/support/submit-security-vulnerability/).
139
+
140
+ ## References
141
+ * [Compact Language Models via Pruning and Knowledge Distillation](https://arxiv.org/abs/2407.14679)