How to predict set of words given an unordered set

Hello,

I’m trying to build a Neural Network to, given a set of keywords extracted from a papers dataset, predict another set of keywords extracted from another dataset. For example:

cat, dog, bird -> Mosquito, elephant, Table
Plane -> computer, Pencil
Tablet, house, France -> Italy

As you can see, the input lenght can be different on each set of words, and the output target size can vary too.

Firstly, I tried with a very simple model with three linear layers and the results were very (very) poor. After reading some tutorials, I tried to create a LSTM but that type of Neural Network is not suitable for my problem because the order of the keywords is not relevant for me, I’m not trying to predict sequences.

Finally, I tried adapting the Word Embedding model from this tutorial https://pytorch.org/tutorials/beginner/nlp/word_embeddings_tutorial.html but results are very poor and, in addition, I don’t know how to deal with the different length of the input targets (in the tutorial, all the input consists always in two words).

So, I’m a bit lost and I don’t know if a Neural Network if really what I need to solve my problem.

Thanks