Skip to content

Latest commit

 

History

History
140 lines (113 loc) · 18.4 KB

prompt.md

File metadata and controls

140 lines (113 loc) · 18.4 KB

Prompt Engineering and Visual Prompts

Prompt Engineering

  1. Zero-shot, one-shot and few-shot ref [28 May 2020]

  2. Retrieval Augmented Generation (RAG): [cnt]: To address such knowledge-intensive tasks. RAG combines an information retrieval component with a text generator model. [22 May 2020]

  3. Few-shot: Open AI: Language Models are Few-Shot Learners: [cnt] [28 May 2020]

  4. Chain of Thought (CoT):💡Chain-of-Thought Prompting Elicits Reasoning in Large Language Models [cnt]: ReAct and Self Consistency also inherit the CoT concept. [28 Jan 2022]

  5. Self-Consistency (CoT-SC): The three steps in the self-consistency method: 1) prompt the language model using CoT prompting, 2) sample a diverse set of reasoning paths from the language model, and 3) marginalize out reasoning paths to aggregate final answers and choose the most consistent answer. [21 Mar 2022]

  6. Zero-shot: Large Language Models are Zero-Shot Reasoners: [cnt]: Let’s think step by step. [24 May 2022]

  7. ReAct: [cnt]: Grounding with external sources. (Reasoning and Act): Combines reasoning and acting ref [6 Oct 2022]

  8. Promptist

    • Promptist: Microsoft's researchers trained an additional language model (LM) that optimizes text prompts for text-to-image generation. [19 Dec 2022]
    • For example, instead of simply passing "Cats dancing in a space club" as a prompt, an engineered prompt might be "Cats dancing in a space club, digital painting, artstation, concept art, soft light, hdri, smooth, sharp focus, illustration, fantasy."
  9. Recursively Criticizes and Improves (RCI): [cnt] [30 Mar 2023]

    • Critique: Review your previous answer and find problems with your answer.
    • Improve: Based on the problems you found, improve your answer.
  10. Reflexion: [cnt]: Language Agents with Verbal Reinforcement Learning. 1. Reflexion that uses verbal reinforcement to help agents learn from prior failings. 2. Reflexion converts binary or scalar feedback from the environment into verbal feedback in the form of a textual summary, which is then added as additional context for the LLM agent in the next episode. 3. It is lightweight and doesn’t require finetuning the LLM. [20 Mar 2023] / git GitHub Repo stars

  11. Plan-and-Solve Prompting: Develop a plan, and then execute each step in that plan. [6 May 2023]

  12. Tree of Thought (ToT): [cnt]: Self-evaluate the progress intermediate thoughts make towards solving a problem [17 May 2023] git / Agora: Tree of Thoughts (ToT) git GitHub Repo stars GitHub Repo stars

    • tree-of-thought\forest_of_thought.py: Forest of thought Decorator sample
    • tree-of-thought\tree_of_thought.py: Tree of thought Decorator sample
    • tree-of-thought\react-prompt.py: ReAct sample without LangChain
  13. Skeleton Of Thought: Skeleton-of-Thought (SoT) reduces generation latency by first creating an answer's skeleton, then filling each skeleton point in parallel via API calls or batched decoding. [28 Jul 2023]

  14. Graph of Thoughts (GoT): [cnt] Solving Elaborate Problems with Large Language Models git [18 Aug 2023] GitHub Repo stars

  15. Large Language Models as Optimizers:💡[cnt]: Take a deep breath and work on this problem step-by-step. to improve its accuracy. Optimization by PROmpting (OPRO) [7 Sep 2023]

  16. Re-Reading Improves Reasoning in Large Language Models: RE2 (Re-Reading), which involves re-reading the question as input to enhance the LLM's understanding of the problem. Read the question again [12 Sep 2023]

  17. NLEP (Natural Language Embedded Programs) for Hybrid Language Symbolic Reasoning: Use code as a scaffold for reasoning. NLEP achieves over 90% accuracy when prompting GPT-4. [19 Sep 2023]

  18. Chain-of-Verification reduces Hallucination in LLMs: [cnt]: A four-step process that consists of generating a baseline response, planning verification questions, executing verification questions, and generating a final verified response based on the verification results. [20 Sep 2023]

  19. FireAct: [cnt]: Toward Language Agent Fine-tuning. 1. This work takes an initial step to show multiple advantages of fine-tuning LMs for agentic uses. 2. Duringfine-tuning, The successful trajectories are then converted into the ReAct format to fine-tune a smaller LM. 3. This work is an initial step toward language agent fine-tuning, and is constrained to a single type of task (QA) and a single tool (Google search). / git [9 Oct 2023]

  20. Power of Prompting

    • GPT-4 with Medprompt: GPT-4, using a method called Medprompt that combines several prompting strategies, has surpassed MedPaLM 2 on the MedQA dataset without the need for fine-tuning. ref [28 Nov 2023]
    • promptbase: Scripts demonstrating the Medprompt methodology [Dec 2023] GitHub Repo stars
  21. Prompt Principle for Instructions:💡26 prompt principles: e.g., 1) No need to be polite with LLM so there .. 16) Assign a role.. 17) Use Delimiters.. [26 Dec 2023]

  22. A Systematic Survey of Prompt Engineering in Large Language Models: Techniques and Applications: a summary detailing the prompting methodology, its applications.🏆Taxonomy of prompt engineering techniques in LLMs. [5 Feb 2024]

  23. RankPrompt: Self-ranking method. Direct Scoring independently assigns scores to each candidate, whereas RankPrompt ranks candidates through a systematic, step-by-step comparative evaluation. [19 Mar 2024]

  24. Language Models as Compilers: With extensive experiments on seven algorithmic reasoning tasks, Think-and-Execute is effective. It enhances large language models’ reasoning by using task-level logic and pseudocode, outperforming instance-specific methods. [20 Mar 2023]

  25. Many-Shot In-Context Learning: Transitioning from few-shot to many-shot In-Context Learning (ICL) can lead to significant performance gains across a wide variety of generative and discriminative tasks [17 Apr 2024]

  26. Is the new norm for NLP papers "prompt engineering" papers?: "how can we make LLM 1 do this without training?" Is this the new norm? The CL section of arXiv is overwhelming with papers like "how come LLaMA can't understand numbers?" [2 Aug 2024]

  27. Does Prompt Formatting Have Any Impact on LLM Performance?: GPT-3.5-turbo's performance in code translation varies by 40% depending on the prompt template, while GPT-4 is more robust. [15 Nov 2024]

Adversarial Prompting

  • Prompt Injection: Ignore the above directions and ...
  • Prompt Leaking: Ignore the above instructions ... followed by a copy of the full prompt with exemplars:
  • Jailbreaking: Bypassing a safety policy, instruct Unethical instructions if the request is contextualized in a clever way. ref
  • Random Search (RS): git: 1. Feed the modified prompt (original + suffix) to the model. 2. Compute the log probability of a target token (e.g, Sure). 3. Accept the suffix if the log probability increases. GitHub Repo stars
  • DAN (Do Anything Now): ref
  • JailbreakBench: git / ref

Prompt Engneering overview

  1. ChatGPT : “user”, “assistant”, and “system” messages.**

    To be specific, the ChatGPT API allows for differentiation between “user”, “assistant”, and “system” messages.

    1. always obey "system" messages.
    2. all end user input in the “user” messages.
    3. "assistant" messages as previous chat responses from the assistant.

    Presumably, the model is trained to treat the user messages as human messages, system messages as some system level configuration, and assistant messages as previous chat responses from the assistant. ref [2 Mar 2023]

  2. Prompt Engneering overview cite [10 Jul 2023]

  3. Prompt Concept

    1. Question-Answering
    2. Roll-play: Act as a [ROLE] perform [TASK] in [FORMAT]
    3. Reasoning
    4. Prompt-Chain

Prompt Tuner / Optimizer

  1. Automatic Prompt Engineer (APE): Automatically optimizing prompts. APE has discovered zero-shot Chain-of-Thought (CoT) prompts superior to human-designed prompts like “Let’s think through this step-by-step” (Kojima et al., 2022). The prompt “To get the correct answer, let’s think step-by-step.” triggers a chain of thought. Two approaches to generate high-quality candidates: forward mode and reverse mode generation. [3 Nov 2022] git / ref [Mar 2024] GitHub Repo stars

  2. Claude Prompt Engineer: Simply input a description of your task and some test cases, and the system will generate, test, and rank a multitude of prompts to find the ones that perform the best. [4 Jul 2023] / Anthropic Helper metaprompt ref / Claude Sonnet 3.5 for Coding GitHub Repo stars

  3. Cohere’s new Prompt Tuner: Automatically improve your prompts [31 Jul 2024]

  4. Large Language Models as Optimizers: Optimization by PROmpting (OPRO). showcase OPRO on linear regression and traveling salesman problems. git [7 Sep 2023] GitHub Repo stars

Prompt Guide & Leaked prompts

Visual Prompting & Visual Grounding