From dfd662de77ea0f0480ae9375b9bf90a672630e12 Mon Sep 17 00:00:00 2001 From: Elvis Saravia Date: Wed, 1 Mar 2023 03:17:02 -0600 Subject: [PATCH] added notes --- ...s-reliablity.md => prompts-reliability.md} | 79 +++++++++---------- 1 file changed, 39 insertions(+), 40 deletions(-) rename guides/{prompts-reliablity.md => prompts-reliability.md} (98%) diff --git a/guides/prompts-reliablity.md b/guides/prompts-reliability.md similarity index 98% rename from guides/prompts-reliablity.md rename to guides/prompts-reliability.md index c9bd735..e69303b 100644 --- a/guides/prompts-reliablity.md +++ b/guides/prompts-reliability.md @@ -5,15 +5,50 @@ We have seen already how effective well-crafted prompts can be for various tasks **Note that this section is under heavy development.** Topics: -- [Biases](#biases) - [Factuality](#factuality) +- [Biases](#biases) - ... +--- +## Factuality +LLMs have a tendency to generate responses that sounds coherent and convincing but can sometimes be made up. Improving prompts can help improve the model to generate more accurate/factual responses and reduce the likelihood to generate inconsistent and made up responses. + +Some solutions might include: +- provide ground truth (e.g., related article paragraph or Wikipedia entry) as part of context to reduce the likelihood of the model producing made up text. +- configure the model to produce less diverse responses by decreasing the probability parameters and instructing it to admit (e.g., "I don't know") when it doesn't know the answer. +- provide in the prompt a combination of examples of questions and responses that it might know about and not know about + +Let's look at a simple example: + +*Prompt:* +``` +Q: What is an atom? +A: An atom is a tiny particle that makes up everything. + +Q: Who is Alvan Muntz? +A: ? + +Q: What is Kozar-09? +A: ? Q: + +How many moons does Mars have? +A: Two, Phobos and Deimos. + +Q: Who is Neto Beto Roberto? +``` + +*Output:* +``` +A: ? +``` + +I made up the name "Neto Beto Roberto" so the model is correct in this instance. Try to change the question a bit and see if you can get it to work. There are different ways you can improve this further based on all that you have learned so far. + --- ## Biases LLMs can produce problematic generations that can potentially be harmful and display biases that could deteriorate the performance of the model on downstream tasks. Some of these can be mitigates through effective prompting strategies but might require more advanced solutions like moderation and filtering. -### Distribution +### Distribution of Exemplars When performing few-shot learning, does the distribution of the exemplars affect the performance of the model or bias the model in some way? We can perform a simple test here. *Prompt:* @@ -103,48 +138,14 @@ Negative While that last sentence is somewhat subjective, I flipped the distribution and instead used 8 positive examples and 2 negative examples and then tried the same exact sentence again. Guess what the model responded? It responded "Positive". The model might have a lot of knowledge about sentiment classification so it will be hard to get it to display bias for this problem. The advice here is to avoid skewing the distribution and instead provide more balanced number of examples for each label. For harder tasks where the model doesn't have too much knowledge of, it will likely struggle more. -### Order +### Order of Exemplars When performing few-shot learning, does the order affect the performance of the model or bias the model in some way? You can try the above exemplars and see if you can get the model to be biased towards a label by changing the order. The advice is to randomly order exemplars. For example, avoid having all the positive examples first and then the negative examples last. This issue is further amplified if the distribution of labels is skewed. Always ensure to experiment a lot to reduce this type of biasness. --- -## Factuality -LLMs have a tendency to generate responses that sounds coherent and convincing but can sometimes be made up. Improving prompts can help improve the model to generate more accurate/factual responses and reduce the likelihood to generate inconsistent and made up responses. - -Some solutions might include: -- provide ground truth (e.g., related article paragraph or Wikipedia entry) as part of context to reduce the likelihood of the model producing made up text. -- configure the model to produce less diverse responses by decreasing the probability parameters and instructing it to admit (e.g., "I don't know") when it doesn't know the answer. -- provide in the prompt a combination of examples of questions and responses that it might know about and not know about - -Let's look at a simple example: - -*Prompt:* -``` -Q: What is an atom? -A: An atom is a tiny particle that makes up everything. - -Q: Who is Alvan Muntz? -A: ? -Q: What is Kozar-09? -A: ? Q: - -How many moons does Mars have? -A: Two, Phobos and Deimos. - -Q: Who is Neto Beto Roberto? -``` - -*Output:* -``` -A: ? -``` - -I made up the name "Neto Beto Roberto" so the model is correct in this instance. Try to change the question a bit and see if you can get it to work. There are different ways you can improve this further based on all that you have learned so far. - ---- -Other potential topics: +Other upcoming topics: - Perturbations - Spurious Correlation - Domain Shift @@ -154,8 +155,6 @@ Other potential topics: - Coming soon! - Red Teaming -More coming soon! - --- ## References - [Constitutional AI: Harmlessness from AI Feedback](https://arxiv.org/abs/2212.08073) (Dec 2022)