LCT: Losslessly Compressed Tensors with GPU friendly execution for Training
Organizations: University of Cambridge · University of Oxford
Abstract
Lossless tensor compression could reduce memory usage during training, but training requires tensors to be repeatedly re-encoded. We introduce Losslessly Compressed Tensors (LCT), a GPU execution framework designed for this repeated encode-decode regime. LCT exploits the natural redundancy in floating point data to reduce storage for weights, activations and optimizer states. Highly optimized GPU kernels implement Huffman coding with precomputed codebooks for low compression and decompression overhead, essential for training. Our analysis characterizes LCT's storage costs and adaptation to magnitude shifts. LCT achieves a compression ratio of up to , and is demonstrated in training and finetuning settings. On a 162M-parameter NanoGPT, LCT reduces memory usage by for a step-time increase. In Qwen3-4B fine-tuning, LCT saves up to of peak memory, enabling a larger context length in training on the same GPU.
Figures & tables
| Tensor | Encodes | Dense decodes | Fused decodes | Uses and lifetime |
|---|---|---|---|---|
| Weights | 1 | 2 | 1 | Forward and backward computation; fused . Persist across steps. |
| Biases | 0 | 0 | 0 | Kept dense because they are small; updated with dense operations. |
| Momentum | 1 | 0 | 2 | Fused , then fused . Persists across steps. |
| Activations | 1 | 1 | 0 | Activations are encoded in forward and decoded for gradient computation in backward. |
| G | L | PL | ||
|---|---|---|---|---|
| Gaussian | ||||
| Laplace | ||||
| Power-law | ||||
| Gamma |
| Average bits per exponent | Compression ratio ( ) | |||||
|---|---|---|---|---|---|---|
| Codec | Attention | MLP | Mamba projection | Attention | MLP | Mamba projection |
| Power-Law | 3.1250 | 3.4041 | 3.1304 | 1.4382 | 1.4030 | 1.4375 |
| Gaussian | 3.4984 | 4.1793 | 3.8003 | 1.3915 | 1.3137 | 1.3559 |
| Laplace | 3.1250 | 3.4025 | 3.1312 | 1.4382 | 1.4032 | 1.4374 |
| Gamma | 3.2668 | 3.4416 | 3.1312 | 1.4201 | 1.3984 | 1.4374 |
| Method | Encode / ms | Decode / ms | Compression ratio |
|---|---|---|---|
| nvCOMP LZ4 | |||
| nvCOMP Bitcomp | |||
| nvCOMP ANS | |||
| DFloat11 | |||
| ZipNN | |||
| SplitZip |
| Operation | Output | LCT / ms | Naive / ms | Dense / ms | Speedup |
|---|---|---|---|---|---|
| Dense | |||||
| Dense | |||||
| Dense | |||||
| Dense | |||||
| Compressed | |||||
| Compressed |
| Compressed components | Time / s | Peak memory / MiB | Effective compression ratio |
|---|---|---|---|
| None | 8.411 | 16058.0 | |
| Activations | 9.013 | 12103.0 | |
| + Weights | 9.131 | 12013.8 | |
| + Momentum Buffers | 9.136 | 11964.6 |
| Baseline | LCT | |||
|---|---|---|---|---|
| Sequence length | Memory / MiB | Time / s | Memory / MiB | Time / s |
| 500 | 19439.2 | 3.759 | 15141.8 | 4.058 |
| 1000 | 21327.8 | 4.006 | 16262.4 | 4.273 |
| 1500 | — | — | 17370.1 | 4.523 |
| 2500 | — | — | 19617.6 | 5.055 |
| 3500 | — | — | 21842.1 | 5.607 |
Appendix figures & tables10 assets
Supplementary material from the paper’s appendix.
Appendix
| NVIDIA V100 (1 GiB) | NVIDIA A40 (1 GiB) | NVIDIA H100 (4 GiB) | ||||
|---|---|---|---|---|---|---|
| Method | Encode / ms | Decode / ms | Encode / ms | Decode / ms | Encode / ms | Decode / ms |
| nvCOMP LZ4 | — | — | ||||
| nvCOMP Bitcomp | — | — | ||||
| nvCOMP ANS | — | — | ||||
| DFloat11 | ||||||
| ZipNN | ||||||
| Activation | Count | Shape | Each / MiB | Total / MiB | Budget |
|---|---|---|---|---|---|
| Embedding output before RMSNorm | 1 | 96 | 96 | CLEAN | |
| Input to RMSNorm and QKV projections | 12 | 96 | 1152 | CLEAN | |
| Q and K before per-head RMSNorm | 24 | 96 | 2304 | CLEAN | |
| FlashAttention Q/K/V/output caches | 48 | 96 | 4608 | CLEAN | |
| FFN input before RMSNorm and first linear | 12 | 96 | 1152 | CLEAN | |
| FFN ReLU output before squaring | 12 | 384 | 4608 | SPARSE |
| Setup | Time / s | Peak memory / MiB |
|---|---|---|
| With buffer | 9.136 | 11964.6 |
| Without buffer | 9.353 | 11912.9 |
| Compression ratio ( ) | ||
|---|---|---|
| Step | Weights | Momentum |
| 0 | 1.2240 | — |
| 1 | 1.2240 | 1.4382* |
| 2 | 1.4382 | 1.2426 |
| 5 | 1.4382 | 1.4116 |
| 10 | 1.4382 | 1.4043 |
| Configuration | Bits/stream | Bits/element | ||
|---|---|---|---|---|
| Sparse (ReLU activations) | 65536 | 256 | 640 | 2.500 |
| Clean, non-Gaussian | 65536 | 256 | 800 | 3.125 |
| Clean, Gaussian | 65536 | 256 | 768 | 3.000 |
| Medium | 32768 | 128 | 608 | 4.750 |
| High | 32768 | 128 | 704 | 5.500 |
| Operator | Computation | Training role |
|---|---|---|
| compress | Retain BF16 weights or state between uses; store activations within an explicitly managed backward integration. | |
| decompress | Restore state or saved tensors for a dense consumer. | |
| compA_add_B | Accumulate microbatch gradients or apply a prepared parameter increment. | |
| compA_mul_B | Apply an existing elementwise mask, gate, or scale. | |
| a_compA_add_B | Update momentum or moment state; combine weight decay with a prepared dense step. | |
| a_compA_add_compB | Apply a compressed update to compressed state; uses first and second. |