Neuro-Visualizer: A Novel Auto-Encoder-Based Loss Landscape Visualization Method With an Application in Knowledge-Guided Machine Learning

Mohannad Elhamod, Anuj KarpatneICML 2024

Visualizing the loss landscape of neural networks is crucial for understanding how they train, diagnosing overfitting, and resolving convergence issues. Because we cannot visualize millions of dimensions, researchers project these high-dimensional surfaces down to 2D.

The standard approach is Principal Component Analysis (PCA). However, PCA creates a flat, linear 2D plane. Because neural network training trajectories curve through high-dimensional space, a flat plane only intersects the trajectory accurately at a single point (usually the final model). Everywhere else, the visualization is distorted.

Other non-linear dimensionality reduction tools like t-SNE or UMAP fall short for landscape visualization because they lack an inverse transform. To plot a loss landscape, one must be able to take a 2D coordinate, map it back to the high-dimensional network weights, and calculate the loss. To address this gap, researchers introduce Neuro-Visualizer, a novel auto-encoder-based method that learns a non-linear 2D manifold to faithfully map high-dimensional training trajectories.

The Neuro-Visualizer Approach

Neuro-Visualizer is an auto-encoder designed specifically for loss landscape visualization.

  • The Core Mechanism: The encoder maps a high-dimensional neural network model (its weights and biases) to a 2D grid coordinate. The decoder maps that 2D coordinate back to the high-dimensional weight space so the loss can be calculated.
  • Custom Constraints: Unlike PCA, where the projection plane is rigid, Neuro-Visualizer's manifold is highly flexible. The authors introduce custom loss functions during the auto-encoder's training to mold the 2D grid:
  • Location Anchoring: Forces specific models (like the start and end of training) to specific coordinates (e.g., placing the start at the bottom-left and the end at the top-right).
  • Grid Scaling: A logarithmic scaling loss that forces the grid to "zoom in" (increase density) around the actual trajectory points, providing high resolution exactly where the model traveled.

Key Insights and Visual Evidence

Rather than traditional static datasets, Neuro-Visualizer is evaluated on the training trajectories of specific models, primarily in Knowledge-Guided Machine Learning (KGML) like Physics-Informed Neural Networks (PINNs) and CoPhy-PGNN.

Comparison of loss landscape visualization methods
  • PCA Distorts Optimization Paths: As seen in the broader landscape comparisons, PCA can project a trajectory such that it crosses the same loss contour twice, falsely implying the loss decreased and then increased. Neuro-Visualizer correctly shows the loss monotonically decreasing, matching actual training logs.
  • Minima Are Rarely Simple: What looks like a clean, simple minimum in PCA is frequently revealed by Neuro-Visualizer to be a bumpy, complex basin.
Zoomed-in view revealing complex local minima

When zooming in on the final stages of training, Neuro-Visualizer captures the intricate local minima where the model bounces around before settling—details that are completely smoothed over by linear methods like PCA.

  • Visual Debugging of PINNs: The tool visually proves existing hypotheses about why PINNs fail. For example, it clearly shows how a PDE's residual loss converges much faster than its boundary condition loss, leading the model into a sub-optimal basin.
  • Evaluating Loss Balancing: When training with multiple competing losses, researchers use algorithms like GradNorm or Dynamic Weight Averaging (DWA). Neuro-Visualizer provides an intuitive way to see why these algorithms succeed or fail by showing whether they steer the model into the same basin, different basins, or completely miss the minima altogether.

Results and Performance

Neuro-Visualizer outperforms baselines by orders of magnitude. It achieved an average relative loss error of 0.0095 (compared to PCA's 1.6782 and UMAP's 0.4295) and an average projection error of 0.0005 (compared to PCA's 0.2832).

Qualitatively, the method successfully mapped the increasingly non-convex landscapes of convection PDEs as the convection coefficient ($\beta$) increased. It visually confirmed the literature's claim that higher $\beta$ values create highly complex, hard-to-optimize landscapes.

Limitations and Future Work

  • Scalability: The most glaring limitation is model size. Because the auto-encoder takes the entire network's weights as a single input vector, it works well for the ~10,000 parameter PINNs tested here. However, applying this directly to an 88-million parameter vision model (or a multi-billion parameter LLM) would be prohibitively expensive.
  • Interpolation Fidelity: The authors acknowledge that the implicit assumptions of how an auto-encoder interpolates between points in its latent space are complex and not yet fully understood theoretically.

Future work will investigate ways to encode massive models efficiently and use Neuro-Visualizer to study the relationship between the sharpness of a loss landscape and a model's ability to generalize to unseen data.

Summary updated

BibTeX
@inproceedings{elhamod2024neuro,
  author = {Mohannad Elhamod and Anuj Karpatne},
  title = {{Neuro-Visualizer: A Novel Auto-Encoder-Based Loss Landscape Visualization Method With an Application in Knowledge-Guided Machine Learning}},
  booktitle = {International Conference on Machine Learning},
  year = {2024},
  url = {https://openreview.net/forum?id=XiemSZpvh0},
}
Figure