Prompt Engineering, Explained

Sunil Manghani
Electronic Life
Published in
9 min readFeb 24, 2024

--

A great tool for teaching prompt engineering: Using a mnemonic, RISEN, a prompt entrepreneur offers a step-by-step framework. This article explains and tests the approach.

What is Prompt Engineering?

Prompt engineering refers to the practice of designing and refining the inputs (prompts) given to AI models, like ChatGPT. This process is critical because the way a question or command is phrased can significantly influence the model’s response. Effective prompt engineering involves understanding the capabilities and limitations of the AI model and applying strategies to guide the AI towards providing the most accurate, relevant, or creative responses.

Prompt engineering is particularly relevant when using ChatGPT (and other similar models) as it uses a conversational approach. Users can enhance their interactions by using specific and clear language, providing context, and framing questions in a way that guides the model towards the desired type of answer.

For instance, instead of asking a vague question like ‘What’s interesting about Mars?’, a prompt-engineered question might be: ‘Can you provide a detailed explanation of the most recent discoveries about Mars’ atmosphere and their implications for future missions?’ This more detailed prompt helps narrow down the scope of the response and signals the AI to focus on recent scientific findings and their significance.

However, there are more specific steps that can be applied to improve a response.

Talking to AI: It’s a Skill

On his promptentrepreneur TikTok channel, Kyle Balmer sets out what he refers to as the RISEN framework. The approach can involve writing relatively long prompts, but the results are far more rewarding. And, of course, you can save your prompts and reuse them, so enabling you to build up your own prompt library.

As Balmer notes, if you ask ChatGPT to ‘write a blog article about yoga’, you are going to receive a fairly bland, generic response, or even, as he puts it, ‘an extremely boring response’! At this point many people are turned off, thinking the AI is not really fit for purpose. The problem, however, Balmer argues, ‘is not ChatGPT [or similar models] … the problem is the user’. As he reminds, AI is simply a tool: ‘We can use it with different levels of skill. Some people are going to be better using it than others’.

Importantly, the skill required is not coding or mathematics, it doesn’t even mean needing to be good with computers. All you need are good communication skills. It is about using clear human language and presenting clear, specific instructions. ‘If you are able to talk to your friends on WhatsApp,’ Balmer suggests, ‘then you are able to talk to AI’. Or, put another way, ‘if you are able to give clear instructions in an email then you are able to give clear instructions to an AI like ChatGPT’.

Put simply, prompt engineering is ‘the skill of talking to an AI’. And even if your communication skills are in need of improvement, the ability to talk effectively to conversational AI models is something you can definitely learn and improve. It is in this respect that the RISEN framework can really help.

What is the RISEN Framework?

RISEN is a mnemonic, which stands for:

  • ROLE
  • INSTRUCTION
  • STEPS
  • END GOAL
  • NARROWING

Each of these terms refer to specific elements of a prompt to improve the quality of the output; to shift from generic responses to ones more specific to your needs and expectations. Let’s go back to the example of asking ChatGPT to write a blog article about yoga. Balmer sets out the five elements accordingly:

Rstands for ROLE. This is to be placed at start of a prompt. It tells the AI to ‘act as’ a type of person or role. E.g. To act as a professional copywriter or an SEO optimiser.

I stands for INSTRUCTION, which in the yoga blog example would be ‘to write an article about yoga’, but first positioned by a role. I.e. ‘act as a professional copywriter to write an article about yoga’.

S stands for STEPS, which develop the instruction through exact steps or components. It is helpful to consider this in human terms. If you asked an employee to write a blog post on yoga, you would likely give some suggestions and to outline your expectations. As Balmer explains, we might say something like: ‘write me a blog article about yoga. Start with a really interesting hook to grab the attention of the reader. Give me three main body points, each with examples and finish with a strong action to get people to subscribe to a newsletter’. These are specific steps, which can then be framed by your desired outcome or ‘end goal’.

E stands for END GOAL. You need to tell the AI exactly what you expect to see as an end result. One of the problems, Balmer notes, is that users give instructions and receive a result, but do not stipluate a desired outcome. As such the results are often unsatisfactory. ChatGPT is smart, but as Balmer puts it, ‘ it can’t read our mind’! The inclusion of clear, specific end goals is really important. We need to say what it is we want, precisely. In the example of the yoga blog article, an end goal might include something about the intended audience. E.g. ‘The blog article is aimed at intermediate yoga practitioners who are looking to get better at yoga’. Balmer confesses his own lack of knowledge about yoga, but his point is clear: we need to give an exact ‘angle’ to ensure the AI can produce a more compelling and beneficial article.

N is for NARROWING. The final step is to give some constraints or to set some key requirements. E.g. To state you want the blog article to be a certain length and to use a certain tone of language. These elements are important to tighten up the approach and again to ensure we get a result we are happy with.

RISEN in Practice

So, we’ve covered the ‘theory’ of RISEN, but what happens when we put it into practice. Taking the yoga article again as the example, here are excerpts from the results of two prompts entered into ChatGPT. (NB. For ease of reading, the texts have been shortened to a third of the original length. The general tone and style is hopefully still very clear). The first examples shows what happens when you merely ask a simple, generic request. The second applies Balmer’s RISEN approach:

PROMPT 1: Write me a blog article about yoga.

The Transformative Power of Yoga: A Journey to Wellness

In the bustling rhythm of modern life, where stress and anxiety often take center stage, yoga emerges as a beacon of tranquility and self-discovery. More than just a physical practice, yoga is a holistic journey towards wellness, encompassing mind, body, and spirit. […]

The Essence of Yoga

Yoga is an intricate practice with a rich history, originating from ancient India. It is a comprehensive system for wellbeing, combining physical postures (asanas), breathing techniques (pranayama), meditation (dhyana), and ethical precepts. […]

Physical Benefits: Beyond Flexibility

While yoga is often associated with flexibility, its benefits extend far beyond achieving a bendy body. Regular practice can enhance strength, improve balance, and increase endurance. […]

Conclusion

Yoga is more than physical exercise; it’s a lifestyle that nurtures the body, calms the mind, and nourishes the soul. Its holistic approach to wellness makes it an invaluable practice for individuals seeking balance, health, and inner peace. […]

In and of itself, this output is not insignificant (and not least when we consider it took a matter of seconds to write — much quicker than it takes to read it!). However, while full text represents a cogent, fluent and informative ‘article’ about yoga, it remains generic and predictable. It is not dissimilar to a Wikipedia entry.

So, what happens when we apply the RISEN framework?

PROMPT 2: Act as a professional copywriter to write a blog article about yoga. Start with a really interesting hook to grab the attention of the reader. Give me three main body points, each with examples, and finish with a strong action to get people to subscribe to a newsletter. The end goal is to provide a blog article for intermediate yoga practitioners who are looking to improve their philosophical understanding of yoga and to help offer insights to their clients. The article should be between 500 – 750 words and be written in clear, accessible language. Also provide a prompt to request a suitable feature image to include in the article.

Unraveling the Deeper Layers of Yoga: A Journey Beyond the Mat

Imagine standing at the edge of a vast ocean, the waves whispering secrets of the deep. Each wave, a breath; every ripple, a movement of your body. This ocean is yoga, and you’re about to dive into its profound depths, far beyond the physical asanas that grace the surface. […]

The Essence of Breath: Pranayama as a Tool for Inner Transformation

Yoga is more than just the alignment of body; it’s the harmony of breath and spirit. Pranayama, or the yogic practice of breath control, is a cornerstone of deepening your yoga journey. […] Sharing these techniques with clients can help them discover the transformative power of breath, turning each session into a meditative experience. […]

Living Yoga Off the Mat: The Yamas and Niyamas in Daily Life

Yoga extends far beyond the confines of a mat; it’s a way of living. […] Similarly, santosha (contentment) teaches us to find satisfaction in the present moment, fostering a sense of gratitude and peace regardless of external circumstances. By embodying these principles, you not only deepen your own practice but also inspire your clients to apply yoga’s wisdom in their everyday lives, creating a ripple effect of positivity and mindfulness.

[…]

Dive Deeper with Our Newsletter

[…] Whether you’re seeking to deepen your own practice or enrich the lives of your clients, our newsletter is your guide to navigating the deeper waters of yoga with confidence and grace. Take the plunge. Subscribe now and transform your practice into a beacon of light for yourself and those you guide.

As expected the article is much more focused, detailed and has a greater sense of purpose and target audience. It is also more concise and more obviously an accessible, blog article. NB. The final ‘narrowing’ command was to provide an image prompt. The following prompt was returned:

Image Request: A serene image capturing the essence of a deep yoga practice. It should feature a tranquil setting, possibly with an individual in meditation or performing a yoga pose that suggests introspection and calmness. […] This image will be used to draw readers into the article, inviting them to explore the profound journey of yoga beyond the physical practice.

PROMPT: “Fine, pencil drawing: A serene image capturing the essence of a deep yoga practice; The atmosphere should evoke a sense of peace and depth, reflecting the philosophical aspects of yoga. This image will be used to draw readers into a magazine article, inviting them to explore the profound journey of yoga beyond the physical practice.

Reflections and Resources

Prompt engineering is not just about getting better answers, it’s also about leveraging the AI’s strengths. It is a means to activate AI’s vast knowledge base and pattern recognition capabilities, while mitigating weaknesses, such as potential biases or misunderstandings. As users become more adept at prompt engineering, it is possible to collaborate with AI tools like ChatGPT to accomplish a wide range of tasks, from creative writing and brainstorming to technical problem-solving and informational research.

To further hone your skills and to delve deeper into the nuances of effective AI communication, consider exploring a variety of resources and platforms. The key to improvement lies in continuous learning, experimentation, and the willingness to explore new possibilities. Here are some suggestions to enhance your understanding and application of prompt engineering:

Kyle Balmer’s TikTok Channel promptentrepreneur is the direct source for the RISEN framework and offers a range of helpful, bite-sized advice. His content demystifies AI interactions and provides actionable tips for users at all levels.

OpenAI’s Blog and Documentation sets out strategies for effective prompt crafting and gives examples of creative use cases. This is a primary resource for understanding the technical and ethical guidelines for interacting with AI models.

Datacamp has a useful article, ‘What is Prompt Engineering? A Detailed Guide For 2024’. It examines the significance of prompt engineering and considers the role of a prompt engineer and future prospects.

Read books, such as Nathan Hunter’s The Art of Prompt Engineering with chatGPT: A Hands-On Guide (sample chapter). Also, watch related YouTube videos.

Finally, join prompt engineering communities via forums and social media groups, including on Medium, which has numerous articles of interest:

And for a usefully critical article, challenging the ‘engineering’ of ‘prompt engineering’, see:

--

--

Sunil Manghani
Electronic Life

Professor of Theory, Practice & Critique at University of Southampton, Fellow of Alan Turing Institute for AI, and managing editor of Theory, Culture & Society.