Prompt engineering for text generation: Difference between revisions

Line 134: Line 134:
===Tips for Example Selection===
===Tips for Example Selection===
====Semantically Similar Examples====
====Semantically Similar Examples====
Liu et al. (2021) suggested choosing examples that are semantically similar to the test example by employing [[k-nearest neighbors]] (KNN) clustering in the [[embedding space]].
Liu et al. (2021) suggested choosing examples that are semantically similar to the test example by employing [[k-nearest neighbors]] (KNN) clustering in the [[embedding space]].<ref name="”112”">Liu et al., 2021 What Makes Good In-Context Examples for GPT-3? https://arxiv.org/abs/2101.06804</ref>


====Diverse and Representative Examples====
====Diverse and Representative Examples====
Su et al. (2022) proposed a [[graph-based approach]] to select a diverse and representative set of examples: (1) construct a directed graph based on the cosine similarity between samples in the embedding space (e.g., using [[SBERT]] or other [[embedding models]]), and (2) start with a set of selected samples and a set of remaining samples, scoring each sample to encourage [[diverse selection]].
Su et al. (2022) proposed a [[graph-based approach]] to select a diverse and representative set of examples: (1) construct a directed graph based on the cosine similarity between samples in the embedding space (e.g., using [[SBERT]] or other [[embedding models]]), and (2) start with a set of selected samples and a set of remaining samples, scoring each sample to encourage [[diverse selection]].<ref name="”113”">Su et al. (2022) Selective Annotation Makes Language Models Better Few-Shot Learners https://arxiv.org/abs/2209.01975</ref>


====Embeddings via Contrastive Learning====
====Embeddings via Contrastive Learning====
Rubin et al. (2022) suggested training embeddings through [[contrastive learning]] specific to one [[training dataset]] for in-context learning sample selection. This approach measures the quality of an example based on a conditioned probability assigned by the language model.
Rubin et al. (2022) suggested training embeddings through [[contrastive learning]] specific to one [[training dataset]] for in-context learning sample selection. This approach measures the quality of an example based on a conditioned probability assigned by the language model.<ref name="”114”">Rubin et al. (2022) Learning To Retrieve Prompts for In-Context Learning https://arxiv.org/abs/2112.08633</ref>


====Q-Learning====
====Q-Learning====
Zhang et al. (2022) explored using [[Q-Learning]] for sample selection in LLM training.
Zhang et al. (2022) explored using [[Q-Learning]] for sample selection in LLM training.<ref name="”115”">Zhang et al. (2022) Active Example Selection for In-Context Learning https://arxiv.org/abs/2211.04486</ref>


====Uncertainty-Based Active Learning====
====Uncertainty-Based Active Learning====
Diao et al. (2023) proposed identifying examples with [[high disagreement]] or [[entropy]] among multiple sampling trials based on [[uncertainty-based active learning]]. These examples can then be annotated and used in few-shot prompts.
Diao et al. (2023) proposed identifying examples with [[high disagreement]] or [[entropy]] among multiple sampling trials based on [[uncertainty-based active learning]]. These examples can then be annotated and used in few-shot prompts.<ref name="”116”">Diao et al. (2023) Active Prompting with Chain-of-Thought for Large Language Models https://arxiv.org/abs/2302.12246</ref>


===Tips for Example Ordering===
===Tips for Example Ordering===
370

edits