6 ms·
Lossless LLM compression for efficient GPU inference via dynamic-length float
- loufe 2y agoI'm so grateful to live through such exciting times. I can open HN every two to some exciting new news about ML/transformer models. I really should read more into it, but does llama.cpp use a "custom kernel" per se, with cublas, or is it just making good use of the cublas kernal?
- jonplackett 2y agoIt’s funny that you’re missing the time frame from your sentence. 2 weeks? Two months? Two days? Two minutes? All of the above are true sometimes! Exciting times indeed.
- loufe 2y agoGood catch, I meant every two days! :)
- iamnotagenius 2y agoInteresting, but not exactly practical for a local LLM user, as 4-bit is how LLM's are run locally.
- sroussey 2y agoTrue, but their research did include running on 5080 local. The big take away, in my opinion, is that their technique for LUTs etc could also be applied to lossy quants as well. Say maybe you get 5bit accuracy in size of 4bit? I don’t know, but maybe? Also their two stage design might make current quantized you kernal designs better.
- spindump8930 2y agoYes, it could be stacked on quants. It might be that quantized activations already are more "dense" and so they can't be compressed as much (from 16 -> ~11 bits), but certainly possible.
- jasonjmcghee 2y agoI read it similarly - that this is a specific attribute of bfloat16, so the quants folks tend to run on local hardware don't have the same inefficiency to exploit
- gojomo 2y agoSome might prefer the fidelity of this method's 70% savings over the lossyness of 4-bit quantization's 75%. And, maybe the methods stack for those willing to trade both costs for the smallest representation.
- svachalek 2y agoThis is only a 30% savings, which is a cool technical feat but hard to see a use case for.
- iamnotagenius 2y ago[dead]
- Havoc 2y agoI'm guessing by lossless they mean something other than what the word usually means in compression context? >achieving near information-optimal compression without any loss of precision So perhaps more lossless as in didn't lose perplexity/benchmarks? In my mind lossless is precisely zero bits lost along the way.
- Vendan 2y agoinformation-optimal compression is "the theoretical minimum number of bits needed to represent data without losing any information, based on the data's entropy", so I think they mean the same thing you do
- brokencode 2y agoYeah, they’re saying that this compression is almost as good as is theoretically possible without losing any information.
- 8ytecoder 2y agoThink Morse code, where frequently used letters have shorter codes than less frequent ones. This ensures zero loss of information.
- artemisart 2y agoThe first sentence of the introduction ends with "we introduce Dynamic-Length Float (DFloat11), a lossless compression framework that reduces LLM size by 30% while preserving outputs that are bit-for-bit identical to the original model" so yes it's lossless.
- ziddoap 2y agoThe part you quote is a few sentences past the sentence that says "preserving outputs that are bit-for-bit identical to the original model".
- vintermann 2y agoA good example that information, i.e. bits, are only meaningful with respect to an end. If you don't know what the bits in a float will be used to, you can't throw them away, but if the floats are in a function, and you know that what some bits are can't affect the output of the function regardless of input, then you can throw those bits away and still have a lossless compression of the function.
- wills_forward 2y agoSo this could universally decrease the memory requirements by un-quantitized LLMs by 30%? Seems big if true.
- moffkalast 2y agoNot as big when Q8 quantization is already considered overkill and cuts it down to 50% (and a flat 2x speed boost without any additional compute overhead mind you) and the more common Q4KM is more like 30%. Definitely interesting if it can be added to existing quantization, but K quants do already use different precision levels for different layers depending on general perplexity impact which is similar to this entropy metric they use, e.g. Q6 using a mix of 4 bits and 8 bits. And that's not even considering calibrated imatrix which does something conceptually similar to FFT to compress even higher.
- janalsncm 2y agoQuantization is not lossless.
- danielmarkbruce 2y agoNobody really cares if it meets a strict definition of lossless.
- moffkalast 2y agoAnd when you consider that the usual final step in the pipeline is that a sampler goes ham on the probabilities and just picks some random nonsense, the tolerance for lossy compression is fairly high. In fact, there's this funny occurrence where Q4 models on occasion perform better than their fp16 counterparts on benchmarks ran with top_k=1 since the outputs are slightly more random and they can less deterministically blunder past the local maximum into a more correct solution.
- Der_Einzige 2y ago
- badmonster 2y agoWhat stands out most is the practical implication: enabling lossless inference of a 405B-parameter model on a single node with 8×80GB GPUs is wild. That’s a huge unlock for research labs and startups alike that want to run frontier models without massive infrastructure costs.
- danielmarkbruce 2y agoIt's... useful right now...it's not a huge unlock in a world where model size, GPU memory size, different precision support are changing quickly.
- striking 2y agoIs GPU memory size really changing that quickly? For that matter, is model size?
- kadushka 2y agoWhat's rapidly changing are quantization algorithms, and hardware features to support those algorithms. For example, Blackwell GPUs support dynamic FP4 quantization with group size 16. At that group size it's close to lossless (in terms of accuracy metrics).
- danielmarkbruce 2y agoYes, yes. Nvidia about to release blackwell ultra with 288GB. Go back to maybe 2018 and max was 16gb if memory serves. DeepSeek recently release a 670 gb model. A couple years ago Falcon's 180gb seemed huge.
- spoaceman7777 2y agoI'd assume that, in the context of LLM inference, "recent" generally refers to the Ampere generation and later of GPUs, when the demand for on board memory went through the roof (as, the first truly usable LLMs were trained on A100s). We've been stuck with the same general caps on standard GPU memory since then though. Perhaps limited in part because of the generational upgrades happening in the bandwidth of the memory, rather than the capacity.
- ein0p 2y agoNote that this is _way_ slower at small batch sizes you'd need for interactive use. At batch size 1 this seems to run at 1/3rd the speed of bf16 (so about 1/6th the speed of fp8 you'd realistically be using) if figure 5 is to be believed. This is actually a pretty impressive feat in itself if you know anything about GPU kernel programming, but it is much slower nevertheless. For this to work at "wire speed" it'd need hardware support, which takes years. Their "baseline" elsewhere in the paper is CPU offloading, which is dog slow and can't be made fast due to PCIe bottleneck.
- timschmidt 2y agoIt's perfectly possible to run LLMs quickly on CPUs. An Epyc or Xeon with 12 memory channels achieves similar memory bandwidth to a 4090, which is the limiting factor. Engineering sample Epycs in kits with motherboard and RAM are available on Aliexpress for reasonable prices even.
- ein0p 2y agoDid I say it wasn't? If your context is short and your model is small, it is possible to run LLMs on high-end CPUs able to support 12 channels of high-spec DDR5 RDIMMs. It's not possible to run them as fast as they'd run on a GPU equipped with HBM though. Nor would it be even remotely as energy efficient. Also, it's not possible to run LLMs quickly on CPU if your context is long, because CPUs do not have the requisite FLOPS to process long context quickly. And before you bring MoE into the conversation, MoE only affects the feedforward part of each transformer block, and full memory bandwidth and compute savings are only realized at batch size 1, sequence length 1, AKA the most inefficient mode that nobody other than Ollama users use in practice. Sequence length 8 (common for speculative decoding) could be using up to 8x37B parameters (assuming you want to run DeepSeek - the strongest available open weights model). Batch size of even 2 with sequence length 8 could use almost all parameters if you're particularly unlucky. Prompt will almost certainly use all parameters, and will slam into the FLOPS wall of your EPYC's ALUs. So can LLMs (with an emphasis on "Large") be run on CPUs? Yes. Are you going to have a good time running them this way? No.
- 2y ago
- mountainriver 2y agoIs it possible to run this on new models? It seem like the code is only for inference, unless I’m misunderstanding
- marksimi 2y agoTime to (dynamically) float
- luotuoshangdui 2y agoDoes it affect speed?
- hchja 2y agoThis is pretty useless in any case that doesn’t involve BFloat16 models
- throwaway314155 2y agoSo an increasingly smaller number of cases?
- spindump8930 2y agobf16 is the defacto default datatype and distribution type for LLMs, which are then often eagerly quantized by users with more limited hardware. See the recent Llama releases and e.g. the H100 spec sheet (advertised flops and metrics target bf16).
- yjftsjthsd-h 2y ago> Compared to a potential alternative of offloading parts of an uncompressed model to the CPU to meet memory constraints, DFloat11 achieves 1.9-38.8x higher throughput in token generation. With a fixed GPU memory budget, DFloat11 enables 5.3-13.17x longer context lengths than uncompressed models. The context length alone probably makes it worthwhile even if your models fit in memory, but I'm curious if it improves tokens/sec even all on GPU, since in my very amateur understanding LLMs tend to be constrained by memory bandwidth?
- philjohn 2y agoMy mental model is saying it might do, much like on slow hard drives DoubleSpace in DOS slightly sped up loading data from disk.
- hnuser123456 2y agoIf the model is 70% the size, it will be 1/0.7 = 1.43x the speed.
- brigade 2y agoIt does not; the decompression is memory to memory, one tensor at a time, so it’s worse. They claim less than 200 GB/s on an A100, and their benchmarks suggest it’s somewhere between 1.5-4x slower at batch size 1 depending on GPU and model. This overhead of course mostly disappears with a large enough batch size. Other lossless codecs can hit 600 GB/s on the same hardware, so there should be some room for improvement. But A100’s raw memory bandwidth is 1.6 TB/s
- anticensor 2y agoThis is just a VBR mode for neural networks. Not quite useful when inference is already quite slow.
- vessenes 2y agoEven presuming this is an accurate summary, the conclusion is not accurate - most local LLM inference users are constantly trading off quality for speed, in that speed drops dramatically once RAM is full. So, if you think of speed at desired quality, this could be very useful.
- jhj 2y agoThis is just a consequence of the fact that bfloat16 has a very high dynamic range which is not all used. People like hyperparameters that look like 0.01 not 10^10, even though there is the same fractional precision available at each exponent and if you multiplied everything - hyperparameters, initialized weights, training data, etc in a network by 10^6 things will still work more or less the same since the upper range is hardly used (with the possible exception of some small number of special functions). Typical entropy of bfloat16 values seen in weights (and activations) are about 10-12 bits (only 65-75% or so of the value range is used in practice). Sign and mantissa bits tend to be incompressible noise. This has been exploited several times before in the context of both classical HPC and AI, with lossless compression work from Martin Burtscher's lab (https://userweb.cs.txstate.edu/~burtscher/ https://userweb.cs.txstate.edu/~burtscher/), fpzip from LLNL (https://computing.llnl.gov/projects/fpzip https://computing.llnl.gov/projects/fpzip) and my library dietgpu from 2021 (https://github.com/facebookresearch/dietgpu https://github.com/facebookresearch/dietgpu) which we used to speed training on a large GPU cluster by about 10% wall clock time overall by losslessly compressing all data prior to send and decompressing upon receive (e.g., gradients, weights from backup, etc), which is still computing the same thing as it did before as it is lossless. Also, rANS is more efficient and easier to implement in SIMD-like instruction sets than Huffman coding. It would reduce the performance latency/throughput penalties as well with DFloat11 (since we have to decompress before we do the arithmetic).
- iandanforth 2y agoFor those who don't bother to click through profiles, Jeff really knows what he's talking about. Much of Meta/FAIR + community benefits from his code.
- VladVladikoff 2y agoI really love HN for this reason. Full of some of the brightest minds on the internet. Often the comments have very interesting information, instead of stupid knee jerk reactions to post titles.
- vessenes 2y agoThanks Jeff -- can you point me to something written up about rANS? All I find on line is turbulence modeling solutions; I presume this is not what you're referring to. As we know, quantizations are a critical tool for local LLM runners; RAM is typically the gating factor. Are you aware of other better lossless compression of BF16 weights out there? The reason I ask is this Dfloat11 seems relatively easy to plug in to existing quantization workflows, but you seem dismissive of the paper -- I presume it's my gap in understanding, and I'd like to understand.
- Animats 2y agoOnce this weight format war settles down, hardware can be built to support it. Presumably you want matrix multiply hardware optimized for whatever weight format turns out to be reasonably optimal.
- eoerl 2y agoOptimization is post hoc here : you have to train first to be able to huffman en ode, so it's not a pure format question
- aazo11 2y agoThis is a huge unlock for on-device inference. The download time of larger models makes local inference unusable for non-technical users.
- aseligman 2y agoSome additional context: many real world agent use cases struggle to balance quality, cost, and performance. This technique can help avoid the tradeoffs that quantization techniques introduce, including unpredictable results while you try cost optimize an agent. In some cases the cost savings can be significant using dfloat11 as you squeeze into more affordable GPUs. * I work with xmad.ai
- thund 2y agoIs this different than ZipNN? https://arxiv.org/pdf/2411.05239 https://arxiv.org/pdf/2411.05239 I see it mentioned but can’t understand if it’s based on it or different/better…
- thund 2y agoFound it, the news reminded me of this paper https://proceedings.neurips.cc/paper/2020/file/747e32ab0fea7fbd2ad9ec03daa3f840-Paper.pdf https://proceedings.neurips.cc/paper/2020/file/747e32ab0fea7...
- jhj 2y agoNot really, it's just adding some data transposition (coalescing individual bytes from the data words together) and an option to use a LZ/dictionary-type compressor to compress redundant things. But an LZ-type compressor doesn't make much sense on NN weights I think since it is not as redundant as most text data with many repeats, and also the space of possible dictionary matches is pretty small since unless the data is highly sparse, there may not be many repetitions that you can leverage to avoid the dictionary overhead. If you add an LZ-type compressor and have this be in the critical path for inference, then decompression will be a lot slower. It would be best to fuse decompression with the compute kernels (e.g., a GEMM that performs decompression on each tile before the arithmetic), and the simpler the decompression routine, the easier this will be.
- fxegdfvbfds 2y ago[dead]
- newuser111 2y ago[dead]
- jsemrau 2y agoI still hold the opinion that ternary instead of binary would lead to an even higher degree of compression.
- firefoxd 2y agoSomeone has figured out how to compress images even further with LLMs. They promised to published a white paper since last year: https://getproxyai.com/blog/this-image-is-4KB https://getproxyai.com/blog/this-image-is-4KB /s I'll show myself out
- gitroom 2y agoPretty cool seeing how fast all this moves - feels like every week theres a new trick or hardware upgrade. I def get nerd sniped by these efficiency improvements lol.