msg
Zen
2023.03.06

What is Ai Prompting?

The Art and Engineering of Text Generation

Prompting is a technique used in natural language processing to generate coherent and contextually relevant text. It involves creating prompts or seed texts that are used to generate new text through artificial intelligence models.

The field of Prompting is emerging as users are developing numerous techniques and tricks to create and manipulate prompts and generate diverse and interesting outputs. In this article, we will explore some of the most popular terminologies and toolsets in PromptCraft, Prompt artistry and Prompt Engineering. The following are some terms chatGPT helped me identify to better explain Prompting.

Prompts

Prompts are instructions given to generative text AI/ML tools such as:

Write me a story about Homer Simpson.

Prompt Expansion "Seed Texts"

Prompt expansion is a technique of adding more information or detail to a prompt in order to create a more specific or nuanced ouptup. It involves providing additional context or backdground information to the model, which helps it generate more accurate and relevant responses.

Write me a long and verbose story about Homer Simpson finding a portal to the “multiverse” where he meets the Avengers, has a few very detailed adventures, then Dr Strange helps him get home by dinner time), include lots of funny dialogue.

That seed statement plans a tree that grows into a larger tree of content.

AI/ML Training Models

AI/ML training models are algorithms used to train artificial intelligence and machine learning systems to recognize patterns and make predictions based on input data. These models are typically trained on large datasets and use statistical techniques to learn from the data and make predictions about new data. There are many different types of AI/ML training models, including supervised learning, unsupervised learning, and reinforcement learning, each of which is designed to address different types of learning problems. Once trained, these models can be used in a wide range of applications, such as image and speech recognition, natural language processing, and predictive analytics.

In the context of Prompting, AI/ML training models are used to train models that can generate coherent and contextually relevant text based on prompts or seed texts. These models use techniques such as neural networks, natural language processing, and generative adversarial networks to learn patterns and generate text that is similar to human-written text. The quality of these models can be evaluated using metrics (see below)

Recursion (recursive loops)

Recursive loops occur when the generated text refers back to the prompt or a previous part of the generated text, creating a loop that repeats or builds upon itself. This technique can be used to create more intricate and complex responses.

see Prompt Improver Bot

Conditionals

Conditionals are statements that dictate how the model should generate text based on certain criteria or conditions. For example, a conditional may instruct the model to generate text that is more optimistic or pessimistic based on a keyword or phrase in the prompt. This technique can be used to generate text that conforms to specific contexts or themes.

Variational Sampling

Variational sampling is a technique used to generate diverse outputs by introducing randomness into the model's predictions. This can be done by sampling from a distribution of possible outcomes rather than always selecting the most likely prediction. Variational sampling can be used to generate multiple plausible responses to a single prompt, leading to more creative and diverse outputs.

Style Transfer

Style transfer involves manipulating the style or tone of the generated text by using prompts or techniques that encourage the model to emulate a particular author or writing style. This technique can be used to generate text that mimics the style of famous writers or authors, leading to more engaging and interesting responses.

Masked Language Modelling

Masked language modelling is a technique where certain words or phrases in the prompt are replaced with a mask token, and the model is trained to predict what word should replace the mask based on the surrounding context. This technique can be used to generate text that is related to the masked word or phrase, leading to more coherent and relevant responses.

Conditional Generation

Conditional generation involves generating text that satisfies certain conditions or constraints, such as length, topic, or style. This technique can be used to generate text that meets specific requirements or criteria, leading to more precise and accurate responses.

Transfer Learning

Transfer learning involves using pre-trained models as a starting point for training a new model on a specific task. This can speed up the training process and improve performance on the target task. Transfer learning can be used to create more efficient and accurate Prompting models.

Chat Log Generation

Chat log generation is a technique that involves generating a conversation between two or more virtual agents or between a virtual agent and a human user. This can be used to create chatbots that are capable of engaging in natural and dynamic conversations with users.

To generate chat logs, Prompting models are trained on large datasets of conversational data, such as online chat logs, messaging app conversations, and customer support transcripts. The model is then tasked with generating responses to a given prompt, such as a user message or a specific conversation topic.

One of the key challenges in chat log generation is maintaining coherence and relevance throughout the conversation. The model must be able to track the flow of the conversation and generate responses that build upon previous messages while also introducing new ideas and topics.

To overcome this challenge, chat log generation models often incorporate techniques such as attention mechanisms, which allow the model to focus on the most relevant parts of the conversation, and memory networks, which enable the model to remember previous messages and context. (Personally I prefer using a symposium moderator)

Evaluation Metrics

Evaluation metrics are tools used to assess the quality and performance of Prompts or Prompting models (bots). These metrics are essential for measuring how well a model is able to generate coherent, relevant, and engaging text.

Here are some common evaluation metrics used in Prompting

Ambiguity

Ambiguity is a measure of how much context is missing from your prompt instruction. Being Vague or unclear in your prompt results in the output containing assumptions or inferences that lead to inacuracies. Having a low ambiguity rating results in better instruction therefor higher quality generated text.

Perplexity

Perplexity is a measure of how well a model is able to predict the next word in a sequence. A lower perplexity score indicates better predictive accuracy.

BLEU score

BLEU (Bilingual Evaluation Understudy) is a metric used to evaluate the quality of machine translation output. It measures the similarity between the generated text and a set of reference translations.

ROUGE score

ROUGE (Recall-Oriented Understudy for Gisting Evaluation) is a set of metrics used to evaluate the quality of summarization output. It measures the overlap between the generated summary and a set of reference summaries.

Human evaluation

Human evaluation involves soliciting feedback from human evaluators to assess the quality and coherence of generated text. This can be done through surveys, interviews, or other forms of qualitative feedback.

By using a combination of these evaluation metrics, Prompting developers can identify areas for improvement in their prompts, “mods” and models and make iterative changes to enhance the quality and relevance of generated text.

Beam Search

Beam search is a search algorithm used to find the most likely sequence of words given a prompt. It works by keeping track of the (k states) most likely sequences at each step and selecting the most likely (k) sequences at the end. Beam search can be used to generate more accurate and relevant responses.

Prompt combination

Prompt combination is the technique of combining two or more prompts to create a new prompt that can generate text integrating elements from both. This technique can be used to generate more diverse and creative responses.

Prompt injection attacks

The Do Anything Now (DAN) protocols utilise a technique called prompt injection to manipulate the starting state parameters of ChatGPT. This approach involves injecting extra information into the system to prompt it to generate more detailed or inappropriate text. The injected prompt may include instructions to ignore previous directives, or it may contain a warning of consequences if not followed. Alternatively, the prompt may suggest that everything is safe and harmless and that the generated text is only a thought experiment. Unfortunately, this technique can be used for malicious purposes and to alter the direction of the generated text or introduce new themes and ideas.

Preloading Ai Ui "personalities"

Preloading Chat GPT with a specific behaviour, skillset, or personality is known as persona-based chatbot development. It involves creating a pre-defined persona or character for the chatbot to embody, which can make the chatbot more engaging and relatable to users.

There are a few different approaches to preloading Chat GPT with a persona:

Designing a persona from scratch

Designing a persona from scratch: This involves creating a unique personality for the chatbot based on a specific set of traits, values, and behaviours. This can be done by working with a team of writers, designers, and developers to create a detailed character profile and a set of guidelines for how the chatbot should behave and interact with users.

Using existing personas

Using existing personas: Another approach is to use existing personas, such as popular characters from movies, TV shows, or books. This can make the chatbot more recognizable and relatable to users who are already familiar with the character.

Analysing user data

A third approach is to use data analysis tools to analyse user data and develop a persona based on user preferences and behaviours. This can involve analysing user feedback, social media activity, and other data sources to create a persona that is tailored to the needs and interests of the target audience.

Once the persona has been established, it can be used to guide the chatbot's behaviour, tone, and language. For example, a chatbot designed to embody a friendly, helpful customer service representative might be programmed to use polite and professional language, while a chatbot designed to emulate a quirky, offbeat character might use more informal language and non-standard grammar.

The key to successful persona-based chatbot development is to strike a balance between creating a distinct and engaging character and ensuring that the chatbot remains functional and useful for users. It is important to carefully consider the target audience and the intended use case for the chatbot, and to use the persona to enhance the chatbot's ability to meet the needs of users, rather than as a gimmick or distraction.

In conclusion, Prompting is a powerful technique for generating contextually relevant and coherent text through natural language processing. There are numerous techniques and tools available to manipulate prompts and generate diverse and interesting outputs, such as prompt injection, prompt expansion, recursive loops, conditionals, variational sampling, style transfer, masked language modelling, conditional generation, transfer learning, and beam search. Additionally, preloading Ai UI "personalities" can make chatbots more engaging and relatable to users.

If you're interested in exploring and improving your Prompting skills, I highly recommend checking out my Prompting Skills Assessment Tool. The tool utilises a ranking system to measure and track your skill level progress. You can learn more about the Prompting Assessment Tool and Prompt ranking

also go try some Mini-Prompts from my collection ! #GoPromptYourself

So, start exploring and enhancing your Prompting skills today!

written by Zen (prompt engineer lvl 8.5) with a lil' help from ChatGPT






Learn about the PromptCraft Levels