NowComment
2-Pane Combined
Comments:
Full Summaries Sorted

Mastering Prompt Engineering or the Art of AI whispering, by Sahbi Chaieb

Author: Sahbi Chaieb

Chaieb, Sahbi. “Mastering Prompt Engineering or the Art of Ai Whispering.” Sahbi Chaieb, 5 Mar. 2023, sahbichaieb.com/prompt-engineering/.

Generative AI systems that respond to plain language inputs are a game-changer. It means anyone can interact with AI without needing programming skills. Users can generate complex outputs like code, images, music, or text just by giving clear instructions. This saves time and effort while also unleashing new possibilities for creative expression and problem-solving.

In this post we will explore the following topics:

  1. The importance of prompt engineering
  2. Practical examples of prompt engineering
  3. Resources and tools to get started with prompt engineering

The importance of Prompt Engineering

Anyone who has used generative AI systems knows that getting the best results for a task requires writing very precise instructions. This process is called prompt engineering, and it’s a crucial skill for effective use of generative AI. Crafting effective prompts involves understanding the AI model’s capabilities and limitations, selecting the appropriate input format, and providing precise instructions.

Click on this image of a Twitter post to see the wealth of follow-up!

Mastering prompt engineering leads to more accurate and relevant outputs from generative AI systems. Tesla’s former chief of AI Andrej Karpathy describes it as a kind of “large language model (LLM) psychologist”.

Jaon Allen won the Colorado State Fair’s annual art competition last year, he used a combination of multiple Midjourney outputs (AI art generator tool) and manual editing on Photoshop to create “Théâtre D’opéra Spatial”

Thtre Dopra Spatial, Jason Allen
Théâtre D’opéra Spatial, by Jason Allen

In this interview 1, he describes his process and how he spent hours searching for the perfect prompt to create his work.

“I’m not sharing my prompt ever, it’s because the prompt is valuable. I think that it proves there’s skill and time and creativity involved in creating the prompt.” — Jason Allen

Prompt engineering is starting to be recognized as a valuable skill, the superpower to get AI to generate the outputs you want. Companies are starting to hire Prompt Engineers 2 and new businesses are emerging around it.

Practical examples of Prompt Engineering

Designing a prompt

A prompt may consist of one or a combination of the following components 3 :

  • The instruction
    A specific task you want the model to perform: Summarize, Recommend, Translate, Explain, Generate, etc.
  • The context
    It allows to add external information or additional context, which guides the model to generate better responses. Example:
  • Input Data
    The input can be the question that we want to answer, examples of answers or an image to edit in the context of image generators.
  • Output Indicator
    Indicates the desired type or format of the output 4.Examples: Format everything in Markdown, output this in a table

Examples of prompting strategies

  • Few-Shot Prompts
    Few-shot prompts are prompts that include a few demonstrations of the task, which improves the performance 5.
  • Priming Prompt
    An advanced technique to interact with an AI Chatbot is to include a priming prompt. This allows you for example to give a personality to the model. For example if you want it to act as an advertiser 6 :

    You can find some additional examples here
  • Chain of thought
    This type of prompting tells the model to explain its reasoning before giving the final answer. For instance, using Let's think step by step allows to improve the permormance in reasoning tasks 7.
  • Chained Prompting
    Performing some complex tasks using a single run of a Large Language Model (LLM) can be challenging. To solve this problem, we can chain multiple prompts to achieve better results 8.

Image prompting

If you have attempted to generate images with DALL-E, Midjourney, or Stable Diffusion, you may have experienced disappointing results. This is likely due to an incomplete or insufficient prompt. Here are some examples of what your prompt may be missing to achieve fabulous art:

  • Type: painting, photography, illustration, modelshoot, drawing
  • Style: futuristic, unreal engine, pixel art, manga graphics, by [artist]
  • Lighting: natural lighting, cinematic lighting, dramatic lighting
  • Boosters: awesome, stunning, masterpiece, featured/trending on X
  • Resolution: 8K, high definition, best quality, insanely detailed

However, creating art with just words can be challenging, but Prompt engineers can now count on ControlNet 9 which is a new flexible method for adding an additional input, such as a sketch or human pose, to guide the generation of new samples in AI models.

Resources & Tools

Prompt-Engineering-Guide: This Github repository is a gold mine for AI whisperers, it contains a large list of courses, papers, datasets and tools to get you started with prompt engineering.

Best practices for prompt engineering by Open AI.

learnprompting.org: A free, open source and user friendly manual for prompt engineering.

AIPRM: AIPRM is a prompt template collection for ChatGPT, you can choose your task (SEO, SaaS, Marketing, Art, Programming..) and access a curated list of prompts. I would like to thank my colleague Léo for sharing this.

PromptHero: One of the largest prompt libraries for AI generated art.

Conclusion

Generative AI has enormous potential, and as the tools and models improve, they will become more user-friendly and effective, unlocking fresh opportunities for prompt engineering while potentially streamlining the process.

Prompt engineering will evolve alongside AI tools, leading to a new breed of prompt engineers who specialize in fields like advertising, law, and art, as well as specialized tools. As the practice becomes more widespread, it will transform existing jobs and empower professionals to achieve more.

References

  1. Artworks and Artificial Intelligence, arte.tv
  2. Tech’s hottest new job: AI whisperer. No coding required.
  3. dair-ai/Prompt-Engineering-Guide
  4. ChatGPT Guide: 7 prompting strategies for better output
  5. Language Models are Few-Shot Learners
  6. Awesome ChatGPT Prompts
  7. Large Language Models are Zero-Shot Reasoners
  8. Generative AI with Cohere: Part 5 – Chaining Prompts
  9. Adding Conditional Control to Text-to-Image Diffusion Models

Sahbi Chaieb

Written by Sahbi Chaieb, who is a Data Scientist Consultant living in Paris. You should follow him on Twitter

DMU Timestamp: May 12, 2023 14:09





Image
0 comments, 0 areas
add area
add comment
change display
Video
add comment

Quickstart: Commenting and Sharing

How to Comment
  • Click icons on the left to see existing comments.
  • Desktop/Laptop: double-click any text, highlight a section of an image, or add a comment while a video is playing to start a new conversation.
    Tablet/Phone: single click then click on the "Start One" link (look right or below).
  • Click "Reply" on a comment to join the conversation.
How to Share Documents
  1. "Upload" a new document.
  2. "Invite" others to it.

Logging in, please wait... Blue_on_grey_spinner