ml-compress-and-compare

Interactively Evaluating Efficiency and Behavior Across ML Model Compression Experiments (VIS 2024)

https://github.com/apple/ml-compress-and-compare

Science Score: 67.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 1 DOI reference(s) in README
  • Academic publication links
    Links to: arxiv.org
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (13.7%) to scientific vocabulary
Last synced: 6 months ago · JSON representation ·

Repository

Interactively Evaluating Efficiency and Behavior Across ML Model Compression Experiments (VIS 2024)

Basic Info
  • Host: GitHub
  • Owner: apple
  • License: other
  • Language: Python
  • Default Branch: main
  • Homepage:
  • Size: 843 KB
Statistics
  • Stars: 23
  • Watchers: 9
  • Forks: 1
  • Open Issues: 0
  • Releases: 0
Created over 1 year ago · Last pushed 8 months ago
Metadata Files
Readme Contributing License Code of conduct Citation

README.md

Compress and Compare

Compress and Compare is a tool that helps you generate, track, and inspect machine learning model compression experiments. Compress and Compare surfaces promising compression strategies by visualizing provenance relationships between compressed models and reveals compression-induced behavior changes by comparing models' predictions, weights, and activations.

screenshot of compress and compare

This code accompanies the research paper:

Compress and Compare: Interactively Evaluating Efficiency and Behavior Across ML Model Compression Experiments
Angie Boggust, Venkatesh Sivaraman, Yannick Assogba, Donghao Ren, Dominik Moritz, Fred Hohman
IEEE Transactions on Visualization and Computer Graphics (TVCG). St. Pete Beach, Florida, 2025.
Paper: https://arxiv.org/abs/2408.03274

Run Locally and Development Setup

The setup requires two components: (1) a model server and (2) a client interface. The two are run on separate servers, so the model server can run on any remote instance through SSH tunneling.

Model Server

On the machine running the model server, install PyTorch using either conda or pip. Then install the package and any remaining dependencies:

bash cd model_server pip install -e .

Then write a module that calls interactive_compression.server.start_flask_server with information about the models you want to display.

For examples of how these modules can look, please refer to the model_server/examples directory of this repository. It contains the following examples:

  • CIFAR10 image classification. Run cifar10_image_classification/cifar10_image_classification.py to start a debug-mode model server showing metadata about CIFAR10 image classification models. Due to space constraints, the models and data need to be loaded separately.
  • ImageNet image classification. The imagenet_image_classification directory contains information about models used in the Compress and Compare user study. To show models as seen by participants in each part of the study, run the imagenet_image_classification.py script with a -m parameter set to either tutorial, part1, or part2. This server runs in non-debug mode by default.
  • Training T5 on SQuAD. To create and evaluate T5-Large models on the SQuAD dataset, run python t5_squad/make_t5_models.py. With a GPU, evaluation takes about 18 minutes per model. You can then show these models by running the run_server_t5.py script. This server runs in non-debug mode by default.
  • CelebA blonde classification. Run celeba_blonde_classification/celeba_blonde_classification.py to start a non-debug-mode model server showing metadata about CelebA blonde classification models. The models and data need to be loaded separately.

Any of the above servers can be changed to run in debug or non-debug mode (debug mode includes auto-reload and only allows traffic on localhost, while non-debug mode utilizes eventlet and can receive traffic from anywhere) by changing the debug parameter on the start_flask_server call.

Client Interface

To start the client interface, first install dependencies:

bash cd comparison_interface npm install

Then run the client hot-reload server:

bash npm run dev

The dashboard should now be visible at localhost:5173.

By default the client connects to a model server located at http://localhost:5001. You can also connect the client to a different URL, such as a remote host, by clicking the Connect to Model... button in the top right of the web interface. Make sure that if running a model server remotely using Flask, you open your instance to incoming traffic by setting the debug parameter to False in your call to start_flask_server, and enable traffic on the selected port using something like sudo ufw allow <PORT> on your instance.

Contributing

When making contributions, refer to the CONTRIBUTING guidelines and read the CODE OF CONDUCT.

BibTeX

To cite our paper, please use:

bibtex @article{boggust2025compress, title={{Compress and Compare:} Interactively Evaluating Efficiency and Behavior Across ML Model Compression Experiments}, author={Boggust, Angie and Sivaraman, Venkatesh and Assogba, Yannick and Ren, Donghao and Moritz, Dominik and Hohman, Fred}, journal={IEEE Transactions on Visualization and Computer Graphics}, year={2025}, publisher={IEEE}, doi={10.1109/TVCG.2024.3456371} }

License

This code is released under the LICENSE terms.

Owner

  • Name: Apple
  • Login: apple
  • Kind: organization
  • Location: Cupertino, CA

Citation (CITATION.cff)

citation-file-format: 1.2.0
creator:
  - family-names: Boggust
    given-names: Angie
  - family-names: Sivaraman
    given-names: Venkatesh
  - family-names: Assogba
    given-names: Yannick
  - family-names: Ren
    given-names: Donghao
  - family-names: Moritz
    given-names: Dominik
  - family-names: Hohman
    given-names: Fred
title: Compress and Compare
version: 1.0.0
url: https://github.com/apple/ml-compress-and-compare
preferred-citation:
  type: article
  authors:
    - family-names: Boggust
      given-names: Angie
    - family-names: Sivaraman 
      given-names: Venkatesh
    - family-names: Assogba
      given-names: Yannick
    - family-names: Ren
      given-names: Donghao
    - family-names: Moritz
      given-names: Dominik
    - family-names: Hohman
      given-names: Fred
  title: "Compress and Compare: Interactively Evaluating Efficiency and Behavior Across ML Model Compression Experiments"
  year: 2024
  journal: IEEE Transactions on Visualization and Computer Graphics

GitHub Events

Total
  • Watch event: 8
  • Delete event: 1
  • Issue comment event: 1
  • Pull request event: 1
  • Fork event: 1
  • Create event: 1
Last Year
  • Watch event: 8
  • Delete event: 1
  • Issue comment event: 1
  • Pull request event: 1
  • Fork event: 1
  • Create event: 1

Issues and Pull Requests

Last synced: about 1 year ago

All Time
  • Total issues: 0
  • Total pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Total issue authors: 0
  • Total pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels

Dependencies

comparison_interface/package-lock.json npm
  • 348 dependencies
comparison_interface/package.json npm
  • @sveltejs/adapter-auto ^2.0.0 development
  • @sveltejs/adapter-static ^2.0.3 development
  • @sveltejs/kit ^1.20.4 development
  • @types/d3 ^7.4.0 development
  • @types/pako ^2.0.0 development
  • autoprefixer ^10.4.14 development
  • gh-pages ^6.0.0 development
  • postcss ^8.4.27 development
  • svelte ^4.0.5 development
  • svelte-check ^3.4.3 development
  • tailwindcss ^3.3.3 development
  • tslib ^2.4.1 development
  • typescript ^5.0.0 development
  • vite ^4.4.2 development
  • apache-arrow ^12.0.1
  • d3 ^7.8.5
  • layercake ^7.6.1
  • pako ^2.1.0
  • regl ^2.1.0
  • socket.io-client ^4.7.1
model_server/pyproject.toml pypi
  • eventlet *
  • flask >= 2.0.0
  • flask-apscheduler *
  • flask-cors *
  • flask-socketio *
  • h5py *
  • pyarrow *
  • torch >= 1.11
  • tqdm *
  • traitlets *