Everything you wanted to know about prompt engineering and never dared to ask
Jan 16, 2024
--
new Prompt engineering 1200x628

Everything you wanted to know about prompt engineering and never dared to ask

Prompt engineering will be in high demand in upcoming years. It’s an art that combines creativity with strategic thinking. Prompting Large Language Models (LLMs) the right way makes all the difference between unusable mediocrity and excellent content.

This article will equip you with all the tools and insights needed to master this craft.

As we delve deeper, you'll discover the intricacies of fine-tuning prompts to align perfectly with your brand's voice and values, ensuring that the content produced is not just accurate, but also resonates with your audience. We'll explore how to precisely target demographic groups, interests, and cultural contexts to create content that speaks directly to your audience's needs and desires.

Moreover, this guide will reveal how to harness the versatility of prompt engineering across various professional roles. Whether you're a marketer looking to captivate your audience, a customer service manager aiming to enhance client interactions, or a technical writer striving for clarity and precision, you'll find practical strategies to elevate your content.

Through real-world examples and expert insights, you'll learn the key principles of successful prompt engineering. You'll see how it’s not just about instructing an AI but about orchestrating a symphony of words that carry the right tone, style, and substance.

Join us on this journey to unlock the full potential of artificial intelligence (AI) in content creation. By the end of this article, you'll not only understand the importance of prompt engineering but also be equipped to implement these techniques, setting a new standard for AI-generated content in your field.

Understanding prompts: What properties they have and how to tune them

Modern LLMs come with capabilities to inject repeatable traits of a prompt. A feature that will help you to produce successful content at scale.

The ChatGPT-4 API, like other language model APIs, offers several properties or parameters that allow you to shape the content generated by the model. Understanding and effectively using these properties can significantly impact the quality and relevance of the generated content.

Here are some key properties:

Prompt

This is the input text that you provide to the model. The prompt sets the context and instructs the model on what kind of response you are looking for. A well-crafted prompt is crucial for generating relevant and specific content.

Temperature

This parameter controls the randomness or creativity of the responses. A higher temperature (closer to 1) results in more creative, unpredictable answers, while a lower temperature (closer to 0) generates more deterministic, predictable responses.

Max tokens

This specifies the maximum length of the response. It determines how verbose or concise it should be. You can adjust this based on the desired length of the output.

Top P (Nucleus sampling)

This parameter, also known as nucleus sampling, controls the diversity of the generated content. A lower Top P value means the model will choose from a narrower set of possibilities, leading to more focused content, while a higher value increases diversity and creativity.

Frequency penalty

This penalizes new tokens based on their existing frequency in the text, encouraging the model to introduce new and varied terms and reducing repetition.

Presence penalty

This penalizes tokens based on their presence in the text, encouraging the model to explore new ideas and topics that haven't been mentioned before.

Stop sequences

You can specify sequences of tokens where the model should stop generating further content. This is useful for defining the end of a response.

User context

This includes additional information about the user or the conversation context that can be used to personalize and tailor the responses.

Role-playing aspects

You can instruct the model to adopt a specific tone, style, or character while responding, which is particularly useful for creating content that needs to align with a particular brand voice or persona.

By adjusting these properties, you can steer the content generated by ChatGPT-4 in a direction that aligns with your specific needs and goals. This makes the API highly versatile and suitable for a wide range of applications, from customer support and content creation to educational tools and creative writing.

Brand voice matters: How to specify prompts to receive branded content

Include specific brand voice attributes in your prompts. If your brand is friendly and informal, use prompts that ask for a conversational tone.

Here’s an example:

{"model": "gpt-4",

"prompt": {

"role": "Social Media Coordinator",

"content": "As the Social Media Coordinator for 'Life's Breeze', a lifestyle brand that embodies a friendly and informal vibe, draft a tweet announcing our summer collection of casual wear. The tweet should have a playful tone, use emojis, and invite our followers to share their summer moments with our hashtag #BreezeIntoSummer.",

"brand_voice": "playful, friendly, informal",

"tone": "conversational",

"use_emojis": true,

"hashtag": "#BreezeIntoSummer"

},

"temperature": 0.5,

"max_tokens": 280

}

Incorporate brand values and themes into your prompts

Your brand consists of more than editorial guidelines and hex codes. To include certain values within your marketing collateral, you can simply make them part of your prompts.

{

"model": "gpt-4",

"prompt": {

"role": "Community Manager",

"content": "You are a community manager for 'GreenFuture', a brand that champions sustainability and eco-friendliness in all its products. Write a post for our online forum celebrating the recent community-led beach cleanup initiative. The post should reflect our core values of environmental responsibility, community collaboration, and positive change. Use a tone that is inspiring and grateful, and encourage further community involvement.",

"values": ["sustainability", "community", "responsibility"],

"tone": "inspiring, grateful",

"call_to_action": "encourage further community involvement"

},

"temperature": 0.7,

"max_tokens": 300

}

Specify your target audience’s demographics, interests, and cultural background

As your brand evolves, you may learn more about your target audiences. By including their demographics and interests in your prompts, you can easily tailor content to each segment and run personalized campaigns.

{

"model": "gpt-4",

"prompt": {

"role": "Product Designer",

"content": "You're a product designer at 'TechGenius', a tech company that targets millennials who value innovation, sustainability, and social responsibility. Write a product description for our latest eco-friendly smartwatch that highlights its sustainable materials, cutting-edge features, and how it fits into an active, socially-conscious lifestyle. The description should resonate with a tech-savvy audience that prioritizes environmental ethics and looks for smart technology to support their dynamic lives.",

"target_audience": {

"demographics": "millennials, ages 24-35",

"interests": ["technology", "sustainability", "social responsibility"],

"cultural_background": "diverse urban communities"

},

"tone": "informative, engaging, aspirational"

},

"temperature": 0.6,

"max_tokens": 400

}

Magnolia AI Accelerator

Magnolia’s AI Accelerator is a collection of generative AI features that speed up content creation, automate repetitive tasks, and improve content and design efficiency.

Prompt models based on your job role and duties

Part of the context you can provide to get more accurate results from LLMs is a job role. By asking ChatGPT or other models to act as a designer, writer, or advisor, you can fine-tune the results. You should keep in mind, though, that the output can still include inaccurate data, so asking the model to act as a lawyer won’t substitute a human legal expert.

Example 1: Customer service representative

Prompt:

"Act as a customer service representative for a luxury hospitality brand known for its high-touch service. Compose a response to a guest who is expressing disappointment with their room not being ready upon arrival. The language should be formal and empathetic. Offer a tangible resolution, such as a complimentary service."

Example 2: Marketing specialist

Prompt:

"Imagine you are a marketing specialist for an eco-friendly outdoor apparel company. Draft an engaging Instagram post announcing our new line of biodegradable rain jackets, highlighting our commitment to sustainability. The tone should be upbeat, adventurous, and align with our mission to protect the environment."

Example 3: Technical support engineer

Prompt:

"As a technical support engineer for a software company specializing in data encryption, provide a detailed yet easy-to-understand explanation of how to install our latest software update on a Windows 10 system. Use concise steps and reassure the user of the update's benefits for security."

Example 4: Content creator for a food blog

Prompt:

"Create a 500-word blog post as a content creator for a vegan cooking site. The post should introduce a new tofu-based recipe that's perfect for summer BBQs. The style should be conversational and informative to encourage readers to try plant-based alternatives."

Example 5: Educational consultant

Prompt:

"You're an educational consultant writing a newsletter piece to inform parents about the benefits of bilingual education for early childhood development. The content should be reassuring, authoritative, and provide evidence-based advantages along with tips on how they can support bilingualism at home."

Example 6: Financial advisor

Prompt:

"As a financial advisor, draft an email to clients about the importance of diversifying their investment portfolio. The tone should be professional and informative, offering reassurance during a volatile market period, and explain the concept in a way that is accessible to those without a financial background."

Example 7: Health and wellness coach

Prompt:

"You're a health and wellness coach writing a newsletter about the importance of mindfulness in daily routines. Provide practical advice and simple exercises they can incorporate into their lives. The tone should be encouraging and peaceful, reflecting the tranquility that mindfulness can bring."

Contextual prompts

Provide context about the situation, the intended use of the content, and any background information that could help the AI understand the scope and purpose.

Examples and analogies

Offer examples of the previous content that aligns well with the brand for the AI to emulate. Use analogies to describe the tone, style, or approach you're looking for.

Regularization techniques

  • Content filters: Implement filters to screen for and remove any content that doesn't meet brand guidelines or could be culturally insensitive.

  • Human oversight: Maintain human oversight in the content creation process to catch nuances that AI might miss. Use editorial teams to review and refine AI-generated content before publication.

  • Training with brand-specific data: If possible, train the AI model on brand-specific content to learn the nuances of the brand's voice and message. Provide the AI with a style guide and examples of preferred content.

  • Monitoring and adjusting: Regularly monitor the performance of AI-generated content and adjust prompts and filters accordingly. Stay updated on cultural trends and sensitivities to keep content relevant and respectful.

Bonus

If you’d like to see the top 5 ChatGPT prompts that I use on a regular basis, I’ve shared them in my previous article on understanding Large language models. Enjoy!

About the author

Jan Schulte

Head of Group Consulting, Magnolia

Working at the intersection of business and technology, Jan helps Magnolia clients succeed with their content management and digital experience initiatives, framing solutions to their custom challenges and opportunities.