LeCo: Lightweight Compression via Learning Serial Correlations

Yihao Liu, Xinyu Zeng, Huanchen Zhang · DOI

Abstract

LeCo is a novel framework that redefines lossless data compression as a machine learning regression task. By automatically learning serial correlations in columnar data and storing only the "model + deltas," it achieves a Pareto improvement—simultaneously outperforming state-of-the-art methods in both compression ratio and random access speed. This approach bridges the gap between simple, ad-hoc lightweight encoders and heavyweight block compression methods that often bottleneck modern analytical workloads.

Introduction

Modern analytical databases (column stores) rely on lightweight compression algorithms like Frame-of-Reference (FOR), Delta Encoding, and Run-Length Encoding (RLE) to minimize storage and maximize disk/network bandwidth. However, these traditional methods are designed for very simple patterns: RLE handles repetitions, and Delta handles basic step functions. Real-world data often contains more sophisticated serial correlations, such as piecewise linearity or complex curves, that these simple algorithms miss.

While "heavyweight" block compression (like zstd) offers high ratios, it often becomes a CPU bottleneck and lacks fast random access—a critical requirement for modern hybrid transactional/analytical processing (HTAP) workloads. LeCo aims to bridge this gap by using machine learning to extract complex patterns while remaining "lightweight" enough for high-performance query execution.

The LeCo Framework

LeCo introduces a "Model + Delta" framework. Instead of storing raw values, it fits a lightweight regression model to a sequence of values and stores the model parameters plus the prediction errors (deltas).

The LeCo system architecture, illustrating the flow from uncompressed data through the model advisor and partitioner to the final compressed format and decoder.

Key Components

  • The Regressor: Unlike standard ML that minimizes Mean Squared Error ($L_2$ norm), LeCo minimizes the maximum error ($L_\infty$ norm). This is crucial because deltas are stored in a fixed-length bit-packed array; the bit-width of the entire array is dictated by the single largest error.
  • The Partitioner: Since real-world data distributions change, LeCo partitions sequences into segments. It offers Fixed-Length Partitioning (for fastest random access) and a greedy Variable-Length "Split and Merge" algorithm (for maximum compression).
  • Hyperparameter-Advisor: An offline-trained classifier that analyzes data features (like log-scale range and subrange trends) to automatically select the best model type (e.g., linear, polynomial, or trigonometric) for a given dataset.
  • String Extension: LeCo extends to strings by mapping them to large integers using order-preserving techniques and adaptive padding to minimize deltas.

Evaluation and Key Results

The authors evaluated LeCo against a massive suite of benchmarks including synthetic distributions, real-world datasets (SOSD), and analytical workloads (TPC-H, TPC-DS).

Random Access latency vs. Compression Ratio, demonstrating LeCo's Pareto improvement over traditional methods like Delta, FOR, and Elias-Fano.

Performance Highlights

  • Pareto Improvement: As shown in the performance analysis, LeCo-fix (fixed-length) achieves better compression than FOR and Elias-Fano while maintaining comparable random access speeds.
  • Compression Ratios: On "locally easy" datasets, LeCo improved compression ratios by 40.9% on average over FOR. On specific real-world datasets like house_price, the variable-length variant achieved nearly 90% better compression than fixed-length baselines.
  • Query Speedup: When integrated into the Apache Arrow execution engine, LeCo provided up to a 5.2x speedup for analytical queries due to reduced I/O and efficient SIMD-friendly decoding.
  • System Throughput: In RocksDB, using LeCo for index block compression resulted in a 16% increase in total system throughput by fitting more index data into the block cache.

Discussion and Conclusion

LeCo demonstrates that extracting serial correlation is fundamentally a regression task. By capturing the "common pattern" in a model, the remaining "noise" (deltas) requires significantly fewer bits to represent. Furthermore, because the models are often monotonic, the decoder can use the model's prediction plus the known maximum error to "prune" entire blocks during range queries without decompressing them.

While LeCo offers superior decompression performance, it does involve a higher training overhead during the compression phase compared to simple methods like FOR. This makes it best suited for "write-once, read-many" scenarios in immutable columnar formats. Future work may explore handling frequent updates and further optimizing model selection for diverse data types.

Summary updated

BibTeX
@article{liu2024leco,
  author = {Yihao Liu and Xinyu Zeng and Huanchen Zhang},
  title = {{LeCo: Lightweight Compression via Learning Serial Correlations}},
  journal = {Proc. ACM Manag. Data},
  year = {2024},
  doi = {10.1145/3639320},
}
Figure