Robot word engineer

Prompt Engineering and Basics of AI

Prompt Engineering 

“Prompt engineering” may be the most common new term created with the growth of AI.  It also suggests more complexity than is involved. However, if like most people, you’re limiting your AI prompts to one or two sentence questions or requests for text, a basic understanding of writing effective prompts can improve your results exponentially. 

The basis much of the content in this section comes from this article, How I Won Singapore’s GPT-4 Prompt Engineering Competition by Sheila Teo. If you’re intrigued by the end of this post, I’d encourage you to continue reading there. 

When writing a prompt, it’s important to give the AI as much context and detail as possible. Because they are prediction engines, their output is by default very general and vague. Details and context are what allow them to produce higher quality and more targeted output. The article linked above uses an acronym to suggest elements to be included in every prompt, CO-STAR.  The first two you should probably have in every prompt. The last four only if you don’t want what the AI tends assume by default. 

  • Context – The more detail you can provide here, the less generic and more useful the response you’ll receive. Include background information, who you are, relevant facts, related examples, and reasoning for the request should all be included. Error on the side of verbosity. 
  • Objective – Be very specific and don’t assume. I recently asked an AI to produce an exam for a German textbook, which it did, but in English. Specify as many requirements as you can. Nothing is too obvious. 
  • Style and Tone – Here we start with optional parameters.  AI’s tend to write in what I consider “Wikipedia” style and tone. Maybe that’s what you want, if so, you’re fine. If you want it to sound more conversational, academic, compelling, etc. specify it here. 
  • Audience – It will assume a generic public audience as you would see on the internet. For my AI queries, I am frequently requesting dialogue or texts for introductory language learners, so I specify that my audience is a class of beginning students or native speaking children in the target language. 
  • Response – You’ll often want to include the length of the text here. Keep in mind, AI’s can do more than plain text. Maybe you’d like html to paste into a Moodle page, information formatted as a table, etc. 

System prompts 

Behind every AI, there is something called a system prompt that governs the AI’s behavior. They are always something along the lines of “You are a helpful assistant …”. In theory, these are secret, but they’ve been reverse engineered at some point on the major platforms.  These cannot be changed, however, if you’re using ChatGPT they do give you a way to add them. Click your profile icon top right and then Customize ChatGPT 

This can be a powerful feature because of what is called the “context window”. AI bots will remember previous parts of your conversation when providing a response. This is why iterative queries are effective; however, there are limitations. Once the total number of words/tokens exceeds AI’s context window, the bot will begin to “forget” text at the beginning of your conversation, which may include your most important initial prompt. By adding information here, you can remind the bot before each query to that information is not lost. 

Delimiters

AI will understand the use of delimiters within your text. This is useful when you’re trying to create a longer documents or one with defined sections you’d like to include. For example, I created this prompt to generate a draft a an exam for beginning German with the usual sections on reading, grammar, listening comprehension, etc.

Less common but useful AI functions 

Data cleaning formatting – Most examples you’ll find are from those who work daily with data using json, xml, and other formats. All of us, though, have at some point received tables or lists in Word that wished to import into Excel, or we received data with formatting errors.  AI can help with both, taking text and formating to .csv for the Excel or .html for Moodle, websites, and blog posts. It will also understand natural language, so you could ask it to combine first and last names into a single column, extract the city from an address line, etc. 

AI as explainer – Again you’ll likely see most examples include explanations of computer code. AI does very well at explaining and documenting code, but it can do the same for text with unfamiliar technical terms, foreign languages, and more. The only caveat I’ll include is you should be able to understand the text well enough that after hearing the explanation you can decide if it’s accurate. This is an area where AI’s expressed confidence can be misplaced. 

AI for simulations – I am big fan for the potential for chatbots for foreign language practice. They can be made to be far more open-ended, informal, and conversational than chatbots even six months ago with further improvements to voice communication on the way. AI is also useful for any other situation where role-playing could be useful: practice interviews, business scenarios, debates, even recreating hypothetical historical interactions. 

As always, if you have other suggestions, leave a comment below or send us an email at academictechnology@dickinson.edu.  


Posted

in

by

Tags: