Skip to Main Content

Generative AI and ChatGPT: Prompt Engineering

Prompt Engineering

What is prompt engineering?

Prompt engineering includes all the different ways you can instruct a GenAI system to inform its output. It is important to be as clear and precise as you can be, including all relevant details, as the prompt is the seed text that the GenAI uses to generate its output. If you prompt the GenAI with a specific tone or terminology, it will respond with an output that matches your tone and includes those kinds of terms.

When prompting GenAI (like Microsoft Copilot or ChatGPT) it is a good idea to break your prompt down into three parts:

  • Context: Tell it the kind of role, expertise, and language to return with (i.e. A prompt stating "ChatGPT you are a 3rd year Nutrition Science student at University..." will get different responses to "You are a busy Mum with three kids" when asking about a weekly menu suggestion.)
    • Tell it the domain or topic
    • Any relevant background information
    • Any specific terminology
    • Constraints and limitations of the specific context
  • Task: Tell it the topic or activity you want it to write about (i.e. Asking for a menu with macro-nutrient make up.)
    • State your objective or goal
    • Break down the steps involved
    • Put in any details such as information or text that the GenAI needs
  • Output: How do you want it to respond? What kind of format? What kind of tone (i.e. Formal or Informal, etc.)
    • Specify the format you want the output in
    • How much detail you want
    • Any specific things you want included or excluded from the output

For an example of this, see the LinkedIn Learning video where Cohen writes a prompt giving the Context of a school science teacher, Task of describing quantum physics, and Output of 800 words without jargon.

Prompt engineering.

https://www.linkedin.com/learning-login/share?account=2072140&forceAccount=false&redirect=https%3A%2F%2Fwww.linkedin.com%2Flearning%2Fgenerative-ai-for-business-leaders%2Fprompt-engineering%3Ftrk%3Dshare_video_url%26shareId%3Dl7PhpNhcSgGi3WUMOcVkpw%253D%253Dhttps://www.linkedin.com/learning-login/share?account=2072140&forceAccount=false&redirect=https%3A%2F%2Fwww.linkedin.com%2Flearning%2Fgenerative-ai-for-business-leaders%2Fprompt-engineering%3Ftrk%3Dshare_video_url%26shareId%3Dl7PhpNhcSgGi3WUMOcVkpw%253D%253Dhttps://www.linkedin.com/learning-login/share?account=2072140&forceAccount=false&redirect=https%3A%2F%2Fwww.linkedin.com%2Flearning%2Fgenerative-ai-for-business-leaders%2Fprompt-engineering%3Ftrk%3Dshare_video_url%26shareId%3Dl7PhpNhcSgGi3WUMOcVkpw%253D%253Dhttps://www.linkedin.com/learning-login/share?account=2072140&forceAccount=false&redirect=https%3A%2F%2Fwww.linkedin.com%2Flearning%2Fgenerative-ai-for-business-leaders%2Fprompt-engineering%3Ftrk%3Dshare_video_url%26shareId%3Dl7PhpNhcSgGi3WUMOcVkpw%253D%253Dhttps://www.linkedin.com/learning-login/share?account=2072140&forceAccount=false&redirect=https%3A%2F%2Fwww.linkedin.com%2Flearning%2Fgenerative-ai-for-business-leaders%2Fprompt-engineering%3Ftrk%3Dshare_video_url%26shareId%3Dl7PhpNhcSgGi3WUMOcVkpw%253D%

You can also ask follow-up questions, and engage the GenAI's output in iterative improvement.

For more detail on "Prompt engineering" see the Academic Skills @ ECU page on Understanding Generative AI.

Why is prompt engineering important?

  • By being precise and neutral in your prompt, you can help the GenAI avoid Confirmation bias (if you were to prompt ChatGPT with: "Tell me more about the third planet from the Sun, Mars..." it will likely output information about the "third planet named Mars," even though this is incorrect -- it has used your prompt as the start of a story, and does not distinguish fact from generated fiction.)
  • Improved accuracy and relevance of AI responses: Ask it to tailor its response to "excel" at planning for a "3rd year university" "essay," to avoid an output that merely "passes" for a "high school" "report."

Prompt Engineering for GenAI Image Generators

Prompt engineering for GenAI image generators is similar to engineering for text-based GenAI, except the Context is less important, and the Task and Outcome parts are more visual. Consider:

  • Composition and Framing: “Close-up,” “Low angle,” etc.
  • Style and Technique: “Art Deco,” “1920s,” etc. Or “Black and white,” “Photography,” etc.
  • Context and Vibe: “Studio shoot,” “Vibrant,” etc.

All this is in addition to the Content.

For example, the prompt:

Can you make me a close-up photo of a clown in a space suit with dramatic lighting

Will be very different to:

Please make a wide-angle image of a clown in a space suit in Cubist style.