An Introduction to Compression-Based Machine Learning
Organizations: University of Maryland, Baltimore County · CrowdStrike · Syracuse University
Abstract
Any lossless compression algorithm (like gzip) may be converted into a machine learning method, via either Normalized Compression Distance or the Minimum Description Length principle. Any auto-regressive model may be converted into a lossless compression method via entropy coding. This seemingly circular dependence has unrealized potential in modern artificial intelligence and machine learning, and we survey and formalize the various strategies that have been used to leverage compression for machine learning. We introduce and empirically validate a design framework for compression-based ML, finding compression-based methods competitive with conventional baselines and decisively stronger on malware. We find that varying these design choices yields accuracy gains of up to 0.62.
Figures & tables
| Work | Compressor | Measure | Context Source | Context Injection Mechanism | Prediction |
|---|---|---|---|---|---|
| [ 45 ] | PPM | conditional code length | probabilistic model | model-conditioned encoding | MDL |
| [ 55 ] | domain-specific (DNA) | NCD (variant) | single sample | string concat | tree-building |
| [ 44 ] | gzip | conditional code length | aggregated class data | string concat | 1-NN, tree-building |
| [ 56 ] | PPM | conditional code length | probabilistic model | model-conditioned encoding | MDL |
| [ 7 ] | gzip, domain-specific (DNA) | NCD | single sample | string concat | tree-building |
| [ 48 ] | zip | CDM | single sample | string concat | 1-NN, clustering |
| Approach | Compressor calls | Input per call |
|---|---|---|
| NCD -NN | train test sample | |
| LZJD / BWMD | one sample | |
| Implicit-model MDL | class context test sample | |
| Explicit-model MDL | test sample only |
| Domain | Regime | method | Comp. | Base. | ms/query | |
|---|---|---|---|---|---|---|
| text | 1-shot | NCD | 0.344 | 0.314 | +0.030 | 0.96 |
| 5-shot | MDL | 0.426 | 0.436 | -0.011 | 0.08 | |
| 10-shot | MDL | 0.513 | 0.509 | +0.004 | 0.17 | |
| MDL | 0.800 | 0.816 | -0.016 | 0.23 | ||
| full | MDL | 0.906 | 0.927 | -0.021 | 1.22 | |
| malware | 1-shot | MDL | 0.396 | 0.181 | +0.215 | 17.93 |
Minimum Description Length
Minimum Description Length (MDL) selects models by minimizing the bits needed to encode both a model and the data it fails to explain.
See all 16 papers