Online Minimum Description Length Passive-Aggressive Algorithms

John Hurwitz, Charles K. Nicholas, Edward RaffNeurIPS 2026

TL;DR

To compress data well, a program must discover its underlying patterns—which is the exact same thing a machine learning classifier needs to do. This paper introduces MDL-PA, an algorithm that turns off-the-shelf lossless compressors (like zstd or zip) into fast, online classifiers that learn from streaming raw bytes on the fly. No feature engineering, no neural networks, and no GPUs required—just information theory doing heavy lifting on a standard CPU.

What Problem Does This Paper Address?

Information theory tells us that compression and prediction are two sides of the same coin. Under the Minimum Description Length (MDL) principle, the best model for a dataset is the one that compresses it to the shortest length. Historically, researchers have used this for classification: build a separate compression model for each category (say, spam vs. ham), compress a new file with both, and pick the category that squeezes the file down the smallest.

While compression-based learning shines because it works directly on raw sequences without hand-crafted features, it has largely been stuck in the offline world, often dumping all available training data into a static model or computing pairwise distances across an entire dataset. Meanwhile, compression algorithms like Lempel-Ziv naturally work online, scanning bytes sequentially and updating an internal dictionary as they go. The authors ask a natural question: can we formalize lossless compression-based classification as a principled, margin-based online learning problem?

Methods

The authors bridge classical online learning with information theory by reinventing Passive-Aggressive (PA) algorithms. Standard PA learners maintain a weight vector in Euclidean space: when a new sample arrives, if the model classifies it correctly with a comfortable safety margin, it stays passive (does nothing). If it makes a mistake or cuts the margin too close, it aggressively updates its weights to the closest vector that satisfies the margin.

MDL-PA translates this from Euclidean weight space into probability distribution space over data:

  • Code-Length Margin: Because Shannon’s source coding links probability $p$ to ideal code length $-\log p$, comparing class probabilities is equivalent to comparing compressed file sizes. The margin is simply how many fewer nats (or bytes) the true-class compressor uses compared to the runner-up.
  • Information Projection: Instead of minimizing Euclidean distance during an update, MDL-PA minimizes Kullback-Leibler (KL) divergence. In theory, it boosts the probability of the misclassified sample just enough to clear the margin and proportionally renormalizes everything else.
  • Practical Dictionary Surrogate: Maintaining explicit probabilities over every possible file is impossible. To make this real, the authors instantiate each class model as a raw compression dictionary using zstandard (zstd). When a streaming sample violates the byte-length margin, the algorithm simply appends that sample's raw bytes onto the true class's dictionary. Future samples from that class sharing byte patterns will now find matches in the lookback window and compress much smaller.

Datasets

The authors evaluate MDL-PA on four existing multiclass benchmarks (no new benchmarks are introduced):

  • AG News: 120,000 training and 7,600 test text articles across 4 classes (mean size: 193 B).
  • 20 Newsgroups: 11,314 training and 7,532 test posts across 20 classes (mean size: 1.9 KB).
  • Drebin TAR & APK: ~4,190 training and ~466 test Android malware binaries across 20 malware families, tested both as compressed packages (APK, ~1.30 MB) and uncompressed archives (TAR, ~1.77 MB).

Key Insights and Ideas

  • Distributions over Data, Not Parameters: Previous probabilistic PA methods (like Confidence-Weighted learning) put distributions over model weights to track uncertainty. MDL-PA flips this, updating distributions over the inputs themselves via class-conditional compressors.
  • Selective Memory Boosts Signal-to-Noise: Traditional MDL classifiers concatenate all training data into a class compressor. By staying passive on easy examples and only appending margin-violating samples, MDL-PA ignores redundant patterns, keeping dictionaries smaller and cleaner.
  • Dictionary Size as Model Complexity: Larger margin thresholds force more frequent updates, growing the dictionary. This acts just like model capacity in standard ML—trading memory footprint for lower error rates.
  • Domain Structure Dictates Margin Utility: Large margins dramatically help short text classification, where subtle vocabulary overlaps require a wider safety buffer. For megabyte-scale malware binaries, however, a zero-margin (mistake-only) rule works best; the byte structures of malware families are already separable enough without extra updates.
Figure 1: Running prequential error trajectories (number of mistakes so far, Mt, divided by the current round t) across code-length margin values ρ on text and malware classification tasks. For text, increasing code-length margins substantially improves prequential error rate. For malware (Drebin), the choice of code-length margin has minimal effect.

Key Results

Running purely on a MacBook Pro M1 Max CPU (taking 30 seconds on 20 Newsgroups and 15 minutes on AG News), MDL-PA outperforms offline compression-similarity nearest-neighbor baselines (gzip + $k$NN and LZJD + $k$NN) across every dataset:

  • AG News: Tuning the margin from $\rho=0$ to $128$ bytes drops held-out test error from $18.61\%$ to $12.04\%$, beating gzip + $k$NN ($14.17\%$) and LZJD ($71.54\%$).
  • 20 Newsgroups: Margin tuning ($\rho=128$) cuts test error from $29.35\%$ down to $22.84\%$, far ahead of gzip + $k$NN ($39.47\%$). Results were highly stable across 10 random stream orderings ($\pm 0.29\%$).
  • Malware (Drebin): Mistake-only updates ($\rho=0$) achieve $3.10\%$ balanced test error on Drebin TAR and $10.47\%$ on Drebin APK, beating LZJD ($12.86\%$ and $12.11\%$).

Limitations and Future Work

The primary limitation acknowledged by the authors is a gap between theory and practice: their mathematical proofs—which establish cumulative model-movement bounds and a finite mistake bound—apply strictly to the exact probability distribution updates. Because practical Lempel-Ziv dictionaries are heuristic approximations of true probability distributions, these theoretical guarantees do not automatically extend to the zstd implementation. Furthermore, the theoretical mistake bound relies on a strict positive-slack assumption over complete inputs, which may be loose in practice. Future directions are not explicitly discussed in the paper.

Summary updated

Abstract

We present an algorithm for margin-based online learning using lossless compressors (like zip) via the Minimum Description Length Principle. The technique, we call \emph{MDL-PA}, can be viewed as an analogue of Passive-Aggressive algorithms for probability distributions (equivalently viewed as lossless compression schemes) where we consider a \emph{code length margin}. Separate models are maintained per class, and the update rule is an information projection correcting the true-class model's prediction on a margin-violating sample. To bridge theory and practice, we demonstrate a practical approximation to this online learning setup via adaptive Lempel-Ziv-style compression dictionaries to classify sequences in the text and malware domains.
BibTeX
@inproceedings{hurwitz2026online,
  author = {John Hurwitz and Charles K. Nicholas and Edward Raff},
  title = {{Online Minimum Description Length Passive-Aggressive Algorithms}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=77tofmsGFn},
}
Figure