Practical Shuffle Coding

Julius Kunze, Daniel Severo, Jan-Willem van de Meent, James TownsendNeurIPS 2024

Introduction

Standard compression algorithms, like those used in ZIP files, are designed for ordered sequences such as text or video. However, much of today's "Big Data" is inherently unordered—think of a set of items in a shopping cart or the complex web of connections in a massive social network. In these structures, the specific order in which items or edges are listed is irrelevant, creating "redundant information."

This paper introduces a general method for the lossless compression of unordered data structures, including multisets and graphs. By presenting two new variants of "shuffle coding," the authors make compressing massive unordered datasets orders of magnitude faster and practical for single objects. Their approach achieves state-of-the-art compression rates on graphs with up to a billion edges at speeds of megabytes per second.

The Challenge of Unordered Data

Previous work on "shuffle coding" demonstrated that significant space could be saved by mathematically removing order redundancy. However, it suffered from two fatal flaws:

  1. The Symmetry Trap: It required calculating the exact "automorphism group"—the set of all ways a structure can be reordered without changing its fundamental properties. For large graphs, computing this exact symmetry is computationally intractable.
  2. The One-Shot Penalty: It was only efficient when compressing a long sequence of objects. Compressing just one single graph (a "one-shot" scenario) incurred a massive initial bit cost that wiped out any compression savings.
Graph symmetries and equivalence classes

A Practical Framework: Methods and Innovations

To overcome these hurdles, the authors propose a "Practical Shuffle Coding" framework built on three main innovations:

1. Incomplete Shuffle Coding

Instead of attempting to find every single symmetry in a graph, the method uses a fast approximation called color refinement (specifically, the 1-dimensional Weisfeiler-Lehman algorithm). This "incomplete" view of symmetry is significantly faster to compute and captures enough structural information to achieve near-optimal compression rates. It proves that "good enough" symmetry detection is sufficient for highly effective compression.

2. Autoregressive Shuffle Coding

To solve the one-shot problem, the authors generalize an idea from multiset compression. They encode the object by progressively "pinning" elements into an order while simultaneously decoding bits from the compressed message. This interleaving of "popping" from the unordered structure and "pushing" into an ordered sequence allows them to realize the "order discount" even for a single object.

The pin and pop process for multisets and graphs

3. Chunking for Speed

To further boost processing speed, elements are grouped into "chunks." Instead of re-running the symmetry approximation after every single element is encoded, it is only executed once per chunk. This dramatically reduces computational overhead with only a negligible trade-off in compression efficiency.

Key Results and Performance

The researchers evaluated their methods across a diverse range of data, including synthetic multisets, standard TUDatasets, SZIP real-world networks, and massive Erdos-Rényi random graphs.

  • Unprecedented Scale: The method successfully compressed a graph with one billion edges (roughly 3.4 GB uncompressed), reducing its size by 0.8 GB. This scale was previously considered impossible for shuffle coding.
  • Massive Speedups: The implementation is orders of magnitude faster than previous joint shuffle coding methods. For medium-sized graphs, speedups reached up to a factor of one million.
  • State-of-the-Art Efficiency: On the SZIP dataset, the "incomplete" method matched or outperformed specialized state-of-the-art graph compressors while remaining flexible enough to adapt to different statistical models.
  • One-Shot Success: The autoregressive variant proved that a significant "rate discount" is achievable even when compressing a single large graph, confirming that the initial bit cost can be effectively amortized.

Limitations and Future Directions

While a major leap forward, the authors note that compression rates still depend heavily on having a good "ordered" statistical model for the data. Integrating more complex generative graph models could yield even better savings. Additionally, about half the runtime is currently spent on the underlying ordered model, suggesting that techniques like vectorized Asymmetric Numeral Systems (ANS) could further optimize the implementation. Finally, optimizing chunk sizes specifically for graphs remains an open research question.

Summary updated

BibTeX
@inproceedings{kunze2024practical,
  author = {Julius Kunze and Daniel Severo and Jan-Willem van de Meent and James Townsend},
  title = {{Practical Shuffle Coding}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2024},
  url = {https://openreview.net/forum?id=m2DaXpCoIi},
}
Figure