TL;DR
Adaptive Context Tree Weighting (ACTW) is an evolution of the classic CTW algorithm designed to handle data that changes over time. By employing a "discounted" estimator that prioritizes recent observations, ACTW significantly improves compression performance on non-stationary data—such as merged files—without increasing computational or memory overhead.
Introduction: The Challenge of Non-Stationarity
In the field of lossless data compression, the Context Tree Weighting (CTW) algorithm is a heavyweight champion for stationary data sources where underlying patterns remain constant. It works by building a Bayesian mixture over all possible "suffix trees" (patterns of bits) up to a certain depth.
However, CTW suffers from a "long memory" problem: it treats the first bit observed and the millionth bit with equal importance. In scenarios where data types shift—for instance, a file transitioning from text to image data—the stale statistics from the initial segment "pollute" predictions for the new data. The standard Krichevsky-Trofimov (KT) estimator used in CTW is simply too slow to adapt to these "drifting" sources. ACTW addresses this by making the algorithm "forgetful" in a mathematically principled way.
Methods: The Discounted KT Estimator
The core innovation of ACTW is the Discounted KT Estimator. Instead of simply incrementing counts of zeros ($a$) and ones ($b$), the authors introduce a discount rate $\gamma$. Every time a new bit is observed, existing counts are multiplied by $(1 - \gamma)$ before the new bit is added. This creates an "effective horizon," ensuring that only recent bits significantly influence the current prediction.
Several variants of ACTW were proposed based on how $\gamma$ is calculated:
- ACTW1 (Fixed Rate): Uses a constant discount rate.
- ACTW2 & ACTW3 (Context Visit-Based): The discount rate depends on how many times a specific context (a pattern of preceding bits) has been seen. This allows rare patterns to adapt slowly while frequent patterns adapt quickly.
- ACTW4 & ACTW5 (Full/Leaf-Context): These variants propagate discount rates through the tree structure to maintain consistency.
Crucially, because these updates involve only simple multiplication, ACTW provides adaptation with zero extra cost in terms of memory or time complexity compared to standard CTW.
Experimental Evaluation
The authors evaluated ACTW against industry-standard benchmarks, including the Calgary and Canterbury corpora, and a custom "Assorted Collection" of 17 diverse file types. To simulate non-stationary challenges, they created "merged" files by concatenating different file types (e.g., an executable merged with a PDF).
Key Results and Specific Wins
ACTW consistently outperformed standard CTW on concatenated files. For example, on the merged Calgary corpus, ACTW showed a 1.3% improvement in space savings. Even more dramatic improvements were seen in structured but non-stationary files.
As shown in the experimental results, ACTW2 (Partial-context visit-based adaptation) emerged as a particularly robust variant. In the Assorted Collection, english.dic saw a compression improvement of 10.5%, while kennedy.xls in the Calgary corpus improved by over 8%.
Insights and Future Directions
A major goal was to ensure that adding adaptivity did not degrade performance on stationary files. Results showed that while ACTW might be slightly worse on some static files, the loss is usually negligible (less than 1%), adhering to a "Do No Harm" principle. The researchers found that decaying counts provides the benefits of a "moving window" approach without the associated memory overhead.
Future work may involve automating the selection of discount parameters and extending ACTW's bitwise logic to byte-oriented formats. Additionally, ACTW has already shown promise when integrated with Monte Carlo AIXI agents, suggesting its utility extends beyond compression into reinforcement learning and general artificial intelligence.
Summary updated