Avoid serialization of vocab in Word2Vec, 2 benefits.
1. Performance improvement for less serialization.
2. This can actually increase the capacity of Word2Vec.
Currently in the fit of word2vec, the closure mainly includes serialization of Word2Vec and 2 global table.
The main part of Word2vec is the vocab of size: vocab * 40 * 2 * 4 = 320 vocab;
2 global table: vocab * vectorSize * 8.
Their sum cannot exceed Int.max due to the restriction of ByteArrayOutputStream. In any case, avoiding serialization of vocab helps decrease the size of the closure serialization, especially when vectorSize is small, thus to allow larger vocabulary.
- links to