Skip to content

πŸ€ Text Generation Prompts

Abstract

This section covers the prompts for text generation tasks like generate tweet and generate questions.

🦜 Video lecture for this chapter - Link

🍁 Generate Tweet

Assume that you want to generate a social media post (i.e., a tweet) based on a paragraph of text. For this, you can write a prompt like this

Prompt

Generate a tweet in a formal tone based on the given paragraph (research paper abstract). 

Paragraph: Large language models (LLMs) have been applied in various applications due to their astonishing 
capabilities. With advancements in technologies such as chain-of-thought (CoT) prompting and in-context learning 
(ICL), the prompts fed to LLMs are becoming increasingly lengthy, even exceeding tens of thousands of tokens. To 
accelerate model inference and reduce cost, this paper presents LLMLingua, a coarse-to-fine prompt compression 
method that involves a budget controller to maintain semantic integrity under high compression ratios, a 
token-level iterative compression algorithm to better model the interdependence between compressed contents, and 
an instruction tuning based method for distribution alignment between language models. We conduct experiments and 
analysis over four datasets from different scenarios, i.e., GSM8K, BBH, ShareGPT, and Arxiv-March23; 
showing that the proposed approach yields state-of-the-art performance and allows for up to 20x compression with 
little performance loss.

Constraints: Include the relevant hashtags and emojis but limit the tweet's length to a maximum of 280 characters. 

Tweet:

Output

LLMLingua, a novel prompt compression method for large language models, achieves state-of-the-art performance and 
allows for up to 20x compression with minimal impact on performance. πŸš€πŸ§  #LLMs #CoT #ICL #AI #ML

🍁 Generate Questions

Assume that you are a teacher who want to generate questions from a paragraph of text. For this, you can write a prompt like this

Prompt

You are an expert teacher and good at English. Generate three questions along with answers from the given 
paragraph.

Paragraph: Artificial intelligence (AI) is like having a super helpful and smart robot friend! Imagine trying 
to learn a new language, like French. AI can help by translating things for you, suggesting the best words
to use, and even checking your grammar. It's like having a personal language tutor, but way faster and more 
efficient! Just like AI can help with languages, it can be used to do lots of other amazing things, 
like driving cars, diagnosing diseases, and even composing music!

Constraints: The questions should be short and at the beginners level. 

Questions and Answers: 

Output

1. What is AI compared to?

AI is compared to a super helpful and smart robot friend.

2. How can AI help with learning a new language?

AI can help with learning a new language by:

- Translating things for you
- Suggesting the best words to use
- Checking your grammar

3. What other amazing things can AI do besides helping with languages?

AI can do many other amazing things, such as:

- Driving cars
- Diagnosing diseases
- Composing music