811 points · by simonw · 3y ago · 369 comments
The big difference between it and Stable Diffusion which caused the latter to go megaviral is a) it can run on a typical GPU that gamers likely already have without hitting a perf ceiling and b) it can run easily in a free Colab GPU. Although Hugging Face transformers can run a 7B model on a T4 GPU w/ 8-bit loading, but with its own caveats too.
There's a big difference between "can run" and "can run well". VQGAN + CLIP had a lot of friction too and that's partially why AI image generation didn't go megaviral then.
Rip open the code and make sure it has top_k 40, temperature 0.7, no top_p, and a repetition penalty of 1/0.85.
Proof: https://twitter.com/theshawwn/status/1632569215348531201?s=6...
Implementation: https://github.com/shawwn/llama
It feels basically identical to davinci. I think no one realizes it yet because Facebook released a horrible sampler that everyone copied.
[1] https://twitter.com/LalwaniVikas/status/1634648646535770113
Vanilla Ubuntu desktop with a used server-grade NVIDIA GPU with lots of GPU RAM is probably your best bang for buck for messing with large model inference right now.
I've had success running the 7B model on a 16GB M1 Mac Mini (purchased in 2020!). I didn't bother to try but pretty sure the 13B model works as well.
I suspect you could grab one of those for less than $1000 these days.
I wonder if there are learnings for how to measure intelligence, just from proliferation of these AI models. Maybe even learnings for how to more efficiently access biological intelligence.
A human brain carries a lot more baggage with it. Long story short, our biological brain hardware is much superior to current AI hardware, but our biological brain software (where we learn the culture that surrounds us) is much inferior to current AI machine learning. GPT-3 trained 175B on basically the whole internet in 15 days. That's insane. And now there are rumors that ChatGPT is executed on an optimized subset of this 175B model, which may be a bit more than 1/10 that size.
I think going forward we'll see 20-30B parameter models perform much better than an average human in typical tasks. Especially after we evolve the topology of an AI to not be a straight directed acyclic graph, as it is now, but allow structures to loop internally, to invoke other structures with input (as subroutines) and so on.
And also there's new hybrid analog/digital hardware in the pipeline, which makes AI execution 100 times more energy efficient and compact. So above-human level AI on your phone is on the horizon, I'd say.
We're only getting started.
Not especially long ago humanity knew basically nothing. The epitome of technology was the stone age. Literally crush two rocks together and then poke things with the sharp bits that flake off. Somehow, in the blink of an eye, we went from that to putting a man on the moon.
So let's do the same with these sort of LLM models and see what happens. Train one with the entirety of expressible human knowledge from the stone age. Where will it send you? I think the answer is largely pretty much where you are. In any case, certainly not to the moon. It seems we're just building natural language search.
This isn't shifting the goal posts. The problem is we keep intentionally making meaningless goal posts in pursuit of AI, because if you don't then the goal seems impossibly far off. But that's because the reality is that it probably is!
It's going to perform like a brilliant person with brain injury. 8 bit is far better and it would be interesting to see if they can get it working on any reasonable hardware.
IMO, Apple's habit of cheaping out on ram is maddening. Although perhaps this is a sign for me to pick up a m2 pro mini with extra ram.
The GP's info is outdated. Apparently they don't realize how quickly LLaMA is being developed on. It's just like the early days of SD.
running 4-bit LLaMa 13B on my MacBook Air M2:
"possible resolutions to the Fermi paradox, the question of where is the evidence for extra-terrestrial civilizations: - "
answer:
possible resolutions to the Fermi paradox, the question of where is the evidence for extra-terrestrial civilizations:
- 1. We are looking in the wrong direction and in the wrong frequency bands for signals from intelligent life in the galaxy.
- 2. We are looking in the right frequency bands, but the technological level of intelligent life in the galaxy is not high enough to be a threat to us.
- 3. We are looking in the right direction and in the right frequency bands, but the probablity of interstellar travel is so small that we are not likely to meet civilizations.
- 4. We are looking in the right direction and in the right frequency bands, and the probability of interstellar travel is not small, but we are unlikely to meet civilizations at our level of technological development.
- 5. We are looking in the right direction and in the right frequency bands, and the probability of interstellar travel is not small, and we are likely to meet civilizations at our level of technological development.
- 6. We are looking in the right direction and in the right frequency bands, and the probability of interstellar travel is not small, and we are likely to meet civilizations at our level of technological development.
I would be inclined to think that option 5 or 6 are the most likely. Given the nature of the universe, I think that we are more likely to encounter civilizations in the earliest stages of their development, than those that are further developed.
I would think that the big question of the next 10 years is whether SETI will be able to detect an ET signal. I think that the chances of being able to do so are less than even.
The reason is that a lot of the technical issues that SETI has been addressing are becoming less of a problem, because the Earth-based radio telescopes are being joined by many smaller radio telescopes that are being sent into space. So, from a technical standpoint, the ability to look for ET signals is becoming easier and easier.
The problem is that any signals that are sent to Earth that come from technologically advanced civilizations are likely to be only a few percent of the power of the ET signals that are coming from sources at our level of technological development. So, for example, SETI@home is looking forUnless it's relicensed I don't expect LLaMA to be a long-term foundation model. But it's shown that yes, you can run a GPT-3 class model on an M1 Mac with 8GB of RAM (or maybe 16GB for the 13B one?)
I fully expect other models to follow, from other organizations, with better capabilities and more friendly licensing terms.
1) Model weights are heavy for just experimentation, although quantizing it down to 4-bit might make them on par with SD FP16.
2) Requires extreme CLI shenanigans (and likely configuration since you have to run make) compared to just running a Colab Notebook or a .bat Windows Installer for the A1111 UI.
3) Again hardware: a M1 Pro or a RTX 4090 is not super common among people who are just curious about text generation.
4) It is possible the extreme quantization could be affecting text output quality; although the examples are coherent for simple queries, more complex GPT-3-esque queries might become relatively incoherent. Particularly with ChatGPT and its cheap API (timely!) out now such that even nontechies have a strong baseline on good output already. The viral moment for SD was that it was easy to use and it was a significant quality leap over VQGAN + CLIP.
I was going to say inference speed since that's usually another constraint for new LLMs but given the 61.41 ms/token cited for the 7B model in the repo/your GIF, that seems on par with the inference speed from OPT-6.7B FP16 in transformers on a T4.
Some of these caveats are fixable, but even then I don't think LLaMA will have its Stable Diffusion moment.
I'm not too worried about CLI shenanigans, because of what happened with whisper.cpp - it resulted in apps like https://goodsnooze.gumroad.com/l/macwhisper - wouldn't be at all surprised to see the same happen with llama.cpp
A regular M1 with 8GB of RAM appears to be good enough to run that 7B model. I wonder at what point it will run on an iPhone... the Stable Diffusion model was 4GB when they first released it, and that runs on iOS now after some more optimization tricks.
For me though, the "Stable Diffusion" moment isn't necessarily about the LLaMA model itself. It's not licensed for commercial use, so it won't see nearly the same level of things built on top of it.
The key moment for me is that I've now personally seen a GPT-3 scale model running on my own personal laptop. I know it can be done! Now I just need to wait for the inevitable openly-licensed, instruction-tuned model that runs on the same hardware.
It's that, but also the forthcoming explosion of developer innovation that a local model will unleash. llama.cpp is just the first hint of that.
How about:
We're all still waiting to hear about (non-shovel-selling) successes in this space.
Now that I've seen that LLaMA can work I'm confident someone will release an openly licensed instruction-tuned model that works on the same hardware at some point soon.
I also expect that there are prompt engineering tricks which can be used to get really great results out of LLaMA. I'm hoping someone will come up with a good prompt to get it to summarization, for example.
So a GTX 1060[1] or GTX 1650[1]?
A proper gamer would have a 4080, or at least a 3070, with the requisite 8gig of video ram.
Gamers with RTX 3070 or above are a small count, at least according to Steam. RTX 4080 gamers are a staggering 0.20% of those surveyed.
Today's price for 1TB of consumer RAM is around 3,000 USD; since it's paramount to be able to run these models locally, especially as they get better the privacy concerns will become even greater, it's time for hardware to step up to the challenge: x10 price reduction in 10 years, a new curve for Gordon Moore's observation.
The unified memory model doesn't mean it's faster for inference. Nvidia's GPUs run circles around Apple Silicon in training and inference right now. Though a part of that is software optimization.
If anything, the reason to have unified memory SoC is to increase general efficiency, not to provide faster AI inference.
I think chip makers will instead start making their NPU (such as Apple's neural engine) really massive. It'll start to take more transistors away from the CPU and GPU. By 2033, perhaps you're buying an NPU with a CPU and GPU attached to it, not the other way around like today.
Also, 2/4/16TB of RAM will not have a 10x price reduction in 10 years. As far as I know, there's nothing in the horizon to do this. Prices will go down but it might stay relatively flat for the next 10 years.
See this chart for $/GB: https://aiimpacts.org/wp-content/uploads/2020/04/memorytrend...
Memory stopped getting exponentially cheaper some time around 2011. This is why the MacBook Air still starts with 8GB of RAM.
The one thing that maybe could have helped was Intel's Optane tech, which they abandoned last year. It's memory that sits in between the speed of DRAM and SSDs.
Sure, plenty of room for optimizations.
"there's nothing in the horizon to do this"
Sure, the prediction is that a new curve is laying just a bit beyond the horizon.
MacBook Air still starts with 8GB of RAM for the same reason they still start with a 256 GB disk and for the same reason an 8 TB SSD from Apple means +$2,200†: corporate greed since it's good enough. The argument is it won't be good enough in the near future.
† whereas a Samsung 870 8TB SSD is around 700 USD
There must be a real necessity for that to happen, and I do not see how LLMs provide substantial benefits to push for a change.
LLMs are merely a technical detail, a stepping stone, the major breakthrough will be the first algorithm of a synthetic agent. Do we really want the boring dystopia HAL, Rehoboam, and so forth, or our own personal Star Trek Data.
I have a dim sense of the hardware industry, but I know that disk storage has gotten 10-100x cheaper, CPU/GPU power increases quite steadily, but RAM is still quite expensive.
Is it even possible for RAM to get much, much better than it is currently? Are there physical limitations, or is there just not the same amount of market interest in more RAM?
Beyond the supply/demand economics and also corporate greed [1], there are fabrication issues, just look at the current mess [2], but as new US-based fabs come online from 2025 and beyond [3], they will be solved to some extent.
Theoretically, the maximum amount of RAM a 64-bit machine can address is around 16.8 million terabytes [4]: as always with computing, the journey hasn't even begun.
[1] Easier and more money in manufacturing RAM for smartphones, https://fossbytes.com/flagship-phones-ram-vs-pc-ram
[2] "EU tells Taiwan to forget about a bilateral investment pact even as bloc seeks more chips", https://www.scmp.com/news/china/article/3213163/eu-tells-tai...
[3] "U.S. Semiconductor Renaissance: All the Upcoming Fabs" (2022), https://www.tomshardware.com/news/new-us-fabs-everything-we-...
[4] https://superuser.com/questions/65191/what-is-the-maximum-am...
AI models that require a huge amount of memory will be done in the cloud.
Will memory demand increase by 2033? Of course. Will demand reach 1TB of RAM for a consumer level computer/mobile device? No.
DRAM currently consists of a small capacitor per bit (cell), which can hold a small amount of charge (1) or not (0). The amount of charge it can hold, its capacitance, depends on the area and the distance between the conductors[1].
So, as you try to cram more cells into the same area, the amount of capacitance goes down. This is problematic because of leakage[2], causing the charge to leave the capacitor. This is why DRAM cells are refreshed periodically, hence the "dynamic" in DRAM. Too much leakage, and you spend all the time refreshing rather than accessing the memory.
To raise the capacitance back up, you can move the conductors closer. However, if the insulating material stays the same, this will lead to increased leakage. Thus a better insulating material is needed.
While the current DRAM cells are quite impressive, it seems they're starting to hit fundamental road blocks with the current technology[3]. There's a limit to just how little amount of charge a cell can hold and still be reliably read, and finding better insulators is getting harder and harder.
It may well be a new approach is the solution to continued scaling. Moving away from individual capacitors as the basis for a memory cell might be a way forward[4].
[1]: https://en.wikipedia.org/wiki/Capacitance#Capacitors
[2]: https://en.wikipedia.org/wiki/Leakage_(electronics)#In_capac...
[3]: https://www.techinsights.com/blog/dram-scaling-trend-and-bey...
[4]: https://spectrum.ieee.org/new-type-of-dram-could-accelerate-...
IDK about DRAM density breakthroughs though, in fact I kinda worry scaling will slow down over the next decade.
[1] "Telehealth startup Cerebral shared millions of patients’ data with advertisers", https://news.ycombinator.com/item?id=35094866
Seems it now also supports AVX2 for x86 architectures too. https://twitter.com/ggerganov/status/1634588951821393922
I still think that open source LLMs models have to be much smaller than 200GB and to be much better than ChatGPT to be more accessible and highly disruptive to OpenAI.
It is a great accident needed thanks to Meta. For now one can use it as a service and make it as a SaaS rather than depend fully on OpenAI. Open source (or even free binary only) LLMs will eventually disrupt OpenAI's business plans.
Mostly using https://github.com/oobabooga/text-generation-webui/, the AUTOMATIC1111 of textgen.
OpenAI limits prompts to 4096 tokens.
If there was no limit, could the LLM be fed a 100 page document in the prompt and then answer questions about it?
What does that mean?
For each token in your input or inference output it requires the model to have some understanding of what the position of the word means.
So there is the word position embedding matrix that contains a vector per position. The matrix has "only" 1024 entries in it for GPT2 or 4096 for GPT3. The size of each entry varies as well, containing a vector from 768 for GPT2 small and up to 12,288 for GPT3.
So the WPE (word position embeddings) for GPT2 is (1024x768) and for GPT3 (4096x12288)
Inference requires info from this vector to be added to the word tokens embedding for each token in the original prompt + each generated token.
As often is the case with these large models, you can change it with some finetuning on longer context samples from the same dataset, with what is really a small amount of compute invested compared to the million hours spent on training the thing.
just checkout Haystack tutorials. I started looking into it after getting introduced to the concept by articles mentioning OpenAI embeddings and GPT 3 api, but it can be done using open source models.
Langchain docs are helpful, and it would be even better if you published an end-to-end notebook using a popular dataset. Definitely looking forward to try langchain as I dive deeper into this.
1. https://haystack.deepset.ai/blog/how-to-build-a-semantic-sea...
You can potentially recursively summarize/create index to breakdown larger texts into smaller chunks.
>Despite recent success in large language model (LLM) reasoning, LLMs struggle with hierarchical multi-step reasoning tasks like generating complex programs. For these tasks, humans often start with a high-level algorithmic design and implement each part gradually. We introduce Parsel, a framework enabling automatic implementation and validation of complex algorithms with code LLMs, taking hierarchical function descriptions in natural language as input. We show that Parsel can be used across domains requiring hierarchical reasoning, including program synthesis, robotic planning, and theorem proving. We show that LLMs generating Parsel solve more competition-level problems in the APPS dataset, resulting in pass rates that are over 75% higher than prior results from directly sampling AlphaCode and Codex, while often using a smaller sample budget. We also find that LLM-generated robotic plans using Parsel as an intermediate language are more than twice as likely to be considered accurate than directly generated plans. Lastly, we explore how Parsel addresses LLM limitations and discuss how Parsel may be useful for human programmers.
A set of data structures to augment LLM's with your data: https://github.com/jerryjliu/gpt_index
So asking a simple one sentence question to a model that has a 81,920 token limit would be a collosal waste of resources.
I just recently tried out one of the most popular [0] Stable Diffusion WebUIs locally, and I'm positively surprised at how different it is to the rest of the space around ML research/computing. I consider myself to be a competent software engineer, but I still often find it pretty tricky to get e.g. HuggingFace models running and doing what I envision them to do. SpeechT5 for instance is reported to do voice transformations, but it took me a good bit of time and hair-pulling to figure out how to extract voice embeddings from .wav files. I'm sure the way to do this is obvious to most researchers, maybe to the point of feeling like this needs not a mention in the documentation, but it certainly wasn't clear to me.
The community around Stable Diffusion is much more inclusive, though. Tools go the extra effort to be easy to use, and documentation for community created models/scripts/tools is so accessible as to be perfectly usable by a non-technical user who is willing to adventure a little bit into the world of hardcore computing by following instructions. Sure, nothing is too polished and you often get the feeling that it's "an ugly thing, but an ugly thing that works", but the point is that it's incredibly accessible. People get to actually use these models to build their stories, fantasy worlds, to work, and things get progressively more impressive as the community builds upon itself (I loved the style of [1] and even effortlessly merged its style with another one in the WebUI, and ControlNet [2] is amazing and gives me ideas for integrating my photography with AI).
I think the general interest in creating images is larger than for LLMs with their current limitations (especially in current consumer-available hardware). I do wonder how much this community interest will boost the spaces in the longer run, but right now I can't help but be impressed by the difference in usability and collaborative development between image generative and other types of models.
[0] https://github.com/AUTOMATIC1111/stable-diffusion-webui
Ooba's textgen webui runs LLaMA 4bit on 8GB VRAM consumer video cards.
KoboldAI (https://github.com/henk717/KoboldAI/) by the creator the AI Horde of stable diffusion fame also supports LLaMA and has forked the Stable Horde for textgen. Currently horde is running half a dozen LLaMA models accessible at http://lite.koboldai.net/
Go to 4chan right now, and poke around their technology and video game boards. There's so much chatter about LLaMa. The last time I saw that much chatter about a technology was when eth was 3 dollars a coin. The communities exist, the general public just isn't aware of them.
George Hotz was so confident that he was riding the wave with his Python implementation: https://github.com/geohot/tinygrad/blob/master/examples/llam.... But I guess not, pure C++ seems better.
That basically the whole AI revolution is powered by CPython of all things (not even PyPy) is the 100 megaton nuke that should end language warring forever.
That the first AGI will likely be running under a VM so inefficient that it refcounts even integers is God laughing in the face of all the people who've spent the past decades arguing that this language or that language is "faster". Amdahl was right: only inner loops matter.
If mainstream AI moves beyond just deep learning and start to encompass other approaches and disciplines (for example, differentiable simulators/renderers), suddenly the language (and the compiler) will be much more important than before.
And a lot of new AI tooling such as tokenization has been developed for Python using Rust (pyo3)
Before Stable Diffusion democratized image generation, Very Serious People across the industry claimed that unless they and their friends exercised strict control over the kinds of images people generated using AI, society would collapse, the sky would fall, and it would all be over. After that, the public gained access to diffusion models for imagine generation, and the sky did not in fact fall. These prognosticators of doom are wearing egg on their faces.
Likewise, today, the intelligentsia is predicting DOOM! DOOM I SAY! if LLMs become available outside the close supervision (and censorship control) of San Francisco trust and safety teams.
Democratizing LLMs will further delegitimize claims that some central authority needs to control this new technology. This is great! When the printing press came out, it took a hundred years to democratize it. It'll take us ten months!
The single biggest benefit of projects like llama.cpp is annihilating claims on the past of gatekeepers that for our own safety we need to let them control how we use math.
Not math. The magical sauce is not math, it's the raw text used to train the model. Language data has this property that it can take a raw initialised neural net and turn it into LLaMA and chatGPT.
The same language data turns babies into modern empowered adults instead of cave men or worse. We're not that smart without language. A single human can't rediscover it, it is a self replicating system evolving in parallel with us.
I wouldn't order figures as Elon Musk or Peter Thiel as intelligentsia. They are just greedy operators for the MIC.
Stable Diffusion kicked off a wave of interest which hasn't stopped building yet - albeit massively accelerated by ChatGPT's release in November.
What do you even mean!
It is being used right now on all sorts of creative industries for things like ui/Ux generation, concept art, vfx production etc
I myself use it for concepting and color correction on video games pipeline production
Have you tried it?
If they were using techniques like GPTQ, presumably it would work much better.
On top of that, you may want to do fine-tuning with reinforcement learning. But the above is “all you need” to get into chat mode with a LLM (or any text generation model, really).
Prior to LLaMA + llama.cpp you could maybe run a large language model locally... if you had the right GPU rig, and if you really knew what you were doing, and were willing to put in a lot of effort to find and figure out how to run a model.
My hunch is that the ability to run on a M1/M2 MacBook is going to open this up to a lot more people.
(I'm exposing my bias here as a M2 Mac owner.)
I think the race is now on to be the first organization to release a good instruction-tuned model that can run on personal hardware.
I suspect people saying it's not good are prompting it like ChatGPT, not realizing how much trickier a raw model is to prompt. Getting the hyperparameters for good sampling is another stumbling block. The models are very good if you do everything properly.
And given how early the cpp port is, there is likely plenty of performance headroom with more m1/m2-specific optimization.
Personally I hope we quickly get to the stage that there's a real open llm like SD is to DALL-E. It sucks to have to bother with Facebook's core model, and give it more attention than it deserves, just because it's out there.
If facebook had actually released it as an open model, I would have said that all the credit should go to them. But instead people are doing great open source work on top of their un-free model just because it's available, and in the popular conception they're going to get credit that they shouldn't
Llama 7B is much better that something like GPT-Neo at text generation.
Kudos to Yann lecun for getting his revenge for Galactica
https://blog.google/products/pixel/introducing-google-tensor...
My money is on something like processing-in-memory enabling inference on gigantic models with rock bottom energy consumption, and rolling out to the masses as a PCIe device. Lots of research on this direction, see https://mythic.ai for an example.
Neuromorphic hardware
Artificial neural networks with backprop is all we need for AI
Some video cards/GPUs have become just that, becoming more and more geared towards non-graphics workloads ...
Well, we have dedicated coprocessors for them (Google TPUs, Nvidia Tensor Cores, Apple Neural Engine, etc.)
There are dedicated cards, though some systems come with them on the mainboard and some videocards have them as well.
Can anyone explain how llama.cpp works? On a very high level, I'm interested in how it's possible to run it on CPU.
Also do I have to bother with their crappy driver module that doesn't support most GPUs?
If your CPU supports AVX2, the output will be "avx2". If your CPU does not support AVX2, the command will not produce any output.
If you want to run on GPU, use the official Python-based stack, which BTW takes about 10GB of runtime binaries on disk, and only supports nVidia GPUs because CUDA.
Do we still need to fill out a form and say we are a researcher?
Not there yet?
Does this still use the gpu?
If it used the GPU/ANE and was a true large language model then it would only work on M1 systems because they're unified memory (which nothing except an A100 can match.)
LLaMA's GPT-3 175B level model, LLaMA-13B, only requires 8GB of VRAM (and no RAM) to run using pre-quantized 4bit weights. So it's hardly a job for an A100.
Even the largest model, LLaMA-65B, is only 30GB and inference can be split between two graphics cards with almost no effect on performance.