LLM-based Source Code Compression via Thresholded Symbol Ranking

· Source: Computation and Language · Field: Technology & Digital — Artificial Intelligence & Machine Learning, Software Development & Engineering, Mathematics & Computational Sciences · Depth: Expert, quick

Summary

A new study introduces LLM-based compressors that enhance source code compression by employing two novel symbol-ranking variants, bounding predictions to the top-$T$ ranks ($T=1$ or $63$). This approach addresses the storage demands of large-scale software archives like Software Heritage, where general-purpose compressors often fail to exploit source code's unique regularities. Unlike prior LLM-based methods that suffer throughput degradation from arbitrarily growing predicted ranks, this $T$-bounded scheme stores out-of-threshold symbols as exceptions, compressing them jointly. A large-scale evaluation across 30 LLMs, including general-domain, code-specialized, and quantized models, demonstrated significant improvements. The new method achieved up to 37% relative compression improvement and 40% faster throughput compared to previous LLM-based compressors. It also delivered up to 82% relative compression gain over general-purpose compressors like zstd and bzip2, albeit at a lower speed, establishing a new trade-off point. These gains are more pronounced on source code than natural language, highlighting LLMs' ability to capture specific source code regularities.

Key takeaway

For software archive managers or ML engineers optimizing storage for large codebases, you should evaluate LLM-based compression with $T$-bounded symbol ranking. This method offers up to 82% relative compression gain over general-purpose tools like zstd, significantly reducing storage demands. While it operates at a lower speed, its superior compression ratio, especially with code-specialized LLMs, presents a compelling new trade-off point for your data management strategies. Consider piloting this approach for critical archives.

Key insights

Bounding LLM symbol predictions to top-$T$ ranks significantly improves source code compression ratio and throughput.

Principles

Method

Deploy LLM-based compressors using top-$T$ rank bounding ($T=1$ or $63$), compressing out-of-threshold symbols as exceptions jointly.

In practice

Topics

Best for: Research Scientist, AI Engineer, AI Scientist, Machine Learning Engineer, NLP Engineer

Related on AIssential

Open in AIssential →

Editorial summary, takeaway, and curation by AIssential. Original article published by Computation and Language.