back
77 comments
This is really cool but the output is such garbage at that weight size that you might as well be running a markov chain.
That's why Alpaca is so exciting: it instruction-tunes LLaMA to the point that even the tiny 7B model (the one that fits on a phone) produces useful output: https://simonwillison.net/2023/Mar/13/alpaca/
I’ve been playing with the Alpaca demo, and I’m really impressed! The outputs are generally excellent, especially for a model of that size, fine tuned on a $100 (!!) compute budget.

If the cloud of uncertainty around commercial use of derivative weights from LLaMA can be resolved, I think this could be the answer for a lot of domain-specific generative language needs. A model you can fine tune on your own data, and which you host and control, rather than depending on a cloud service not to arbitrarily up prices/close your account/apply unhelpful filters to the output/etc.

But they won’t give us the model… so it’s ultimately meaningless because they’ll just sell out
My understanding is they legally can't. It was trained used OpenAI, which doesn't allow using their output to train new models. Someone would need to find another data source to fine tune llama.
If they don't release the model, recreating it doesn't look too hard. $100 worth of compute time to run the fine-tuning, and the training data they used is here: https://github.com/tatsu-lab/stanford_alpaca/blob/main/alpac...

That would have the same licensing problems that they have though: that alpaca_data.json file was created using GPT3. But creating a "clean" training set of 52,000 examples doesn't feel impossible to me for the right group.

How one can tune the model to a specific usage? Is there some place that teaches this?
It’s quite a bit bigger than GPT-2 which was a really big deal not very long ago (remember the unicorn news article example and the slow release because it was apparently too powerful?)
Our standards have gone up so much!

If you are talking about the video that's perfectly fluent English. There are some unusual elements to the story which probably wouldn't be there in a larger model.

I'd invite you to try that with a Markov model or even something like a LSTM based neural network and compare.

Afaik, the Llama sampler needs to be tuned to get more sensible outputs.

https://twitter.com/theshawwn/status/1632569215348531201

Isn't any LLM mathematically a Markov chain, such that the current state includes the context of the last (finite) n tokens?
The distinctive aspect of the 'transformer' family of neural networks is that they incorporate 'attention', which is a model that identifies which parts of the input are critical to its meaning. You're correct in that modern transformer models are essentially Markov chains, but the function that derives the probabilities (of which the attention heads are part of) is imbued with 'understanding' of related concepts during the training process. In contrast, a traditional Markov chain text generator might have a probability function that only takes into account the frequency of the n-grams in the training data, and so produces superficially coherent (but mostly meaningless) output.
This is like saying all computers are state machines because they have finite amounts of memory and disk space. It's sort of true, but it's not a useful mathematical model.

With a Markov chain, you're assuming a state machine where each state has independent probabilities on outgoing edges. As the number of states gets larger, you have fewer training samples for each state. When n gets large enough, nearly all states have zero training samples; they've never been seen before. How do you estimate probabilities?

Better to just say it's a stateless function of the input.

From the video output seems fine.

But if it is a trimmed version, it is wong to call it LLaMa.

Could call it Slim LLaMa
SLLaMa?
It's nonsensical, celeb announces they're going to rehab and notes it (?) is an issue affecting all women, at least, earlier today (??), they also noted it wasn't drugs or alcohol this time, but, a life (???)
Until it thermally throttles 40 seconds later. But yeah, it's really cool how many platforms the vanilla code in llama.cpp can be easily compiled on. And somehow I doubt they did the quantization step on the Pixel itself. My favorite was the person who did it on the rpi4. I know a guy working on getting it going on rpi3 but the ARM7/8 mixing , NEON support, and 64 bit ARM intrinsics are apparently non-trivial to convert.
I'm the original tweet author.

Currently typing this from my Pixel after running it countless times :)

I would need a step by step guide, but I would love to test it on my Galaxy S21 Ultra 5G. It has 16gb ram and I have about 350 GB available.
>And somehow I doubt they did the quantization step on the Pixel itself

You're probably right (because why would they?) but I don't see any reason they couldn't have done this if they wanted to.

I would have tried it but I didn't have enough storage on my phone to hold both the original and quantized weights.
Here is a thread to tweak the parameters which the model seems very sensitive to:

https://github.com/ggerganov/llama.cpp/issues/129

Could the model itself be used to tweak it’s own parameters iteratively?
That's Model Extraction basically
This would be useful for predictive text. That's exactly what LLMs are actually built for.
LSTMs have been in the Google keyboard for years...
I'm waiting until it runs on my C64...
Did anyone get this to run on an iPhone or in a browser yet?
Most iphone have only 4GB RAM (and even latest iphone 14 has only 6GB RAM). Pixel 6 has 8GB RAM. But bigger issue is on iOS still OS limits how much RAM your app can use and might kill your app.
I'm still amazed that Apple invests so much into every other bit of hardware on a high end phone, yet always gives you the bare minimum amount of RAM they can get away with.

There are so many use cases (like this) that require more RAM. And even if a use case doesn't theoretically require more RAM, getting a developer to dedicate time to optimizing RAM is time taken away from making a wonderful app.

Does this in theory mean it should be relatively easy to port to coral TPU?
Afaik that TPU has only 8MB of RAM to fit models, you'd have to continuously stream the weights - can't imagine that's workable.
All their tensor/math magic seems to happen in https://github.com/ggerganov/llama.cpp/blob/master/ggml.h .

So maybe if you implement the ggml.c with tensorflow/libcoral - you'd have a chance.

It is not really llama, it is llama quantized to 4bit. Not even the quality of original 7B. I could also quantize it to 1 bit and claim it runs on my RPI3.
The quantization to four hits doesn’t have that much effect on the output. 1 bit might not either, but someone would need to do some testing before making the claim that “1 bit … runs on my RPI3” because “runs” is a bit overloaded to mean “runs and produces sensible output.” I think you’re missing that runs here has that overloading.
It should also be mentioned that it isn’t really that each weight is a 4 bit float, but rather that they’re basically clustering floats into 2^4 clusters and then grabbing from a lookup table the float associated to a 4 bit value as needed. So as long as the weights roughly fall into 16 clusters you’ll get identical results
i haven't noticed 4bit quantization affecting the quality of LLaMA-7B, it produces very coherent outputs, the trick is having a good example in your prompt so it has a good idea of what's expected of it.
Quality and quantity: I've had the best luck cramming a bunch of examples into the input, just like with GPT-J where you're only working with 6B parameters. Making sure the format stays consistent and ideally presented in the shape you'd encounter that same text if you found it on a webpage somewhere.
The 4 bit quantization performs well, though. Does your 1 bit version?
1 bit will mathematically be guaranteed to be more efficient for performance-per-parameter so to me it is a pretty clear eventuality one day, but I think also the relative performance % will likely tank still. Impressed honestly that it held so well at 4 bit tbh, I thought personally that 8 bit was the ceiling.

However I can see fractional bits (via binary representations) and larger models happening first before that compression step.

And then we have the sub-bit range..... ;DDDD

Do you have the numbers? I suspect is is way worse. Original llama.cpp authors never measure any numbers as well.
I used the 7B quantized to 4 bit and it needs a few tries for most things, but it's not useless.
Any more details? I'm guessing they're leveraging the NPU in the pixel?
I think they are using llama.cpp without any NPU/TPU patches. By default it only runs on CPU with support for various SIMD extensions.

https://github.com/ggerganov/llama.cpp

It uses the ARM NEON extensions to the instruction set for SIMD (as far as I understand).
So is this finally peak hipster coder and from this point on rust will diminish because all the cool kids start switching to zag?
would be even cooler if it employed the accelerator!

(unless this ggml library is doing that under the hood)

i assume it has unified memory, but maybe not little numbers...