Ask HN: What's the best self hosted/local alternative to GPT-4?
Constant outages and the model seemingly getting nerfed[^1] are driving me insane.
Which viable alternatives to GPT-4 exist? Preferably self-hosted (I'm okay with paying for it) and with an API that's compatible with the OpenAI API.
[^1]: https://news.ycombinator.com/item?id=36134249
201 comments
[ 3.5 ms ] story [ 256 ms ] threadWizardlm-uncensored-30B is fun to play with.
I use it all the time at home. It's decent at things like summaries and writing content. It follows instructions as well as GPT and isn't nearly as pretentious but it's still a bit pretentious.
It's not very good at code.
It’s actually impressive how good it is considering the limited resources they have.
https://www.youtube.com/watch?v=qM79_itR0Nc
For compatibility with the OpenAI API one project to consider is https://github.com/go-skynet/LocalAI
None of the open models are close to GPT-4 yet, but some of the LLaMA derivatives feel similar to GPT3.5.
Licenses are a big question though: if you want something you can use for commercial purposes your options are much more limited.
[1] https://arxiv.org/abs/2305.18290
https://justine.lol/mmap/
But it is definitely no GPT3.5 or GPT4 replacement. It will not be good for getting "work" done or helping do tasks. It's for recreation. If you want a GPT3.5 level LLM, something akin to text-davinci-002, you'll need to do the SFT and RLHF fine tuning of the 65B llama yourself. And that's no small task. Neither is running a 65B model (even at 4 bits).
The big models, if even available, need >100GB of graphics memory to run and would likely take minutes to warm up.
The pricing available via OpenAI/GCP/etc is only effective when you can multi-tenant many users. The cost to run one of these systems for private use would be ~$250k per year.
It's easy to run a much worse model on much worse hardware, but there's a reason why it's only companies with huge datacenter investments running the top models.
And this spreadsheet shows a pretty comprehensive list of LLMs: https://anania.ai/chatgpt-alternatives/
Currently the "best" ones seem to be Llama and Dolly. Dolly can be used commercially, and Llama cannot, so it's best for personal use.
I myself have been trying to get [the huggingface chat ui](https://github.com/huggingface/chat-ui) running on my own system, but it's finicky. Right now I'm focused on getting immediate income so I can't spend too much effort on it.
Overall, no model gets close to the accuracy of GPT-3 or 4 (though Llama does decently), though I can definitely imagine in 3 years or so open source can match or even exceed the capabilities of OpenAI's model.
Obviously being legally right doesn't necessarily save you from having Meta's legal team breathing down your neck...
Perhaps that's okay, I don't know, but it seems strange that the little pieces of client-side javascript are so copyrightable yet this other work isn't.
No, you don't.
It's a simple app download and allows you to select from multiple available models. No hacking required.
I also remember something more directly analogous to @home, but I'm having a hard time finding it.
Edit: Petals! Thank you sibling commenter!
I think the problem is that it's hard to parallelize this effectively across a network with Internet-scale latency - individual matrix multiplications parallelize very well, but there would need to be coordination of each result, which would be much slower than just doing the computation locally.
In the case of Folding@home, evaluating possible folds could be done completely in parallel and only need to be coordinated on discovery of a plausible fold (which is rare), so distributing over a high-latency network is still beneficial.
While this is a MINST classifier (and can be run in the browser) you can get an idea of the math behind it. https://www.3blue1brown.com/lessons/gradient-descent and https://www.3blue1brown.com/lessons/neural-network-analysis
When dealing with a LLM, it's being run again and again - token by token. Pick the best next token, append it to the input, run it again.
If you want to generate 100 tokens (rather small amount of data when compared to much of the GPT-4 conversations), that means running it 100 times.
The network traffic makes the entire system much slower than running it all in one spot.
Consider also the "are you the input to everyone?" and the privacy implications of that.
Guanaco-65B is per https://arxiv.org/abs/2305.14314
CPU Version: https://huggingface.co/TheBloke/guanaco-65B-GGML
GPU Version: https://huggingface.co/TheBloke/guanaco-65B-HF
4bit GPU Version: https://huggingface.co/TheBloke/guanaco-65B-GPTQ
The more you can fit on your GPU (in VRAM) the better (for speed), but no GPU is strictly required.
I'm the founder of Mirage Studio and we created https://www.mirage-studio.io/private_chatgpt. A privacy-first ChatGPT alternative that can be hosted on-premise or on a leading EU cloud provider.
A quick test of the huggingface demo gives reasonable results[1]. The actual model behind the space is here[2], and should be self-hostable with reasonable effort.
0. https://arxiv.org/abs/2305.14314 1. https://huggingface.co/spaces/uwnlp/guanaco-playground-tgi 2. https://huggingface.co/timdettmers/guanaco-33b-merged
I'd really like someone to make a big leaderboard/ranking engine which pits all these engines against eachother and publishes the resulting Elo score.
A basic question: How can i join with SQL a column to a string separated with comma
GPT-4: PostgreSQL: SELECT STRING_AGG(columnName, ', ') FROM tableName;
Guanaco: Here is an example of how you could use the CONCAT function in MySQL to concatenate a string to a column value in a single-line query: SELECT CONCAT('The total price for ', product_name, ’ is ', SUM(price)) AS total FROM products; This will result in output like “The total price for Chocolate Bar is 10” or similar depending on your data.
Yeah, no...
I just ask "What is the capital of France?" and I haven't had a correct answer yet in any model I tried. They often get Paris right at least, but most other details are wrong.
Guanaco says:
> The current capital of France is Paris. It has been so since 1982 when it replaced the previous one which was Vichy.
I think I might give this one to Guanaco. I’m moderately familiar with SQL, and I can’t really understand your question. You’re faking the reader out by using “join” to mean something which is not JOIN.
So do you mean to concatenate a string in a column (coming from a single row) to a “string separated with a comma”? If so (and assuming “separated” means starting or ending with), then Guanaco nailed it. If you meant to join (in the Python sense) the values from a given column in multiple rows, then GPT-4 is doing better.
But GPT-4 gave no explanation, and my general experience with it is that it’s happy to write code that does something vaguely related to the prompt. As the prompt gets more complex or unusual, the degree to which the code doesn’t actually do something useful increases. And I have had quite poor results getting ChatGPT to generate code along with some explanation such that the code actually matches the explanation.
Yeah and not having to do precise prompt engineering is a major advantage of GPT-4 vs other models.
edit: I guess GPT-4 has better reading comprension than me!
A skilled human will distinguish themselves from a less skilled human by also thinking about the overall problem and helping make sure the specification is correct. This far, I have not seen an AI meet that bar unless the problem is something well-covered already on the web.
I have seen ChatGPT (3.5 and 4) output code that is syntactically correct, executes without errors, and does the wrong things in ways that are not entirely obvious to me until I read the docs myself.
I've only used Bard so far, but indeed, it has never replied to my question with a clarifying question. Only with a statement. This seems like an obvious evolution of the chatbot concept...
As a human, I wouldn't know what to give you for this either. Not surprised the models give unexpected results. "Guanaco" gives something more in line with what I understand you to be asking for, but clearly you're asking for something else that I don't understand.
> How can I join a column with SQL in Postgres to a string separated with a comma?
You can use the `string_agg` function in PostgreSQL to concatenate columns into a string. For example, to concatenate all values from a column named "column1" into a single string separated by commas, you can run the following query:
```sql
SELECT string_agg(column1, ',') FROM table;
```
The `string_agg` function takes two arguments: the first argument is the expression to concatenate (in this case column1), and the second argument is the separator between each value (in this case a comma). The query above will return a single string containing all values from column1 separated by commas.
I generally find WizardLM 1.0, Guanaco and Manticore to be good enough for most GPT cases.
Well, you asked for sql and ansi sql function is listagg(), so technically this is not the right answer - and definitely a completely useless one for mysql or oracle users.
MySQL: SELECT GROUP_CONCAT(columnName SEPARATOR ', ') FROM tableName;
Oracle: SELECT LISTAGG(columnName, ', ') WITHIN GROUP (ORDER BY columnName) FROM tableName;
I mean, it's not a big deal.. you just give have to give it a little nudge.
This model seems roughly on par with GPT-3, maybe GPT-3.5 in some cases.
> Write a function to compute the maximum, minimum, and average of an array of doubles in C.
Here is an example function in C that computes the maximum, minimum, and average of an array of doubles:
```c void compute_statistics(double arr[], int n) { double max = arr[0]; double min = arr[0]; double sum = 0.0; for (int i = 1; i < n; i++) { if (arr[i] > max) { max = arr[i]; } else if (arr[i] < min) { min = arr[i]; } sum += arr[i]; } double avg = sum / n; printf("Maximum: %.2f", max); printf("Minimum: %.2f", min); printf("Average: %.2f", avg); } ```
To use this function, simply call it with the array of doubles and its length as arguments. For example:
```c double arr[] = {1.0, 2.5, 3.0, 4.0, 5.0}; int n = sizeof(arr) / sizeof(arr[0]); compute_statistics(arr, n); ```
This will output:
``` Maximum: 5.00 Minimum: 1.00 Average: 3.00 ```
Here are some simple logic questions:
> Compute the sum of an array of 512 elements with each element having the value 2.
The sum of an array of 512 elements with each element having the value 2 is 1024.
> Compute the sum of an array of 512 elements with each element having the value 3.
The sum of an array of 512 elements with each element having the value 3 is 1536.
Not bad.
My conclusion is that they are using the data from users to improve or some other prompt injection tricks.
So the comparision is not even fair.
CPU Version: https://huggingface.co/TheBloke/guanaco-65B-GGML
GPU Version: https://huggingface.co/TheBloke/guanaco-65B-HF
4bit GPU Version: https://huggingface.co/TheBloke/guanaco-65B-GPTQ
How much ram and vram does one need to run 4,13,33,65B models at a reasonable speed?
edit: instead I'll ask this, what's the best model to run on a system with a 24gb 4090 and 64gb of ram?
You can run 4-bit quantized 65B models on your cpu, but it is slow, 1-2 tokens a second instead of 8-15 people typically get with a gpu, but you need two 24gb or an enterprise card with 48gb of ram to load them there.
https://old.reddit.com/r/LocalLLaMA/wiki/models has the information you are irritated about not being listed.
"Reasonable speed" is subjective, though.
Easy way to self-host it is to use text-generation-webui[1] and 33B 4-bit quantized GGML model from TheBloke[2].
[1] https://github.com/oobabooga/text-generation-webui
[2] https://huggingface.co/TheBloke/guanaco-33B-GGML
You’re stuck with openai, and you’re stuck with whatever rules, limitations or changes they give you.
There are other models, but specifically if you’re actively using gpt-4 and find gpt-3.5 to be below the quality you require…
Too bad. You’re out of luck.
Wait for better open source models or wait patiently for someone to release a meaningful competitor, or wait for openai to release a better version.
That’s it. Right now, there’s no one else letting people have access to their models which are equivalent to gpt-4.
There’s a gap, it’s closing, likely faster than anticipated.
Huggingface awaits :)
I also generally prefer Claude or Claude+ over GPT4 or ChatGPT (GPT 3.5) for explanations too, which tend to be more thorough without any special prompting.
So for example Tesla has/had a lead in EV tech, but their supercharger network is a moat because it’s very difficult for a rival to compete with, even if they have equivalent EV tech.
I know there isn’t established terminology for this. It is a nitpick, but I think a lead is already a term we have, and moat has connotations of being in some way ‘unfair’. To me, just creating a better product isn’t unfair in any meaningful way, while moats in some circumstances can represent anti trust issues.
But perhaps at this stage Google's not meant to / need to build cutting edge products, but rather focus on commoditizing the ones that prove profitable.
How is Google "losing" when they are not even in the same market? Are you expecting Google to develop and sell access to an LLM API or use AI internally to enhance it's other products (which it jas been doing to great effect)
OpenAI has a lead on Bard, LLaMA and friends, but I would expect that to close in the next few months or years.
The technology is just GPT and transformers, the open source alternatives are just not as advanced as the GPT4 model yet. It might change with current trajectory, mainly because OpenAI keeps nerfing it.
The design of abstractions, prompt engineering, custom fine-tunes and software engineering required to ship a valuable application on top of that interface counts as "building an app" in my book.
https://cloud.google.com/vertex-ai/docs/generative-ai/models...
You can generate the training data for this with 3.5 and 4 and tune smaller models with the resulting data. For lots of tasks, this results in robust results, which btw are also faster than 3.5 turbo.
I don’t think OpenAI’s contribution should be so understated- they built a technology that was considered science fiction just a few years ago. They deserve all the credit for the “AI”.
We can now write software that interprets language under the hood (to some degree). The value propositions enabled by this change in the world are so vast, and partly so complex - to make absolute statements like "yeah but you don't control the model, so anyone can copy your solution" seems out of touch to me. What subset of technology doesn't get reverse engineered? Either this applies almost nowhere (because every piece of tech that an engineer can get their hands on is effectively open), or everywhere.
I would also add "distribution" to the "app and UX" part, but you can certainly build a valuable business upon an API "everyone else has access to" - plenty of companies out there that do that.
[0]https://twitter.com/englishpaulm/status/1623701758781558784
That doesn't mean that everything else in the stack is window dressing though - custom, domain specific wrangling with the different api endpoints, finding a satisfying prompt, temperature param etc. for specific tasks - the entire process of designing systems around an LLM-api has many intricacies to it, lots of which are completely uncharted territory.
I can assure you: very smart people are knees deep in this process, and they deserve the credit for their share of the value that is being created.
However, the "very very temporary space" might as well lead to momentum and a moat in a subdomain, and anyone who met a sufficiently large number of smart people knows that lots of them are very pragmatic, don't chase prestige, and enjoy laying ground work for future iterations.
So I have to believe that the people making these products are intending to make as much cash as possible up front and aren't aiming for a long-term thing.
It's certainly building an app. It's not building an AI app, though. It's building a front-end to an existing AI application.
Replace social media / graph APIs with the ones from OpenAI
Depending on your business case, the 4096 tokens given to you have to go quite far. Vector embeddings are not "easy" to work with. Trying to splat together a range of techniques to craft a good prompt is hard™.
Adding in Actions (e.g. using headless browsers to open pages etc) is also pioneering territory.
Sucks that OpenAI currently has the market, but there is still plenty of reasons to develop on top of it.
Claude should be more well known, imo. ChatGPT/GPT4 gets all the hype, but Claude is really good too... sometimes even better.
And this is Claude+: https://poe.com/Claude%2B
Of course, running a 180B dense transformer at home for personal use is utterly impractical.
(You can use any ChatGPT front-end which lets you change the OpenAI endpoint URL.)
[0] https://huggingface.co/TheBloke/guanaco-65B-HF A QLoRA finetune of LLaMA-65B by Tim Dettmers from the paper here: https://arxiv.org/abs/2305.14314
[1] https://github.com/hyperonym/basaran
They also have A/B testing with a leaderboard where vicunia wins for the self-hostable ones: https://chat.lmsys.org/?leaderboard