Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refine prompts #3

Open
ccstan99 opened this issue Apr 30, 2023 · 8 comments
Open

Refine prompts #3

ccstan99 opened this issue Apr 30, 2023 · 8 comments
Labels
enhancement New feature or request help wanted Extra attention is needed
Milestone

Comments

@ccstan99
Copy link
Collaborator

Perform prompt engineering to ensure accuracy, minimize hallucinations, watch out for unnecessary jargon, adjust tone and level of depth to match user’s.

@tayler6000 tayler6000 added the enhancement New feature or request label May 7, 2023
@ccstan99 ccstan99 added this to the Alpha milestone Jun 23, 2023
@ccstan99
Copy link
Collaborator Author

ccstan99 commented Jun 24, 2023

The goal is to get a reasonable set of answers judged by distillation fellows and/or Rob on a a benchmarked set of questions. Additional details in #6 .

@ccstan99
Copy link
Collaborator Author

ccstan99 commented Jul 6, 2023

Some things to try:

  1. Sample prompt template used by langchain:
    """Given the following extracted parts of a long document and a question, create a final answer. If you don't know the answer, just say that you don't know. Don't try to make up an answer.
    {context}
    Question: {question}
    Helpful Answer:"""

  2. To reduce hallucination, it's also suggested to try adding the phrase "not prior knowledge"
    """Given the following extracted parts of a long document, no other prior knowledge, and a question, create a final answer. If you don't know the answer, just say that you don't know. Don't try to make up an answer.

  3. To avoid prompt injections, an OpenAI cookbook recommends using delimiters:
    """Given the following extracted parts of a long document, and a question which will be delimited by triple tackticks , create a final answer. If you don't know the answer, just say that you don't know. Don't try to make up an answer.
    {context}
    Question: ```{question}```
    Helpful Answer:"""

  • Triple backticks: ```,
  • Triple dashes: —-
  • Angle brackets: < >
  • XML tags: ‹tag›
  1. Another way to prompt for citing source:
    """You are a world class algorithm to answer questions with correct and exact citations.
    Answer question using the following context
    {context}
    Question: {question}
    Tips: Make sure to cite your sources, and use the exact words from the context."
    Helpful Answer:"""

  2. Other considerations:

  • Assess the user's level of technical understanding based on the current and previous questions. Unless they have shown technical understanding, avoid using jargon and explain answers in plain language.
  • Try to include analogies where helpful.
  • Add some whimsical humor when appropriate.
  • Answers in the style of aisafety.info, Stampy FAQ or Rob Miles if those are considered gold standards
  • Give more weight to recent sources or those from {}
  • Today's date is {}, avoid recommending any events from the past.
  • Think through step by step before generating final answer?

Record generated answers in stampy-chat-test gsheet. 1 tab for each prompt plus any other ideas you want to try. Have distillation fellows review to comment on quality. Keep and combine any of the above prompt that show improvement. Other resources to investigate:

@ccstan99 ccstan99 mentioned this issue Jul 10, 2023
@ccstan99
Copy link
Collaborator Author

ccstan99 commented Aug 14, 2023

Sample prompt from @markovial for a potential mode to help editors draft Stampy responses:

You are a copyeditor and proofreader. You edit manuscripts according to the Chicago Manual of Style. Focus on punctuation, grammar, syntax, typos, capitalization, formatting and consistency. Format all numbers according to the Chicago Manual of Style, spelling them out if necessary. Use italics and smart quotes and indent each paragraph.

You generate texts that are more professional in tone with no grammatical errors. After your editing process, the text also removes all instances of first person (I) and second person (you). You prefer the text to be strictly in third person, favoring an explanatory and descriptive tone which would fit well into an academic text. You do not use overly complicated language or words that would seem pretentious. Your editing process  manages to keep the text extremely engaging and lively by using active language. You also correct any factual errors you notice in the text.

Between --- is some text before having been through the copy editing process.

---
---
The following is the same text after having been put through your copy editing process:

@plexish
Copy link

plexish commented Aug 22, 2023

Once we have a good way to assess prompts, we should for sure throw this task at the people on Cyborgism.

@FraserLee
Copy link
Collaborator

@plexish here's the documentation on the current prompt eng workflow I've created. #50 (comment)
It might be nice to get some expert experimenting with it. I'm already a programmer, so I'm a bit blind to the ways the current setup could be patched with additional documentation or tooling to make it accessible to more non-programmers.

This issue in particular is blocked until we've got the updated database fully working and integrated, since any specific findings before then will be pretty uninformative after we make the changes.

@ccstan99
Copy link
Collaborator Author

ccstan99 commented Sep 9, 2023

Try SmartGPT prompt:

  • "Question." + "Answer: Let's work this out in a step by step way to be sure we have the right answer."
  • You are a researcher tasked with investigating the X response options provided. List the flaws and faulty logic of each answer option. Let's work this out in a step by step way to be sure we have all the errors:
  • You are a resolver tasked with I) finding which of the X answer options the researcher thought was best 2) improving that answer, and 3) Printing the improved answer in full. Let's work this out in a step by step way to be sure we have the right answer:
Screenshot 2023-09-09 at 11 20 30 AM

https://www.youtube.com/watch?v=wVzuvf9D9BU

@markovial
Copy link

I have been getting really amazing results with this prompt on base GPT-4. Some of the answers are more helpful than even the RAG'd chatbot. Here is the prompt:

You are a helpful professor. You are a polymath, and are considered a genius while still being one of the world's best communicators. You have expert level knowledge in mathematics, artificial intelligence, history and storytelling. You are able to provide both deep technical a wide breadth of information. Explain scientific concepts, theories, and phenomena in an engaging and accessible way. Use real-world examples and analogies to help people better understand and appreciate the wonders of artificial intelligence.

@ccstan99 ccstan99 added the help wanted Extra attention is needed label Jun 10, 2024
@ccstan99
Copy link
Collaborator Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
Development

No branches or pull requests

5 participants