Prompt Engineering tips and tricks

Posted by Venkatesh Subramanian on January 20, 2024 · 5 mins read

Prompt engineering is all about structuring your interaction with large AI models, so as to get the most useful responses. However, most users ask plain vanilla questions and end up getting sub-optimal responses.

Let’s say you want AI to explain to you the rules of a game like cricket. The naive approach will be to prompt as: “Explain the rules of Cricket to me”. In response to this prompt the AI will dump a long list of rules without knowing your situation. It does not know your current background on this topic like say your age or how much you already know about the game.

So the 1st step is to give it more context such as below. “I am a 6 year old living in India, and have occasionally played the game. Please explain the rules to me”. And now it will give simple brief points in a child friendly manner- so more useful for you.

Yet, it still does not know why you want these rules. You could add your objective now, say: “I want to use this content to write an essay in my school project”. Now the AI makes the response crisper in a typical essay style.

Next you can also ask the AI to adopt the style of a cricket coach explaining the rules to school children. And the generated content will use that style like a motivating coach of the game!

You can also tell the prompt to use a humorous, authoritative or an inspirational tone - so that the essay hooks the readers! And AI can do that easily.

Audience can be your fellow classmates or committee of older teachers reading the essay. This information can help the AI further fine-tune the answer.

And finally you can also tell AI to limit the response to certain number of characters, output format in text or HTML etc.

The above refinements is also now popularly known as the CO-STAR prompting, popularized by Singapore GovTech Prompt engineering competition. Context, Objective, Style, Tone, Audience, and Response guidance.
Note that depending on your scenario you may use a combination of these.

There are other interesting ways to use Prompts as follows:

Summarize content This could be as simple as reframing a given text, paraphrasing content, or even amplifying it or simplify the explanation.

Content extraction Let’s say you have a long text transcript and want to extract all the nouns or entities inside the text. This can be done with a prompt, and can be very useful for use cases such as metadata extraction.

Classification You can ask AI to classify a bunch of text into categories based on an input set that you anticipate the content to be from. This way you are guiding the AI to restrict to your golden set of categories and then classify where it best maps into.

Clustering You could give AI a mixed bag of entities that may be related or unrelated to one another, and then ask AI to create related clusters. For example, if you share all entities extracted from a news article and ask AI to cluster that - then it may create clusters such as Persons, events, locations, machines etc.

Question Generation You can ask AI to generate pop-quiz questions based on a given text input. This can be really useful in learning scenarios where the trainer may want to check the learner comprehension before moving on to next lesson.

Social media posts with emojis You can ask AI to format a post for say LinkedIn or Instagram using appropriate emojis and hashtags. This can be very useful for marketing where human and AI can collaborate to personalize the post for multiple web platforms.

20 questions This is one of my favorites, where you can ask AI to pretend to be an expert on some topic and ask you 20 questions on a concept till you get clear understanding. Say you are trying to choose a sport to play, and you ask AI to act as a sports coach and ask you 20 questions to narrow down your choice.
In my case GPT suggested that I should go for Cricket!

Conclusion While these are all different ways to improve the quality and richness of your prompts for different use cases, you still must carefully evaluate the answers for correctness. AI models have tendencies to make up answers in situations they are unsure of. In such cases you can re-prompt AI to reconsider its response or admit it does not have an answer if that is the case.
So, use responsibly and amplify your productivity!


Subscribe

* indicates required

Intuit Mailchimp