davidxmle commited on
Commit
f379686
·
verified ·
1 Parent(s): 18af198

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +26 -1
README.md CHANGED
@@ -40,4 +40,29 @@ datasets:
40
  - Original Model creator: [Meta](https://huggingface.co/meta-llama)
41
  - Original model: [meta-llama/Meta-Llama-3-8B](https://huggingface.co/meta-llama/Meta-Llama-3-8B)
42
  - Built with Meta Llama 3
43
- - Created by [David Xue](https://www.linkedin.com/in/david-xue-uva/) from [Astronomer](https://astronomer.io)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
  - Original Model creator: [Meta](https://huggingface.co/meta-llama)
41
  - Original model: [meta-llama/Meta-Llama-3-8B](https://huggingface.co/meta-llama/Meta-Llama-3-8B)
42
  - Built with Meta Llama 3
43
+ - Created by [David Xue](https://www.linkedin.com/in/david-xue-uva/) from [Astronomer](https://astronomer.io)
44
+
45
+ ## Description
46
+ - This is the exact same model ([meta-llama/Meta-Llama-3-8B](https://huggingface.co/meta-llama/Meta-Llama-3-8B)) with the weights for the input and output embeddings from lm head and embedding matrix adjusted for certain tokens that were untrained which caused widespread issues for people attempting to fine-tune this base model with either adding their own tokens or using existing special tokens.
47
+
48
+ - ## Why We Made This Model
49
+
50
+ The Llama 3 base (non-instruct) model, while powerful, came with a significant oversight that some special tokens for instruction following within its architecture were left untrained, potentially derailing further fine-tuning processes. This was first noted by Daniel Han on X, highlighting a critical but fixable flaw in a widely used model.
51
+
52
+ The primary goal of releasing a patched version of this model was to address this issue so that all users can utilize the model without facing training instabilities, such as sudden gradient explosions or `NaN` gradients, or having to fix the model themselves before fine-tuning.
53
+
54
+ We aim to ensure that the machine learning community could continue using this model without needing to perform repetitive manual checks or corrections, thus speeding up the research and application deployment processes.
55
+
56
+ ## Details of the Adjustment
57
+
58
+ The [meta-llama/Meta-Llama-3-8B](https://huggingface.co/meta-llama/Meta-Llama-3-8B) model was pulled directly from HuggingFace directly and loaded using transformers. Then, the input embedding and output embedding dimension values are retrieved using `model.get_input_embeddings().weight.data` and `model.get_output_embeddings().weight.data`. These 2 matrics are identical in shape, with each row represneting a token id, and each column representing a embedding feature.
59
+
60
+ The special tokens can be found by locating the rows where the entire row of the embedding values are all zeros, which imply they were not trained during the pretraining phase of the model from Meta. Such untrained tokens could lead to heavy computational issues, like gradient explosions or `NaN` gradients, during downstream fine-tuning on specific tasks.
61
+
62
+ See here for a list of the tokens we found that has fit the "untrained" profile described:
63
+
64
+ Once these untrained tokens are identified, the average of trained tokens can be calculated by using the sums of embedding values of trained tokens for each feature/column and divided by the number of trained. This is done for both input and output matrices.
65
+
66
+ Lastly, the problematic token's rows in the 2 embedding matrics are set to the computed mean, thus completing the adjustment.
67
+
68
+