LLMComp: A Language Modeling Paradigm for Error-Bounded Scientific Data Compression

Guozhong Li, Muhannad Alhumaidi, Spiros Skiadopoulos, Panos Kalnis · DOI

Abstract

Scientific simulations generate massive datasets that require efficient, error-bounded compression. Traditional methods often fail to capture complex, non-linear dependencies. We present LLMComp, a framework that reformulates multidimensional scientific data compression as a next-token prediction task using decoder-only transformers. By employing spatial linearization, structure-aware training, and a top-$k$ prediction strategy, LLMComp achieves up to 30% better compression ratios than state-of-the-art compressors while maintaining strict point-wise error bounds.

Introduction

Modern scientific research is increasingly data-intensive. Simulations of atmospheric dynamics or turbulent fluids generate terabytes of spatiotemporal data. To manage this, researchers rely on error-bounded lossy compression, which guarantees that reconstructed data points do not deviate from original values beyond a specified threshold. Traditional compressors like SZ or ZFP utilize local mathematical predictors. However, these often fail to capture the long-range dependencies inherent in complex physical systems. LLMComp addresses this by applying the predictive power of Large Language Models (LLMs) to numerical data sequences.

The LLMComp Framework

LLMComp reformulates compression as a sequence modeling task. The process involves several key stages:

  1. Tokenization and Linearization: Continuous physical values are quantized into discrete tokens using the Lloyd-Max algorithm. To preserve spatial locality in a 1D sequence, the framework employs Z-order curves (Morton order) rather than standard row-major scanning.
  2. Structure-Aware Training: A decoder-only transformer is trained on these sequences. To provide context, each token is augmented with its $(x, y, t)$ coordinates.
  3. Target-Aware Sampling: To handle skewed data distributions common in scientific datasets, a weighted sampling strategy ensures the model learns rare but critical patterns.
  4. Top-k Compression: The model predicts the most likely next tokens. If the true value is within the top-$k$ predictions, only the rank is stored. Otherwise, the true value is stored as a fallback, ensuring 100% fidelity within the quantization bound.
The LLMComp pipeline: from raw scientific data to tokenization, weighted sampling, and LLM-based compression.

Evaluation and Results

The framework was evaluated using the ERA5 global climate dataset and the Redsea high-resolution reanalysis dataset. These datasets represent typical high-dimensional scientific data with complex temporal evolution.

Visualization of scientific data used for evaluation, showing temperature fields at a single timestep and across a 500-timestep sequence.

LLMComp consistently outperformed baselines such as SZ3.1 and ZFP, achieving 20-30% higher compression ratios. On the ERA5 temperature variable, it reached a Peak Signal-to-Noise Ratio (PSNR) exceeding 104 dB.

A significant finding was the "Goldilocks" effect regarding model size: a 345M parameter "Base" model outperformed a 1.5B parameter "XL" model. The larger model appeared to overfit on frequent patterns, reducing its generalizability to rare data transitions. Additionally, the use of Z-order curves proved critical; preserving spatial neighborhoods significantly enhanced the transformer's predictive accuracy.

Conclusion

LLMComp demonstrates that the "grammar" of physical sciences can be effectively modeled by transformers. While the computational overhead of autoregressive inference is higher than traditional methods, the gains in compression efficiency are substantial. Future research will focus on optimizing inference speed through lightweight architectures and refining training via curriculum learning.

Summary updated

BibTeX
@misc{li2025llmcomp,
  author = {Guozhong Li and Muhannad Alhumaidi and Spiros Skiadopoulos and Panos Kalnis},
  title = {{LLMComp: A Language Modeling Paradigm for Error-Bounded Scientific Data Compression}},
  year = {2025},
  eprint = {2510.23632},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2510.23632},
}
Figure