DualComp: End-to-End Learning of a Unified Dual-Modality Lossless Compressor
Yan Zhao, Zhengxue Cheng, Junxuan Zhang, Qunshan Gu, Qi Wang, Li Song · 2025
Read DualComp: End-to-End Learning of a Unified Dual-Modality Lossless Compressor by Yan Zhao, Zhengxue Cheng, Junxuan Zhang, Qunshan Gu, Qi Wang, Li Song (2025) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2505-16256.txt.
Introduction
Yan Zhao and five co-authors build in 2025 DualComp, one compact neural compressor that shrinks both images and text without loss. Most learned compressors handle a single data type, so mixed collections need a shelf of models. Giant multimodal models could unify the job but are too heavy for daily use.
DualComp shares one light backbone across both types. Shared token handling, context learning that switches by data type, and routed expert blocks adapt it to each input. A retraining trick squeezes out extra compression. It runs near real time on a desktop CPU and matches far larger language-model compressors on both text and image sets. Unified, light compression could simplify archiving and transmission.
Catalog record
| CREATOR | Yan Zhao, Zhengxue Cheng, Junxuan Zhang, Qunshan Gu, Qi Wang, Li Song |
|---|---|
| YEAR | 2025 |
| COLLECTION | PAPERS |
| FORMAT | TXT |
| FILE SIZE | 53 KB |
| VERSION | 1.0 |
| LICENSE | http://creativecommons.org/licenses/by/4.0/ |
| RIGHTS | CC BY |
| SOURCE | arXiv |
Source: https://arxiv.org/abs/2505-16256
Browse the full library · About the Tower of Babel
Full text
The opening of the work, from the library's hosted text:
DualComp: End-to-End Learning of a Unified Dual-Modality Lossless Compressor Yan Zhao, Zhengxue Cheng, Junxuan Zhang, Qunshan Gu, Qi Wang, Li Song Abstract Most learning-based lossless compressors are designed for a single modality, requiring separate models for multi-modal data and lacking flexibility. However, different modalities vary significantly in format and statistical properties, making it ineffective to use compressors that lack modality-specific adaptations. While multi-modal large language models (MLLMs) offer a potential solution for modality-unified compression, their excessive complexity hinders practical deployment. To address these challenges, we focus on the two most common modalities, image and text, and propose DualComp , the first unified and lightweight learning-based dual-modality lossless compressor . Built on a lightweight backbone, DualComp incorporates three key structural enhancements to handle modality heterogeneity: modality-unified tokenization, modality-switching contextual learning, and modality-routing mixture-of-experts. A reparameterization training strategy is also used to boost compression performance. DualComp integrates both modality-specific and shared parameters for efficient parameter utilization, enabling near real-time inference ( 200 200 KB/s) on desktop CPUs. With much fewer parameters, DualComp achieves compression performance on par with the SOTA LLM-based methods for both text and image datasets. Its simplified single-modality variant surpasses the previous best image compressor on the Kodak dataset by about 9 % 9\% using just 1.2% of the model size. 1 Introduction Information theory [ 1 ] proves that the minimum number of bits needed to represent data is determined by its -\log{2} probability [ 2 ] . This forms the basis for combining probabilistic modeling with entropy coding [ 3 , 4 , 5 ] to achieve lossless compression. Leveraging their contextual predictive strengths, neural networks, especially large language models (LLMs), have recently been combined with entropy coding to improve compression performance [ 6 , 7 , 8 , 9 , 10 , 11 , 12 , 10 ] . Though notable progress has been made, some key limitations still remain. First , these methods typically use models with billions of parameters, far exceeding the size of the data being compressed. As encoding and decoding speed roughly equals the prediction model’s inference speed, this complexity becomes a major bottleneck. For instance, Du et al. [13] and Chen et al. [9] use fine-tuned LLaMA-8B models [ 14 ] for lossless image compression, requiring over 30 minutes to decode a single 1080p image. Bellard [15] and Knoll [16] leverage Transformers [ 17 ] and LSTMs [ 18 ] for text compression, requiring 2.8 and 7.2 days, respectively, to decode just 1GB of text. Second , most approaches support only a single modality, requiring separate compressors for image and text in multi-modal scenarios, which increases the system complexity and deployment costs. Though Deletang et al. [6] explores multi-modal compression, it neglects modality-specific characteristics by uniformly encoding all data as ASCII text, resulting in relatively poor performance on non-text modalities. In fact, different modalities exhibit distinct characteristics. Text naturally has a 1D sequential structure with intra- and inter-sentence semantic dependencies, while images are two-dimensional with strong spatial and inter-channel correlations. Ignoring these structural differences and simply feeding both modalities into an unadapted model would result in quite poor compression performance. Figure 1: Left: Most existing lossless compressors support only a single modality, whereas DualComp enables dual-modality compression in one model. Right: Lossless compression performance (bits/Byte) on image (Kodak) and text (enwik9) datasets. DualComp matches or surpasses SOTA methods with fewer parameters on both image and text. To address these challenges, we propose DualComp, the first unified and lightweight dual-modality lossless compressor for both image and text. We select the latest RWKV-7 [ 19 ] as our lightweight backbone and introduce three key enhancements for efficient dual-modality compression. First , we adopt a shared vocabulary to achieve modality-unified tokenization for both image and text. Second , considering the distinct contextual patterns of image and text, we separate their core contextual learning procedure with a modality-switching mechanism. Third , we replace the model’s final multilayer perceptron (MLP) [ 20 ] with a modality-routing mixture-of-experts (MoE) architecture [ 21 ] to boost dual-modality representation. Besides , inspired by [ 10 ] , we apply a reparameterization training strategy to improve compression performance without increasing inference complexity. DualComp integrates both modality-specific and shared parameters, enabling efficient dual-modality lossless compression with fewer parameters than using separate single-modality models. It achieves a 57% higher compression efficiency than gzip [ 22 ] for text compression and outperforms PNG [ 23 ] by 70% for image compression. It matches the SOTA methods with quite fewer parameters and supports near real-time inference on desktop CPUs. Its single-modality variant surpasses previous best image compressors by 9% with 1.2% of the model size. Our contributions can be concluded as: • We propose DualComp, a unified and lightweight dual-modality lossless compressor for both image and text data. To our best knowledge, it is the first learning compressor to explicitly address modality heterogeneity and enable efficient dual-modality compression within a single framework. It provides useful insights for the emerging multi-modal applications. • Built on a lightweight backbone, DualComp integrates three key enhancements for efficient dual-modality compression: modality-unified tokenization, modality-switching contextual learning, and modality-routing mixture-of-experts. A reparameterization training strategy is also utilized to boost compression performance without increasing complexity. • DualComp matches or surpasses other SOTA compressors on both image and text datasets. It compresses the Kodak dataset up to 2.57 bits/Byte, outperforming the previous best method by about 9% with only 1.2% of the model size. Due to the parameter-efficient designs, it supports near real-time inference ( 200 KB/s) on desktop CPUs. 2 Related Work Classical Lossless Compressors. Figure 2: DualComp tokenizes text and image inputs with a unified vocabulary, then encodes them into a compressed bitstream via context probabilities and arithmetic coding. Built on a lightweight backbone, it further incorporates modality-switching context learning and a modality-routing mixture-of-experts for efficient dual-modality compression. Classical lossless compression methods fall into two main categories: (1) general-purpose compressors such as gzip [ 22 ] , bzip2 [ 24 ] , and zstd [ 25 ] , and (2) modality-specific compressors tailored to particular data types. Gzip combines LZ77 [ 26 ] with Huffman coding [ 4 ] , while bzip2 improves compression using the Burrows-Wheeler transform [ 27 ] , move-to-front encoding [ 28 ] , and Huffman coding. Zstd enhances efficiency by combining fast LZ77-style matching with finite-state entropy coding [ 29 ] . General-purpose compressors are commonly used for text, while image compression relies on specialized methods that exploit spatial redundancy. Examples include PNG [ 23 ] , WebP [ 30 ] , FLIF [ 31 ] , JPEG-XL [ 32 ] , JPEG-2000 [ 33 ] , and BPG [ 34 ] , which apply techniques like predictive coding, filtering, and transform-based compression. FLIF uses MANIAC entropy coding to adaptively model data distributions, PNG employs filtering and Deflate, and BPG leverages advanced intra-frame coding and CABAC [ 35 ] for higher efficiency. Learning-based Lossless Compressors. Learning-based compressors combine neural predictive modeling with entropy coding to outperform classical methods. However, due to the distribution sensitivity of neural models and distinct characteristics of different modalities, most learning-based compressors are designed for a single modality (image [ 13 , 9 , 12 , 36 , 37 , 38