In NLP a common problem is that you have vector embeddings of large vocabularies, and you do manipulations on these vector embeddings to compute some result vector, and then you want to find which words in your vocabulary have word embeddings close to the result vector. How can this query be made quickly (and how does it work with a sense of "closeness"?). Of course a naive solution would be to store every vector embedding in some list/array/whatever and just compute the distance between result vector and literally every vector embedding to see which are close. While that works this requires going through every word in the vocabulary. Is there some more efficient way to structure the data and run the query in order to quickly find what vector embeddings are near to the result vector? I assume this is a solved problem and am looking for advice or pointers. I feel like there should be some more structure to the data than the naive solution requires because you should be able to take advantage of, say, the triangle inequality in order to make sure points close to each other sit in some predictable positions in a search tree or something.

This is a self-made problem so please excuse if I'm missing obvious vocabulary (in fact, please advise me on it)!



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.