Word embeddings are a way to store the meaning of word (such as "plane" or "dog") in a large vector (= a long list of numbers)
These vectors can then be used to find words similar to each other. But they can also be used to calculate with English words, e.g.:
dog - bark + meow --> cat
(in fact, you can try this very example on the demo website, or come up with your own calculation)
In order to retrieve these embeddings, I created a model that reads through billions of words to understand how they are used. It looks at the words appearing close to each other and assumes all words with the same nearby words must have similar meaning.
This retrieval of the embeddings was the hardest part: My first model was okayish and could find related words, but I could not yet calculate with them like in the example before. For the final version I used a much larger dataset, with thought-out pre-processing steps, which was more complicated then I thought (You need to ensure the words you are grouping actually belong together, so you may only group within individual sentences, groups mustn't overlap anything inside brackets, and you can't make a group with words you filtered in pre-processing at the same time you shouldn't skip any words, ...)
Additionally the challenge with a larger dataset was, that it didnt fit into my memory, so I had to read it in chunks and train the model incrementally. The training of the final model took over 50 hours.
- 7 devlogs
- 28h