AI Prompt Engineering

How to Research and Write Using Generative AI Tools

INSTRUCTOR Dave Birss, Creative Expert

LinkedInLearning
See the accompanying PDF file: The Prompt Guide by David Birss

See also other LinkedIn Learning:
Prompt Engineering: How to talk to the AIs

Overview of working with AI

How to work with AI

Sign up to ChatGPT chat.openai.com

Adding value: thinking or doing. Doing has generally been automated by the mechanisms of industrialisation while up until recently, the thinking and creativity was only for humans. Generative AI can help change the way the thinking process progresses, but is an aid only (at this point).

Research + writing -> text
[1]input + [2]process -> [3]output
AI can help but can't do everything. The process still requires judgement, expertise and ability.
While AI can get a good part of the processing done, it is not always correct or valid.

Attitude - ChatGPT is a collaborator to obtain a great result.

How to write an effective prompt

Framework for prompt engineering. Crafting a great prompt to focus on good quality data for best results.

C.R.E.A.T.E.

How to work with responses

Helping you do better. AI is not a search engine. AI is a journey that requires a number of interractions, read and respond with feedback to improve the response. The AI output is not the finished product - your processing is required to complete the text.

Always attribute that you have used AI to create the text.

Using AI to improve research

Using AI to summarise complex information

Better input allows for great output.

Below are ChatGPT prompt examples and the resulting ChatGPT output

Using AI to view an issue from multiple perspectives

Using AI to view an issue from multiple perspectives

Using AI to create fast user personas

Using ChatGPT, we can determine who your potential audiences are. Once we have identified the audiences we can create a user persona. Personas are fictional profiles that represent groups of similar people in a target audience. They can help you figure out how to reach people on a more personal level, while delivering the right messages, offers, and products at the right time.

Using AI to discover interesting facts and statistics

Using AI to create search queries to discover actual sources of information.

Using AI to improve your writing

Determing the tone of existing copy.

Using AI to interesting ideas for headlines and articles

Using AI to help outline your content

Use ChatGPT to outline an article, and then use the outline for research, in order to complete the research where upon you should have all of the ingredients to write your article in one smooth flow

Using AI to improve your writing

AI builds adequacy and provides a demonstrable path forward, but must not be relied on for accuracy - always check.

You can also use ChatGPT to edit and improve your existing text.


Introduction to Prompt Engineering for Generative AI

Ronnie Sheer, Software Developer and Instructor
Introduction to prompt engineering for generative AI

Course impressions: Very basic/light, limited utility, incomplete and vague explanations, poor examples.

Generative AI is a broad description for technology that leverages AI to generate data. This data can include text, images, audio, video, and even code.

Prompt engineering refers to constructing inputs to supply to the AI to obtain desired output.

Tokens are a small units of language that are used by large language models in the processing to produce output. Ronnie then proceeds to give a really poor brief of tokens and models.

ChatGPT chat.openai.com
openai.com/api
platform.openai.com/examples

Zero shot approach vs Few shot
Few shot = adjusting stop sequence.

Fine tuning - requires ~500 good examples, example GitHub Copilot. Lower number of tokens, higher quality responses, better response times.

python -m pip install openai

export OPENAI_KEY=""

Use responsibly, always verify output, know AI biases.
This appears to be a Ronnie cop-out, as he states "beyond the scope" but should have been core to an Introduction.


Prompt Engineering: How to talk to the AIs

Instructor: Xavier Amatriain, VP of Engineering, AI Product Strategy at LinkedIn
Prompt Engineering: How to talk to the AIs

Generative AI revolution

Generative AI much more creative and responds to natural language prompt input.

Large Language Models:
- Trained on huge collection of text
- Trained to predicted the next word
- Show some emergent behaviour: follow and produce realistic conversations, reason about facts when given restrictions
Example: ChatGPT / GPT-4, LLaMA, Sparrow, Bard / LaMDA

Text to image:
Example: DALL-E 2, Stable Diffusion, Midjourney

Text to speech, music, video
Action transformers

Tranformer Architecture
"Attention is All You Need" - Google Research, 2017, 31st Conference on Neural Information Processing Systems (NIPS 2017), Long Beach, CA, USA.
Attention mechanism is a key component of transformers
Reinforcement learning from human feedback (RLHF) has become a key as

Diffusion models for image generation

Zero Shot Learning (ZSL)
Can learn on the fly, learn from information that is new without having to be retrained.

AI prompt
The natural language input that tells the AI model what to do.
Models have quirks, that need to be addressed with skilled prompting.
Reduce chances of hallucinations - invalid or incorrect text.

Prompts can include:
● Instructions
● Question
● Input data
● Examples
Requires some domain understanding to encorporate the goal into the prompt. Including what good and bad outcomes look like, and an understanding of the AI model.

Prompt templates that can be programattically modified.
Prompt engineering tools becoming available.

To use GPT-4, use Microsoft Edge browser and Bing Chat
or sign up to ChatGPT chat.openai.com for GPT-3.5

Model output is stochastic - randomness is involved and will be different everytime even when using the same prompt.
Randomness - are you being creative or looking for accuracy?

Chain of thought prompting - force the model to follow a series of steps when "reasoning" the output.
See: "Chain-of-Thought Prompting Elicits Reasoning in Large Language Models" - Wei et al 2022 ARXIV.

Reduce the chances of inaccuracies by requesting the AI cite sources.

Prompting tips
Order of examples in prompt, LLMs only read forward. Instructions before examples helps get better output.
Affordances: functions that are defined in the prompt.
- Example: whenever you encounter a mathematical expression in the prompt, use calc() to obtain the value of the expression before proceeding.
Different languages: AI can speak almost any language.
LLMs will know programming, not as specialised as Copilot or Codex, but still good.

<|endofprompt|>
Instructs that language model to interpret what comes after this statement as a completion task.