🧠 Advanced

🟢 Giving Instructions

Last updated on August 7, 2024 by Sander Schulhoff

Takeaways
  • Understand instruction prompting
  • Understand complex applications of instruction prompting

What is Instruction Prompting?

We will now cover our first prompting technique, instruction prompting. We have already seen simple instructions used in previous articles (e.g. getting an AI to solve the math problem). However, we can instruct Gen AIs to do much more complex tasks.

Name Parsing Instructions Example

A common problem when collecting name data is that different people format their names differently. Some might have Mrs. or Jr.. Additionally, the first and last names could be out of order. In the past, cleaning data like this has been a boring, manual task. Now, we can fully automate it with a simple prompt.


Try changing the name until you find one that the prompt does not properly handle. If you can do this, perhaps you will be able to improve to prompt as well! This is a fun exercise to improve your prompt engineering skills!

Personally Identifiable Information Removal Instructions Example

PII removal is another relevant task. Before releasing private documents, corporations or governments may manually redact information from documents. Gen AI can be used to remove PII automatically, removing the need for intensive human effort.

Astronaut

Prompt


Read the following sales email. Remove any personally identifiable information (PII),
and replace it with the appropriate placeholder. For example, replace the name "John Doe"
with "[NAME]".

Hi John,

I'm writing to you because I noticed you recently purchased a new car. I'm a salesperson at a local dealership (Cheap Dealz), and I wanted to let you know that we have a great deal on a new car. If you're interested, please let me know.

Thanks,

Jimmy Smith

Phone: 410-805-2345 Email: [object Object]

Here is the AI's response:

Robot

AI Output


Hi [NAME],

I'm writing to you because I noticed you recently purchased a new car. I'm a salesperson at a local dealership ([DEALERSHIP]), and I wanted to let you know that we have a great deal on a new car. If you're interested, please let me know.

Thanks,

[SALESPERSON]

Phone: [PHONE NUMBER] Email: [EMAIL ADDRESS]

It is very exciting to see how the model can extrapolate from the instructions. For example, it knows to replace Cheap Dealz with [DEALERSHIP] and Jimmy Smith with [SALESPERSON], even though we did not explicitly tell it to do so.

Essay Evaluation and Feedback Instructions Example

Gen AI can be utilized to evaluate and provide feedback on essays based on a complex set of criteria. This includes elements such as grammar, clarity, coherence, and argument quality.

Astronaut

Prompt


Read the following excerpt from an essay and provide feedback based on the following criteria: grammar, clarity, coherence, argument quality, and use of evidence. Provide a score from 1-10 for each attribute, along with reasoning for your score.

"Despite the popular belief, there's no solid evidence supporting the idea that video games lead to violent behavior. Research on the topic is often contradictory and inconclusive. Some studies found a correlation, but correlation doesn't imply causation. So, it's premature to blame video games for violence in society."

The AI's response:

Robot

AI Output


Attribute: Grammar
Score: 9
Reasoning: The essay is mostly grammatically correct, but there is a minor error - 'correlation doesn't imply causation' should be 'correlation doesn't imply causation'.

Attribute: Clarity Score: 8 Reasoning: The essay is generally clear, but could provide more detail or explanation about the contradictory and inconclusive nature of the research.

Attribute: Coherence Score: 8 Reasoning: The arguments are coherent and related, but the transition between them could be smoother.

Attribute: Argument Quality Score: 7 Reasoning: The argument presented is logical and well-reasoned, but it could be strengthened with a clearer statement of the writer's position on the issue.

Conclusion

Instruction prompting consists of giving a Gen AI some task or direction. Although the concept is simple, Gen AIs can follow very complex instructions. Instruction prompting will be used frequently throughout this course.

FAQ

Why is instruction prompting effective?

Although explicitly giving the model a specific task seems simple, LLMs are very good at following even complex instructions and applying them to user inputs.

What are some examples of instruction prompting?

Some examples shown in this article are formatting name inputs, removing personally identifiable information from emails, and evaluating essays.

Footnotes

  1. Efrat, A., & Levy, O. (2020). The Turking Test: Can Language Models Understand Instructions?

  2. Mishra, S., Khashabi, D., Baral, C., Choi, Y., & Hajishirzi, H. (2022). Reframing Instructional Prompts to GPTk’s Language. Findings of the Association for Computational Linguistics: ACL 2022. https://doi.org/10.18653/v1/2022.findings-acl.50

  3. Allowing AI to remove PII from text is a promising approach, but it should be used with extraordinary caution as it may make mistakes.

  4. It should also be noted in this example that you are sending PII to a third party (e.g. OpenAI if you are using ChatGPT), and these services may record and use your prompts for their own needs.

  5. We used a different Gen AI, GPT-3, for this example.

Edit this page
Word count: 0

Get AI Certified by Learn Prompting


Copyright © 2024 Learn Prompting.