Artikel 61
llm

Working with Examples: Showing Instead of Explaining

Sebastian Rydz16. März 202610 min Lesezeit

You probably know this from experience: you explain something to someone, and despite your best words, they just do not get it. Then you show a single example, and suddenly everything clicks. Exactly this principle works when interacting with AI as well. Instead of describing in lengthy detail what you want, you simply show the AI what the result should look like. In this article, you will learn how using examples in your prompts leads to dramatically better results.

In the previous article, you learned the role technique and how to assign an expert perspective to the AI. Now we add a technique to your toolkit that truly shines when you need a very specific format, style, or structure. In the next article, we will go a step further and have the AI think step by step.

One Example Is Worth a Thousand Words

Why are examples so powerful? The answer lies in how language models work. When you tell the AI "Write a professional but friendly text," it has to interpret on its own what "professional but friendly" means to you. The result may hit the mark or miss it entirely. But when you provide an example of what such a text should look like, the AI has a concrete template to follow.

In technical terms, this technique is called "Few-Shot Prompting." "Shot" refers to a single example. "Zero-Shot" means you provide no examples. "One-Shot" means one example, and "Few-Shot" means multiple examples. The more fitting examples you provide, the better the AI understands what you expect.

Imagine asking a chef to cook a dish "Italian style." They could prepare anything from pizza to tiramisu. But if you show them a photo of the exact dish you mean, they will deliver precisely the right result. Examples in prompts work the same way: they eliminate ambiguity and steer the AI in the desired direction.

This principle works for virtually any task: writing texts, formatting data, structuring responses, creating summaries, generating code, and much more. Wherever you expect a specific pattern or style, examples help enormously.

Good vs. Bad Examples: What Makes the Difference

Not every example is equally useful. There is a significant difference between examples that truly help the AI and those that confuse it. Here you will learn what matters most.

Characteristics of good examples:

  • Representative: The example shows exactly the kind of result you expect. It is not an edge case but the typical standard.
  • Complete: The example shows the entire desired format, not just a snippet. The AI can derive all relevant patterns from it.
  • Consistent: When you provide multiple examples, they all follow the same pattern. Contradictory examples confuse the AI.
  • Clearly delimited: It is unmistakably clear what is the example and what is your instruction. Use markers like "Example:" or separate them clearly.

Characteristics of bad examples:

  • Too vague: The example does not show enough detail for the AI to recognize the pattern.
  • Contradictory: Multiple examples follow different patterns, and the AI does not know which one to follow.
  • Misleading: The example shows something different from what you actually want.
  • Too complex: The example contains so many elements that the AI cannot identify which pattern is relevant.

Here is a concrete comparison:

Bad example in a prompt: "Write product descriptions. Here is an example: The product is great and has many features."

Good example in a prompt: "Write product descriptions in the following format. Example: Product name: EcoBottle 500. Target audience: Environmentally conscious athletes. Main benefit: Keeps drinks cold for 24 hours, made from 100% recycled stainless steel. Tone: Active, motivating, sustainable. Description: The EcoBottle 500 is your reliable companion for every workout. Crafted from 100% recycled stainless steel, it keeps your water ice-cold all day long. Good for you, good for the planet."

Can you see the difference? The good example shows both input and output. It demonstrates structure, tone, and length. After seeing it, the AI knows exactly what to produce.

The "Do It Like This" Principle in Practice

The "Do It Like This" principle is the simplest form of the example technique. You give the AI one or more examples and essentially say: "This is what it should look like. Do the same thing, but with my content."

Here are some practical applications:

Application 1: Setting an email style

Prompt: "I want you to write emails in my style. Here is an example of how I normally write:

Subject: Quick project update
Hi Lisa,
Quick update on our progress: We have finished Phase 2 and will start testing next week. If you have any questions, just reach out.
Best regards, Max

Now write an email to our client Mr. Weber, informing him that the delivery date has been pushed back by one week."

The AI will adopt the tone (brief, direct, friendly), the structure (subject line, greeting, short body, sign-off), and the style (informal but professional).

Application 2: Outputting data in a specific format

Prompt: "Format the following information as shown in this example:

Example Input: Berlin, Germany, 3.7 million inhabitants
Example Output: Berlin | Germany | Population: 3.7M

Now format: Tokyo, Japan, 14 million inhabitants | Paris, France, 2.1 million inhabitants | New York, USA, 8.3 million inhabitants"

Application 3: Summarizing according to a template

Prompt: "Summarize articles using this template:

Example:
Topic: Climate change and agriculture
Key message: Rising temperatures threaten crop yields in Southern Europe
Most important figure: 30% decline in harvests projected by 2050
Conclusion: Adaptation strategies are urgently needed

Now summarize the following article: [article text]"

In all of these cases, the example eliminates the need to verbally describe every detail. The AI recognizes the pattern and applies it. This saves you time and delivers more consistent results.

When Examples Are Especially Helpful

Examples are not equally useful in every situation. There are specific scenarios where they make an especially big difference:

When you want a specific writing style: Instead of describing the style with adjectives ("casual but professional, with a dash of humor"), you simply show a text written in that style. The AI captures nuances that are hard to put into words.

When you need a specific format: JSON, CSV, tables, bullet points with specific markers: an example immediately tells the AI how the output should be structured.

When verbal descriptions are not enough: Sometimes it is nearly impossible to describe a desired result using words alone. An example bridges that gap instantly.

When you need consistent results across multiple runs: If you ask the AI to write ten product descriptions, an example ensures all ten follow the same pattern.

When working with classifications: "Classify the following customer reviews as positive, neutral, or negative" works much better when you provide an example for each category.

When you want to set a creative direction: You want poems in the style of Robert Frost? Provide a Frost poem as an example. You want jokes in the style of Monty Python? Show a Monty Python joke as a template.

As a rule of thumb: if you notice that you need more than two sentences to describe the desired result, an example is probably more effective.

How Many Examples Are Optimal?

The question of how many examples to provide is a fair one. Here are the most important guidelines:

One example (One-Shot): Often sufficient when the task is relatively simple and you mainly want to demonstrate the format or style. A single example gives the AI clear guidance without overloading the prompt.

Two to three examples (Few-Shot): Ideal for more complex tasks or when you want to ensure the AI has truly understood the pattern. Three different examples with the same pattern give the AI enough data points to reliably recognize the pattern.

More than three examples: Rarely necessary but can be helpful for very complex classification tasks or unusual formats. Keep in mind that too many examples make the prompt very long and unnecessarily burden the context window of some models.

Variation in examples: When providing multiple examples, they should show different variants of the same task. For product descriptions, for instance: one example for a physical product, one for software, and one for a service. This helps the AI understand that the pattern is universally applicable.

Counter-examples: Sometimes it is useful to show not only what the result should look like but also what it should not look like. "This is how it should look: [good example]. This is how it should NOT look: [bad example]." This technique is especially helpful when the AI tends to make typical mistakes.

Using Examples in the Prompt Generator

The prompt generator at optiprompt.io also supports you when working with examples. It helps you determine the right number and type of examples for your task.

Here is how to proceed:

  1. Describe your task in the prompt generator.
  2. Activate the example option: The generator offers you the ability to add your own examples.
  3. Add your example: Paste an existing result that matches your expectations.
  4. The generator structures the prompt: It places the example optimally within the prompt and combines it with other techniques like the role technique.
  5. Generate and test: Try the finished prompt and compare it with a prompt that has no example.

Especially effective is combining the example technique with the role technique from the previous article. You assign the AI an expert role and simultaneously provide an example of the desired result. This produces prompts like: "You are an experienced copywriter. Write product texts in the following style: [example]. Now create a text for [your product]."

The prompt generator combines these elements automatically and ensures that role, task, and example work together optimally. Try it out and you will notice the difference immediately.

Common Mistakes When Working with Examples

There are also typical pitfalls with the example technique that you should know about and avoid:

Mistake 1: Mixing example and task

If you do not clearly separate the example from the actual task, the AI can get confused. Always use clear markers: "Example:", "Template:", "Pattern:" and then "Now your task:" or "Now create:".

Mistake 2: Too many different patterns in the examples

If your examples follow different patterns, the AI does not know which one to follow. Keep all examples consistent. If you deliberately want variation, say so explicitly.

Mistake 3: Using examples from a different context

An example of a formal business email is of little help when you want to write a casual newsletter. The example must match the goal.

Mistake 4: The example is better than the desired result

If your example is a masterfully written text from a professional author and you expect similar quality for a simple blog post, the result may come across as overdone. Choose an example that matches the desired quality level.

Mistake 5: Showing only the format but not the content style

An example that only shows the structure (heading, paragraph, list) but reveals nothing about tonality and level of detail is often insufficient. A good example shows both: form and content.

If you avoid these mistakes, you will quickly master the example technique and noticeably improve the quality of your AI results.

Exercise: Setting Your Own Writing Style with an Example

In this practical exercise, you will learn to convey your very own writing style to the AI. This is one of the most useful applications of the example technique because it allows the AI to write texts that sound like they came from you.

Step 1: Find an example of your writing style

Look for an email, a social media post, or a short text that you wrote yourself and that represents your typical style well. Ideally, the text should be between 100 and 300 words long.

Step 2: Formulate the prompt

Use the following prompt structure:

"Analyze the following text and adopt my writing style for all subsequent texts. Pay attention to tonality, sentence length, word choice, and structure.

My sample text:
[Insert your text here]

Task: Now write a short text in my style about [topic of your choice]."

Step 3: Compare and refine

Read the result and compare it with your original text. Does it sound like you? If not, give the AI feedback: "The text is too formal for my taste. In my style, I use shorter sentences and more colloquial language. Try again."

Step 4: Test with different topics

Once the style fits, test it across different topics. Can the AI consistently maintain your style regardless of whether you are writing about technology, travel, or cooking?

Bonus task: Open the prompt generator at optiprompt.io, enter your style example, and let it generate an optimized prompt. Compare the result with your manual attempt.

Reflection: What did the AI capture well? Which style elements get lost? What do you need to describe additionally to get the style just right? These insights will help you write even better example prompts in the future.

Summary and Outlook

Working with examples is one of the most intuitive and effective prompting techniques. Instead of describing what you want, you simply show it. The "Do It Like This" principle works in virtually any situation and delivers more consistent, more precise results.

The key takeaways from this article:

  • An example eliminates ambiguity and gives the AI a clear template.
  • Good examples are representative, complete, consistent, and clearly delimited.
  • One to three examples are sufficient for most tasks.
  • The technique is especially powerful for style, format, and classification tasks.
  • In combination with the role technique, it unleashes its full power.
  • The prompt generator at optiprompt.io helps you integrate examples optimally into your prompt.

In the next article, "Thinking Step by Step," you will learn a technique that is indispensable for complex tasks. You will discover how to get the AI to reveal its reasoning process and solve problems systematically. The combination of all three techniques (roles, examples, and step-by-step thinking) will make you a prompting expert. Until then: collect examples of your desired style and experiment with the example technique!

Autor

Sebastian Rydz

Das OptiPrompt Team teilt Wissen und Best Practices rund um KI und Prompt Engineering, um dir zu helfen, bessere Ergebnisse mit KI-Modellen zu erzielen.

Bereit, deine Prompts zu optimieren?

Erstelle mit OptiPrompt professionelle Prompts in Sekunden – kostenlos starten.