Prompt Engineering (PE)
YouTube ... Quora ...Google search ...Google News ...Bing News
- Prompt Engineering (PE) ...PromptBase ... Prompt Injection Attack
- Assistants ... Personal Companions ... Agents ... Negotiation ... LangChain
- Python ... Generative AI with Python ... Javascript ... Generative AI with Javascript
- Gaming ... Game-Based Learning (GBL) ... Security ... Generative AI ... Metaverse ... Quantum ... Game Theory
- Large Language Model (LLM) ... Natural Language Processing (NLP) ...Generation ... Classification ... Understanding ... Translation ... Tools & Services
- Attention Mechanism ...Transformer Model ...Generative Pre-trained Transformer (GPT)
- Generative AI ... Conversational AI ... OpenAI's ChatGPT ... Perplexity ... Microsoft's Bing ... You ...Google's Bard ... Baidu's Ernie
- Few Shot Learning
- Prompt Engineer | Anthropic ... Salary - The expected salary range for this position is $175k - $335k
- Prompt Engineering | Kris - All About AI ...Allabtai ... and other informative AI videos
- Writer ... AI Content Detector ... grammar correction, brand voice, product terms enforcement, & text transformation
- Lists:
- Best practices for prompt engineering with OpenAI API | OpenAI
- Prompt Engineering Guide | Elvis Saravia - dair.ai ... lecture, notebook, & slides
- ChatGPT cheatsheet | QuickRef.ME
- Learn Prompting ... a Free, Open Source Course on Communicating with Artificial Intelligence
- 12 ways to get better at using ChatGPT: Comprehensive prompt guide | Aaron Mok - Insider
Prompt is the starting point for a model to generate output; a language model to generate text, providing context for text generation in natural-language-processing tasks such as chatbots and question-answering systems, or an application to generate images.
Contents
What is Prompt Engineering (PE)?
|
|
Prompting for Text vs Image Generation
Prompting for text generation and image generation are two different tasks, and as such, the prompts that are used for each task are also different.
- For text generation, the prompt is typically a short sentence or phrase that describes the desired output. For example, a prompt for generating a poem might be "A sonnet about love." The prompt should be specific enough to give the model a clear idea of what is desired, but it should also be open-ended enough to allow for creativity.
- For image generation, the prompt is typically a more detailed description of the desired image. This might include the subject of the image, the setting, the mood, and any other relevant details. For example, a prompt for generating an image of a cat sitting on a chair might be "A realistic image of a black cat sitting on a red chair in a sunny room." The prompt should be as detailed as possible to give the model a clear idea of what is desired.
Here are some tips for writing effective prompts for text generation and image generation:
- Be specific. The more specific the prompt, the better the model will be able to understand what you are asking for.
- Be open-ended. Don't be afraid to leave some room for creativity. The model will use its knowledge of the world to fill in the blanks.
- Use keywords. If you are not sure how to describe something, use keywords that are related to it. For example, if you want to generate an image of a cat, you could use the keywords "cat," "animal," "furry," and "meow."
- Use examples. If you can, provide examples of the kind of output you are looking for. This will help the model to understand what you are trying to achieve.
Text Generation Prompting
YouTube ... Quora ...Google search ...Google News ...Bing News
- Requirements Management ... Generative AI for Business Analysis
- The Art of ChatGPT Prompting: A Guide to Crafting Clear and Effective Prompts | Faith Akin ...free e-book
|
|
Advice from ChatGPT
Human-Machine Interaction (HMI) is used in engineering for asking questions or interacting with an artificial intelligence like myself is often referred to as Human-Computer Interaction (HCI) or Human-Machine Interaction (HMI). These terms describe the study and practice of designing, evaluating, and implementing interactive systems or devices that allow humans to communicate with machines, including artificial intelligence models like myself. This can involve designing user interfaces, voice and Speech Recognition, Natural Language Processing (NLP), and other technologies that allow people to communicate effectively with machines. In general, engineers and designers in the field of HCI/HMI are focused on creating systems and devices that are intuitive, user-friendly, and effective at facilitating communication between humans and machines, like me, to achieve certain goals. As an AI language model, I am designed to assist you with your questions and concerns. Here are some tips on how to ask and converse with me effectively:
- Be clear and specific: Clearly state your question or topic of conversation. The more specific you are, the better I can understand and provide a relevant response. For example, instead of asking "Tell me about cars," you could ask, "What are some popular electric car models available in the market today?"
- Use simple language: While I can understand complex language, using simple and straightforward language helps ensure clear communication. Avoid unnecessary jargon or complex sentence structures.
- Provide context: When asking a question, provide any relevant context or background information. This helps me better understand your needs and provide a more accurate response. For example, if you're asking about the best places to visit in a city, let me know your interests or preferences, such as whether you enjoy historical sites, outdoor activities, or cultural experiences.
- Use examples: If you're looking for specific information or examples, providing examples can help clarify your question or illustrate what you're seeking. For instance, if you want advice on writing a cover letter, you could provide a sample sentence or paragraph from your draft and ask for suggestions for improvement.
- Assign me a specific role: If you want me to provide information or act as a specific role, such as a travel agent, historian, or creative writer, let me know. This helps me understand the context and provide responses accordingly.
- Let me know the reading level: If you have a preference for the reading level of the response, such as basic, intermediate, or advanced, please specify. This allows me to adjust the complexity of the language used in the response to match your preference.
- Ask for an outline: If you have a lengthy question or want a comprehensive answer, you can request an outline of the main points first. This allows you to review the structure of the response and ask me to elaborate on specific sections.
- Follow up with additional questions: Feel free to ask follow-up questions to seek further clarification or delve deeper into a topic. This helps me understand your needs better and provide more detailed and relevant information.
- Be patient: While I strive to generate responses quickly, complex queries may require a bit more time for processing. Please be patient and allow me a moment to generate a thoughtful and accurate response.
Remember, I am a language model designed to assist you, so feel free to ask any questions or have any conversations you would like. I'm always here to help!
Prompt Techniques
Recursively Criticizing and Improving the output (RCI)
The RCI approach significantly outperforms existing LLM methods for automating computer tasks and surpasses supervised learning (SL) and reinforcement learning (RL) approaches on the MiniWoB++ benchmark. RCI is competitive with the state-of-the-art SL+RL method, using only a handful of demonstrations per task rather than tens of thousands, and without a task-specific reward function. Furthermore, we demonstrate RCI prompting's effectiveness in enhancing LLMs' reasoning abilities on a suite of natural language reasoning tasks, outperforming Chain of Thought (CoT) prompting. We find that RCI combined with CoT performs better than either separately.
Chain of Thought (CoT) prompting
The process of an AI model using its own human tendency to ‘think out loud’ is called inner speech or self-dialog. Chain-of-Thought (CoT) prompting can dramatically improve the multi-step reasoning abilities of Large Language Model (LLM)s. CoT explicitly encourages the LLM to generate intermediate rationales for solving a problem, by providing a series of reasoning steps in the demonstrations. There are two main methods to elicit chain-of-thought reasoning: few-shot prompting and zero-shot prompting. The initial proposition of CoT prompting demonstrated few-shot prompting, wherein at least one example of a question paired with proper human-written CoT reasoning is prepended to the prompt. CoT prompting can effectively elicit complex multi-step reasoning from Large Language Models (LLMs).
However, it is not clear whether CoT is still effective on more recent instruction finetuned (IFT) LLMs such as ChatGPT. IFT is a method for improving the performance and usability of pretrained language models. It involves finetuning language models on a collection of datasets phrased as instructions, which has been shown to improve model performance and generalization to unseen tasks Surprisingly, on ChatGPT, CoT is no longer effective for certain tasks such as arithmetic reasoning while still keeping effective on other reasoning tasks. Moreover, on the former tasks, ChatGPT usually achieves the best performance and can generate CoT even without being instructed to do so.
Resources - Text Generation
YouTube ... Quora ...Google search ...Google News ...Bing News
- Lists:
- Apps:
- WriteGPT | OpenAI ... web extension to facilitate prompt writing
- WebChatGPT ... qunash -GitHub ... A browser extension that augments your ChatGPT prompts with web results.
- YouTube & Article Summary powered by ChatGPT | Glasp
- Bottom right in subheader click on '...', 'Show Transcript', Above the transcript, click on 'Transcript & Summary'
Prompt Vine
- Prompt Vine ... a large collection of ChatGPT prompts, a community-driven library so that you can contribute to the dozens of categories
- PromptVine ChatGpt Prompts | Startup Ai Tools
Prompt Vine provides a variety of useful prompts to help you use ChatGPT and AI Chatbots effectively. You can find the best ChatGPT prompts by category, profession, or use case. In addition to ChatGPT prompts, it also provides Bing AI, GPT-3, Bard, and GPT-4 prompts to make your AI conversations more engaging.
PromptBase
- PromptBase ... Find top prompts, produce better results, save on API costs, sell your own prompts.
- The wild world of PromptBase, the eBay for Generative AI prompts | Ryan Broderick - Fast Company ... There’s an art to writing the string of prompts that can produce what you want from ChatGPT, DALL-E 2, and Midjourney. Right now, there are more buyers than sellers.
|
|
writeGPT
- WriteGPT | OpenAI ... web extension to facilitate prompt writing
|
|
Artificial Intelligence-Powered Response Manager (AIPRM)
- AIPRM
- AIPRM for ChatGPT | Google Web Store
The AIPRM extension adds easy to use list of curated prompt templates for ChatGPT curated for you by a community of prompt engineering experts. The long-awaited release with many free features, but also many new premium features like “Favorites”, “Hidden”, your own Custom Lists, Custom Writing Tones, Custom Writing Styles, (Custom) Power Continue actions. Now with Multiple Variables in the Prompt, support for everyone, also free users, as well as the long-awaited LIVE CRAWLING feature and the CLONE Private Prompt feature.
Image Generation Prompting
YouTube ... Quora ...Google search ...Google News ...Bing News
- DALL-E
- Stable Diffusion
- MidJourney
- CLIP Interrogator ... Want to figure out what a good prompt might be to create new images like an existing one?
- ArtBreeder ... a collaborative, machine learning-based art website. Using the models StyleGAN and BigGAN
- Here’s a Whole Bunch of Sites to Help You With Image Prompts | Daniel Nest - Why Try AI:
- Lexica ... a massive database of images generated via Stable Diffusion, with prompts attached. You can search the library, explore styles related to a selected image, and easily copy text prompts to use elsewhere. You can even generate images directly on the site.
- PromptHero ... not limited to just Stable Diffusion, organizes images into a few top-level categories like “Anime,” “Architecture,” “Landscapes,” etc. making it easier to browse images related to the same theme.]
- Prompt Hunt ... filter by your preferred AI art generator
- Prompt builders -
- Prompter ... use Midjourney, prompt builder, Google Sheet that lets you customize all possible aspects of your Midjourney prompt.
- promptoMANIA ... all-in-one prompt builder; guides you through picking your subject, styles, artist tags, and other relevant descriptors. You also get nice visual references for the modifiers, giving you a decent idea of how your final image might turn out.
- Automated prompt generators -
- Stable Diffusion Prompt Generator ... demo of the model series: “MagicPrompt”
- Midjourney Prompt Generator generates multiple prompts which often include Midjourney-specific tags like “--ar” (to set the aspect ratio).
- AI Prompt Generator ... creates a narrative around your subject, describing the setting in great detail using natural language. You can then plop it into any text-to-image program.
- Image-to-text tools -
- CLIP Interrogator ... features a neat “Analyze” tab that breaks down your prompt into underlying components like “Artist,” “Medium,” etc.
- Img2Prompt by Methexis ... tweaked version of the CLIP Interrogator.
- PEZ Dispenser ... condense an existing text prompt into a shorter one
After I have a rough idea of what I want to accomplish, I try to narrow things down to people, places and things - the core actors or main drivers in the scene I’m trying to construct. I use the service to generate a few rough prompts to get a feel for what the scene might look like. I find it much easier to take something that works well and then add on to it rather than having to go back and remove things until it looks better. You start with the big important strokes and then work in the finer details.
... I see prompt writing from the perspective of an artist, coder and engineer. I use my programming experience to help me understand how the service may interpret my prompt, which guides me to more effective tinkering with it to coax the results I’m after. Every word in a prompt has a weight associated with it, so trying to work out what works best and where becomes a core asset in the skillset. My background in software quality assurance is a pretty big driver in that “what happens if” style of thinking. - Professional AI whisperers have launched a marketplace for DALL-E prompts | Justin Reckling interviewed by article author Adi Robertson - The Verge
Generative AI Pattern Language
- A Pattern Language for Generative AI: A Self-Generating GPT-4 Blueprint | Carlos E. Perez ... Contact: ceperez@intuitionmachine.com
A pattern language is an organized and coherent set of patterns, each of which describes a problem and the core of a solution that can be used in many ways within a specific field of expertise. The term was coined by architect Christopher Alexander and popularized by his 1977 book A Pattern Language.
A Pattern Language is a way of describing good design practices in a way that can be easily understood and applied by others.
Here are a few Generative AI language patterns:
- Creational: design patterns that deal with object creation mechanisms, trying to create objects in a manner suitable to the situation. In generative AI prompting, creational patterns can be used to specify the desired characteristics of the output, such as the format, style, medium, genre, or content.
- Builder pattern: This pattern allows constructing complex objects step by step. It can be used to create prompts that have multiple components or details, such as “a dragon with blue scales and red eyes flying over a mountain, oil painting style”.
- Factory method pattern: This pattern defines an interface for creating an object, but lets subclasses decide which class to instantiate. It can be used to create prompts that have different variations or options, such as “a logo for a company called XYZ, either minimalist or geometric”.
- Prototype pattern: This pattern creates objects by cloning an existing object. It can be used to create prompts that are based on existing examples or references, such as “a poem like ‘Do Not Go Gentle Into That Good Night’ by Dylan Thomas, but about love instead of death”.
- Singleton pattern: This pattern ensures that only one instance of a class exists and provides a global point of access to it. It can be used to create prompts that have a unique or specific identity or purpose, such as “the only photo of Albert Einstein smiling”.
- Transformational: used to transform data from one form to another; a type of design pattern that deal with object behavior mechanisms, aiming to change the state or structure of objects in a flexible and dynamic way. In generative AI prompting, transformational patterns can be used to modify the output of the model, such as the tone, perspective, format, or content. For example, some transformational patterns that can be used in generative AI prompting are:
- Adapter pattern: This pattern allows adapting an existing interface to another interface that is expected by the client. It can be used to create prompts that change the format or style of the output, such as “Rewrite this sentence in passive voice: She opened the door.”
- Decorator pattern: This pattern allows adding new functionality to an existing object without altering its structure. It can be used to create prompts that add more details or information to the output, such as “Add a catchy slogan to this product description: A smartwatch that tracks your fitness and health.”
- Strategy pattern: This pattern allows defining a family of algorithms, encapsulating each one, and making them interchangeable. It can be used to create prompts that change the behavior or logic of the output, such as “Generate a headline for this article using a different strategy: How to save money on groceries.”
- Template method pattern: This pattern allows defining the skeleton of an algorithm in a base class, but letting subclasses override some steps without changing the algorithm’s structure. It can be used to create prompts that have a fixed structure but variable content, such as “Write a haiku about winter.”
- Explainability: used in AI to help explain how a decision was made by an algorithm; that deal with object understanding mechanisms, aiming to provide insights into the reasoning or logic behind the output of an object. In generative AI prompting, explainability patterns can be used to understand the output of the model, such as the source, confidence, relevance, or quality. For example, some explainability patterns that can be used in generative AI prompting are:
- Proxy pattern: This pattern provides a surrogate or placeholder for another object to control access to it. It can be used to create prompts that ask the model to provide a source or reference for the output, such as “Generate a fact about dolphins and cite the source.”
- Observer pattern: This pattern defines a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically. It can be used to create prompts that ask the model to provide a confidence score or a probability distribution for the output, such as “Generate a headline for this article and give a confidence score from 0 to 1.”
- Mediator pattern: This pattern defines an object that encapsulates how a set of objects interact. It can be used to create prompts that ask the model to provide a relevance or similarity score for the output, such as “Generate an image of a cat wearing sunglasses and give a similarity score from 0 to 1 compared to this image of a dog wearing sunglasses.”
- Chain of responsibility pattern: This pattern avoids coupling the sender of a request to its receiver by giving more than one object a chance to handle the request. It can be used to create prompts that ask the model to provide a quality or evaluation score for the output, such as “Generate a summary of this article and give a quality score from 0 to 1 based on grammar, coherence, and accuracy.”
- Procedural: used to define the steps that should be taken in order to complete a task; aiming to create objects in a procedural or algorithmic way. In generative AI prompting, procedural patterns can be used to specify the desired process of the output, such as the steps, rules, constraints, or variations. For example, some procedural patterns that can be used in generative AI prompting are:
- Iterator pattern: This pattern provides a way to access the elements of an aggregate object sequentially without exposing its underlying representation. It can be used to create prompts that generate a sequence or a list of outputs, such as “Generate 5 names for a new brand of coffee.”
- Command pattern: This pattern encapsulates a request as an object, thereby allowing for the parameterization of clients with different requests, and the queuing or logging of requests. It can be used to create prompts that execute a specific action or function on the output, such as “Generate a logo for a company called XYZ and rotate it 90 degrees clockwise.”
- State pattern: This pattern allows an object to alter its behavior when its internal state changes. It can be used to create prompts that change the output based on a condition or a trigger, such as “Generate a tweet from Elon Musk and make it positive if Tesla’s stock price is above $1000 or negative otherwise.”
- Memento pattern: This pattern provides the ability to restore an object to its previous state. It can be used to create prompts that undo or redo the output, such as “Generate a summary of this article and undo the last sentence.”
- Composite: used to represent hierarchical structures of objects
- Coherence: used to ensure that data is consistent across different parts of a system; aiming to ensure that the output of an object is logical, relevant, and meaningful. In generative AI prompting, coherence patterns can be used to improve the quality of the output, such as the clarity, accuracy, fluency, or diversity. For example, some coherence patterns that can be used in generative AI prompting are:
- Corrective: used to fix problems that arise in a system.
- Recombinational: used to combine different parts of a system in new ways.
- Variational: used to represent variations of a system.
- Modularity: used to break down a system into smaller, more manageable parts.