Reconstruction loss measures how far a decoder’s output is from what it should reproduce. An autoencoder compresses an input into a latent representation, decodes it, and trains to reduce the difference between the input and its reconstruction. For graphs, that output can be a predicted adjacency matrix; for temporal data, it can be the next pose in a sequence. section 5.5 section 5.4.2 section 6.4
To use it in a training loop:
- Run the encoder and decoder, then compare the decoder’s prediction with the corresponding target. In molecular graph generation, the target adjacency matrix is built from the graph’s edges. section 5.4.4
- Choose a comparison suited to the output: the molecular graph example uses binary cross-entropy for adjacency matrices; the pose-prediction example uses mean squared error against the next timesteps, scaled by prior variance. section 5.4.2 section 6.4
- Combine reconstruction loss with the model’s other objectives before backpropagation. The molecular VGAE adds KL divergence and QED prediction loss; neural relational inference pairs reconstruction loss with KL divergence. section 5.4.2 section 6.4.3
Molecular graph loss in PyTorch
For predicted and true adjacency matrices, `F.binary_cross_entropy(pred_adj, true_adj)` supplies the reconstruction term. The loss function adds QED mean squared error and KL divergence. The decoder also produces a feature matrix, but the displayed loss calculation explicitly applies binary cross-entropy to adjacency only; do not assume this line trains feature reconstruction. section 5.4.2 section 5.4.3
A falling combined training loss is useful feedback, but it does not by itself verify that generated molecules are valuable: proposed candidates still need further testing. Likewise, future-pose prediction is evaluated separately at different time horizons. section 5.4.4 section 6.4.3









