Prompt Engineering interview question

Generative AIPrompt EngineeringHallucinationeasy

An e-commerce team writes product descriptions with a prompt that includes three example descriptions, all for one brand's running shoes. New descriptions for kettles and sofas now mention "breathable mesh", "30-day free returns" and the example brand's name. What is the best fix?

  1. ALower the temperature to 0, because the copied phrases come from random sampling, and greedy decoding keeps the model closer to the facts that are given for each new product.
  2. BAdd five more running-shoe examples in the same style, because more examples help the model separate the reusable style from the facts that are specific to the example product.
  3. CUse examples from varied categories with placeholder details, because when all three share one brand and category, the model treats their specific facts as part of the task.
  4. DMove the examples after the product data, so the model reads the real facts first, since a model copies content mainly from text that appears near the start of the prompt.
Show the answer and explanation

Correct answer: C, Use examples from varied categories with placeholder details, because when all three share one brand and category, the model treats their specific facts as part of the task.

Explanation Prompt Engineering

Few-shot examples teach format and tone, but the model cannot tell which parts are style and which are content unless you make it obvious. When all examples share one product type, brand and policy, the most likely continuation reuses those details: content leakage. Here it is also a factual risk, because "30-day free returns" may not be true for kettles or sofas.

The core fix is in the examples themselves; labelling and output checks add defence in depth:

  • Diversify the examples: different categories, brands, lengths and selling points, so no detail looks like a constant of the task.
  • Neutralise content: use clearly fictional names or placeholders such as [BRAND] and [MATERIAL], so any copying is obvious and harmless.
  • Label them: wrap the examples in tags and state that they illustrate structure and tone only; every fact must come from the product data.
  • Check outputs: flag descriptions that contain distinctive example phrases (n-gram overlap) or claims absent from the product data.

Why the other fixes fail: greedy decoding always picks the most likely continuation, and copying is often exactly that. More examples of the same product strengthen the pattern instead of breaking it. Position does not stop copying: the model attends to the whole context, and examples placed right before the output can be copied even more (recency bias).

Interview tip: test few-shot prompts on inputs that look unlike the examples (other categories, edge cases); leakage only shows up when the inputs differ from the demonstrations.

Practice it as a quiz

Answer this and the other free questions with instant grading, streaks and weak-topic tracking, or unlock all 4,000 questions.

More Generative AI questions

  1. What is a large language model (LLM)?
  2. What is the difference between zero-shot and few-shot prompting?
  3. What is retrieval-augmented generation (RAG)?
  4. What does it mean to fine-tune a pretrained LLM?
  5. A chatbot's conversation history is growing longer than the model's context window. What is a common way to handle it?