Saturday, November 16, 2024

3 GenAI prompting methods worth trying

In our past few issues, we’ve been highlighting specific career areas, namely business management, data analytics, and cybersecurity. This week, we’re going to zoom out and return to a more widely applicable topic, AI skills.

At first glance, AI skills may seem highly technical. The name alone can bring to mind mechanical and robotic imagery. And, truthfully, some aspects of AI are highly technical. For example, if you’re aspiring to become an AI engineer, you’ll become intimately familiar with words like Python and LangChain. (Sidenote: If this sounds like your dream scenario, read our interview with Isaac Ke, an AI engineer at IBM. He reflects on his journey and top skills, plus offers detailed advice for entering the field.)

For the rest of us, however, AI skills have less to do with building pipelines and more to do with practical applications, like using Google Gemini to create a chore tracker. The more comfortable you get with your practical AI skills and using GenAI tools, the better equipped you are to capture AI’s time-saving benefits. According to a report from Visier, professionals using GenAI to augment their skills are saving 1.75 hours per day.

The trick to maximizing your efficiency with GenAI? Good communication.

How to prompt LLMs

If you’ve spent any time chatting with a large language model (LLM), you’ll notice that it responds to almost any type of question, or input. These tools are designed to be conversational, meaning now matter how you phrase your input, you’ll likely get a response, or output. But just like in human-to-human conversation, there are more and less effective ways to communicate with the tool.

Generally, the quality of your output reflects the quality of your input. Fortunately, there are guidelines for writing high-quality inputs that are more likely to generate high-quality outputs. This practice describes prompting, and an input that instructs the LLM on the kind of output you’re looking for is a prompt.

There are several prompting methods that are worth trying as you practice using LLMs. Here are some of the methods described in the course Google AI Essentials:

1. Zero-shot prompting is a simple prompt that provides no example to guide the output. Here, you provide a sentence or two instructing the LLM.

Example: Draft an email to my physician’s office requesting to schedule an appointment for my annual check-up on October 14.

2. One-shot prompting includes one example of the type of output you’re seeking. Similarly, few-shot prompting includes two or more examples of the type of output you’re seeking. This helps to instruct the LLM on the format and tone you’d like to achieve. Here, you provide your instruction, an instruction to review the example(s), your labeled example(s), and an open label for your request.

Example: Write a short, fun phrase to open a social media caption about my beach vacation. Review the examples provided and write in the same style.

Hike: Climbing to the top!

Game day: Rolling the dice!

Beach vacation:

3. Chain-of-thought prompting asks the AI to explain the reasoning for the output. This helps to ensure accuracy for logic and problem-solving questions. Here, you provide the context, an example, and your request. If you don’t have an answer to provide, you can alternatively instruct the LLM to “Solve the problem in a step-by-step manner.”

Example: My household eats 3 bags of frozen spinach per week, and I typically go grocery shopping one time per week. I purchase 3 bags of frozen spinach during each grocery trip (3 bags/week * 1 week = 3 bags).  I can only buy whole bags of frozen spinach. Explain the steps involved in determining how many bags of spinach I should buy during each shopping scenario.

Question: I will be unable to go to the grocery store for 1.5 weeks. How many bags of frozen spinach should I buy?

Answer: 5 bags. To determine this, multiply 3 bags/week by 1.5 weeks (3 bags/week * 1.5 weeks = 4.5) , then round up to the nearest whole number (5).

Question: I will be unable to go to the grocery store for 2.5 weeks. How many bags of spinach should I buy?

Answer:

With any of these methods, if you aren’t satisfied with the output, you can (and should) try different ways of phrasing your prompt. Iteration describes an approach where you write a prompt, see the output, and refine your prompt to get a more exact output.

Keep learning

If you enjoyed learning about these prompting methods, check out Google AI Essentials. This 9-hour introductory course goes into more detail about these methods and more.

For even more prompting techniques, explore Vanderbilt University’s Prompt Engineering Specialization.

For hands-on practice using GenAI tools, try the course Use Generative AI as Your Thought Partner from Jeff Maggioncalda, Coursera CEO.

Finally, to learn about incorporating AI into your career, we’ve compiled all of our top GenAI recommendations.

That’s all for this week.

Related Articles

Latest Articles