Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- I declared my GPT style arhitecture for my NN (neuronal network).
- Let me explain you how it works:
- 1) Let's say we have this dataset: "The dog chased the cat because it was a bad dog"
- 2) The model (I will name the AI as model) first transforms the dataset into a vocabulary of numbers and then every word into a sequence of numbers, that's because the computer can not read words like people, they need binary code and integers are the closest solution😎 !
- For example, the data set is transformed into:
- "The" → 17
- "dog" → 482
- "chased" → 901
- etc.
- Now we have: [17, 482, 901, 17, 623, 77, 55, 34, 12, 482] P.S. there are no duplicates in this
- Then he transforms it again in this:
- 482 ("dog") →
- [0.21, -0.44, 0.88, ..., 0.03]
- etc.
- 3) The model needs an order: "this is" and "is this" are not the same thing, so he creates arrays of positions and then he combines it with the array of the word itself, giving birth to a usable word.
- Position 0 → [0.01, 0.02, -0.01, 0.03, 0.00]
- Position 1 → [-0.02, 0.00, 0.04, 0.01, -0.01]
- Position 2 → [0.03, -0.01, 0.02, -0.02, 0.04]
- etc.
- P.S. every position needs combinations!!!
- Then:
- for the word "dog":
- Word vector: [0.21, -0.44, 0.88, -0.1, 0.03] (the word itself)
- Position vector: [-0.02, 0.00, 0.04, 0.01, -0.01] (the position in dataset)
- -----------------------------------------------
- Sum → [0.19, -0.44, 0.92, -0.09, 0.02]
- P.S. Like this dog from the last position is different from dog on the second position
- 4) It then creates attentions, meaning that for every word he looks for the most important words for him:
- For the word "it", he looks and see the words "cat" and "dog", and he creates attentions like this
- dog: 0.7
- cat: 0.3
- This are named importance scores, so when he will see it he will probably refer to a dog, how smart😎!!!!
- 5) MLP (thinking step)
- He now starts to make patterns putting words in correlation:
- It may learn patterns like:
- If sentence contains “bad dog”
- And earlier subject is dog
- Strengthen dog-related features
- This is where feature combinations happen.
- 6) This repeats many times.
- Each block refines meaning.
- Early blocks:
- Learn simple relationships
- Later blocks:
- Learn long-range structure
- Learn cause/effect
- Learn grammar
- After all blocks:
- Each word vector contains deep context.
- 7) Now he starts predicting words
- At each position, the model tries to predict the next word.
- For example:
- Input:
- "The"
- Model predicts:
- "dog" (maybe high probability)
- Then:
- Input:
- "The dog"
- Model predicts:
- "chased"
- And so on.
- At the end of:
- "The dog chased the cat because it was a bad"
- Model predicts:
- "dog"
- ******************************
- This is the key part.
- During training:
- The real next word is known.
- Example training pairs:
- Input:
- "The"
- Correct next word:
- "dog"
- Input:
- "The dog"
- Correct next word:
- "chased"
- And so on.
- **********************
- After many repetitions he will learn to talk!!!!
- See you when the model will be trained!!!
Advertisement
Add Comment
Please, Sign In to add comment