Iterative Pruning - 1.2 English

Vitis AI Optimizer User Guide (UG1333)

Document ID
UG1333
Release Date
2020-07-07
Version
1.2 English

VAI pruner is designed to reduce the number of model parameters while minimizing the accuracy loss. This is done in an iterative process as shown in the following figure. Pruning results in accuracy loss and retraining (finetuning) recovers accuracy. Pruning followed by retraining forms one iteration. In the first iteration of pruning, the input model is the baseline model, and it will be pruned and fine-tuned. In subsequent iterations, the fine-tuned model obtained from previous iteration is used to prune again. Such process is usually repeated several times until a desired sparse model is obtained. Note that the reduction parameter is gradually increased in every iteration to help better recover accuracy during the finetuning stage. Pruning cannot be done to a smaller size at once. This is because, once too many parameters are removed from the model, the performance of the model will be reduced obviously, and it is challenging to restore model.

Important: The reduction parameter is gradually increased in every iteration, to help better recover accuracy during the finetune stage.

Following the process of iterative pruning, higher pruning rates can be achieved without significant loss of model performance.

Figure 1. Iterative Process of Pruning

Four primary tasks in VAI pruner are as follows:

  1. Analysis (ana): Perform a sensitivity analysis on the model to determine the optimal pruning strategy.
  2. Pruning (prune): Reduce the number of computations in the input model.
  3. Fine-tuning (finetune): Retrain the pruned model to recover accuracy.
  4. Transformation (transform): Generate a dense model with reduced weights.

Generally follow these steps to prune a model. The steps are also shown in Figure 4.

  1. Analyze the original baseline model.
  2. Prune the input model.
  3. Finetune the pruned model.
  4. Repeat Step 2 and 3 several times.
  5. Transform the pruned sparse model to a final dense model.
Figure 2. Pruning Workflow