Blog

Prompt Engineering for Beginners

David Balami February 6th, 2024

Prompt Engineering for Beginners

What is prompt engineering?

Prompt engineering is a term used in the context of machine learning, particularly with models like GPT-4, to describe the process of carefully crafting the input (or "prompt") to the model in a way that elicits the desired output.

Just as traditional software engineering involves designing code to achieve a specific functionality, prompt engineering involves designing the prompts that are fed into a language model to achieve a specific response. This can involve adjusting the wording, context, or structure of the prompt, and may require a deep understanding of the model's behavior and capabilities.

Prompt engineering is a way to guide a machine learning system to give better answers. It's like asking questions in a specific way to get the kind of answer you want.

For example, if you're using a language model, how you ask your question - the "prompt" - can make a big difference in the response you get. So prompt engineering involves finding the best way to ask questions to get the results you need.

Prompting for image generation

Text-to-image prompting is a type of prompt engineering where a language model is provided with a text prompt, and it generates an image based on that prompt. This technique is used in machine learning models capable of generating images from textual descriptions.

For example, a model like DALL-E 2, which was released by OpenAI, is capable of generating unique images from textual descriptions. If you provide it with a prompt like "an armchair in the shape of an avocado", DALL-E 2 would generate an image of an armchair that looks like an avocado.

Prompting best practices

Good text-to-image prompt techniques involve crafting prompts that provide clear instructions and specific details to guide the generation of images. Here are some key techniques:

Core Prompt

Start with a simple and concise description of the central theme, subject, or figure you want in your image. For example, "Panda," "A warrior with a sword," or "Skeleton." The core prompt forms the foundation of the image.

For example:

  • "A majestic waterfall surrounded by lush greenery" (try it)
  • "A futuristic cityscape at night" (try it)
  • "A magical forest with glowing mushrooms" (try it)

Style

Specify the desired artistic style for the image. The choice of style significantly influences the final outcome. Common styles include realistic, oil painting, pencil drawing, and concept art. You can indicate the style by modifying the prompt, such as "a photo of [core prompt]" for a realistic image or "a pencil drawing of [core prompt]" for a pencil drawing style.

For example:

  • "A photo of a panda in a realistic style" (try it)
  • "An oil painting of a serene landscape" (try it)
  • "A pencil drawing of a majestic mountain range" (try it)
  • "Concept art of a sci-fi spaceship" (try it)

Artist

To make the style more specific or coherent, you can mention the name of an artist associated with that style. For example, "in the style of Pablo Picasso" or simply "Picasso" for abstract images. You can explore artists from different styles, such as portrait artists, oil painters, or landscape artists, to add more depth to your prompt.

For example:

  • "An abstract painting of a panda in the style of Pablo Picasso" (try it)
  • "An oil painting of a serene landscape inspired by Claude Monet" (try it)
  • "A pencil drawing of a portrait resembling John Singer Sargent's style" (try it)
  • "A landscape painting reminiscent of Thomas Moran's artwork" (try it)

Finishing Touches

Add additional elements or details to refine the image further and achieve your desired vision. These finishing touches can include characteristics like highly-detailed, surrealism, specific color schemes, lighting effects, or post-processing. Use these elements to enhance the image and make it visually appealing.

For example:

  • "A highly-detailed and vibrant oil painting of a panda, with dramatic lighting" (try it)
  • "An ethereal concept art of a floating city, featuring a triadic color scheme" (try it)
  • "A surrealistic pencil drawing of a skeleton in a dreamlike setting" (try it)
  • "A digital illustration of a warrior with a sword, with a matte finish and sharp focus" (try it)

Prompt engineering for vector images

In the next part we discuss aspects related to effective prompt engineering aimed specifically for generating high quality vector images.

Create your own SVG vector images with AI
More from the blog
Designing a logo with AI
Designing a logo with AI
How you can use generative AI to create a logo for your business.
January 28th, 2024
SVG is the Future (and Present, and Past)
SVG is the Future (and Present, and Past)
In this post, we share our take on SVG and why we love it.
April 8th, 2024
The Evolution of AI: Unveiling the Power of Transformers
The Evolution of AI: Unveiling the Power of Transformers
In this post, we discuss the transformative impact of Transformer models in AI.
December 22nd, 2023