How to Write a Good Prompt for AI?

Article updated on Saturday, March 16, 2024.

How to Write a Good Prompt for AI?

What is a prompt? How to effectively communicate with AI? Learn how to write professional prompts for ChatGPT and image generators.

What is an AI prompt?

A prompt is a piece of text that an artificial intelligence interprets to produce results. The AI will tokenize the words and phrases, breaking them down into smaller parts called “tokens,” which are then compared to the training model it has been trained on. It can then generate a result.

These results are in the form of text for AIs like ChatGPT or in the form of an image for image generators.

Some prompts can also be images for image generators.

We talk about:

  • text-to-image to refer to an image generated from text
  • image-to-image to refer to an image generated from another image

How does a prompt work?

Once a prompt has been written, it is sent to a server where it will be interpreted and compared to the AI model. The language model will then provide us with a result that appears in the form of text or an image.

Want to ask better questions to ChatGPT? Then my article on prompting with ChatGPT will surely interest you!

Prompts for AI image generator

In my article the best image generators by AI, I talk about the best solutions available to create your virtual art.

But if you don’t know how to write a good prompt, you won’t get very far.

How to write a good prompt for image generators?

Format (optional): Do you want your image to be a painting? What format?

Subject: This is the main element you want to see. What does your image represent? What is depicted?

Adjectives: In addition to the subject, we have adjectives that will serve to specify how it is.

Context: Where is your subject? In what context? What inspiration?

The subject, adjectives, and context form the description of your prompt.

Style: What style do you want? A style inspired by a painter? A movie? A video game? A particular art style?

Scene: What angle, view, scene appears in your virtual art?

Quality: What quality of rendering? Example: 8k.

What is a negative prompt?

A negative prompt is a type of input used with AI image generation models to specify what should not appear in the generated image. These prompts help refine the result of the created art by ensuring that certain elements or characteristics will not be present.

Free art prompts for AI image generators

Many sites offer galleries of images generated from the various models on which AI art has been trained.

I’ll give you a few below.

Lexica: the search engine for Stable Diffusion

Lexica positions itself as the search engine for Stable Diffusion. Its interface consists of a search bar at the top of the page and then results of images generated by the AI.

💡 Want to learn more about Stable Diffusion and how to run it for free on your computer? Then my comprehensive guide on Stable Diffusion and Automatic1111 will surely interest you!

You can retrieve the prompts of the images you find interesting.

I talked a lot about cats 🐱 in my article on the best image generators by artificial intelligence, so I’ll give an example of an AI image of a dog 🐶.

It’s a small black and brown dachshund wearing a golden Jedi knight cape holding a blue lightsaber in its left paw, with R2D2 and 3PO in the background, art station trends, concept art, highly detailed, complex, sharp, digital art, 8k.

Star Wars scene artificial intelligence: a small black and brown dachshund wearing a golden Jedi knight cape holding a blue lightsaber in its left paw, with R2D2 and 3PO in the background, art station trends, concept art, highly detailed, complex, sharp focus, digital art, 8k

Source: Lexica.art

So I can retrieve the prompt for this image:

Star Wars scene artificial intelligence: a small black and brown dachshund wearing a golden Jedi knight cape holding a blue lightsaber in its left paw, showing R2D2 and 3PO in the background, art station trends, concept art, highly detailed, complex, sharp focus, digital art, 8k

And then modify it, use it with another tool, with different parameters, etc.

MidJourney showcases

MidJourney offers an art gallery with the best recent images that are highlighted. You can retrieve the prompt that was used for the image you like and reuse this prompt to create your own image.

You can also find free prompts on the Stable Diffusion France website, which offers a course called Stable Diffusion: Generating images by AI like a pro.

Here is the link to the gallery

PromptBase

[PromptBase] is a marketplace to find prompts for DALL·E, GPT-3, Midjourney, Stable Diffusion.

This marketplace was launched quite early and has become the default solution for buying and selling prompts.

You can find a lot of prompts to save time, get better images, and spend fewer credits on AI services and their APIs.

Since prompts are sold by humans, you can also make money by selling your prompts if you are a good “prompt engineer.”

💡 By the way, if you want to learn how to create prompts of better quality, I recommend the training Stable Diffusion: Generating images by AI like a pro.


Thomas Collart

Hey, I'm Thomas 👋 Here, you'll find articles about tech, and what I think about the world. I've been coding for 20+ years, built many projects including Startups. Check my About/Start here page to know more :).