Bfloat16 support coming to Apple's Metal and PyTorch [video]
developer.apple.com
developer.apple.com
Remember that switching from 16 bit to 4 bit lets you have 4x as many weights, 4x as many weights loaded from RAM per second, and ~1/16 of the silicon area for the calculations (a multiplier scales with approximately the number of bits squared). That smaller silicon area will let you do more per $ too...
Any particularly good papers you can recommend me on the topic?
Ie. All weights, activations and gradients become powers of two! Which means all multiplications become simple bit shifts. That really changes mathematics and silicon design.
You're usually feeding a ton of multiplies into an accumulator. You can handle one or two mantissa bits as the same bit shifting except that it outputs two or three numbers to accumulate. And accumulators are very easy to scale.
Also in the extreme I've seen powers of 4 get used.
In practice this seems to get very good results, while being cheap to implement and relatively space efficient, Q4_K for example works out to 4.5 bits per weight instead of 4. The PR adding it has more details: https://github.com/ggerganov/llama.cpp/pull/1684
It has the best balance between quality and weight of the model and almost indistinguishable from original f16: https://www.reddit.com/r/LocalLLaMA/comments/142q5k5/updated...
And widespread hardware 4 bit will take some time. If the HW makers started designing 4 bit silicon in 2022, then we are still years away.
But it seems to be past the point of diminishing returns, where you mind as well use a model with fewer parameters... For now.
There was another scheme in a paper where the "sparse" majority of the model was highly quantized, while the "dense" part was left in FP16, with good results.
Remember BF16 was invented specifically to be able to be backwards compatible with existing silicon - and pulling 2 bytes out of 4 is a far cheaper operation than any rounding.
That maxed out Mac Studio M2 w/ 192GB of memory now looks more appealing...
This matfp instruction computes an outer product and is a kernel for matrix multiplication.
Inhousing typically means falling behind in technology but having lower operating costs. That makes the company win, not the users.
If you hinge your career on Apple, they might make your technology obsolete on a dime.
Its not the fastest, its not the best, its not the cheapest, its not some combination either.
> 'compute per watt'
With AI? The local LLM models are near useless already. There will be a time to cut down on power, but from what I've read, there is currently ~no value even with a 4090 with 512 RAM.
I suggest avoiding Windows/M$, I am annoyed with Linux bugs, and google cannot be trusted. But all of that could be said about Apple as well.
I just don't see a future with Apple hardware, it gives me some serious Nintendo vibes where they are going to be some quirky niche that is just enough for marketers to sell it. Compute per watt seems like a wiimote that no one asked for, but suddenly claim is ultra important.
Maybe someone can change my view. I don't see who buys this when they are educated on the possible options.
Intel? AMD Ryzen?
Apple has taken their ARM approach and scaled it to all their platforms.
Amazon now is on what, Gen 2 or 3 for their graviton platform in AWS.
And what OS are you using if you don’t trust Microsoft, Linux or Apple?
Buying a Mac for running LLMs is kinda like buying a Mac for gaming. Its thoeretically interesting, but I don't think thats a serious driver of Mac sales.
But:
- Finetuned local LLMs are good for specific niches, like roleplaying, text games, and helper bots for your own pile of data. And they are getting better at other niches like code completion for specific languages, or summarization.
- Remember that a huge selling point for Macs is iPhone/iPad development. The market for AI App Store apps is not small.This is also a reason to believe there will be some stability with the ML support.
I can't see how they don't hallucinate/are leagues away from GPT-3.5 let alone GPT-4 level of quality of output. Am I mistaken?
Again, the specialized variants perform very well in their niches.
Now often does a human make random shit up about general knowledge questions?
Mobile devices are energy-limited. You'll want to do as much compute as possible on a limited battery.
It's true also that fp16 is often manageable with enough batch/layer norm and gradient clipping.
The transfer pipeline I wrote for fp32->fp16 also took a lot more work than fp32->bf16
It's an empirical question and depends upon the nature of your problem and data. You should try all three fp32, fp16, and bf16 as part our model selection / hyperparameter tuning.
For example, in audio generative models (where typical output is 16-bit), I've sometimes found that fp16 and bf16 just don't produce good output as fp32 weights.