Product Documentation

Purpose of moco

moco takes machine learning models (or any "learned" function) and optimizes them for computational efficiency. moco consists of a suite of algorithms that optimize models for computational efficiency with no accuracy loss.

moco analyzes data to find early-exit strategies to exploit:

moco analyzes the internal parameters (weights and biases) to find equivalent loss-less representations for models.

moco also analyzes the interaction of the parameters with the data/activations to find equivalent loss-less representations to represent models.

Form Factor

moco is a pip-installable Python package that offers:

API Methods

Pruning

Notes:

  1. model is uploaded as a .joblib file.
  2. model.activation must be "relu".
  3. condense_neurons returns two models whose summed output matches the original model.
  4. prune_neurons returns one model whose output matches the original model.

Early-Exiting

Note that early-exiting involves an analysis step to do this step intentionally. Training a probe classifier on **any** given layer will have low probability of success.

class RoutedModel:
    base: torch.nn.Module
    conditional: torch.nn.Module
    router: torch.nn.Module
    yes_path: torch.nn.Module
    no_path: torch.nn.Module

Notes:

  1. In many cases, yes_path is a simple constant function.
Utility
Compatibility