🧩

Prompt Engineering 101

AI technology has evolved to a point where it is now capable of performing many tasks that were once only achievable only by human professionals - tasks like data compilation, strategy development, and content writing. What is ground breaking is that these tasks are creative, yet performed by a machine. Here, we will teach you how to guide this creative flow towards the end results you seek within your specific context.

📌
At Handshake, we believe that text commands, or prompt engineering, will fade away and morph beyond recognition eventually, paving the way for more varied forms of direction and interaction. If you want to future-proof your skill set, explore further as to how you can learn to use AI at our Generative AI Masterclass.

Basic terms:

Prompt - a way for the user to convey to the AI model what he or she wants by sending it direct instructions or samples.

There is a particular craft in writing a prompt. Some people compare it to spellcasting. As in, you have this great power to create things by saying the right words, but it is not as simple as just saying things. There is a reason Harry Potter went to a school teaching magic for as many years as JK Rowling cares to write books. For good results, you need to describe your wishes in a particular manner. You need to be careful, specific and clear with the prompts you give to AI. You need to provide it with sufficient context and at the same time maintain enough flexibility for it to generate creative and useful outputs.

Prompt engineering - the art of creating instructions that AI can interpret to generate desired outputs.

Principles of prompt engineering

There are particular attitudes and general principles which will go a long way in guiding you towards effective prompts.

The right attitude: AI - Your New Superhero Superpower

The key to thriving in an AI-driven environment is to develop a correct understanding of AI. This correct perspective acknowledges that AI is a tool which is guided by prompts. The incorrect perspective is to anthropomorphize it - attribute to it life and human-like features. Countless movies about humanoid bots and future supercomputers lead us to acknowledge AI as a separate agent, the way we would approach a person. But this is actually a gross misconception, one that will be a huge hindrance to you mastering the tool.

To dispel the misconception, we use the metaphor that AI isn't a superhero, it's a superpower. In the sense that talking about AI without a human at the helm makes as much sense as talking about a superpower without a superhero. The hero is still us. While AI may seem autonomous, it is actually a tool under human control. It is the user, not AI, who sets the goals and navigates the path towards those objectives

However, harnessing the power of AI, like handling any superpower, can be a tricky endeavor at first. This is why it is crucial to learn and understand how to effectively wield this tool, similar to how the X-men are trained to control their abilities at the Xavier Institute. In the same way, we must understand how to give it instructions, how to nudge it to get the results we desire.

We built our own Xavier Institute for AI, where we provide you with the insights you need to to channel this superpower.. More than just generate prompts, we show you how to create a prototype of it which you can utilize as reusable, personalized tool. Learn how you can integrate AI into your work and business through hands-on prototyping and cutting-edge research at our Generative AI Masterclass.

When should you bother with prompt engineering?

Cost-benefit analysis: Developing a prompt and iterating through a model’s outputs takes time. So before you even start composing your prompt, there is a cost-benefits analysis you need to do in your head. If you are writing a paragraph blog post, but have half a page of context, style specifications and details to prescribe, you’ll waste more time than you will save. Generating text with AI makes sense only if you are either writing a significant amount of content, or you have much of the content already available to serve as an example, or if you are repeating a content generation process with slight variation over and over again.

The writing stage when AI can help you: You only want to turn to the assistance of a text generator when you are at a particular stage in your writing process. It's incorrect to assume that a model is useful for generating content in all use cases and scenarios. There is actually a much more limited application setting for these models.

The ideal use case is when you know what content you need, but you don’t know exactly what content you need. If you know exactly what you want to write, down to the individual sentences, and the tone, and style, don’t bother with enlisting AI into your process. The likelihood that the output of the model will be exactly what you are looking for, perfectly matching your expectations, is very low. These are indeterminable systems, unexpectability and creative freedom is what makes these models so powerful. So generating content with AI will always be a stabbing in the dark to some degree.

The opposite extreme of content awareness is equally disqualifying. If you have no idea what you want to write but you just really want to write something cool and intriguing, generative AI is not likely to give you quality. It needs guidance and context. Without these things, it cranks out generic tropes which are anything but original. It can help you explore options for original topics, but even so only if you can give it some kind of scope to brainstorm within.

So an optimal time to turn to a text generator is when you have a clear goal for the content, but you are still in the brainstorming and piecing-together stage of your writing process. You know the general direction of where you want to go with the text, but not its finest details. So for example, you wrote two thirds of a piece and you are still wondering how to finish it all off. Perfect use case because the model can riff off of your tone, your style and your general direction.Or maybe you wrote something, and you want to replicate the style but switch up the subject matter. Or you are just starting, but you know your audience, that you want to write like Ernest Hemingway, and that it will be about the suspicious passing of Dick Cheney’s heart transplant donor in 2012.

TL;DR: So, to sum things up, you want to bother engineering prompts and sifting through AI generated content only if it will save you more time than writing it yourself, and if you’re between two extremes of having no idea and knowing exactly what you want to write.

4 Principles of Prompt Engineering

  1. Specificity and detail is key: The more detailed your prompt, the better the output. It pays to be very specific. Be precise with your instruction to guide AI effectively.
  2. Garbage in, garbage out: The inverse of this statement is: quality input equals quality output. Make sure to use polished language when prompting to ensure high-quality responses. A lot of the newer models like GPT4  appear to absorb some degree of carelessness with your lingo, but this is true only to a degree. In the end, the model is trained on the internet. And the prompt you put in guides it as to what corner of the internet it is to look for content to replicate. That means if you use poor writing, it will look in the corner of the internet which contains poor writing. And that would probably involve political commentary and rambling in the YouTube comments, because that is where you will most often come upon poorly written English.
    1. Replicate what works: If there is quality output that the AI generates, copy it into your prompt. You want to go through and pick out parts where it does what you like. Then re-inject those into the prompt so that it gets represented in further outputs. These models feed a lot on repetition. The more that you repeat things, the more it will follow them.
  3. Choose your words wisely: Vocabulary matters. Different words can yield different results. Choose your vocabulary based on what you aim to achieve. This is a both powerful and difficult part of these models. It is the reason why you still need to be a domain expert in what you're talking about in order to achieve quality outputs.
    1. Example: If you use automobile versus vehicle versus car, you'll get very different results. The reasons here are the same as before - the AI looks for guidance in the corners of the internet which contain content similar to what is in the prompt. For example, when talking about self-driving cars, I can use the word autonomous vehicle, which is a term mostly used in commercial applications. The content the AI will choose to generate will likely focus on safety, ease of use and other consumer-level concerns. But the term unmanned vehicle is what is predominantly used in government settings. So if I use the term unmanned vehicle, I’ll end up with content generated about government applications. So it might talk about applications in defense, or search and rescue or surveillance applications. And so these very subtle differences can have profound effects on the kinds of things you're getting out of the AI.
    2. Tip: If you don’t have access to an expert, my suggestion is get out your thesaurus. You can type in your keyword and ask for synonyms in Google. Try different words to make sure that you're getting the kind of content that you actually really want.
  4. Keep trying: You want to frequently adjust and edit the text. Get in the mindset that if it gets something wrong, you haven't discovered a limitation of AI. Rather, you have prompted wrong and you should assume this for as long as you can.
    1. You see a lot of commentary on LinkedIn or on Facebook or wherever you consume your social media that are like: “haha, I asked AI this thing and it got it wrong.” To me, this sounds a little bit like blaming the hammer for missing the nail. This isn't to say that real limitations of AI don’t exist and that you might not discover them, but it's just not a useful mindset when you're trying to prompt.