In this work, we develop a new order-independent graph-based autoencoder called Vector-Quantized Graph AutoEncoder (VQGAE). This autoencoder is designed to generate an order-independent molecular representation based on learned fragment vectors. Unlike previous work, it does not require a predefined set of fragments but is able to learn them in an unsupervised manner. Thus, the latent vector of VQGAE is represented by fragment counts, as in commonly used fragmentbased descriptors. The atom order independence in the latent space of VQGAE is ensured by using only commutative operations in the encoder.