Compress and Compare: Interactively Evaluating Efficiency and Behavior Across ML Model Compression Experiments

Angie W. Boggust, Venkatesh Sivaraman, Yannick Assogba, Donghao Ren, Dominik Moritz, Fred HohmanIEEE TVCG 2024

TL;DR

This paper introduces "Compress and Compare," an interactive visualization system designed to help machine learning practitioners analyze and compare the results of numerous model compression experiments. It addresses the challenge of understanding trade-offs between model efficiency (size, speed) and behavior, offering a unified interface to track experiment provenance, compare model metrics, and inspect internal model differences.

What Problem Does This Paper Address?

Deploying machine learning models, especially on resource-constrained devices, necessitates model compression to reduce size and inference time. However, the process of finding the optimal compression strategy is complex and time-consuming. Practitioners often need to run many experiments, mixing and matching various techniques, and then meticulously compare the resulting models. Existing tools fall short in supporting this comparative workflow, leading to fragmented analyses across disjoint applications. A key challenge is that compression can subtly alter model behavior (e.g., introduce biases or new errors) without significantly impacting top-level metrics like accuracy, making these changes difficult to detect. Furthermore, understanding why a compression strategy failed or succeeded often requires deep dives into model internals, which is also poorly supported by current tools.

Methods

The core contribution is the Compress and Compare system, an interactive visual analytics tool. It offers two main views:

  • Compression Overview: This view uses a Model Map (a node-link diagram) to visualize the "recipe" or provenance of compressed models, showing how each model was derived from its parent through specific compression operations. Nodes represent models, and edges represent operations. Color and size of nodes encode metrics like accuracy and model size. A Model Scatterplot allows users to visualize model metrics (e.g., accuracy vs. model size) and identify Pareto frontiers. A Filter view enables users to set hard budgets for metrics and visually filter models.
  • Performance Comparison: This view allows for a more in-depth comparison of a small subset of selected models. It has two tabs:
  • Behaviors: Compares model outputs on a validation dataset, showing class-level or instance-level differences in predictions, confidence scores, or other user-defined metrics. This helps identify subtle behavioral changes and biases.
  • Layers: Exposes the internal workings of models by comparing layer-wise metrics like weight sparsity, weight distributions, and activation distributions. This is crucial for debugging compression-induced issues at a granular level.

The system uses a recursive algorithm to automatically generate meaningful comparisons in a Selection Details view, explaining model differences with a minimal set of variables representing operations and their parameters.

Datasets

The paper uses standard datasets for its case studies:

  • Stanford Question Answering dataset (SQuAD): Used for evaluating a generative language model (T5-Large) in the question-answering task.
  • CelebA: Used for evaluating image classification models (ResNet18) in the context of face attribute prediction (specifically, predicting the "blond" attribute).

No new benchmarks were introduced; instead, the system was evaluated on existing tasks and models.

Key Insights and Ideas

  • Provenance is Key: Visualizing the "recipe" of how compressed models are generated (the Model Map) is crucial for understanding the experimental space and identifying patterns in successful or failed compression strategies.
  • Behavioral Drift is Subtle but Critical: Top-level metrics often hide significant changes in model behavior, such as increased bias against underrepresented groups or the introduction of spurious correlations. Visualizing instance-level predictions and class-level errors is essential for detecting these issues.
  • Layer-Level Inspection is Necessary for Debugging: When compression breaks a model, understanding which components are affected (e.g., specific normalization layers) requires detailed inspection of internal model states, not just overall performance metrics.
  • Unified Workflow is Highly Valued: Practitioners currently juggle multiple tools for compression. A single, integrated system that supports experiment tracking, metric comparison, and behavioral analysis significantly streamlines workflows and builds intuition.
  • Intuition Drives Better Experiments: By providing visual feedback on how compression affects models at different levels, the system helps practitioners develop a deeper understanding and generate more informed hypotheses for future experiments.

Key Results

  • Case Study 1 (Generative QA): The system helped debug a generative language model where aggressive magnitude pruning broke its generative capabilities. By inspecting layer-level weight changes, the authors identified that normalization layers were disproportionately affected, leading to performance degradation. Restoring these layers recovered performance, and further analysis guided more effective compression.
  • Case Study 2 (Image Classification Bias): For image classification, the system revealed that while overall accuracy remained similar across various sparsity levels, compression disproportionately increased errors for underrepresented groups (male, non-young). It also helped identify specific images that were sensitive to compression, suggesting potential data auditing needs.
  • User Study: Eight compression experts found Compress and Compare valuable for:
  • Unifying disjoint workflows: Bringing experiment tracking, metric analysis, and behavioral inspection into one interface.
  • Building intuition: Helping them understand how compression techniques affect models and generate new hypotheses.
  • Encouraging comprehensive analysis: Facilitating the identification of subtle biases and the exploration of trade-offs. Participants were able to quickly identify "deployable" models and design new experiments.

Limitations and Future Work

  • Novice Users: The current system is primarily designed for experienced compression practitioners. Future work could involve adding features to support novice users, such as guided suggestions or graphical interfaces for running experiments.
  • Scalability: While the system supports remote computation, comparing many models simultaneously in memory can be a bottleneck for extremely large datasets or models. Future work could explore more efficient comparison techniques.
  • Integration: The system requires users to integrate it into their existing Python workflows. Developing more seamless code-level interfaces could improve adoption.
  • Generalization: The authors suggest that the visualization techniques, particularly the Model Map and the layered comparison views, could be generalized to other stages of ML development beyond compression.

Summary updated

BibTeX
@article{boggust2024compress,
  author = {Angie W. Boggust and Venkatesh Sivaraman and Yannick Assogba and Donghao Ren and Dominik Moritz and Fred Hohman},
  title = {{Compress and Compare: Interactively Evaluating Efficiency and Behavior Across ML Model Compression Experiments}},
  journal = {IEEE TVCG},
  year = {2024},
  url = {https://openreview.net/forum?id=dUHHT0UH5m},
}
Figure