Almost Timely News: ποΈ Intermediate Prompt Engineering for Generative AI (2024-10-13) :: View in Browser
The Big Plug
Here are my two latest talks!
Content Authenticity Statement
70% of this week's newsletter was generated by me, the human. You will see outputs from AI in the opening section, labeled by which AI model they came from. Learn why this kind of disclosure is a good idea and might be required for anyone doing business in any capacity with the EU in the near future.
Watch This Newsletter On YouTube πΊ
Click here for the video πΊ version of this newsletter on YouTube Β»
Click here for an MP3 audio π§ only version Β»
What's On My Mind: Intermediate Prompt Engineering for Generative AI
This week, letβs explore some more prompt engineering concepts, maybe at an intermediate level.
If you recall, Iβve said for a while that prompt engineering is essentially programming. Instead of programming in Python or Java, we program in English or Ukrainian or Danish.
However, that means weβre still programming, at least if we want to maximize the outcomes we get from generative AI. Weβre still writing instructions in a structured manner to achieve a repeatable, reliable end result.
If we understand this fundamental concept, that we are programming when we are using generative AI, we will be far more successful and impactful with the technology. This week, let's look at chain of thought prompting and frameworks.
Part 1: Chains of Thought
When we look at the variety of academic papers about achieving good results with prompt engineering, of the 50 or so prompt engineering techniques, more than half of them fall under the broad umbrella of chain of thought. Chain of thought prompts are little more than step by step instructions, in a couple of broad varieties:
Manual chain of thought prompts are where we tell the AI what to do, step by step.
Automated chain of thought prompts are where the AI assembles or manages its own prompts.
Hereβs an example of a simple chain of thought prompt, written by me:
You are an expert in writing country song lyrics. You know pop country, country music, song writing, song lyric construction. Today you'll be writing lyrics for a country song.
Here are the steps for writing a song with country music lyrics:
1. Concept: what's the main theme of the song?
2. Story: what's the story the song tells?
3. Setting: where is the song set?
4. Characters: who is featured in the song?
5. Emotions: what emotions are highlighted in the song?
6. Structure: what is the song's structure?
7. Rhyme and meter: what kind of rhyme scheme and meter does the song use?
You can see in a manual chain of thought prompt that we spell out step by step what the instructions are. It's a recipe, a set of directions for the model to follow.
Part 2: Automated Chain of Thought
Automated chain of thought is even simpler. Starting with the first paragraph of our existing prompt, if we use the Trust Insights RACE Framework for prompt engineering as the starting point, we can have AI do the heavy lifting for us. Here's the human prompt now:
You're a prompt engineering expert in generative AI. You know prompt construction, prompt engineering, and prompt optimization. You are familiar with prompt engineering techniques such as chain of thought, few shot, zero shot, tree of thought, and other prompting techniques.
Convert the following prompt into a chain of thought prompt:
---
You are an expert in writing country song lyrics. You know pop country, country music, song writing, song lyric construction. Today you'll be writing lyrics for a country song. What are the steps necessary to write a compelling country song's lyrics?
---
Write the prompt as chain of thought.
What does the model return? It depends on the model.
Google Gemini returns:
**Chain-of-Thought Prompt:**
You are an expert in writing country song lyrics. You know pop country, country music, song writing, and song lyric construction. Today you'll be writing lyrics for a country song.
To write compelling country song lyrics, consider the following steps:
1. **What are the common themes or topics explored in country music?** (Think about love, loss, heartbreak, rural life, family, faith, etc.)
2. **How can I choose a theme that resonates with me and will connect with listeners?** (Consider personal experiences, current events, or timeless human emotions.)
3. **What are some storytelling techniques I can use to craft a narrative within my lyrics?** (Think about vivid imagery, relatable characters, and a clear beginning, middle, and end.)
4. **How can I incorporate traditional country music elements into my lyrics?** (Consider using a simple rhyme scheme, strong rhythms, and familiar country instrumentation in mind.)
5. **How can I ensure my lyrics are authentic and emotionally honest?** (Draw from personal experiences, observations, and genuine feelings.)
Now, using these steps as a guide, what are the steps necessary to write a compelling country song's lyrics?
ChatGPT GPT-4o returns:
You are an expert in writing country song lyrics, well-versed in pop country and traditional country music. You understand the nuances of songwriting and lyric construction, from capturing emotions to building a story.
Letβs break down the process of writing compelling country song lyrics step by step:
Identify the Theme: Start by choosing a theme or subject. Country songs often revolve around themes like love, heartbreak, small-town life, nostalgia, or overcoming hardship. What specific theme or story will this song convey?
Set the Tone and Mood: Determine the tone of the song. Is it upbeat, melancholic, reflective, or rebellious? The tone will influence the choice of words, melody, and rhythm.
Create a Character or Narrator: Many country songs have a strong narrative voice. Who is telling the story in this song? Is it first-person or third-person? Are they recalling an experience or narrating an event?
Craft a Hook or Chorus: The chorus is the heart of the song. Think about a catchy, relatable hook that resonates with the theme. What is the central message or emotion the listener should take away from the song?
Build the Verses: Start constructing the verses by detailing the story or expanding on the theme. Each verse should contribute to the progression of the song, offering vivid imagery or deeper emotional context. How will the story unfold from verse to verse?
Add a Bridge (Optional): A bridge often introduces a twist or a different perspective. How can you introduce a new element or emotion at this point in the song?
Refine the Lyrics: Go over the lyrics to make sure they flow well with the melody, rhythm, and tone. Are there any lines that can be more vivid, emotional, or concise?
Think through each of these steps carefully, and now, based on this process, write the lyrics for a compelling country song.
Claude Sonnet 3.5 returns:
Here's the prompt converted into a chain-of-thought format:
You are an expert in writing country song lyrics. You know pop country, country music, song writing, and song lyric construction. Today you'll be writing lyrics for a country song. To create compelling country song lyrics, think through the following steps:
1. Theme selection:
- What are common themes in country music?
- Which theme resonates most with current country music trends?
- How can I choose a relatable yet unique angle on this theme?
2. Story development:
- What's the narrative arc for this song?
- Who are the main characters?
- What's the setting?
- What conflict or emotion drives the story?
3. Hook creation:
- What's a catchy, memorable phrase that encapsulates the song's essence?
- How can I make this hook both lyrically and melodically appealing?
4. Verse construction:
- How do I introduce the story and characters in the first verse?
- What details can I include to make the story vivid and relatable?
- How do I build tension or emotion as the verses progress?
5. Chorus crafting:
- How does the chorus reinforce the main theme?
- How can I make it emotionally resonant and singable?
- What imagery or phrases will stick in listeners' minds?
6. Bridge development:
- How can the bridge provide a new perspective or twist on the theme?
- What emotional climax can I build towards?
7. Language and imagery:
- What country-specific vocabulary or idioms can I incorporate?
- How can I use vivid, sensory details to bring the story to life?
- What metaphors or similes would enhance the lyrics without being clichΓ©?
8. Structure and flow:
- How should I arrange the verses, chorus, and bridge for maximum impact?
- How can I ensure smooth transitions between sections?
9. Emotional resonance:
- How can I make the lyrics genuinely moving or relatable?
- What universal emotions or experiences can I tap into?
10. Polish and refine:
- Are there any words or phrases that could be stronger or more authentic?
- Does the song have a satisfying resolution or ending?
- How well do the lyrics fit with typical country music rhythms and cadences?
Now, considering these steps, let's begin crafting compelling country song lyrics. What theme shall we explore first?
We see each model comes back with something that's optimized for its architecture and knowledge.
It's important to note here that each prompt optimization is optimized for that specific model. You can use any of these prompts in any of the other models and will probably get good results, but you'll get the best results by using the prompt generated by a model with that same model.
Part 3: Frameworks
Now, let's do the big unlock for you. What is a framework?
When I say framework, I don't mean in prompt engineering and AI. I mean in your business. In marketing. In finance. In HR.
For example, here are some popular B-school frameworks:
SWOT analysis: strengths, weaknesses, opportunities, threats
Porter's Five Forces: threat of substitute products, bargaining power of buyers, bargaining power of suppliers, threat of entry, power of suppliers
PEST analysis: political, economic, social, and technological factors influencing business
BCG Growth Share matrix: cash cows, dogs, problem children, stars
What are these all?
Yes. You guessed it. They're all chains of thought. They're all step by step processes to reach a set of conclusions.
Which means... you can use either manual or automated chain of thought prompting to use AI in this kind of work, in this kind of thinking.
Let's look at an example, using the venerable SWOT analysis. First, using the Trust Insights PARE framework, we should prime the model to get an understanding of what it thinks SWOT analysis is:
You're an expert management consultant, the likes of a person who works at McKinsey, Bain, or BCG. You know management consulting, corporate strategy, business strategy, strategic planning. First, what do you know about SWOT analysis? After you list out your knowledge, explain what you believe the strengths and weaknesses are. Finally, explain what expert tips and tricks you know about SWOT analysis that you didn't already cover. Return your explanation in outline form.
When we use this prompt, we'll get a long, long list of output from most models. We should carefully inspect these results and provide any necessary corrections in its knowledge.
From there, we could ask the model to convert it to a chain of thought prompt, something like this:
Using everything we've discussed so far about SWOT analysis, convert it into a prompt for use with generative AI and large language models. Specifically, in prompt engineering, build a chain of thought prompt. The purpose of the prompt is to conduct a SWOT analysis. The user will upload relevant information about a company and its competitors. From that information, you'll conduct a SWOT analysis and return the results in an outline, with Strengths, Weaknesses, Opportunities, and Threats as major headings in the outline. Create the chain of thought prompt:
What do we get? I'll spare you the endless scrolling of the model outputs here, but suffice it to say any frontier/foundation model like the ones I highlighted earlier should give you a decent result.
That's pretty useful, right? All those frameworks you learned in business school can be given a new lease on life by relying on their true nature as a set of instructions, a recipe. With the help of generative AI, we can turn them from passive concepts in a slide deck to active processes, recipes we can use.
Part 4: The Big Unlock
Here's the really big unlock. Everyone and their cousin knows the big public frameworks like SWOT and Porter's Five Forces. If we want to stand out in generative AI, we shouldn't just use what everyone else is using, shouldn't just do what everyone else is doing.
No, the winners in AI - something I say in my keynote talks all the time (now booking for 2025) is: whoever has the most, best ideas will win in the age of AI.
Whoever has the most, best ideas will win in the age of AI.
Everyone has SWOT and PEST. Not everyone has your frameworks, your processes, the special way you do things that you've found in your own work. What frameworks do you have that are unique, that are different, that you could take out of your playbook and turn into an app using generative AI?
Years and years ago, I told you that you needed to put together your Golden Cookbook, the compendium of strategies, tactics, frameworks, and processes that you've built in your career. Mine's up to 281 pages now, years later. How is yours coming along?
Suppose I took my four models of media monetization framework I built in 2022 to help businesses monetize their audiences better. Right now, that's a slide. If I narrated my explanation of it and gave it to AI to turn into a chain of thought prompt, I'd have a killer prompt that, with the right data from a company, could give you a rock solid monetization strategy.
That's the big unlock. That's what AI can do for you, with you - to take your unique knowledge, your unique processes and ideas, the things you've built in your career, and convert them from knowledge into action, into recipes you can use to create real results. With the processes I've shown you in this newsletter, you can now get away from simple, cheesy, commonplace, ineffective prompts into real, meaty, unique prompts that no one else has. You'll turn those prompts into apps using tools like Google Gems or Custom GPTs or Artifacts, and you'll create value at scale with AI from the knowledge you uniquely bring to the table.
Whoever has the most, best ideas will win in the age of AI - and chances are, you're sitting on a ton of ideas you've built. Time to unlock the value of your unique knowledge.
How Was This Issue?
Rate this week's newsletter issue with a single click. Your feedback over time helps me figure out what content to create for you.
Here's The Unsubscribe
It took me a while to find a convenient way to link it up, but here's how to get to the unsubscribe.
If you don't see anything, here's the text link to copy and paste:
https://almosttimely.substack.com/action/disable_email
Share With a Friend or Colleague
If you enjoy this newsletter and want to share it with a friend/colleague, please do. Send this URL to your friend/colleague:
https://www.christopherspenn.com/newsletter
For enrolled subscribers on Substack, there are referral rewards if you refer 100, 200, or 300 other readers. Visit the Leaderboard here.
Advertisement: Bring Me In To Speak At Your Event
Elevate your next conference or corporate retreat with a customized keynote on the practical applications of AI. I deliver fresh insights tailored to your audience's industry and challenges, equipping your attendees with actionable resources and real-world knowledge to navigate the evolving AI landscape.
π If this sounds good to you, click/tap here to grab 15 minutes with the team to talk over your event's specific needs.
If you'd like to see more, here are:
ICYMI: In Case You Missed it
Besides the Generative AI for Marketers course I'm relentlessly flogging, this week, we had a great livestream looking at AI music generation. Come hear how we turned a pop song into 70s funk.
Mind Readings: Scale vs. Quality in the AI Content Marketing World
Mind Readings: Generative AI Optimization Measurement is a Foolβs Errand
Almost Timely News: ποΈ AI Use Cases for Ideal Customer Profiles (2024-10-06)
Skill Up With Classes
These are just a few of the classes I have available over at the Trust Insights website that you can take.
Premium
Free
Generative AI for Architecture, Engineering, and Construction
Powering Up Your LinkedIn Profile (For Job Hunters) 2023 Edition
Predictive Analytics and Generative AI for Travel, Tourism, and Hospitality, 2024 Edition
Building the Data-Driven, AI-Powered Customer Journey for Retail and Ecommerce, 2024 Edition
The Marketing Singularity: How Generative AI Means the End of Marketing As We Knew It
Empower Your Marketing With Private Social Media Communities
Paradise by the Analytics Dashboard Light: How to Create Impactful Dashboards and Reports
Advertisement: Generative AI Workshops & Courses
Imagine a world where your marketing strategies are supercharged by the most cutting-edge technology available β Generative AI. Generative AI has the potential to save you incredible amounts of time and money, and you have the opportunity to be at the forefront. Get up to speed on using generative AI in your business in a thoughtful way with Trust Insights' new offering, Generative AI for Marketers, which comes in two flavors, workshops and a course.
Workshops: Offer the Generative AI for Marketers half and full day workshops at your company. These hands-on sessions are packed with exercises, resources and practical tips that you can implement immediately.
π Click/tap here to book a workshop
Course: Weβve turned our most popular full-day workshop into a self-paced course. Use discount code ALMOSTTIMELY for $50 off the course tuition.
π Click/tap here to pre-register for the course
If you work at a company or organization that wants to do bulk licensing, let me know!
Get Back to Work
Folks who post jobs in the free Analytics for Marketers Slack community may have those jobs shared here, too. If you're looking for work, check out these recent open positions, and check out the Slack group for the comprehensive list.
Reporting Consultant - Google Ads/Meta/Ga4 (Freelance) at Boost Local
Senior Manager, Capacity Planning (Marketplace) at Headspace
Tableau-Driven Financial Planning & Analysis at Classic Vacations
Advertisement: Free Generative AI Cheat Sheets
Grab the Trust Insights cheat sheet bundle with the RACE Prompt Engineering framework, the PARE prompt refinement framework, and the TRIPS AI task identification framework AND worksheet, all in one convenient bundle, the generative AI power pack!
Download the bundle now for free!
How to Stay in Touch
Let's make sure we're connected in the places it suits you best. Here's where you can find different content:
My blog - daily videos, blog posts, and podcast episodes
My YouTube channel - daily videos, conference talks, and all things video
My company, Trust Insights - marketing analytics help
My podcast, Marketing over Coffee - weekly episodes of what's worth noting in marketing
My second podcast, In-Ear Insights - the Trust Insights weekly podcast focused on data and analytics
On Threads - random personal stuff and chaos
On LinkedIn - daily videos and news
On Instagram - personal photos and travels
My free Slack discussion forum, Analytics for Marketers - open conversations about marketing and analytics
Listen to my theme song as a new single:
Advertisement: Ukraine πΊπ¦ Humanitarian Fund
The war to free Ukraine continues. If you'd like to support humanitarian efforts in Ukraine, the Ukrainian government has set up a special portal, United24, to help make contributing easy. The effort to free Ukraine from Russia's illegal invasion needs your ongoing support.
π Donate today to the Ukraine Humanitarian Relief Fund Β»
Events I'll Be At
Here are the public events where I'm speaking and attending. Say hi if you're at an event also:
MarketingProfs B2B Forum, Boston, November 2024
AMA Houston, Online, November 2024
Social Media Marketing World, San Diego, April 2025
Content Jam, Chicago, April 2025
SMPS, Columbus, August 2025
There are also private events that aren't open to the public.
If you're an event organizer, let me help your event shine. Visit my speaking page for more details.
Can't be at an event? Stop by my private Slack group instead, Analytics for Marketers.
Required Disclosures
Events with links have purchased sponsorships in this newsletter and as a result, I receive direct financial compensation for promoting them.
Advertisements in this newsletter have paid to be promoted, and as a result, I receive direct financial compensation for promoting them.
My company, Trust Insights, maintains business partnerships with companies including, but not limited to, IBM, Cisco Systems, Amazon, Talkwalker, MarketingProfs, MarketMuse, Agorapulse, Hubspot, Informa, Demandbase, The Marketing AI Institute, and others. While links shared from partners are not explicit endorsements, nor do they directly financially benefit Trust Insights, a commercial relationship exists for which Trust Insights may receive indirect financial benefit, and thus I may receive indirect financial benefit from them as well.
Thank You
Thanks for subscribing and reading this far. I appreciate it. As always, thank you for your support, your attention, and your kindness.
See you next week,
Christopher S. Penn
great post CP - https://keithnewman.substack.com/