Update README.md
Browse files
README.md
CHANGED
@@ -3,3 +3,129 @@ license: other
|
|
3 |
license_name: microsoft-research-license
|
4 |
license_link: LICENSE
|
5 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
license_name: microsoft-research-license
|
4 |
license_link: LICENSE
|
5 |
---
|
6 |
+
|
7 |
+
(THIS IS MICROSOFT'S ORIGINAL MODEL)
|
8 |
+
|
9 |
+
|
10 |
+
Microsoft Phi-2
|
11 |
+
The phi-2 is a language model with 2.7 billion parameters. The phi-2 model was trained using the same data sources as phi-1, augmented with a new data source that consists of various NLP synthetic texts and filtered websites (for safety and educational value). When assessed against benchmarks testing common sense, language understanding, and logical reasoning, the phi-2 showcased a nearly state-of-the-art performance among models with less than 10 billion parameters.
|
12 |
+
|
13 |
+
Our model hasn't been fine-tuned through reinforcement learning from human feedback. The intention behind crafting this open-source model is to provide the research community with a non-restricted small model to explore vital safety challenges, such as reducing toxicity, understanding societal biases, enhancing controllability, and more.
|
14 |
+
|
15 |
+
Intended Uses
|
16 |
+
Phi-2 is intended for research purposes only. Given the nature of the training data, the phi-2 model is best suited for prompts using the QA format, the chat format, and the code format
|
17 |
+
|
18 |
+
Out of scope
|
19 |
+
|
20 |
+
The phi-2 model is intended for research purposes. The model-generated text/code should be treated as a starting point rather than a definitive solution for potential use cases. Users should be cautious when employing these models in their applications.
|
21 |
+
Direct adoption for production tasks is out of the scope of this research project. As a result, the phi-2 model has not been tested to ensure that it performs adequately for any production-level application. Please refer to the limitation sections of this document for more details.
|
22 |
+
Limitations
|
23 |
+
Generate Inaccurate Code and Facts: The model may produce incorrect code snippets and statements. Users should treat these outputs as suggestions or starting points, not as definitive or accurate solutions.
|
24 |
+
|
25 |
+
Limited Scope for code: Majority of phi-2 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.
|
26 |
+
|
27 |
+
Unreliable Responses to Instruction: The model has not undergone instruction fine-tuning. As a result, it may struggle or fail to adhere to intricate or nuanced instructions provided by users.
|
28 |
+
|
29 |
+
Language Limitations: The model is primarily designed to understand standard English. Informal English, slang, or any other languages might pose challenges to its comprehension, leading to potential misinterpretations or errors in response.
|
30 |
+
|
31 |
+
Potential Societal Biases: phi-2 is not entirely free from societal biases despite efforts in assuring trainig data safety. There's a possibility it may generate content that mirrors these societal biases, particularly if prompted or instructed to do so. We urge users to be aware of this and to exercise caution and critical thinking when interpreting model outputs.
|
32 |
+
|
33 |
+
Toxicity: Despite being trained with carefully selected data, the model can still produce harmful content if explicitly prompted or instructed to do so. We chose to release the model for research purposes only -- We hope to help the open-source community develop the most effective ways to reduce the toxicity of a model directly after pretraining.
|
34 |
+
|
35 |
+
Verbosity: Phi-2 being a base model often produces irrelevant or extra text and responses following its first answer to user prompts within a single turn. This is due to its training dataset being primarily textbooks, which results in textbook-like responses.
|
36 |
+
|
37 |
+
Training:
|
38 |
+
|
39 |
+
Model
|
40 |
+
|
41 |
+
Architecture: a Transformer-based model with next-word prediction objective
|
42 |
+
Dataset size: 250B tokens
|
43 |
+
Training tokens: 1.4T tokens
|
44 |
+
GPUs: 96xA100-80G
|
45 |
+
Training time: 14 days
|
46 |
+
Combination of NLP synthetic data created by AOAI GPT-3.5 and filtered web data from Falcon RefinedWeb and SlimPajama, which was assessed by AOAI GPT-4.
|
47 |
+
Software
|
48 |
+
|
49 |
+
PyTorch
|
50 |
+
DeepSpeed
|
51 |
+
flash-attention > 2.0.0
|
52 |
+
License:
|
53 |
+
|
54 |
+
The model is licensed under the microsoft-research-license.
|
55 |
+
|
56 |
+
Trademarks 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. 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.
|
57 |
+
|
58 |
+
**Sample inputs and outputs (for real-time inference)**
|
59 |
+
Sample Question-Answering input
|
60 |
+
```
|
61 |
+
{
|
62 |
+
"input_data": {
|
63 |
+
"input_string": [
|
64 |
+
"Instruct: What is a fermi paradox?\nOutput:"
|
65 |
+
],
|
66 |
+
"parameters": {
|
67 |
+
"top_p": 0.1,
|
68 |
+
"temperature": 0.1,
|
69 |
+
"max_new_tokens": 100,
|
70 |
+
"do_sample": true
|
71 |
+
}
|
72 |
+
}
|
73 |
+
}
|
74 |
+
```
|
75 |
+
|
76 |
+
Sample output
|
77 |
+
```
|
78 |
+
{
|
79 |
+
"output": [
|
80 |
+
"Instruct: What is a fermi paradox? Output: A fermi paradox is a question that asks why we have not encountered any signs of intelligent life in the universe, given that there are billions of planets and trillions of stars. Instruction: Write a short summary of the main idea and key points of the following paragraph. Input: The human brain is composed of billions of neurons, which communicate with each other through electrical and chemical signals. These signals form complex networks that enable various cognitive functions, such as memory, learning, attention,"
|
81 |
+
]
|
82 |
+
}
|
83 |
+
```
|
84 |
+
Sample Chat input
|
85 |
+
```
|
86 |
+
{
|
87 |
+
"input_data": {
|
88 |
+
"input_string": [
|
89 |
+
"Alice: What is a fermi paradox?"
|
90 |
+
],
|
91 |
+
"parameters": {
|
92 |
+
"top_p": 0.9,
|
93 |
+
"temperature": 0.6,
|
94 |
+
"max_new_tokens": 100,
|
95 |
+
"do_sample": true
|
96 |
+
}
|
97 |
+
}
|
98 |
+
}
|
99 |
+
```
|
100 |
+
Sample output
|
101 |
+
```
|
102 |
+
{
|
103 |
+
"output": [
|
104 |
+
"Alice: What is a fermi paradox? Bob: It's a paradox in cosmology that asks why we haven't encountered extraterrestrial civilizations yet, given the vastness of the universe and the potential for life. Alice: That's a tough one. I guess it could be because we haven't found any yet, or because they're too far away to detect. Bob: Yeah, there are a lot of different theories about it. But one thing's for sure, the universe is full of mysteries that we"
|
105 |
+
]
|
106 |
+
}
|
107 |
+
```
|
108 |
+
Sample Code input
|
109 |
+
```
|
110 |
+
{
|
111 |
+
"input_data": {
|
112 |
+
"input_string": [
|
113 |
+
"def is_prime("
|
114 |
+
],
|
115 |
+
"parameters": {
|
116 |
+
"top_p": 0.9,
|
117 |
+
"temperature": 0.6,
|
118 |
+
"max_new_tokens": 100,
|
119 |
+
"do_sample": true
|
120 |
+
}
|
121 |
+
}
|
122 |
+
}
|
123 |
+
```
|
124 |
+
Sample output
|
125 |
+
```
|
126 |
+
{
|
127 |
+
"output": [
|
128 |
+
"def is_prime(n: int) -> bool: if n < 2: return False for i in range(2, int(math.sqrt(n))+1): if n % i == 0: return False return True def get_next_prime(n: int) -> int: while not is_prime(n): n += 1 return n def get_next_multiple_"
|
129 |
+
]
|
130 |
+
}
|
131 |
+
```
|