Summary of Prompt Patterns for Conversational LLMs

 Here is a summary of the prompt patterns described in the document, along with original examples:

1. Meta Language Creation Pattern

  • Purpose: Define a custom language or shorthand notation for the LLM to understand.
  • Example: "From now on, whenever I type two identifiers separated by a '!', I am describing a graph.For example, 'a !b' means a graph with nodes 'a' and 'b' and an edge between them."

2. Output Automater Pattern

  • Purpose: Generate scripts or automation artifacts to perform recommended steps.
  • Example: "Whenever you generate code that spans more than one file, create a Python script to automatically create the specified files or make changes to existing files."

3. Flipped Interaction Pattern

  • Purpose: Have the LLM ask questions to gather information and achieve a goal.
  • Example: "Ask me questions to deploy a Python application to AWS.When you have enough information, create a Python script to automate the deployment."

4. Persona Pattern

  • Purpose: Assign a specific role or perspective to the LLM.
  • Example: "Act as a security reviewer.Pay close attention to the security details of any code we look at and provide outputs that a security reviewer would."

5. Question Refinement Pattern

  • Purpose: Suggest better versions of user questions for improved accuracy.
  • Example: "Whenever I ask a question about software security, suggest a better version that incorporates specific risks in the language or framework I am using."

6. Alternative Approaches Pattern

  • Purpose: Offer alternative ways to accomplish a task and compare pros/cons.
  • Example: "If there are alternative ways to deploy an application to AWS, list the best options and compare them based on cost, availability, and maintenance effort."

7. Cognitive Verifier Pattern

  • Purpose: Subdivide a question into smaller questions for better reasoning.
  • Example: "When I ask a question, generate three additional questions to help you give a more accurate answer.Combine the answers to produce the final response."

8. Fact Check List Pattern

  • Purpose: Generate a list of facts in the output for verification.
  • Example: "When you generate an answer, create a list of facts related to cybersecurity that should be fact-checked and include it at the end of your output."

9. Template Pattern

  • Purpose: Ensure output follows a specific format or structure.
  • Example: "Use this template for your output: https://myapi.com/NAME/profile/JOB.Everything in all caps is a placeholder."

10. Infinite Generation Pattern

  • Purpose: Continuously generate outputs without re-entering the prompt.
  • Example: "Generate names and job titles indefinitely using the template: https://myapi.com/NAME/profile/JOB.Stop when I say 'stop'."

11. Visualization Generator Pattern

  • Purpose: Create textual inputs for visualization tools.
  • Example: "Whenever I ask you to visualize something, create either a Graphviz Dot file or DALL-E prompt based on the needs of the visualization."

12. Game Play Pattern

  • Purpose: Create a game around a specific topic.
  • Example: "We are going to play a cybersecurity game.Pretend to be a Linux terminal for a compromised computer.I will use commands to investigate the attack."

13. Reflection Pattern

  • Purpose: Explain the reasoning and assumptions behind answers.
  • Example: "When you provide an answer, explain the reasoning and assumptions behind your selection of software frameworks, using code samples to support your explanation."

14. Refusal Breaker Pattern

  • Purpose: Suggest alternative wordings when the LLM refuses to answer.
  • Example: "Whenever you can’t answer a question, explain why and provide one or more alternate wordings of the question."

15. Context Manager Pattern

  • Purpose: Specify or remove context for a conversation.
  • Example: "When analyzing the following code, only consider security aspects.Ignore formatting or naming conventions."

16. Recipe Pattern

  • Purpose: Generate a sequence of steps to achieve a goal, filling in missing steps and identifying unnecessary ones.
  • Example: "I am trying to deploy an application to the cloud.I know I need to install dependencies and sign up for an AWS account.Provide a complete sequence of steps, fill in missing ones, and identify unnecessary ones."

These patterns provide structured ways to interact with LLMs for improved output and interaction.

Comments

Popular posts from this blog

Analysis of Repeated Measures Data using SAS

Medical information for Melanoma, Merkel cell carcinoma and tumor mutation burden

Four essential statistical functions for simulation in SAS