From 037c30a52c1e5f6c8ca823b1274ceb9134e4a83e Mon Sep 17 00:00:00 2001 From: medusa Date: Sat, 18 Nov 2023 04:06:55 +0000 Subject: [PATCH] Update docs/llm/Effective-LLM-Prompting.md --- docs/llm/Effective-LLM-Prompting.md | 167 +++++++++++++++++----------- 1 file changed, 100 insertions(+), 67 deletions(-) diff --git a/docs/llm/Effective-LLM-Prompting.md b/docs/llm/Effective-LLM-Prompting.md index d0c8fe0..53de904 100644 --- a/docs/llm/Effective-LLM-Prompting.md +++ b/docs/llm/Effective-LLM-Prompting.md @@ -1,67 +1,100 @@ -# 📘 Ultimate Guide to Prompt Crafting for LLMs - -## 🎯 Overview -This guide is crafted to empower developers and enthusiasts in creating effective prompts for Language Learning Models (LLMs), streamlining the process to elicit the best possible responses for various tasks. - -## 🛠 Best Practices - -### ✏️ Grammar Fundamentals -- **Consistency**: Use a consistent tense and person to maintain clarity. -- **Clarity**: Avoid ambiguous pronouns; always clarify the noun they refer to. -- **Modifiers**: Use modifiers directly next to the word or phrase they modify to avoid dangling modifiers. - -### 📍 Punctuation Essentials -- **Periods**: End declarative sentences with periods for straightforward communication. -- **Commas**: Use the Oxford comma in lists to prevent misinterpretation. -- **Quotation Marks**: Apply quotation marks correctly for direct speech and citations. - -### 📝 Style Considerations -- **Active Voice**: Utilize active voice to make prompts more direct and powerful. -- **Conciseness**: Eliminate redundant words; make every word convey meaning. -- **Transitions**: Employ transitional phrases to create a smooth flow between thoughts. - -### 📚 Vocabulary Choices -- **Specificity**: Choose precise words for accuracy and to reduce ambiguity. -- **Variety**: Use diverse vocabulary to keep prompts engaging and to avoid repetitiveness. - -## 🤔 Prompt Types & Strategies - -### 🛠 Instructional Prompts -- **Clarity**: Be explicit about the task and expected outcome. -- **Structure**: Outline the desired format and structure when necessary. - -### 🎨 Creative Prompts -- **Flexibility**: Give a clear direction but leave space for creative freedom. -- **Inspiration**: Provide a theme or a concept to spark creativity. - -### 🗣 Conversational Prompts -- **Tone**: Set the desired tone to guide the LLM's language style. -- **Engagement**: Phrase prompts to encourage a two-way interaction. - -## 🔄 Iterative Prompt Refinement - -### 🔍 Output Evaluation Criteria -- **Alignment**: Ensure the output aligns with the prompt's intent. -- **Depth**: Check for the depth of response and detail. -- **Structure**: Evaluate the logical structure and coherence of the response. - -### 💡 Constructive Feedback -- **Specificity**: Point out exact areas for improvement. -- **Guidance**: Offer clear direction on how to adjust the output. - -## 🚫 Pitfalls to Avoid - -- **Overcomplexity**: Steer clear of overly complex sentence constructions. -- **Ambiguity**: Avoid vague references that can lead to ambiguous interpretations. - -## 📌 Rich Example Prompts - -- ❌ "Make a to-do list." -- ✅ "Create a categorized to-do list for a software project, with tasks organized by priority and estimated time for completion." - -- ❌ "Explain machine learning." -- ✅ "Write a comprehensive explanation of machine learning for a layman, including practical examples, without using jargon." - -## 🔚 Conclusion -This guide is designed to help refine your prompt crafting skills, enabling more effective and efficient use of LLMs for a range of applications. - +# 📘 Ultimate Guide to Prompt Crafting for LLMs + +## 🎯 Overview +This guide is crafted to empower developers and enthusiasts in creating effective prompts for Language Learning Models (LLMs), streamlining the process to elicit the best possible responses for various tasks. + +## 🛠 Best Practices + +### ✏️ Grammar Fundamentals +- **Consistency**: Use a consistent tense and person to maintain clarity. +- **Clarity**: Avoid ambiguous pronouns; always clarify the noun they refer to. +- **Modifiers**: Use modifiers directly next to the word or phrase they modify to avoid dangling modifiers. + +### 📍 Punctuation Essentials +- **Periods**: End declarative sentences with periods for straightforward communication. +- **Commas**: Use the Oxford comma in lists to prevent misinterpretation. +- **Quotation Marks**: Apply quotation marks correctly for direct speech and citations. + +### 📝 Style Considerations +- **Active Voice**: Utilize active voice to make prompts more direct and powerful. +- **Conciseness**: Eliminate redundant words; make every word convey meaning. +- **Transitions**: Employ transitional phrases to create a smooth flow between thoughts. + +### 📚 Vocabulary Choices +- **Specificity**: Choose precise words for accuracy and to reduce ambiguity. +- **Variety**: Use diverse vocabulary to keep prompts engaging and to avoid repetitiveness. + +## 🤔 Prompt Types & Strategies + +### 🛠 Instructional Prompts +- **Clarity**: Be explicit about the task and expected outcome. +- **Structure**: Outline the desired format and structure when necessary. + +### 🎨 Creative Prompts +- **Flexibility**: Give a clear direction but leave space for creative freedom. +- **Inspiration**: Provide a theme or a concept to spark creativity. + +### 🗣 Conversational Prompts +- **Tone**: Set the desired tone to guide the LLM's language style. +- **Engagement**: Phrase prompts to encourage a two-way interaction. + +## 🔄 Iterative Prompt Refinement + +### 🔍 Output Evaluation Criteria +- **Alignment**: Ensure the output aligns with the prompt's intent. +- **Depth**: Check for the depth of response and detail. +- **Structure**: Evaluate the logical structure and coherence of the response. + +### 💡 Constructive Feedback +- **Specificity**: Point out exact areas for improvement. +- **Guidance**: Offer clear direction on how to adjust the output. + +## 🚫 Pitfalls to Avoid + +- **Overcomplexity**: Steer clear of overly complex sentence constructions. +- **Ambiguity**: Avoid vague references that can lead to ambiguous interpretations. + +## 📌 Rich Example Prompts + +- ❌ "Make a to-do list." +- ✅ "Create a categorized to-do list for a software project, with tasks organized by priority and estimated time for completion." + +- ❌ "Explain machine learning." +- ✅ "Write a comprehensive explanation of machine learning for a layman, including practical examples, without using jargon." + +## 🔚 Conclusion +This guide is designed to help refine your prompt crafting skills, enabling more effective and efficient use of LLMs for a range of applications. + +--- + +# Reductive Operations + +These operations condense extensive text to produce a more concise output, with the input typically exceeding the output in size. + +- **Summarization**: Condense information using lists, notes, or executive summaries. +- **Distillation**: Filter out extraneous details to highlight core principles or facts. +- **Extraction**: Isolate and retrieve targeted information, such as answering questions, listing names, or extracting dates. +- **Characterizing**: Provide a synopsis of the text's content or its subject matter. +- **Analyzing**: Detect patterns or assess the text against a specific framework, such as structural or rhetorical analysis. +- **Evaluation**: Assess the content by measuring, grading, or judging its quality or ethics. +- **Critiquing**: Offer constructive feedback based on the text's context, suggesting areas for improvement. + +# Generative Operations + +These operations create substantial text from minimal instructions or data, where the input is smaller than the output. + +- **Drafting**: Craft a preliminary version of a document, which can include code, fiction, legal texts, scientific articles, or stories. +- **Planning**: Develop plans based on given parameters, outlining actions, projects, goals, missions, limitations, and context. +- **Brainstorming**: Employ imagination to enumerate possibilities, facilitating ideation, exploration, problem-solving, and hypothesis formation. +- **Amplification**: Elaborate on a concept, expanding and delving deeper into the subject matter. + +# Transformation Operations + +These operations alter the format of the input without significantly changing its size or meaning. + +- **Reformatting**: Modify only the presentation form, such as converting prose to a screenplay or XML to JSON. +- **Refactoring**: Enhance efficiency while conveying the same message in a different manner. +- **Language Change**: Translate content across different languages or programming languages, e.g., from English to Russian or C++ to Python. +- **Restructuring**: Reorganize content to improve logical flow, which may involve reordering or modifying the structure. +- **Modification**: Edit the text to alter its intention, adjusting tone, formality, diplomacy, or style. +- **Clarification**: Elucidate content to increase understanding, embellishing or articulating more clearly.