News for hackers. Stuff that matters.
Re:The Coming of Local LLMs by cs702 on Tuesday April 11, 2023 @11:44AM (#35526787)
I expect we will see the biggest jump in performance if (when) consumer-grade coprocessors like mobile GPUs start incorporating attention as a primitive building block at the hardware level, e.g., with instructions and memory layouts engineered specifically to make ultra-low-precision (say, 4-bit) transformer layers as compute- and memory-efficient as possible on consumer devices. That seems almost inevitable to me.
Re:The Coming of Local LLMs by jjoonathan on Tuesday April 11, 2023 @11:54AM (#35526948)
Low precision: agreed

Attention: Isn't it quadratic in context length? I dunno, this feels like the crude first iteration of something that will get inevitably passed by something that scales better.

Re:The Coming of Local LLMs by dpflan on Tuesday April 11, 2023 @12:00PM (#35527045)
Sharing a comment from a similar line of discussion:

"""

Complexity is quadratic in sequence length. For 512 tokens it is 262K, but for 4000 tokens it becomes 16M and goes OOM on a single GPU. We need about 100K-1M tokens to load whole books at once.

Since 2017 there have been hundreds of attempts to bring O(N^2) to O(N), but none of them replaced the vanilla attention yet in large models. They lose on accuracy. Maybe Flash attention has a shot (https://arxiv.org/abs/2205.14135).

"""

- source: https://news.ycombinator.com/item?id=34171503

Re:The Coming of Local LLMs by whimsicalism on Tuesday April 11, 2023 @01:17PM (#35528125)
There is literally no way that GPT-4 is using classic O(N^2) attention exclusively. They haven't released the results, but I promise you this is not what they are using exclusively.
Re:The Coming of Local LLMs by anthlax on Wednesday April 12, 2023 @09:03AM (#35538982)
Interesting! How do you know this?
Re:The Coming of Local LLMs by sebzim4500 on Tuesday April 11, 2023 @12:39PM (#35527597)
Probably once context lengths get really long it might be better to use ANN rather than exact attention at inference time. I would imagine this would only pay off with ~100,000 token contexts, and even then it would only work if only a few tokens meaningfully contribute to each attention head.
Re:The Coming of Local LLMs by cs702 on Tuesday April 11, 2023 @12:03PM (#35527093)
Memory use is already linear in practice, thanks to FlashAttention. It's an open question whether computation can be made sub-quadratic without impacting model performance, although there are ongoing efforts seeking to do exactly that.[a]

Keep in mind: Once you go into precision as low as 4 bits (or lower?), all sorts of optimizations can become practical. Off the top of my head, maybe you could cache and reuse common attention sub-matrices (e.g., a 16×16 sub-matrix with 4-bit elements occupies only 1KB of space)?

My sense is there's so much money at stake here, that whoever does this first will win big even if they end up having to replace or augment it with something better down the road.

[a] Here's a recent post about a new approach from a group at Stanford that looks promising to me: https://news.ycombinator.com/item?id=35502187

Re:The Coming of Local LLMs by throwawaymaths on Tuesday April 11, 2023 @12:30PM (#35527475)
In theory one could use the nysromformer. Don't know if anyone does in practice
Re:The Coming of Local LLMs by whimsicalism on Tuesday April 11, 2023 @01:19PM (#35528150)
They don't
Re:The Coming of Local LLMs by throwawaymaths on Tuesday April 11, 2023 @03:52PM (#35530553)
Do you know why/why not?
Re:The Coming of Local LLMs by whimsicalism on Tuesday April 11, 2023 @04:53PM (#35531401)
They've just gone with a different approach for fast attention. [0] Not sure it was due to any particular merits/lack of the nystroformer.

[0]: https://twitter.com/typedfemale/status/1609867110695735296

Re:The Coming of Local LLMs by whimsicalism on Tuesday April 11, 2023 @01:21PM (#35528172)
I agree - unfortunately we have gone so far down the rabbit hole optimizing transformer models.

Alternative models like S4 have been able to get transformer level performance with O(N) sequence length scaling.

Re:The Coming of Local LLMs by seydor on Tuesday April 11, 2023 @12:07PM (#35527160)
maybe one could use physics to do that in analog. Or even better, in biology. I think with a clump of ~1.5kg of neurons we can have a pretty efficient coprocessor that is fed with pizza.
Re:The Coming of Local LLMs by bick_nyers on Tuesday April 11, 2023 @12:52PM (#35527791)
On the other hand, securing the biological coprocessor in your homelab and running queries on it 24/7 appears to have legal implications.
Re:The Coming of Local LLMs by cs702 on Tuesday April 11, 2023 @01:03PM (#35527946)
Moral implications too. The first Matrix movie is about the moral implications.
Re:The Coming of Local LLMs by mcculley on Tuesday April 11, 2023 @01:18PM (#35528147)
In polite company it is considered rude to suggest that there was more than one Matrix movie.
Re:The Coming of Local LLMs by liuliu on Tuesday April 11, 2023 @11:53AM (#35526923)
Chip's capability planning seems need about ~2yr lead time. So we are expecting fastest would be somewhere around end of 2024. (Transformers probably earlier than that (2023?), 4-bit would be later).
Re:The Coming of Local LLMs by cs702 on Tuesday April 11, 2023 @11:54AM (#35526949)
Unless there are groups that have been thinking about and working on this for a while...
Re:The Coming of Local LLMs by zamalek on Tuesday April 11, 2023 @12:46PM (#35527693)
There are those Google accelerators that plug into an M.2 slot. You could plausibly do this today, although I am not sure what sort of memory constraints those accelerators have.
Re:The Coming of Local LLMs by BrutalCoding on Tuesday April 11, 2023 @01:37PM (#35528407)
These ones can be plugged in with USB type-c, see: https://coral.ai/products/accelerator/

It’s used for boosting interference (offline) on Linux, Mac and Windows.

Haven’t bought or used them but I’ve had my eyes on these for a little while!

Re:The Coming of Local LLMs by beauzero on Tuesday April 11, 2023 @01:47PM (#35528558)