Create your chatgpt clone with free and open source alternatives! Discover 12 options to develop your chatbot without additional costs.

If you are interested in creating your chatgpt clone but you prefer free alternatives and open source, you are in the right place. In this article, we will explore 12 alternatives aChatgpt you can useTo create your chatbot model without having to spend money.
The advantages of free and open source alternatives to chatgpt
Before immersing us in specific alternatives, it is important to understand the advantages of using open source language models compared to chatgpt.
- Data privacy.Many companies want to maintain control of their data and do not want to grant access to third parties.
- Customization.Open source alternatives allow developers to train personalized language models using their data and apply filters on certain topics if necessary.
- Economic accessibility.The open source GPT models allow you to train sophisticated language models without worrying about expensive hardware.
- Democratization of AI.The use of open source models opens the way to further research that can be used to solve problems of the real world.
Now that we have clarified the advantages, let's go to examine the free and open source alternatives to chatgpt.
1. Llama
Introduction to Llama
Llama stands for Large Language Model Meta Ai. It is a model that includes a series of size from 7 billion to 65 billion parameters. Meta Ai researchers focused on improving the performance of the model by increasing the volume of training data, rather than the number of parameters. They said that the 13 billion parameters model exceeded 175 billion parameters of the GPT-3 model. Llama uses the transformer architecture and was trained on 1.4 trillions of token extracted from Wikipedia, Github, Stack Exchange web scraping, Project Gutenberg books and scientific articles on Arxiv.
Python code for Llama
# Install the PIP Install Llama-CPP-Python PAP PAP FROM_CPP IMPORT LLAMA LLM = LLAMA (Model_path = "./ Models/7b/GGML-Model.bin") Output = LLM ("Q: List of the planets of the Solar System? A:", Max_TOKENS = 128, Stop = ["q:". " Echo = True) Print (output)
2. Llama 2
What's new in Llama 2
There are some key differences between Llama 2 and Llama:
Training data
: Llama 2 was trained on a number of token 40% greater than Llama, for a total of 2 trillion of token. This gives him a wider base of knowledge and allows him to generate more accurate answers.Dimensioni del modello
: Llama 2 is available in three dimensions: 7 billion parameters, 13 billion parameters and 70 billion parameters. While the maximum size of Llama is 65 billion parameters.Ottimizzazione della chat
: Llama 2-Chat is a specialized version of Llama 2 optimized for bidirectional conversations. He was trained on a dataset of human conversations, which allows him to generate more natural and engaging responses.Sicurezza e mitigazione dei pregiudizi
: Llama 2 was trained with particular attention to the safety and mitigation of prejudices. This means that it is less likely that toxic or harmful content is generated.Open source
: Llama 2 is Open Source, which means that anyone can use it for research or commercial purposes, unlike Llama that cannot be used for commercial purposes.
Python Code for Llama 2
To perform the Llama2 model of 7 billion parameters, here is the reference code:
%cd /content !apt-get -y install -qq aria2 !git clone -b v1.3 https://github.com/camenduru/text-generation-webui %cd /content/text-generation-webui !pip install -r requirements.txt !pip install -U gradio==3.28.3 !mkdir /content/text-generation-webui/repositories %cd /content/text-generation-webui/repositories !git clone -b v1.2 https://github.com/camenduru/GPTQ-for-LLaMa.git %cd GPTQ-for-LLaMa !python setup_cuda.py install !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/4bit/Llama-2-7b-Chat-GPTQ/raw/main/config.json -d /content/text-generation-webui/models/Llama-2-7b-Chat-GPTQ -o config.json !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/4bit/Llama-2-7b-Chat-GPTQ/raw/main/generation_config.json -d /content/text-generation-webui/models/Llama-2-7b-Chat-GPTQ -o generation_config.json !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/4bit/Llama-2-7b-Chat-GPTQ/raw/main/special_tokens_map.json -d /content/text-generation-webui/models/Llama-2-7b-Chat-GPTQ -o special_tokens_map.json !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/4bit/Llama-2-7b-Chat-GPTQ/resolve/main/tokenizer.model -d /content/text-generation-webui/models/Llama-2-7b-Chat-GPTQ -o tokenizer.model !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/4bit/Llama-2-7b-Chat-GPTQ/raw/main/tokenizer_config.json -d /content/text-generation-webui/models/Llama-2-7b-Chat-GPTQ -o tokenizer_config.json !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/4bit/Llama-2-7b-Chat-GPTQ/resolve/main/gptq_model-4bit-128g.safetensors -d /content/text-generation-webui/models/Llama-2-7b-Chat-GPTQ -o gptq_model-4bit-128g.safetensors %cd /content/text-generation-webui !python server.py --share --chat --wbits 4 --groupsize 128 --model_type llama
For the Llama2 model of 13 billion parameters, you can refer to the following code:
%cd /content !apt-get -y install -qq aria2 !git clone -b v1.8 https://github.com/camenduru/text-generation-webui %cd /content/text-generation-webui !pip install -r requirements.txt !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/4bit/Llama-2-13b-chat-hf/resolve/main/model-00001-of-00003.safetensors -d /content/text-generation-webui/models/Llama-2-13b-chat-hf -o model-00001-of-00003.safetensors !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/4bit/Llama-2-13b-chat-hf/resolve/main/model-00002-of-00003.safetensors -d /content/text-generation-webui/models/Llama-2-13b-chat-hf -o model-00002-of-00003.safetensors !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/4bit/Llama-2-13b-chat-hf/resolve/main/model-00003-of-00003.safetensors -d /content/text-generation-webui/models/Llama-2-13b-chat-hf -o model-00003-of-00003.safetensors !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/4bit/Llama-2-13b-chat-hf/raw/main/model.safetensors.index.json -d /content/text-generation-webui/models/Llama-2-13b-chat-hf -o model.safetensors.index.json !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/4bit/Llama-2-13b-chat-hf/raw/main/special_tokens_map.json -d /content/text-generation-webui/models/Llama-2-13b-chat-hf -o special_tokens_map.json !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/4bit/Llama-2-13b-chat-hf/resolve/main/tokenizer.model -d /content/text-generation-webui/models/Llama-2-13b-chat-hf -o tokenizer.model !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/4bit/Llama-2-13b-chat-hf/raw/main/tokenizer_config.json -d /content/text-generation-webui/models/Llama-2-13b-chat-hf -o tokenizer_config.json !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/4bit/Llama-2-13b-chat-hf/raw/main/config.json -d /content/text-generation-webui/models/Llama-2-13b-chat-hf -o config.json !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/4bit/Llama-2-13b-chat-hf/raw/main/generation_config.json -d /content/text-generation-webui/models/Llama-2-13b-chat-hf -o generation_config.json %cd /content/text-generation-webui !python server.py --share --chat --load-in-8bit --model /content/text-generation-webui/models/Llama-2-13b-chat-hf
3. Alpaca
Introduction to Alpaca
A team of researchers from the University of Stanford has developed an open source language model called Alpaca. It is based on the great language model of a destination called Llama. The team used the Openai GPT API (Text-Davinci-003) to improve the Llama model of 7 billion parameters. The team's goal is to make the IA available for free to allow academics to do further research without having to worry about expensive hardware to perform these intensive algorithms in memory. Although these open source models are not available for commercial use, small companies can still use them to create their own chatbots.
How Alpaca works
Stanford's team started their research with the smallest language model among those of Llama, or the 7 billion parameters Llamm model, and pre-investigated it with 1 trillion of token. They started with 175 couples of instruction-response written by human beings from the seed set of self-education. They then used the chatgpt bees to ask Chatgpt to generate further instructions using the seed set. In this way they obtained about 52,000 example conversations, which they used for further refinements of the Llama model using the Hugging Face training framework.
Llama is available in different sizes: 7b, 13b, 30b and 65b of parameters. Alpaca has also been extended to 13b, 30b and 65b models.
Alpaca performance
The Alpaca model has been tested with respect to chatgpt in tasks such as the creation of email, isocial mediaAnd the productivity tools, and Alpaca won 90 times while Chatgpt has won 89 times. The model can be used in the real world for various purposes. It will be of great help for researchers in the field of ethics and computer security, as in detecting scams and phishing.
Alpaca limitations
Like the commercial version of Chatgpt, Alpaca also presents similar limitations, such as healicination, toxicity and stereotypes. In other words, it can be used to generate text that spreads disinformation, racism and hatred towards vulnerable sections of society.
Alpaca memory requirements
Alpaca cannot be performed on CPU, requires a GPU. For 7b and 13b models, a single GPU with 12 GB of RAM is sufficient. For the 30b model, additional system resources are required.
Python code for Alpaca
Here is a reference code for Alpaca. It is a chat application that uses the Alpaca 7B model:
Import Sys Sys.path.Appand ("/USR/Local/Lib/Python3.9/Site-packages")! Nvidia-mmi! Git Clone https://github.com/deepanshu88/alpaca-lora-omve.git %CD Alpaca-Lora-omve! Python3.9 -M Pip Install -R Requirements.txt Base_Model = 'Decapoda-Research/Llama-7b-HF' FineUned_Model = 'Tloen/Alpaca-Lora-7b'! Python3.9 App.Py-Base_url $ base_model-Ft_ckPt_url $ fineUned_model-Share-
Remember that this is only a reference code for Alpaca 7b. You can adapt it to use models of different sizes, such as Alpaca 13b and Alpaca 30b.
Alpaca output
Below is an example of Alpaca output in response to two relatively simple questions. One question concerns a generic topic and the other concerns coding. Alpaca answers both questions correctly.
4. Gpt4all
Introduction to GPT4All
The Nomic Ai team was inspired by Alpaca and used the Openii GPT-3.5-12-5-5-5-5-5th API to collect prompt-response couples in order to create 430,000 assistant style prompts and generations, including codes, dialogues and narratives. The 800,000 couples are about 16 times larger from Alpaca. The interesting thing about this model is that it can be performed on CPU, it does not require a GPU. Like Alpaca, it is also open source, which means you can use it for commercial purposes and you can easily perform it on your computer.
How GPT4All works
It works in a similar way to Alpaca and is based on the 7 billion parameter Llamm model. The team trained 7b Llama models and the final model was trained on the 437,605 post-elaborated assistant style prompt.
GPT4All performance
In the processing of natural language, perplexity is used to evaluate the quality of language models. Measure how surprised a language model would be to see a new sequence of words he has never met before, based on his training data. A lower perplexity value indicates that the language model is better in predicting the next word in a sequence and therefore is more accurate. Nomic's team to the states that their models have a lower perplexity than Alpaca. However, the real accuracy depends on the type of prompt you use. Alpaca could have a better accuracy in some cases.
GPT4all memory requirements
It can be performed on a CPU with 8GB of RAM. If you have a laptop with 4GB of RAM, it could be time to upgrade to at least 8GB.
Python code for GPT4All
Here is a reference code for GPT4All. You can use it as a reference, change it according to your needs or perform it as it is. It is entirely at your discretion to decide how to use the code to better adapt it to your needs.
# Clone The Git! Git Clone repository -Recurse-submodules https://github.com/nomic-ai/gpt4all.git # Install the requested packages cd/content/GPT4all! Python -m pip install -r repaquirements.txt cd transformers! Pip install -e. cd ../peft! pip install -e. # Start training! Accelerate launch -Dynamo_backe = inductor -Num_processs = 8 -Num_machines = 1 -Machine_rank = 0 -Despespeed_multinode_launcher Standard -Mixed_precision = BF16 -US_DEPSPEEDED -Eepspeed_config_file = configs/deeppspeed/ds_config.json Train.py -Config Confs/Train/Fineune.Yaml # Download the checkpoint of the GPT4All CD/Content/GPT4all/Chat! Wget model https://the-eye.eu/public/ai/models/nomic-ai/gpt4all/gpt4all-lora-quantized.bin # Perform the conversation system!.
If you are performing the code on a local machine that uses a different operating system from Linux, use the following commands instead:
Windows (Powershell):./GPT4all-Lora-quanized-win64.exeMac (M1):./GPT4all-Lora-quanized-Osx-M1Mac (Intel):./GPT4all-Lora-quanized- osx-INTEL
GPT4All output
GPT4All was not able to respond correctly to a question relating to coding. This is just an example and we cannot evaluate the accuracy of the model according to a single case. It could work well in other prompts, so the accuracy of the model depends on the use you do. Also, when I performed it again after 2 days, it worked well for questions related to coding. It seems that they have further perfected the model.
Resolution of GPT4All problems
If you meet problems with the distributed version that does not have NCCL, it could be because Cuda is not installed on your computer.
Some users have reported strange errors on the Windows 10/11 platform. As a last resource, you can install the Windows Subshystem for Linux, which allows you to install a Linux distribution on your Windows computer and follow the above code.
5. GPT4all-J
This model has a name similar to the previous one, but the difference is that both models come from the same Nomic Ai team. The only change is that it has now been trained on GPT -J instead of Llam. The advantage of training it on GPT-J is that GPT4All-J is now with Apache-2 license, which means that you can use it for commercial purposes and you can easily perform it on your computer.
6. Dolly 2
The Databrks team created a language model based on the Pythia model of Eleutherai, subsequently perfected on about 15,000 instructions taken by a corpus. It is available in three dimensions: 12b, 7b and 3b of parameters.
Dolly 2 memory requirements
Requires a GPU with about 10GB of RAM for the 7B model with 8 -bit quantization. For the 12B model, at least 18GB of VRAM of the GPU is required.
Python code for Dolly 2
Here is a reference code for Dolly 2. You can use it as a reference to access the Python code and a detailed description of the Dolly model.
7. Vicuna
Introduction to Vicuna
A team of researchers from UC Berkeley, Cmu, Stanford and UC San Diego has developed this model. It was perfected on Llama using a chat dataset extracted from the ShareGpt website. The researchers say that the model has obtained a quality greater than 90% compared to Openai Chatgpt-4. It is worth noting that its performance is almost equal to Bard. They used the Alpaca training program and have further improved two aspects: the several round conversations and long sequences.
Python code for Vicuna
You can refer to this post - Vicuna detailed guide to access the Python code and a detailed description of the Vicuna model.
8. Stablevicuna
Introduction to Stablevicuna
Estabilities AI has released Stablevicuna, an perfect version of the 13b Vicuna model. To improve the Vicuna model, they trained it further using the supervised end-tuning (SFT). They used three different datasets to train it:
- Openassistant Conversations Dataset, which contains 161,443 human conversation messages in 35 different languages.
- GPT4All Prompt Generations, which is a dataset of 437,605 prompts and responses generated by GPT-3.5.
- Alpaca, which is a dataset of 52,000 prompts and responses generated by the Text-Davinci-003 model.
They used Trolx to train a reward model. This model has been set up using their further SFT model. Reward's model was trained using three datasets with human preferences:
- Openassistant Conversations Dataset with 7213 preference samples.
- Anthropic HH-Mrhf with 160,800 labels of people who express what they think of the usefulness or nocity of the IA assistants.
- Stanford Human Preferences with 348,718 human preferences on answers to questions or instructions in different areas, such as cuisine or philosophy.
Finally, the SFT model was trained using RLHF with Trolx through a process called Proximal Policy Optimization. Here's how Stablevicuna was created.
Stablevicuna memory requirements
To perform the 4 -bit Stablevicuna GPTQ model, about 10GB of GPU VRAM are required.
Stablevicuna performance problems
Stability to the states that this model is an improvement compared to the original Vicuna model, but many people have reported the opposite. This model makes more "halucinations" than the original model, producing worse answers. In other words, the model generates inaccurate output that does not correspond to the question. Since these models have just been released, a rigorous evaluation is still necessary. It is possible that this model can work better in some tasks, but much worse in others.
Python code for Stablevicuna
We can perform the model using Text Generation Webui, which makes the LLM Open Source model easy. The following code performs a 4 -bit quantization that reduces the model's memory requirements and makes it possible to execute with less VRAM.
%cd /content! apt -gt -y install -qq air2! git clone -b v1
9. Alpaca GPT-4 Model
Introduction to the Alpaca GPT-4
Alpaca GPT-4 is a language model developed by Openai. It is an improved version of the Alpaca model that uses 10 trillion of token for training. Alpaca GPT-4 is known for its ability to generate high quality texts and coherent responses.
Python code for Alpaca GPT-4
At the moment, Openii has not released the code or the pre-edited model for Alpaca GPT-4. However, you can use other free and open source alternatives listed in this article to create your chatbot.
10. Cerebras-GPT
Introduction to Cerebras-GPT
Cerebras-GPT is a language model developed by the Cerebras artificial intelligence society. Use the parallel processing technology of the Cerebras chip to train large language models. Cerebras-GPT is known for its high-level performance and its ability to process large quantities of data efficiently.
Cerebras-GPT memory requirements
Cerebras-GPT requires a GPU with a large amount of VRAM memory, preferably 32 GB or more, to perform large language models.
Python code for Cerebras-GPT
At the moment, Cerebras has not released the code or the pre-edited model for Cerebras-GPT. However, you can use the free and open source alternatives listed in this article to create your chatbot.
11. GPT-J 6B
Introduction to GPT-J 6B
GPT-J 6B is a large language model developed by Eleutherai. It has been trained on 6 billion parameters using advanced automatic learning techniques. GPT-J 6B is known for its ability to generate coherent and high quality texts on a wide range of topics.
Python code for GPT-J 6B
At the moment, Eleuthei has not released the code or the pre-edited model for GPT-J 6B. However, you can use the free and open source alternatives listed in this article to create your chatbot.
12. OpenChatkit Model
Introduction to the OpenChatkit Model
OpenChatkit Model is a model of open source chatbot developed by Openi. It is based on transformer architecture and can be used to create chatbots with coherent and high quality responses.
Python code for OpenChatkit Model
At the moment, Openii has not released the code or the pre-edited model for OpenChatkit Model. However, you can use the free and open source alternatives listed in this article to create your chatbot.
Published inArtificial intelligence, Development & programming
Comment first