#Finetuning helps #LLMs to overcome their limitations such as hallucination, missing context, etc.
Here is a example code on how to fine-tune a large language model like Llama2 on custom datasets using the QLoRA technique.
https://t.co/luYeO6bU81
How to Reduce the Hallucinations from Large Language Models?
Hallucinations can be a serious problem for LLMs because they can lead to the spread of misinformation, expose confidential information, and create unrealistic expectations about what LLMs can do.
For Example: User ask question it will first create embedding and extract most closest context from database and pass it into prompt and then LLM generates the output.
Retrieval Augmented Generation aka RAG
RAG is a powerful tool that combines the benefits of retrieval-based models and generative models.
It involves retrieving relevant information from a large database and using that information to generate a response or solution.
While both RAG and Prompt Engineering contribute to problem-solving. RAG focuses on retrieving relevant information from a database, while Prompt Engineering focuses on guiding the model's generation process through well-crafted prompts.
Prompt
A prompt is simply the input text given to an LLM, and is meant to guide the model to generate the desired output.
A prompt can consist of multiple components:
1. Instructions or Description
2. External information or context
3. User input or query
4. Output indicator
Example:
"Classify the text into neutral, negative or positive.
Text: I think the vacation is okay.
Sentiment:"
2. Few Shot prompt: The model is given small number of examples (few shots) related to task before attempting it.
For example the public IP address of the new instance is written to a local file ip_address.txt.
3. Remote-exec Provisioner: The remote-exec Provisioner runs commands on the remote machine. It connects via SSH or WinRM.
In Terraform, "provisioners" are used as a last resort to execute scrips or action on a local or remote machine to prepare servers or other infrastructure objects.
This provisioners is used to copy files from your local machine to the remote machine.
2. Local-exec Provisioners: This provisioner is used to execute a command on the machine where Terraform is being run. This could be to Runa cleanup or an initialisation script.
8. Terraform state:
Performs operations on the Terraform state, such as listing resources or moving resources to a different state file.
terraform state list
Below are the some useful commands in terraforms.
1. Terraform init: Initializes a Terraform working directory by downloading the necessary provider plugins and setting up the backend.
terraform init
terraform validate
6. terraform fmt:
Rewrites Terraform configuration files to a canonical format with consistent indentation and formatting.
terraform fmt
7. Terraform show:
Outputs the current state or a saved plan in a human-readable format.
terraform show