Read this article if you are excited about Generative Artificial Intelligence (Generative AI), ChatGPT, Stable Diffusion and MobileGPT. In this article we are going to explore the art of prompting, or prompt engineering. By the end of this story, you will be a master in generating prompts for Generative AI - we will cover both text and image generating prompts.
Read this article if you are excited about Generative Artificial Intelligence (Generative AI), ChatGPT, Stable Diffusion, and MobileGPT.
In this article, we are going to explore the art of prompting, or prompt engineering. By the end of this story, you will be a master in generating prompts for Generative AI - we will cover both text and image-generating prompts.
This article is for you if you want to maximize the output you get from the GenerativeAI tools you are using.
What Is Prompt Engineering?
Prompt engineering, at its most fundamental level, is the process of designing, crafting, and refining inputs or "prompts" that are used to guide an artificial intelligence (AI) model's outputs.
The term is especially relevant when we're dealing with generative AI models, such as the ones developed by OpenAI (GPT-3 and GPT-4) or other similar technologies.
Imagine you're giving instructions to someone to perform a task they have never done before. The clarity and specificity of your instructions can greatly influence the end result. Similarly, with AI, the way you frame your prompts can significantly affect the AI's responses.
Step-by-Step Guide to Building Effective GenerativeAI Prompts for Text Generation
There is no better way to learn than with examples; we will use - GenerativeAI on WhatsApp to demonstrate these concepts.
Example Prompt:
Write a Speech
This is the response we get back from MobileGPT, the instruction is too vague for the AI to understand, and it will even respond back with more clarification questions.
At a minimum, we need to provide a topic or subject. This brings us to the basics of prompting - you need to provide both the format and topic.
Format: This is what the AI must return or submit back to you, it is the basis of your prompt. For instance, do you ask the AI to generate text in the form of a bullet-point list, a formal letter, a speech, or a conversation?
Subject: What is your format about? The subject, topic, or title of the content that forms the basis of the content that the AI will return.
In our example, we could say:
Write a speech about ‘The dangers of Plagiarism’
The Title or Subject is: Dangers of Plagiarism
Generative AI is so intelligent and well-trained that - Format and Subject alone can be enough to generate real great content.
However, we want to refine this a little more, so I am going to introduce a few more variables that will customize this speech, exactly the way we want it.
Consider:
Tone
Audience
Objective
Act As
The Tone
The tone refers to the general character, attitude, or sentiment conveyed by the content that the AI generates. It is the overall feeling or mood that is portrayed through the language used in the output.
You can think of tone as a directive on how the AI should "sound" in its response.
The Audience
The audience refers to the intended recipients or consumers of the AI-generated content. Essentially, it is the group of people that the content is designed to reach or influence.
Clarifying the audience is very important in GenerativeAI - delivering our speech to kindergarten class would not be the same as graduating class at Harvard for example - even if the subject was the same.
Objective
The objective refers to the intended purpose or goal of the AI-generated content. It's essentially what you aim to achieve with the content that the AI produces. Defining the objective can help AI pick relevant talking points for your content.
Act As
Defining "Act As" in a prompt is a way of instructing the AI to assume a specific role, perspective, or persona while generating the content. This can significantly influence the tone, style, language, and overall nature of the AI's output.
In most cases, you will not need to define all these variables in one prompt. For example, if you choose to say: Act as a lecturer, you might not need to define a tone because the persona comes with a context and tone.
Let us put these to the test and refine our prompt.
Variation 1:
Write a speech about ‘The dangers of Plagiarism’ to be delivered to high school graduates by Oprah Winfrey
Variation 2:
Write a speech about ‘The dangers of Plagiarism’ in a humorous tone to convince pre-school children about the dangers of plagiarism
Changing the audience results in a completely different speech, specifying the tone helps the AI understand how to structure the content, and most importantly - defining the objective gives the AI specifications of what the content should achieve.
MobileGPT Cheat Sheet
I developed a summary reference guide, download it, share it, and when in doubt, refer back to the cheat sheet:
But wait - there is more. You can customize the output you get from Generative AI by specifying more variables such as (1) background information, (2) keywords, (3) word count, (4) guidelines, and (5) outline.
Background Information
Say you are giving a speech, but you want the AI to know more about the context. You could give it some background information. For example, you could add: “I am new to this school, this is my first year, and I graduated top of my class; I would like to sound humble in this speech.”
Keywords
I must say GPT3 and GPT4 engines, which we call for MobileGPT responses generally love to ignore instructions about keywords, but I love to include them, especially when writing content for blogs or social media.
It’s usually important to specify the important terms and words that must come through in the content generated.
Word Count
This is another variable GPT3 and GPT4 engines love to ignore, but not always, depending on how you phrase it. It might be better to say: write me 5 paragraphs with 2 sentences each instead of saying: write me 500 words.
Guidelines
Honestly, “guidelines” alone, as an added variable can mean the difference between a generic response and a well-engineered AI output. Guidelines are like sets of instructions on “how” the AI should go about structuring your content.
Imagine you want to write a research report and you tell AI:
Write a research report on the impact of social media on mental health.
You could add audience, tone, and objective, but you will probably need to give the AI more structure.
This is where guidelines come in; I normally say:
Write a research report on the impact of social media on mental health.
--Start Guidelines--Start by providing an executive summary highlighting all the important points and takeaways.
Discuss the benefits and challenges in a critical manner, producing evidence for and against the topic. Give a brief background on the topic, discuss the literature around it, and present the different schools of thought.
Discuss how the topic has evolved over the years and how the literature and schools of thought have shifted. Add a SWOT analysis towards the end and discuss the outcomes. Finally, summarize the key takeaways and present the findings in bullet points.--End Guidelines--
Let us test this out on MobileGPT, this time we will use the “Long Research Report” functionality. Just click on the menu, from any message and choose - Long Research Report.
Then enter the title of your report: The Impact of Social Media on Mental Health
That is it: MobileGPT handles the prompt engineering in the background, collects real data from the internet, and returns a report in Word format.
You will also get links used to compile the data - so you can go expand on the report in your own time.
Outline
It sometimes helps to give Generative AI content outline, especially if you are generating content for reports, blogs, or content that needs to follow a prescribed outline. I will use blog writing as an example, you could provide an outline like this:
Generate a blog about the dangers of plagiarism, and include the following subheadings in the blog. (1) Introduction - discuss the purpose of the blog, (2) Benefits - Talks about the benefits of plagiarism, (3) Discuss the challenges with plagiarism, (4) Conclude - write a compelling conclusion.
Building Effective Prompts for Image Generation With AI
AI image generation might be easier as there are fewer things and variables you have to remember. As we did with text generation, we will start with simple prompts, and build up the complexity with more detail to refine the output and customize what we will get from the AI.
We will work with the prompt:
Generate an image of a dog
Lucky for us, we can also do this on MobileGPT - select Image Generation from the menu, then enter your prompt.
This is not the dog I wanted. When it comes to image generation, you really have to think like an artist. Start visualizing this dog, what type of dog is it, what is it doing, and where is it.
Define the subject in detail.
Define what the subject is doing
Define the background image in detail.
Let us try this again:
Generate an image of a white chihuahua, running on the pavement, in front of a house, surrounded by blue skies and tall trees.
The image looks much better, but there is more. Consider adding the image type, you can choose from:
Image Type
Photorealistic: Images that look like photographs
Sketch: Pencil or charcoal sketches
Watercolor images
Oil Painting images
Pointillism: The image is made up of small dots of color. They have a unique look and feel, with a lot of detail and texture.
Cartoon: These are images that are generated to look like cartoons.
Anime/Manga: Images that look like Japanese anime or manga.
Pop Art: Images that look like pop art, with bold colors and graphic shapes.
Background Settings
An often overlooked variables when doing image generation is the setting. This usually goes hand in hand with the image type and depends on the subject of the image.
For example, it makes sense for a model to be in a studio setting, perhaps it’s a photo shoot, and for a bird to be in a natural setting, like a forest.
Here are some examples:
AI image generation technologies have advanced to a point where they can create a wide range of backgrounds and settings, complete with complex lighting and textural details.
The specific capabilities may depend on the particular AI model and its training data, but here are a few examples of the types of backgrounds and settings that could be created:
Studio Setting: This could include a basic backdrop (like white, black, or a specific color) with controlled, professional lighting. Props and models can be included as well, with the AI adjusting their appearances to match the studio lighting conditions.
Natural Settings: These could include forests, mountains, beaches, deserts, oceans, and other landscapes. Lighting conditions could vary from bright sunlight to the soft hues of a sunset or the cool tones of a moonlit night.
Urban Environments: Cityscapes with skyscrapers, busy streets, parks, or suburban neighborhoods are all possible. Again, lighting conditions can be varied to simulate different times of day or weather conditions.
Indoor Scenes: These could be home interiors, offices, restaurants, schools, museums, or any other type of indoor setting. Lighting can be adjusted to match typical indoor conditions like the warm glow of a table lamp or the bright fluorescent lights of an office.
Historical or Fictional Settings: Depending on the AI's training data, it might be possible to generate images of historical settings (like a medieval village or a 1920s city street) or fictional environments from books, movies, or games.
Abstract Backgrounds: The AI can generate purely abstract or artistic backgrounds with a variety of colors, shapes, and patterns.
Let us apply what we have learned now and create a futuristic car fit for a magazine cover:
Generate a photo-realistic image of a futuristic electric BMW car, in a studio setting with perfect colour and light shinning on the metallic surface of the car.
And this was just my first attempt; you can refine the prompt by adding how the car is positioned, different camera angles, etc.
Hope you learned something; feel free to check out MobileGPT here: Add it to your WhatsApp experience, and become a prompt master.