Nacrith: Neural Lossless Compression via Ensemble Context Modeling and High-Precision CDF Coding
Nacrith 是一种结合了大型语言模型和轻量级在线预测器的无损压缩系统,通过高精度CDF编码实现了自然语言文本的优异压缩效果。
更新于 2026-03-09。作者:Roberto Tacconelli。
中文摘要
我们推出了Nacrith,这是一种无损压缩系统,它将一个135M参数的Transformer语言模型(SmolLM2-135M)与一系列轻量级在线预测器和32位算术编码器相结合。在基础LLM加算术编码范式之外,Nacrith引入了以下贡献:(1)将CDF精度从2^16提升到2^24,消除了由大词汇表中的最小概率地板引起的约75%的量化开销;(2)一个用于快速局部预测的token级N-gram模型;(3)通过在线梯度下降纠正每个文档LLM错误的自适应对数空间偏置头;(4)基于置信度的LLM跳过,以加速高度可预测的token;(5)一种混合二进制格式(NC06),将神经网络压缩扩展到任意二进制文件——据我们所知,这是基于LLM的压缩器中的首次;(6)一个llama.cpp推理后端,比PyTorch快约7倍的单一token解码;(7)最多8个工作者的并行多GPU压缩;(8)原生KV缓存滑动窗口,通过约37倍减少每页的成本。该系统每个工作器仅需约500 MB的GGUF权重和约1.2 GB的VRAM,在消费级GPU上运行。 在alice29.txt(坎特伯雷语料库,152 KB)上,Nacrith实现了每字节0.918比特(bpb)的压缩率——比gzip快3.1倍,比bzip2快2.5倍,比CMIX v21快44%,比ts_zip快20%,同时压缩率低于0阶、1阶和2阶字节级香农熵界限。在enwik8(100 MB)上,Nacrith实现了0.9389 bpb(11.74%)的压缩率,尽管使用了60倍更小的模型且没有微调,仍比ts_zip(约1.11 bpb)快15%,比FineZip(1.024 bpb)快8%。在模型训练截止日期之后发布的一篇文档上进行的分布外评估确认,这些增益不是记忆化伪影,在未见过的文本上实现了0.723 bpb。
英文摘要
We present Nacrith, a lossless compression system that combines a 135M-parameter transformer language model (SmolLM2-135M) with an ensemble of lightweight online predictors and a 32-bit arithmetic coder. Beyond the base LLM-plus-arithmetic-coding paradigm, Nacrith introduces several contributions: (1) a CDF precision upgrade from 2^16 to 2^24 that eliminates ~75% of quantization overhead caused by minimum-probability floors in large vocabularies; (2) a token-level N-gram model for fast local predictions; (3) an adaptive log-space bias head correcting per-document LLM errors via online gradient descent; (4) confidence-based LLM skip for accelerating highly predictable tokens; (5) a hybrid binary format (NC06) extending neural compression to arbitrary binary files--to our knowledge a first among LLM-based compressors; (6) a llama.cpp inference backend achieving ~7x faster single-token decode than PyTorch; (7) parallel multi-GPU compression across up to 8 workers; and (8) native KV cache sliding window reducing per-slide cost by ~37x. The system requires only ~500 MB of GGUF weights and ~1.2 GB VRAM per worker, running on consumer GPUs. On alice29.txt (Canterbury Corpus, 152 KB), Nacrith achieves 0.918 bits per byte (bpb)--outperforming gzip by 3.1x, bzip2 by 2.5x, CMIX v21 by 44%, and ts_zip by 20%, while compressing below the 0th-, 1st-, and 2nd-order byte-level Shannon entropy bounds. On enwik8 (100 MB), Nacrith achieves 0.9389 bpb (11.74%), surpassing ts_zip (~1.11 bpb) by 15% and FineZip (1.024 bpb) by 8% despite using a 60x smaller model with no fine-tuning. An out-of-distribution evaluation on a document published after the model's training cutoff confirms these gains are not memorization artifacts, achieving 0.723 bpb on unseen text.
解读
一句话总结
Nacrith 是一种结合了大型语言模型和轻量级在线预测器的无损压缩系统,通过高精度CDF编码实现了自然语言文本的优异压缩效果。
问题1:这篇论文想要解决什么具体问题?
- 问题背景:传统的无损压缩方法在处理自然语言文本时,压缩效率有限,且存在一些瓶颈,如CDF精度和模型复杂度等。
- 现有方案不足:现有无损压缩方法在压缩比和压缩速度上存在不足,且在处理大型语言模型时,存在量化精度和模型复杂度等问题。
- 研究目标:提出Nacrith系统,通过结合大型语言模型和轻量级在线预测器,实现自然语言文本的高效无损压缩。
问题2:论文的核心创新点是什么?
- 技术创新:提出CDF精度升级(CDF-24),消除量化溢出,提高压缩比;引入自适应上下文混合器,结合LLM和N-gram预测,实现快速局部预测。
- 方法改进:引入自适应对数空间偏差头,纠正LLM预测错误;基于置信度的LLM跳过,加速压缩;采用混合二进制格式(NC06),扩展神经压缩到任意二进制文件。
- 优势:压缩比和压缩速度均优于现有方法,且对硬件要求较低。
问题3:实验结果如何验证了方法的有效性?
- 关键实验:在alice29.txt和enwik8基准测试中,Nacrith的压缩比和压缩速度均优于gzip、bzip2、CMIX和ts_zip等现有方法。
- 性能提升:在alice29.txt上,Nacrith的压缩比达到11.5%,优于gzip、bzip2、CMIX和ts_zip等现有方法;在enwik8上,Nacrith的压缩比达到11.74%,优于FineZip和ts_zip等现有方法。
- 对比结果:与基线方法的对比结果表明,Nacrith在压缩比和压缩速度上均有显著提升。
问题4:这个研究的实际应用价值是什么?
- 应用场景:Nacrith可用于自然语言文本的无损压缩,如文本存储、传输和归档等。
- 实施建议:在实际应用中,应根据具体需求和硬件条件选择合适的模型和参数。
- 局限与展望:Nacrith在压缩速度和模型复杂度上仍有待提高,未来可考虑采用更高效的模型和压缩算法。