Live data from Hacker News

Llama.cpp: Port of Facebook's LLaMA model in C/C++, with Apple Silicon support

github.com

261–270 of 298 posts

Re: Llama.cpp: Port of Facebook's LLaMA model in C/C++, with Apple Silicon support

#261
post #61

That's all fine and good. But to do anything useful, you're going to want a powerful GPU (RTX 3090, RTX 4090 or A6000) with as much VRAM as possible. Unlike the diffusion models, LLM's are very memory-intensive, even at 4-bit GPTQ. The larger models like llama-13b and llama-30b run quite well at 4-bit on a 24GB GPU. The llama-65b-4bit should run on a dual 3090/4090 rig. Coupled with the leaked Bing prompt and text-ge…

Here is some quick math: these devices has SSD read speed somewhere around 2GiB/s. With 4-bit quantization, we are looking at loading 4B parameters per second. That means we need 8s per token for 30B model. Hmmm, the math is a bit off (or I need to look closer whether we can do more tokens per iteration with some batching).

You can use Speculative Sampling, where a draft model is used to generate short continuations of a sequence, which are scored in parallel by the large model. The draft model can be small, and you only need to call the large model from time to time, so you can stream it from SSD or cheap RAM.

Using LRDIMM DDR4 at the price of less than $1000 it is possible to stream GPT-3 five times a second, in 4bit quantisation. Multiply that with the 2-2.5x speedup from Speculative Sampling.

>Accelerating Large Language Model Decoding with Speculative Sampling

https://arxiv.org/abs/2302.01318

Re: Llama.cpp: Port of Facebook's LLaMA model in C/C++, with Apple Silicon support

#263
post #81

If you are interested in implementing LLaMA yourself or learning, I noticed that the reference code by Facebook is one of the cleaner, easier to read ML code I've seen in a while. https://github.com/facebookresearch/llama/blob/main/llama/mo... It's about 200 lines long. You probably do need a bit of knowledge to understand what you are reading but I was pleasantly surprised. For example in comparison, StableDiffusion…

Just don’t copy their sampler. It’s trashcan-tier. Bad defaults and no repetition penalty.

I think tuning the sampler temperature and using top-k over top-p sounds ad hoc and shouldn’t be necessary for a solid model. Do you have any reason for suggesting those changes in particular? Especially since top-p, or nucleus sampling, is meant to be an improvement over top-k.

Re: Llama.cpp: Port of Facebook's LLaMA model in C/C++, with Apple Silicon support

#264
post #191

Does anyone know how many languages this supports? I know that FB has been translated to a ton of languages. Will those translations benefit the models in LLaMA? Or am I misunderstanding the point of this?

The point of it is to generate arbitrary text locally, like the GPT-3 API does remotely. It can "say"/talk about anything an average IQ person with knowledge of the entire internet and most books in existence could. So if you prompt it to write 100 pages on the differences between positive and negative law, as a poem, while never using a word with the letter "F" it will spit that out for you without any issue. It can…

What models exist for translations? The reason I wonder is that a lot of community work has gone into producing high quality translations of Facebook. I have actually submitted a few translations myself. If Meta could release some of those models, it would be very powerful.

Right now I see "google translate" type quality everywhere and it's pretty bad, since there are often sentences you can't translate unless the technology understands the context and meaning.

Re: Llama.cpp: Port of Facebook's LLaMA model in C/C++, with Apple Silicon support

#265
post #165

Earlier quoted context omitted.

> All of the specs indicate an iPhone 14 Pro could achieve similar throughput to an M1 MacBook Pro. Battery capacity and thermals are different and might be problematic. The phone might throttle performance earlier. > it looks like we have all the pieces needed to make a ChatGPT-level assistant operate entirely through voice and run entirely on your phone. As a demo, yes, but would loading the model be fast enough fo…

Siri doesn’t seem as fast or responsive compared to Google assistant at times.

At this point in time, Siri as a voice-driven assistant has become so totally and utterly useless, its not even worth comparing it to anything else. I wonder how a company can work at a feature like that for 10 years, and manage to make it worse with every release they put out.

At this point in time, Apple should be so embarrased of Siri that I really think scratching the whole thing would have a net benefit.

Scratch it, and start over. And fire everyone involved with Siri :-)

Re: Llama.cpp: Port of Facebook's LLaMA model in C/C++, with Apple Silicon support

#266
post #247

Earlier quoted context omitted.

Oh shit, I took a closer look and you’re right. The repo was also helpfully updated with a note to this effect: “The Accelerate framework is actually currently unused since I found that for tensor shapes typical for the Decoder, there is no benefit compared to the ARM_NEON intrinsics implementation. Of course, it's possible that I simlpy don't know how to utilize it properly. But in any case, you can even disable it…

Our investigations indicate that it might not be possible to achieve ANE performance improvement over CPU for LLM Decoder inference with batch size of 1 [0]. Just to make it clear - I'm no expert in Core ML / ANE, so these conclusions could be totally wrong. [0] https://github.com/ggerganov/whisper.cpp/discussions/548#dis...

Don’t sell yourself short! (And you have my apologies in advance if my excited comment above has created any extra work for you)

Re: Llama.cpp: Port of Facebook's LLaMA model in C/C++, with Apple Silicon support

#267
post #104

A quick survey of the thread seems to indicate the 7b parameter LLaMA model does about 20 tokens per second (~4 words per second) on a base model M1 Pro, by taking advantage of Apple Silicon’s Neural Engine. Note that the latest model iPhones ship with a Neural Engine of similar performance to latest model M-series MacBooks (both iPhone 14 Pro and M1 MacBook Pro claim 15.8 teraflops on their respective neural engines…

4 words a second doesn't seem fast enough for a voice assistant ?

It's faster than that [0], 20 token/s, should be approximately 15 words per second.

0: https://help.openai.com/en/articles/4936856-what-are-tokens-...

Re: Llama.cpp: Port of Facebook's LLaMA model in C/C++, with Apple Silicon support

#268
post #237

Earlier quoted context omitted.

You're right I overestimated how fast we talk!

Some rules of thumb I use for estimating this kind of stuff 100wpm: Max typing speed 200wpm: Max speaking speed 300wpm: Max listening speed, max reading speed with subvocalisation 900wpm: Max reading speed without subvocalisation

Doin napkin math, this model should be hitting 900wpm
Post reply on HN