Skip to content

Commit

Permalink
Merge branch 'main' into anindya/fine-tuning-section
Browse files Browse the repository at this point in the history
  • Loading branch information
Anindyadeep committed Dec 10, 2023
2 parents 4632816 + aed6e3a commit 24152b1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 16 deletions.
16 changes: 5 additions & 11 deletions _static/emails.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,15 @@ function getCookie(cname) {

async function emailButtonClick() {
let emailInput = document.getElementById("email-input");
let emailValue = emailInput.value;
let res = await fetch("https://premai.pythonanywhere.com/email?a=" + emailValue);
const ok = 200 <= res.status && res.status < 299;
const server_err = 500 <= res.status && res.status < 599;
if (ok || server_err) {
// from https://html.spec.whatwg.org/multipage/input.html#valid-e-mail-address
const valid = /^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;
if (valid.test(emailInput.value)) {
let modal = document.getElementById('email-modal');
modal.style.display = 'none';
emailInput.value = "";
setCookie("address", emailInput.value, 365); // might fail if cookies disabled
} else {
let emailError = document.getElementsByClassName('email-error')[0];
let msg = await res.json();
emailError.innerHTML = "Error " + res.status + ": " + msg.status;
}
if (ok) {
setCookie("address", emailValue, 365); // might fail if cookies disabled
emailError.innerHTML = "Error: please enter a valid email";
}
}

Expand Down
12 changes: 7 additions & 5 deletions fine-tuning.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ Common LLM issues include:

A baseline LLM model cannot answer questions about content is hasn't been trained on {cite}`tidepool-citation`. The LLM will make something up, i.e., hallucinate. To fix issues like this, RAG is a good tool to use because it provides the LLM with the context it needs to answer the question.

On the other hand, if the LLM needs to generate accurate SQL queries, RAG is not going to be of much help here. The format of the generated output matter a lot, so fine-tuning would be more useful for this use case.
On the other hand, if the LLM needs to generate accurate SQL queries, RAG is not going to be of much help here. The format of the generated output matters a lot, so fine-tuning would be more useful for this use case.

Here are some examples of models that have been fine-tuned to generate content in a specific format/style:

Expand All @@ -126,16 +126,16 @@ Here are some examples of models that have been fine-tuned to generate content i
RAG is not a part of fine-tuning, because it uses a pre-trained LLM and does not modify it in any way.
However, there are several advantages to using RAG:

- **Boost model accuracy**
- **Boosts model accuracy**
- Leads to less hallucinations by providing the right context
- **Less computing power required**
- Unlike fine-tuning, RAG does not need to re-train any part of the model. It's only the models prompt that changes.
- **Quick and easy setup**
- RAG does not require much domain expertise about LLMs. You don't need to find training data or corresponding labels. Most pieces of text can be uploaded into the vector db as is, without major modifications.
- RAG does not require much LLM domain expertise. You don't need to find training data or corresponding labels. Most pieces of text can be uploaded into the vector db as is, without major modifications.
- **Connect to private data**
- Using RAG, engineers can connect data from SaaS apps such as Notion, Google Drive, HubSpot, Zendesk, etc. to their LLM. Now the LLM has access to private data and can help answer questions about the data in these applications.

RAG plays a key role in making LLMs for useful, but it can be a bit tedious to set up. There are a number of open-source project such as https://github.com/run-llama/llama_index which can help make the process a bit easier.
RAG plays a key role in making LLMs useful, but it can be a bit tedious to set up. There are a number of open-source project such as https://github.com/run-llama/llama_index which can help make the process a bit easier.

## Fine-tuning Image Models

Expand Down Expand Up @@ -204,7 +204,9 @@ Preparing a robust dataset is key to building a fine-tuned model. For audio rela

The performance of a fine-tuned model largely depends on the **quality** and **quantity** of training data.

For LLMs, the quantity of data can be an important factor when deciding whether to fine-tune or not. There have been many success stories of companies like Bloomberg {cite}`wu2023bloomberggpt`, [Mckinsey](https://www.mckinsey.com/about-us/new-at-mckinsey-blog/meet-lilli-our-generative-ai-tool), and [Moveworks](https://www.moveworks.com/insights/moveworks-enterprise-llm-benchmark-evaluates-large-language-models-for-business-applications) that have either created their own LLM or fine-tuned an existing LLM which has better performance than ChatGPT on certain tasks. However, tens of thousands of data points were required in order to make these successful AI bots and assistants. In the [Moveworks blog post](https://www.moveworks.com/insights/moveworks-enterprise-llm-benchmark-evaluates-large-language-models-for-business-applications), the fine-tuned model which surpasses the performance of GPT-4 on certain tasks, was trained on an internal dataset consisting of 70K instructions.
For LLMs, the quantity of data can be an important factor when deciding whether to fine-tune or not. There have been many success stories of companies like Bloomberg {cite}`wu2023bloomberggpt`, [Mckinsey](https://www.mckinsey.com/about-us/new-at-mckinsey-blog/meet-lilli-our-generative-ai-tool), and [Moveworks] that have either created their own LLM or fine-tuned an existing LLM which has better performance than ChatGPT on certain tasks. However, tens of thousands of data points were required in order to make these successful AI bots and assistants. In the [Moveworks blog post][Moveworks], the fine-tuned model which surpasses the performance of GPT-4 on certain tasks, was trained on an internal dataset consisting of 70K instructions.

[Moveworks]: https://www.moveworks.com/us/en/resources/blog/moveworks-enterprise-llm-benchmark-evaluates-large-language-models-for-business-applications

In the case of computer vision models, data quality can play a significant role in the performance of the model. Andrew Ng, a prominent researcher and entrepreneur in the field of AI, has been an advocate of data centric AI in which the quality of the data is more important than the sheer volume of data {cite}`small-data-tds`.

Expand Down

0 comments on commit 24152b1

Please sign in to comment.