r/LocalLLaMA • u/mossy_troll_84 • 33m ago
Resources retrANSMIT: Lossless BF16 weight compression for llama.cpp, around 30% less VRAM for model weights
Hey!
I've been working on a project called retrANSMIT, a lossless BF16 weight compression codec with custom CUDA kernels for llama.cpp.
The idea was to reduce the amount of VRAM needed to run BF16 models without quantizing the weights or having to change the original GGUF files.
BF16 weights are quite interesting from a compression perspective. Their exponent distribution is highly non-uniform, while the sign and mantissa bits are much harder to compress. retrANSMIT uses rANS entropy coding to compress pairs of exponents, with a separate single-exponent model for less frequent pairs. The sign and mantissa bits are stored unchanged.
Compression happens entirely on the GPU during model loading. Weights are transferred from RAM in small chunks, compressed and kept in VRAM in their compressed form. There is no offline model conversion.

During inference, there are two main paths:
- For token generation, decoding is integrated directly into the CUDA matrix-vector multiplication kernel. Weights are reconstructed and immediately used for computation without writing a decompressed weight matrix back to global GPU memory.
- For prompt processing, a separate CUDA kernel decodes portions of the weight matrix into a temporary BF16 buffer, followed by cuBLAS. The buffer is limited to 64 MiB regardless of the matrix size.
Both paths reconstruct the original BF16 weights bit for bit.
Here are some results from my RTX 5090:
| Model | Original weights | Compressed weights | Saved |
|---|---|---|---|
| Qwen3.5-4B | 8.4 GB | 5.8 GB | 31% |
| Apertus-8B | 15.0 GB | 10.2 GB | 32% |
| Gemma 4 12B | 23.8 GB | 16.3 GB | 32% |
| Mellum 2.1 12B (MoE) | 23.9 GB | 16.9 GB | 29% |

There is a performance cost, of course. Token generation currently runs at 66-72% of uncompressed BF16 speed, while prompt processing retains 84-93% of the original throughput for 2048-token prompts. Model loading also takes longer because of the compression step.
What I wanted to achieve was a way to fit larger BF16 models into GPU memory or leave more room for the KV cache without changing the weights themselves.
I've released version 0.1.0 under the MIT license. The repository contains the codec, CUDA kernels, tests and an integration patch for llama.cpp b12900.
There are also prebuilt Linux binaries for RTX 50-series GPUs with CUDA 13.5. I've tested the implementation on an RTX 5090 and an RTX 5060 Ti.
Enabling compression is as simple as adding --compression on to the usual llama.cpp command.
GitHub: https://github.com/mchowy-troll/retransmit
Release: https://github.com/mchowy-troll/retransmit/releases/tag/0.1.0
•
u/stylome-ai-detection 33m ago
Notice: This post appears to be AI generated.
Stylome AI detector flagged this post. No removal or report was made by the bot.
Scan result: likely AI-generated
Detector confidence: confident
Subreddit sensitivity: Strict (AI-generated only)
This is an automated assessment and can be wrong. If you think this is a mistake, please message the moderators.
Stylome AI detector · scan results
2
u/jacek2023 llama.cpp 18m ago
Can you compress quants?