Model optimization modifies a trained model to reduce inference memory, computation, or latency while preserving acceptable predictive performance. It matters especially on smartphones, embedded devices, and other constrained or low-latency targets. section 6.3.2
Use two main techniques to reduce inference cost:
- Apply weight pruning to retain the most significant coefficients, reducing parameters and computation while exposing a tunable size-versus-accuracy tradeoff. section 6.3.2
- Apply weight quantization to convert float32 weights to int8, producing an inference-only model that is four times smaller and near the original accuracy. section 6.3.2
Quantizing a Keras model
Call quantize_weights(model, "int8") before importing the model into TensorFlow.js or exporting it to TensorFlow Lite. Validate the resulting accuracy because optimization trades resource usage against predictive performance. section 6.3.2

