Docsity

Advanced Prompting Techniques for Large Language Models (LLMs), Schemes and Mind Maps of Computer Science

Partial preview of the text

Download Advanced Prompting Techniques for Large Language Models (LLMs) and more Schemes and Mind Maps Computer Science in PDF only on Docsity!

Advanced Prompting

Techniques - 1

Why Advanced?

PROMPT - Albert's father has a brother called Donald. Donald has three nephews: Huey, Dewey, and...?

OUTPUT - The third nephew would be Louie. This is referencing the classic Disney characters Huey, Dewey, and Louie - Donald Duck's three nephews. In the context of your riddle, if Albert's father has a brother named Donald, and Donald has three nephews, the third one following the pattern would be Louie to complete the famous trio.

Step-back Prompting

Step-back Prompting

Step-back prompting is a technique for improving the performance by prompting the LLM to first consider a general question related to the specific task at hand, and then feeding the answer to that general question into a subsequent prompt for the specific task.

● Activates relevant background knowledge and reasoning. ● Leads to more accurate, insightful, and creative responses. ● Helps reduce biases by focusing on principles rather than details. ● Utilizes more of the LLM’s stored knowledge than direct prompting.

Step-back Example

OUTPUT - The level begins with the player’s squad being ambushed in a dense urban area by a relentless enemy faction. Players must fight their way through a maze of back alleys and dilapidated buildings, utilizing stealth and precision to eliminate enemy forces and avoid detection. The player must use their environment to their advantage, setting traps, utilizing cover, and making calculated moves to survive. Along the way, they uncover intel suggesting the enemy is planning a devastating attack, and the player must race against time to gather evidence and relay it back to their headquarters before the enemy can carry out their plans.

Step-back Example

you might end up with all kinds of creative writings for a storyline, but it’s also quite random and generic. So let’s take a step back

Step-back Example

OUTPUT -

  1. Abandoned Military Base: A sprawling, post-apocalyptic military complex crawling with mutated soldiers and rogue robots, ideal for challenging firearm combat.
  2. Cyberpunk City: A neon-lit, futuristic urban environment with towering skyscrapers and dense alleyways, featuring cybernetically enhanced enemies and hacking mechanics.
  3. Alien Spaceship: A vast alien vessel stranded on Earth, with eerie corridors, zero-gravity sections, and extraterrestrial creatures to encounter. …

Step-back Example

Context: 5 engaging themes for a first person shooter video game:

  1. Abandoned Military Base: A sprawling, post-apocalyptic military complex crawling with mutated soldiers and rogue robots, ideal for challenging firearm combat.
  2. Underwater Research Facility: A deep-sea laboratory flooded with water, filled with mutated aquatic creatures, and requiring stealth and underwater exploration skills to survive. … Take one of the themes and write a one paragraph storyline or a new level of a first-person shooter video game that is challenging and engaging.

Step-back Prompting: Tips

Best for creative or knowledge-heavy tasks (storytelling, idea generation, analysis). Use when direct prompt = too generic. ⚠ Needs multi-step prompting → slower, more tokens. ⚠ Quality depends on first “step-back” question.

💡 Pro Tip: Write the step-back as a category or principle question: ● “What are the key factors…?” ● “What general strategies apply…?”

Chain of Thought (CoT)

CoT Example

PROMPT - When I was 3 years old, my partner was 3 times my age. Now, I am 20 years old. How old is my partner?

OUTPUT - 63 years old

CoT Example

PROMPT - When I was 3 years old, my partner was 3 times my age. Now, I am 20 years old. How old is my partner? Let's think step by step.

It’s interesting to see that the model adds up the 17 increased years.

In my head I would take the difference of years between my partner and me and add those up. (20+(9-3)). Let’s help the model to think a little bit more like me.

PROMPT -

Q: When my brother was 2 years old, I was double his age. Now I am 40 years old. How old is my brother? Let's think step by step. A: When my brother was 2 years, I was 2 * 2 = 4 years old. That's an age difference of 2 years and I am older. Now I am 40 years old, so my brother is 40 - 2 = 38 years old. The answer is 38. Q: When I was 3 years old, my partner was 3 times my age. Now, I am 20 years old. How old is my partner? Let's think step by step. A: