Stable Diffusion Prompt Comment

As AI tools like DALL-E, Stable Diffusion, and ChatGPT become more advanced, properly formatting prompts is crucial to get the best results. In this article, I’ll share my expertise on writing effective AI prompts, with plenty of meaningful examples across different AI models.

Whether you’re generating images, text, or code, following prompt engineering best practices will help your AI assistant understand exactly what you want. Read on to learn techniques I’ve picked up over many hours of fine-tuning prompts.

Image Generation with Stable Diffusion

Stable Diffusion is revolutionary AI that generates images from text prompts. However, it can only depict what you describe in your prompt. The more details you provide, the better the result.

Here’s an example Stable Diffusion prompt to create a specific landscape painting:

An oil painting by Claude Monet of a Japanese footbridge over a still pond with lily pads and cherry blossom trees in bloom. The style is impressionist with visible thick brush strokes in vivid reddish pink, bright green, and cobalt blue. The bridge is slightly angled with a red railing leading from the foreground to a pagoda in the background. Early morning light reflects softly on the water.

This prompt sets the scene clearly, specifies an art style, defines colors, lighting, and composition details. Without these specifics, the output could look completely different!

Use this formatting consistently:

  • Artist’s name
  • Art medium
  • Exact scene description
  • Art style
  • Prominent colors
  • Lighting
  • Composition

Conversational AI with ChatGPT

ChatGPT is an AI assistant that can answer questions and converse on many topics when prompted properly. The key is providing enough context so ChatGPT can give an accurate, relevant response.

Here’s an example prompt querying about US history:

I am a high school student studying US history in the year 2023. Please act as a tutor and **explain the causes of the US Civil War between the North and South in the 1860s**. Ensure your 3-paragraph explanation is accurate and unbiased using supporting details. Write as if you are teaching a student who knows little about this topic.  

This structures the request clearly, defines ChatGPT’s role, states exactly what information is needed, and sets expectations on answer length/tone. Without explicitly saying to be accurate and unbiased, the AI could inject opinions or falsehoods!

Use this formatting pattern:

  • State ChatGPT’s role
  • Define student’s knowledge level
  • Ask a specific question
  • Set expectations for response length, accuracy, objectivity

Code Generation with GitHub Copilot

GitHub Copilot is an AI pair programmer which suggests code completions and entire functions. Like with other AI models, providing examples helps Copilot immensely.

Here is a prompt to generate a Python function:

# Generate a Python function named validate_email 
# It accepts one string parameter 'email'
# It should return True if email is a valid email string, otherwise return False
# Valid emails have one @ symbol, text on both sides, and a domain extension like .com

# Examples of valid emails:
# [email protected] 
# [email protected]

# Examples of invalid emails:  
# missing_at_symbol.com
# @noname.com

def validate_email(email):

This prompt explains exactly what the function should do, defines the input parameter, provides examples of valid/invalid inputs, and starts the function definition for Copilot to complete. Without the examples, Copilot would have little indication of what constitutes a valid email.

Use this template:

  • Describe function name and purpose
  • Define parameters
  • Give examples of expected input/output
  • Start writing code for AI to complete

Prompt Engineering Tips

Through much trial and error, I’ve learned ways to optimize prompts to maximize AI performance. Here are my top tips:

  • Use clear, simple language – Avoid jargon and complex sentences
  • Add examples – Provide sample inputs and ideal outputs
  • Set expectations – Define exactly what you want the AI to generate
  • Use consistent formatting – Structure prompts similarly each time
  • Proofread prompts – Fix typos/ambiguities that could trip up the AI
  • Try different approaches – Re-word prompts that don’t work to trigger the AI differently

Take the time to carefully engineer your prompts. It makes a world of difference!

Helpful Prompt Engineering Resources

Here are some websites I recommend for learning more about crafting effective AI prompts:

Spend time browsing through prompts on these sites to get ideas for your own projects. Prompt engineering is an iterative process, so the more you practice, the better you’ll get!

Conclusion

I hope these AI prompt examples and tips help you create prompts that produce fantastic AI-generated images, text, and code. Properly formatting prompts is an essential skill as these models grow more advanced. Feel free to reach out if you have any other prompt engineering questions!