chore(root): Initial documentation upload.
Browse files- .gitattributes +2 -0
- CODE_OF_CONDUCT.md +9 -0
- LICENSE +22 -0
- Modelfile_fp16 +9 -0
- Modelfile_q4 +9 -0
- NOTICE.md +38 -0
- Phi-3-mini-4k-instruct-fp16.gguf +3 -0
- Phi-3-mini-4k-instruct-q4.gguf +3 -0
- README.md +251 -0
- SECURITY.md +41 -0
.gitattributes
CHANGED
@@ -33,3 +33,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
+
Phi-3-mini-4k-instruct-q4.gguf filter=lfs diff=lfs merge=lfs -text
|
37 |
+
Phi-3-mini-4k-instruct-fp16.gguf filter=lfs diff=lfs merge=lfs -text
|
CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Microsoft Open Source Code of Conduct
|
2 |
+
|
3 |
+
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
|
4 |
+
|
5 |
+
Resources:
|
6 |
+
|
7 |
+
- [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/)
|
8 |
+
- [Microsoft Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/)
|
9 |
+
- Contact [[email protected]](mailto:[email protected]) with questions or concerns
|
LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Microsoft.
|
2 |
+
Copyright (c) Microsoft Corporation.
|
3 |
+
|
4 |
+
MIT License
|
5 |
+
|
6 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
7 |
+
of this software and associated documentation files (the "Software"), to deal
|
8 |
+
in the Software without restriction, including without limitation the rights
|
9 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10 |
+
copies of the Software, and to permit persons to whom the Software is
|
11 |
+
furnished to do so, subject to the following conditions:
|
12 |
+
|
13 |
+
The above copyright notice and this permission notice shall be included in all
|
14 |
+
copies or substantial portions of the Software.
|
15 |
+
|
16 |
+
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
22 |
+
SOFTWARE.
|
Modelfile_fp16
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
FROM ./Phi-3-mini-4k-instruct-fp16.gguf
|
2 |
+
TEMPLATE """<s>{{ if .Prompt }}<|user|>
|
3 |
+
{{ .Prompt }}<|end|>
|
4 |
+
{{ end }}<|assistant|>
|
5 |
+
{{ .Response }}<|end|>"""
|
6 |
+
PARAMETER stop <|endoftext|>
|
7 |
+
PARAMETER stop <|assistant|>
|
8 |
+
PARAMETER stop <|end|>
|
9 |
+
PARAMETER num_ctx 4096
|
Modelfile_q4
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
FROM ./Phi-3-mini-4k-instruct-q4.gguf
|
2 |
+
TEMPLATE """<s>{{ if .Prompt }}<|user|>
|
3 |
+
{{ .Prompt }}<|end|>
|
4 |
+
{{ end }}<|assistant|>
|
5 |
+
{{ .Response }}<|end|>"""
|
6 |
+
PARAMETER stop <|endoftext|>
|
7 |
+
PARAMETER stop <|assistant|>
|
8 |
+
PARAMETER stop <|end|>
|
9 |
+
PARAMETER num_ctx 4096
|
NOTICE.md
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
NOTICES AND INFORMATION
|
2 |
+
Do Not Translate or Localize
|
3 |
+
|
4 |
+
This software incorporates material from third parties.
|
5 |
+
|
6 |
+
**Component.** https://github.com/Dao-AILab/flash-attention
|
7 |
+
|
8 |
+
**Open Source License/Copyright Notice.**
|
9 |
+
|
10 |
+
BSD 3-Clause License
|
11 |
+
|
12 |
+
Copyright (c) 2022, the respective contributors, as shown by the AUTHORS file.
|
13 |
+
All rights reserved.
|
14 |
+
|
15 |
+
Redistribution and use in source and binary forms, with or without
|
16 |
+
modification, are permitted provided that the following conditions are met:
|
17 |
+
|
18 |
+
* Redistributions of source code must retain the above copyright notice, this
|
19 |
+
list of conditions and the following disclaimer.
|
20 |
+
|
21 |
+
* Redistributions in binary form must reproduce the above copyright notice,
|
22 |
+
this list of conditions and the following disclaimer in the documentation
|
23 |
+
and/or other materials provided with the distribution.
|
24 |
+
|
25 |
+
* Neither the name of the copyright holder nor the names of its
|
26 |
+
contributors may be used to endorse or promote products derived from
|
27 |
+
this software without specific prior written permission.
|
28 |
+
|
29 |
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
30 |
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
31 |
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
32 |
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
33 |
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
34 |
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
35 |
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
36 |
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
37 |
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
38 |
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
Phi-3-mini-4k-instruct-fp16.gguf
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:5d99003e395775659b0dde3f941d88ff378b2837a8dc3a2ea94222ab1420fad3
|
3 |
+
size 7643295904
|
Phi-3-mini-4k-instruct-q4.gguf
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:8a83c7fb9049a9b2e92266fa7ad04933bb53aa1e85136b7b30f1b8000ff2edef
|
3 |
+
size 2393231072
|
README.md
ADDED
@@ -0,0 +1,251 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: mit
|
3 |
+
license_link: >-
|
4 |
+
https://huggingface.co/microsoft/Phi-3-mini-4k-instruct-gguf/resolve/main/LICENSE
|
5 |
+
language:
|
6 |
+
- en
|
7 |
+
pipeline_tag: text-generation
|
8 |
+
tags:
|
9 |
+
- nlp
|
10 |
+
- code
|
11 |
+
---
|
12 |
+
|
13 |
+
## Model Summary
|
14 |
+
|
15 |
+
This repo provides the GGUF format for the Phi-3-Mini-4K-Instruct.
|
16 |
+
The Phi-3-Mini-4K-Instruct is a 3.8B parameters, lightweight, state-of-the-art open model trained with the Phi-3 datasets that includes both synthetic data and the filtered publicly available websites data with a focus on high-quality and reasoning dense properties.
|
17 |
+
The model belongs to the Phi-3 family with the Mini version in two variants [4K](https://huggingface.co/microsoft/Phi-3-mini-4k-instruct) and [128K](https://huggingface.co/microsoft/Phi-3-mini-128k-instruct) which is the context length (in tokens) it can support.
|
18 |
+
The model has underwent a post-training process that incorporates both supervised fine-tuning and direct preference optimization to ensure precise instruction adherence and robust safety measures.
|
19 |
+
When assessed against benchmarks testing common sense, language understanding, math, code, long context and logical reasoning, Phi-3 Mini-4K-Instruct showcased a robust and state-of-the-art performance among models with less than 13 billion parameters.
|
20 |
+
|
21 |
+
Resources and Technical Documentation:
|
22 |
+
|
23 |
+
+ [Phi-3 Microsoft Blog](https://aka.ms/phi3blog-april)
|
24 |
+
+ [Phi-3 Technical Report](https://aka.ms/phi3-tech-report)
|
25 |
+
+ [Phi-3 on Azure AI Studio](https://aka.ms/phi3-azure-ai)
|
26 |
+
+ [Phi-3 on Hugging Face](https://aka.ms/phi3-hf)
|
27 |
+
+ Phi-3 ONNX: [4K](https://aka.ms/phi3-mini-4k-instruct-onnx) and [128K](https://aka.ms/phi3-mini-128k-instruct-onnx)
|
28 |
+
|
29 |
+
This repo provides GGUF files for the Phi-3 Mini-4K-Instruct model.
|
30 |
+
| Name | Quant method | Bits | Size | Use case |
|
31 |
+
| ---- | ---- | ---- | ---- | ----- |
|
32 |
+
| [Phi-3-mini-4k-instruct-q4.gguf](https://huggingface.co/microsoft/Phi-3-mini-4k-instruct-gguf/blob/main/Phi-3-mini-4k-instruct-q4.gguf) | Q4_K_M | 4 | 2.2 GB| medium, balanced quality - recommended |
|
33 |
+
| [Phi-3-mini-4k-instruct-fp16.gguf](https://huggingface.co/microsoft/Phi-3-mini-4k-instruct-gguf/blob/main/Phi-3-mini-4k-instruct-fp16.gguf) | None | 16 | 7.2 GB | minimal quality loss |
|
34 |
+
|
35 |
+
|
36 |
+
## Intended Uses
|
37 |
+
|
38 |
+
**Primary use cases**
|
39 |
+
|
40 |
+
The model is intended for commercial and research use in English. The model provides uses for applications which require
|
41 |
+
1) memory/compute constrained environments
|
42 |
+
2) latency bound scenarios
|
43 |
+
3) strong reasoning (especially math and logic)
|
44 |
+
4) long context
|
45 |
+
|
46 |
+
Our model is designed to accelerate research on language and multimodal models, for use as a building block for generative AI powered features.
|
47 |
+
|
48 |
+
**Use case considerations**
|
49 |
+
|
50 |
+
Our models are not specifically designed or evaluated for all downstream purposes. Developers should consider common limitations of language models as they select use cases, and evaluate and mitigate for accuracy, safety, and fariness before using within a specific downstream use case, particularly for high risk scenarios.
|
51 |
+
Developers should be aware of and adhere to applicable laws or regulations (including privacy, trade compliance laws, etc.) that are relevant to their use case.
|
52 |
+
Nothing contained in this Model Card should be interpreted as or deemed a restriction or modification to the license the model is released under.
|
53 |
+
|
54 |
+
|
55 |
+
## Chat Format:
|
56 |
+
|
57 |
+
Given the nature of the training data, the Phi-3-Mini-4K-instruct model is best suited for prompts using the chat format as follows.
|
58 |
+
You can provide the prompt as a question with a generic template as follow:
|
59 |
+
```markdown
|
60 |
+
<|user|>\nQuestion <|end|>\n<|assistant|>
|
61 |
+
```
|
62 |
+
For example:
|
63 |
+
```markdown
|
64 |
+
<|user|>
|
65 |
+
How to explain Internet for a medieval knight?<|end|>
|
66 |
+
<|assistant|>
|
67 |
+
```
|
68 |
+
|
69 |
+
where the model generates the text after "<|assistant|>" . In case of few-shots prompt, the prompt can be formatted as the following:
|
70 |
+
|
71 |
+
```markdown
|
72 |
+
<|user|>
|
73 |
+
I am going to Paris, what should I see?<|end|>
|
74 |
+
<|assistant|>
|
75 |
+
Paris, the capital of France, is known for its stunning architecture, art museums, historical landmarks, and romantic atmosphere. Here are some of the top attractions to see in Paris:\n\n1. The Eiffel Tower: The iconic Eiffel Tower is one of the most recognizable landmarks in the world and offers breathtaking views of the city.\n2. The Louvre Museum: The Louvre is one of the world's largest and most famous museums, housing an impressive collection of art and artifacts, including the Mona Lisa.\n3. Notre-Dame Cathedral: This beautiful cathedral is one of the most famous landmarks in Paris and is known for its Gothic architecture and stunning stained glass windows.\n\nThese are just a few of the many attractions that Paris has to offer. With so much to see and do, it's no wonder that Paris is one of the most popular tourist destinations in the world."<|end|>
|
76 |
+
<|user|>
|
77 |
+
What is so great about #1?<|end|>
|
78 |
+
<|assistant|>
|
79 |
+
```
|
80 |
+
|
81 |
+
## How to download GGUF files
|
82 |
+
|
83 |
+
1. **Install Hugging Face CLI:**
|
84 |
+
|
85 |
+
```
|
86 |
+
pip install huggingface-hub>=0.17.1
|
87 |
+
```
|
88 |
+
|
89 |
+
2. **Login to Hugging Face:**
|
90 |
+
```
|
91 |
+
huggingface-cli login
|
92 |
+
```
|
93 |
+
|
94 |
+
3. **Download the GGUF model:**
|
95 |
+
```
|
96 |
+
huggingface-cli download microsoft/Phi-3-mini-4k-instruct-gguf Phi-3-mini-4k-instruct-q4.gguf --local-dir . --local-dir-use-symlinks False
|
97 |
+
```
|
98 |
+
|
99 |
+
## How to use with Ollama
|
100 |
+
|
101 |
+
1. **Install Ollama:**
|
102 |
+
|
103 |
+
```
|
104 |
+
curl -fsSL https://ollama.com/install.sh | sh
|
105 |
+
```
|
106 |
+
|
107 |
+
2. **Run the *phi3* model:**
|
108 |
+
|
109 |
+
```
|
110 |
+
ollama run phi3
|
111 |
+
```
|
112 |
+
|
113 |
+
### Building from `Modelfile`
|
114 |
+
|
115 |
+
Assuming that you have already downloaded GGUF files, here is how you can use them with [Ollama](https://ollama.com/):
|
116 |
+
|
117 |
+
1. **Get the Modelfile:**
|
118 |
+
|
119 |
+
```
|
120 |
+
huggingface-cli download microsoft/Phi-3-mini-4k-instruct-gguf Modelfile_q4 --local-dir /path/to/your/local/dir
|
121 |
+
```
|
122 |
+
|
123 |
+
2. Build the Ollama Model:
|
124 |
+
Use the Ollama CLI to create your model with the following command:
|
125 |
+
|
126 |
+
```
|
127 |
+
ollama create phi3 -f Modelfile_q4
|
128 |
+
```
|
129 |
+
|
130 |
+
3. **Run the *phi3* model:**
|
131 |
+
|
132 |
+
Now you can run the Phi-3-Mini-4k-Instruct model with Ollama using the following command:
|
133 |
+
|
134 |
+
```
|
135 |
+
ollama run phi3 "Your prompt here"
|
136 |
+
```
|
137 |
+
|
138 |
+
Replace "Your prompt here" with the actual prompt you want to use for generating responses from the model.
|
139 |
+
|
140 |
+
## How to use with Llamafile:
|
141 |
+
|
142 |
+
Assuming that you already have GGUF files downloaded. Here is how you can use the GGUF model with [Llamafile](https://github.com/Mozilla-Ocho/llamafile):
|
143 |
+
|
144 |
+
1. **Download Llamafile-0.7.3**
|
145 |
+
```
|
146 |
+
wget https://github.com/Mozilla-Ocho/llamafile/releases/download/0.7.3/llamafile-0.7.3
|
147 |
+
```
|
148 |
+
2. **Run the model with chat format prompt:**
|
149 |
+
|
150 |
+
|
151 |
+
```markdown
|
152 |
+
<|user|>\nHow to explain Internet for a medieval knight?\n<|end|>\n<|assistant|>
|
153 |
+
```
|
154 |
+
|
155 |
+
|
156 |
+
```
|
157 |
+
./llamafile-0.7.3 -ngl 9999 -m Phi-3-mini-4k-instruct-q4.gguf --temp 0.6 -p "<|user|>\nHow to explain Internet for a medieval knight?\n<|end|>\n<|assistant|>"
|
158 |
+
```
|
159 |
+
|
160 |
+
3. **Run with a chat interface:**
|
161 |
+
|
162 |
+
```
|
163 |
+
./llamafile-0.7.3 -ngl 9999 -m Phi-3-mini-4k-instruct-q4.gguf
|
164 |
+
```
|
165 |
+
|
166 |
+
Your browser should open automatically and display a chat interface. (If it doesn't, just open your browser and point it at http://localhost:8080)
|
167 |
+
|
168 |
+
## How to run on Python:
|
169 |
+
|
170 |
+
1. **Install llama-cpp-python:**
|
171 |
+
|
172 |
+
```
|
173 |
+
! CMAKE_ARGS="-DLLAMA_CUBLAS=on" pip install llama-cpp-python
|
174 |
+
```
|
175 |
+
|
176 |
+
2. **Run the model:**
|
177 |
+
|
178 |
+
```python
|
179 |
+
from llama_cpp import Llama
|
180 |
+
|
181 |
+
|
182 |
+
llm = Llama(
|
183 |
+
model_path="./Phi-3-mini-4k-instruct-q4.gguf", # path to GGUF file
|
184 |
+
n_ctx=4096, # The max sequence length to use - note that longer sequence lengths require much more resources
|
185 |
+
n_threads=8, # The number of CPU threads to use, tailor to your system and the resulting performance
|
186 |
+
n_gpu_layers=35, # The number of layers to offload to GPU, if you have GPU acceleration available. Set to 0 if no GPU acceleration is available on your system.
|
187 |
+
)
|
188 |
+
|
189 |
+
prompt = "How to explain Internet to a medieval knight?"
|
190 |
+
|
191 |
+
# Simple inference example
|
192 |
+
output = llm(
|
193 |
+
f"<|user|>\n{prompt}<|end|>\n<|assistant|>",
|
194 |
+
max_tokens=256, # Generate up to 256 tokens
|
195 |
+
stop=["<|end|>"],
|
196 |
+
echo=True, # Whether to echo the prompt
|
197 |
+
)
|
198 |
+
|
199 |
+
print(output['choices'][0]['text'])
|
200 |
+
```
|
201 |
+
|
202 |
+
## Responsible AI Considerations
|
203 |
+
Like other language models, the Phi series models can potentially behave in ways that are unfair, unreliable, or offensive. Some of the limiting behaviors to be aware of include:
|
204 |
+
+ Quality of Service: the Phi models are trained primarily on English text. Languages other than English will experience worse performance. English language varieties with less representation in the training data might experience worse performance than standard American English.
|
205 |
+
+ Representation of Harms & Perpetuation of Stereotypes: These models can over- or under-represent groups of people, erase representation of some groups, or reinforce demeaning or negative stereotypes. Despite safety post-training, these limitations may still be present due to differing levels of representation of different groups or prevalence of examples of negative stereotypes in training data that reflect real-world patterns and societal biases.
|
206 |
+
+ Inappropriate or Offensive Content: these models may produce other types of inappropriate or offensive content, which may make it inappropriate to deploy for sensitive contexts without additional mitigations that are specific to the use case.
|
207 |
+
+ Information Reliability: Language models can generate nonsensical content or fabricate content that might sound reasonable but is inaccurate or outdated.
|
208 |
+
+ Limited Scope for Code: Majority of Phi-3 training data is based in Python and use common packages such as "typing, math, random, collections, datetime, itertools". If the model generates Python scripts that utilize other packages or scripts in other languages, we strongly recommend users manually verify all API uses.
|
209 |
+
|
210 |
+
Developers should apply responsible AI best practices and are responsible for ensuring that a specific use case complies with relevant laws and regulations (e.g. privacy, trade, etc.). Important areas for consideration include:
|
211 |
+
+ Allocation: Models may not be suitable for scenarios that could have consequential impact on legal status or the allocation of resources or life opportunities (ex: housing, employment, credit, etc.) without further assessments and additional debiasing techniques.
|
212 |
+
+ High-Risk Scenarios: Developers should assess suitability of using models in high-risk scenarios where unfair, unreliable or offensive outputs might be extremely costly or lead to harm. This includes providing advice in sensitive or expert domains where accuracy and reliability are critical (ex: legal or health advice). Additional safeguards should be implemented at the application level according to the deployment context.
|
213 |
+
+ Misinformation: Models may produce inaccurate information. Developers should follow transparency best practices and inform end-users they are interacting with an AI system. At the application level, developers can build feedback mechanisms and pipelines to ground responses in use-case specific, contextual information, a technique known as Retrieval Augmented Generation (RAG).
|
214 |
+
+ Generation of Harmful Content: Developers should assess outputs for their context and use available safety classifiers or custom solutions appropriate for their use case.
|
215 |
+
+ Misuse: Other forms of misuse such as fraud, spam, or malware production may be possible, and developers should ensure that their applications do not violate applicable laws and regulations.
|
216 |
+
|
217 |
+
|
218 |
+
## Training
|
219 |
+
|
220 |
+
### Model
|
221 |
+
|
222 |
+
* Architecture: Phi-3 Mini has 3.8B parameters and is a dense decoder-only Transformer model. The model is fine-tuned with Supervised fine-tuning (SFT) and Direct Preference Optimization (DPO) to ensure alignment with human preferences and safety guidlines.
|
223 |
+
* Inputs: Text. It is best suited for prompts using chat format.
|
224 |
+
* Context length: 128K tokens
|
225 |
+
* GPUS: 512 H100-80G
|
226 |
+
* Training time: 7 days
|
227 |
+
* Training data: 3.3T tokens
|
228 |
+
* Outputs: Generated text in response to the input
|
229 |
+
* Dates: Our models were trained between February and April 2024
|
230 |
+
* Status: This is a static model trained on an offline dataset with cutoff date October 2023. Future versions of the tuned models may be released as we improve models.
|
231 |
+
|
232 |
+
### Datasets
|
233 |
+
Our training data includes a wide variety of sources, totaling 3.3 trillion tokens, and is a combination of
|
234 |
+
1) publicly available documents filtered rigorously for quality, selected high-quality educational data, and code;
|
235 |
+
2) newly created synthetic, “textbook-like” data for the purpose of teaching math, coding, common sense reasoning, general knowledge of the world (science, daily activities, theory of mind, etc.);
|
236 |
+
3) high quality chat format supervised data covering various topics to reflect human preferences on different aspects such as instruct-following, truthfulness, honesty and helpfulness.
|
237 |
+
|
238 |
+
### Software
|
239 |
+
|
240 |
+
* [PyTorch](https://github.com/pytorch/pytorch)
|
241 |
+
* [DeepSpeed](https://github.com/microsoft/DeepSpeed)
|
242 |
+
* [Transformers](https://github.com/huggingface/transformers)
|
243 |
+
* [Flash-Attention](https://github.com/HazyResearch/flash-attention)
|
244 |
+
|
245 |
+
### License
|
246 |
+
|
247 |
+
The model is licensed under the [MIT license](https://huggingface.co/microsoft/phi-3-mini-128k/resolve/main/LICENSE).
|
248 |
+
|
249 |
+
## Trademarks
|
250 |
+
|
251 |
+
This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow [Microsoft’s Trademark & Brand Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks). Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party’s policies.
|
SECURITY.md
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!-- BEGIN MICROSOFT SECURITY.MD V0.0.9 BLOCK -->
|
2 |
+
|
3 |
+
## Security
|
4 |
+
|
5 |
+
Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet) and [Xamarin](https://github.com/xamarin).
|
6 |
+
|
7 |
+
If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://aka.ms/security.md/definition), please report it to us as described below.
|
8 |
+
|
9 |
+
## Reporting Security Issues
|
10 |
+
|
11 |
+
**Please do not report security vulnerabilities through public GitHub issues.**
|
12 |
+
|
13 |
+
Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://aka.ms/security.md/msrc/create-report).
|
14 |
+
|
15 |
+
If you prefer to submit without logging in, send email to [[email protected]](mailto:[email protected]). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://aka.ms/security.md/msrc/pgp).
|
16 |
+
|
17 |
+
You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://www.microsoft.com/msrc).
|
18 |
+
|
19 |
+
Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue:
|
20 |
+
|
21 |
+
* Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.)
|
22 |
+
* Full paths of source file(s) related to the manifestation of the issue
|
23 |
+
* The location of the affected source code (tag/branch/commit or direct URL)
|
24 |
+
* Any special configuration required to reproduce the issue
|
25 |
+
* Step-by-step instructions to reproduce the issue
|
26 |
+
* Proof-of-concept or exploit code (if possible)
|
27 |
+
* Impact of the issue, including how an attacker might exploit the issue
|
28 |
+
|
29 |
+
This information will help us triage your report more quickly.
|
30 |
+
|
31 |
+
If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://aka.ms/security.md/msrc/bounty) page for more details about our active programs.
|
32 |
+
|
33 |
+
## Preferred Languages
|
34 |
+
|
35 |
+
We prefer all communications to be in English.
|
36 |
+
|
37 |
+
## Policy
|
38 |
+
|
39 |
+
Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://aka.ms/security.md/cvd).
|
40 |
+
|
41 |
+
<!-- END MICROSOFT SECURITY.MD BLOCK -->
|