One of the most useful applications of AI is their ability to go through long text or large documents and to create summaries of all kinds. We've started already in our last instalment of our everyday prompt engineering series with some basic summarisation prompts for documents. Here, we will take a look a some additional techniques. Up-front a word of warning: AIs are known to produce “fiction” instead of facts. This is commonly called hallucinations: AIs make things up that sound nice, but are wrong. For example, when summarising important legal documents, it’s highly recommended to go through them and not rely on the result of the AI. Better double check! However, if your goal is to get an overview and an initial idea what a longer document is about, then summary prompts are a very useful tool. Let’s get started!
Basic summaries with Zero-Shot Prompting
The TL;DR acronym, standing for "too long; didn't read," is a succinct way to request a summary of lengthy text on the internet. It's a straightforward tool: you place "TL;DR" after a long piece of text, signaling a desire for a condensed version that captures the essential points or main ideas:
<long text> TL;DR
This prompt is an example for what is also known as Zero-shot prompting. In zero-shot prompting we directly ask an AI for the specific information without any prior training or examples on that specific task. Essentially, it means giving the AI a single instruction or question and expecting it to understand and respond appropriately, based on its pre-existing knowledge and training. This approach is particularly useful for straightforward tasks like summarizing content, as it allows for quick and efficient extraction of key information without the need for complex or multiple prompts. But with some clever prompt engineering we can do more.
One Shot Prompting for Summarizing
One-shot prompting for summarizing involves giving an AI model a single example or instruction on how to perform a task, followed by the content to be summarized. This method is particularly effective in guiding the AI to understand the desired format or style of the summary:
We introduce Extreme TLDR generation, a new form of extreme summarization for texts. TLDR generation involves high source compression, removes stop words and summarises the text whilst retaining meaning. The result is the shortest possible summary that retains all of the original meaning and context of the text.
"This is a conversation between a human and an AI. AI is empathetic and reassuring. The human has a name of John Doe. The human can also be referred to a guest. For a two night stay beginning on October 27th, 2022, the guest paid $100 USD. The guest indicated that there will be one guest in total and 1 pet. The $50 pet fee was previously paid by the guest."
"John Doe paid $100 for a two night stay beginning on October 27th, 2022. The guest indicated that there will be one guest in total and 1 pet."
The prompt uses a one-shot prompting strategy. One-shot prompting nudges the model in the right direction without overwhelming it with multiple examples. It involves generating an answer based on a single example or piece of context provided by the user. One-shot prompts can be used to guide the model's response and ensure it aligns with the user's intent.
Role Play Prompting
You can achieve similar results using a more prosaic description:
As a professional summarizer, create a detailed, in-depth, and concise summary of the provided text, while adhering to these guidelines: Incorporate main ideas and essential information, eliminating extraneous language and focusing on critical aspects. Rely strictly on the provided text, without including external information. Format the summary in paragraph form for easy understanding.
In comparison with the other prompts, you will notice a few differences. First of all, the prompt primes the AI to act in a specific manner; here we ask to act as professional summariser. This is called role play and a very useful technique. Much like the psychological concept, instructing an AI to assume a specific role or persona can substantially enhance its performance. This technique, allows the AI to generate more accurate, contextually relevant, and persona-consistent responses. You can experiment with this in creative ways. For example:
Imagine you're a news reporter who has only 30 seconds to summarize this article for a broadcast.
Formatting the summary
Sometimes it’s really nice to have a formatted output of a summary. This prompt produces a bulleted list in markdown:
Please read the following text and provide a summary highlighting the key points and main findings. Present the summary in Markdown format, using bullet points for each key point and bold text for particularly important findings.
text = “””<text>”””
Alternatively, the AI can organize the information in a table:
Please read the following text and provide a summary highlighting the key points and main findings. Present the summary in a table. text = “””<text>”””
Or, you can get a visual representation for the summary:
Please read the following text and provide a summary highlighting the key points and main findings. Present the summary as graph illustrating the main concepts. text = “””<text>”””
Text summarization prompting is a powerful tool for distilling essential information from large texts or documents. By leveraging AI capabilities, it provides concise, relevant summaries that capture the core message or findings of a document. This technique is not only efficient for quick comprehension but also versatile, adaptable to various formats and styles. Effective use of prompting can significantly enhance information processing, making it an invaluable asset in the realm of digital communication and document management.
Unlock the Future of Business with AI
Dive into our immersive workshops and equip your team with the tools and knowledge to lead in the AI era.