Effective prompt writing has become something of a skill in itself. Mark Wickersham, founder of the Value Pricing Academy, has been building a prompt library for accountants, having developed an interest in ChatGPT and other large language models (LLMs).
Working with an LLM is just like working with a brand new employee, he says. Without the right information, they may not do the job the way you want it done. But once you get it right, you can get brilliant and more consistent results. While this work will still need to be checked by a human being, good prompt writing should reduce the likelihood of errors and make the task of assessing AI outputs easier.
Essential elements of a prompt
There are many potential elements of a prompt that you could consider when giving an AI model a task – Wickersham has catalogued 17 different core components – but these are the critical basics you should master if you want to improve your outputs.
The task
Without this component, you don’t really have a prompt. This is prompt writing at its most basic: “I want you to write a report.”
The persona
Taking it one step further from a simple task, you can set a ‘persona’ for the LLM to help improve your results. This interacts with a system prompt – an instruction built into the model that guides how it responds to user queries. For example, the default persona of ChatGPT is ‘helpful assistant’; any output will be delivered in a writing style that matches that persona.
“If, for example,” Wickersham says, “you wanted it to analyse financial statements and give you a report, if you said, as part of the prompt: ‘I want you to play the role of a financial accountant skilled in analysing financial data,’ that's the persona you want it to play.”
As a result, the output will be more appropriate for the task you’ve assigned it (though it will still need to be checked). LLMs can take on a variety of roles, says Wickersham: “Many tests have shown that when you tell an LLM to play a particular role, you often get a better result. It's an element I always build into a prompt.”
The context
Context is the information, and the more background information you give, the better the response that you're going to get, says Wickersham. Going back to the analysis of financial statements, for example, adding information about the company in question – such as the industry sector or region in which it operates – will give you a more refined, tailored result.
“There's a number of ways that we can feed in context,” says Wickersham. “One is simply to put it in the prompt itself. But also we can do it by adding links to websites, uploading files and so on.”
The examples
LLMs generate outputs based on predictions of the likely next word in the sequence of its response. It develops these probabilities by analysing patterns in data, so if we can give it more data, it will perform better at the task you wanted to perform. With the financial statements analysis, for example, you could include relevant reports that you have produced in the past for it to base its output on:
“Playing the role of a financial accountant, analyse the attached financial statements and write a research report giving me information about potential weaknesses in the numbers and suggestions for improvement. The client is a restaurant chain based in Exeter – review the information on [company website]. Use the example financial reports to guide your response.
“I'd have a heading, say, ‘example’, and I just copy and paste a previous report that I've got. If you do that, you'll get a better result, because it will see the layout of that example. The more examples you give the better, because it's looking for patterns. But too many examples just create noise. Testing has found that generally five examples is the optimal.”
It’s important that you consider confidentiality when giving an LLM examples, particularly when using a public model such as ChatGPT; do not use anything that contains sensitive client or company data.
The format
Any time you want a response from an LLM that you might want to share with somebody else, such as a report, a blog post, or an email template, you must consider the format. “There are a number of elements of that; things like the writing style,” says Wickersham. At a simple level, you might have a professional style of writing or a humorous style of writing. If you're writing a report summarising the set of financial statements, that might well be a professional style.
“If you were writing an email, for example, you might want to go with a motivational style, to encourage the recipient to take action.”
Building a prompt library
Wickersham recommends that once you start refining your prompts, it’s worth building a prompt library to help systemise your use of LLMs, giving you a series of prompts to hand when you need them. “The benefit of this work is that when you have great prompts, you are going to save hours of time every single week – possibly every single day.”
Webinar: AI - how will it transform analytics?
On 18 February, ICAEW's Data Analytics Community is hosting a webinar where Monica Odysseos, AI and Data Lab Leader at Grant Thornton Cyprus, will explore how AI is transforming data-driven decision-making for organisations. The webinar is free to attend for ICAEW and Data Community Members and offers 1 hour of verifiable CPD.
Accounting Intelligence
This content forms part of ICAEW's suite of resources to support members in business and practice to build their understanding of AI, including opportunities and challenges it presents.