Compressed-Language Models for Understanding Compressed File Formats: a JPEG Exploration
Juan C. Pérez, Alejandro Pardo, Mattia Soldan, Hani Itani, Juan Leon-Alcazar, Bernard Ghanem
TL;DR
This work explores whether Compressed-Language Models can understand data encoded by Compressed File Formats by training a decoder-only Transformer directly on raw JPEG byte streams. The authors introduce a framework to pre-train CLMs on CFF-encoded files and evaluate them on three tasks: recognizing inherent file properties, handling anomalous files, and generating new JPEGs. Empirical results on MNIST and CIFAR-10 show high JPEG-quality recognition, strong anomaly detection and correction performance, and generation of largely valid JPEGs with correct quality, all without decompression. The findings suggest potential for efficient, compression-native AI systems that operate on raw compressed data, enabling ubiquity-aware and segment-level processing of digital media.
Abstract
This study investigates whether Compressed-Language Models (CLMs), i.e. language models operating on raw byte streams from Compressed File Formats~(CFFs), can understand files compressed by CFFs. We focus on the JPEG format as a representative CFF, given its commonality and its representativeness of key concepts in compression, such as entropy coding and run-length encoding. We test if CLMs understand the JPEG format by probing their capabilities to perform along three axes: recognition of inherent file properties, handling of files with anomalies, and generation of new files. Our findings demonstrate that CLMs can effectively perform these tasks. These results suggest that CLMs can understand the semantics of compressed data when directly operating on the byte streams of files produced by CFFs. The possibility to directly operate on raw compressed files offers the promise to leverage some of their remarkable characteristics, such as their ubiquity, compactness, multi-modality and segment-nature.
