r/deeplearning • • 10h ago

Can a gpt model predict the same token again?

I recently coded trained a gpt model from scratch after lots and lots of debugging and when I test it with some input worlds , I can see some correct grammar prediction but , it also sometimes predicts words twice in a row like "this is is ..."

Is this normal for a gpt model , or did I do something wrong while creating it?

Model Specifications -

•Dataset used- tiny Shakespeare

•attention head blocks used -16

•number of gpt blocks -12

•using nn.parameterlist with the above values to loop the calculation for each block.

Here is my code if needed-

https://github.com/Rishikesh-2006/Decoder-only-Transformer-for-Text-Generation/blob/main/Model%2FGPT.ipynb

1 Upvotes

2 comments sorted by

2

u/Full-World8839 10h ago

Hey, first congratulations on training a model! I did something similar and it was a great feeling! It's tiny so looping is normal. Maybe under trained? What was the size of the dataset. Work to chinchilla rule. What was your final train/Val loss? Could be greedy sampling. What is your temp and top k. Check out other similar models on HF. It happens to everyone! If your GPU allows it you could always move on to llama or mamba with your own dataset!

1

u/Jumbledsaturn52 9h ago

Thanks man , I am actually feeling very good after making a working model .Now for the training size , as for my 3050 laptop I had to dial down the data size , my latest training was done on 8000 sentences and for tokenization , I just made all of the sentences be 50 numbers wide by adding the <null> value from the dictionary I stored . Batch size was 32 using Data loader (pytorch) , trained for 20 epoch ,final avg loss = 4.066.. and final total =1016.73.