Prompt Engineering: Lessons Learned from Google’s Guide

Filippo MameliFilippo Mameli
6 min read

Introduction

Large Language Models (LLMs) have rapidly evolved from experimental curiosities to powerful tools that can summarize, code, reason, and create.
Yet, the quality of their output isn’t solely determined by the model, it’s deeply influenced by how we interact with it.

This year Google released a comprehensive guide to Prompt Engineering for LLMs. While much has been written about this topic, their approach combined theory with practical advice, offering a systematic way to get more reliable, relevant, and structured results.

I went through the guide in detail and extracted what I believe are the most impactful takeaways principles and techniques that any developer, data scientist, or product builder can apply immediately.


1. Prompt Design Is Iterative

One of the most important points in Google’s guide is that prompting is not a one-shot effort.

Your first attempt will rarely yield the optimal output. Instead, treat prompt design like any other development process:

  • Start with a hypothesis (your initial prompt)

  • Test it

  • Observe the output

  • Adjust wording, structure, or examples

  • Repeat until results are consistent and aligned with your goal

This iterative cycle mirrors debugging or model tuning — each prompt revision is a small experiment.

Example:

  • Initial prompt:

    Summarize the following article.

  • Refined prompt:

    Summarize the following article in 5 bullet points focusing on the main arguments and excluding examples.

The second version is clearer, more constrained, and leaves less room for the model to guess your intent.

2. Context Is Everything

LLMs are context-dependent: the more relevant information you give them, the better they can align their output with your expectations.

Google’s guide emphasizes three ways to embed context:

a) System prompts

Define the rules of the game upfront.

You are an expert technical writer specializing in Python tutorials.

b) Role prompting

Assign the model a persona to control tone and style.

Act as a project manager preparing a status update for executives.

c) Contextual prompts

Include relevant background, data, or constraints.

Context: This report is for non-technical stakeholders who need actionable recommendations.

Why it matters:
Without context, an LLM may default to generic responses. With context, you guide it toward domain-specific, audience-appropriate output.

3. Reasoning Before Answering

For tasks requiring logic, planning, or problem-solving, prompting the model to think before it speaks often yields better results.

Two techniques stand out:

Chain of Thought (CoT)

Ask the model to reason step-by-step.

Let’s think step by step.

Example:
Question:

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

A CoT approach encourages the model to calculate incrementally instead of guessing.


Step-back Prompting

Before tackling a specific problem, ask the model to generate general knowledge first.

Example for a game design task:

  1. What are common themes in forest-based video game levels?

  2. Now write a level description using one of those themes.

This two-step process primes the model with useful concepts before diving into execution.

4. Let the Model Help You

One fascinating insight from the Google guide is Automatic Prompt Engineering (APE).
Here, you use the LLM to generate better prompts for itself.

Example:

Generate five alternative ways to instruct an LLM to produce a structured executive summary from a long technical document.

You then test these variations and pick the best performer.
This meta-prompting approach offloads part of the creative design process to the model, saving time and potentially surfacing strategies you wouldn’t think of yourself.

5. Structure Pays Off

Unstructured outputs are hard to parse, verify, or integrate into downstream systems.

Instead of asking:

List the top three risks for this project.

Ask:

Return the top three project risks as a JSON array with keys risk and mitigation.

By specifying the format (JSON, bullet points, tables), you:

  • Reduce ambiguity

  • Make parsing easier for automation

  • Keep responses consistent across multiple runs

This aligns perfectly with software engineering principles: define the contract before execution.

6. Mixing Control and Creativity

LLM configuration parameters temperature, top-k, and top-p act like dials controlling creativity, determinism, and diversity.

  • Temperature

    • Lower values (0.0–0.3) yield deterministic, precise outputs.

    • Higher values (0.8–1.0) produce creative, varied results.

  • Top-k

    • Limits token selection to the top k most likely options.

    • Lower k = more predictable output.

  • Top-p (nucleus sampling)

    • Selects from the smallest set of tokens whose cumulative probability exceeds p.

    • Lower p = more focus.

Experiment idea:
Ask the same creative question: Invent three names for a futuristic coffee shop. Use a temperature setting of 0.1 and then 0.9. Compare how the style and variety of the names differ.

7. Best Practices in Prompt Engineering

The Google guide closes with a set of practical do’s and don’ts. My distilled version:

  • Be explicit: vague prompts yield vague answers

  • Limit scope: ask for one thing at a time

  • Use examples: few-shot prompting improves consistency

  • Control output length: specify word count, bullet count, or token limit

  • Review and iterate: collect and compare outputs to refine prompts


Case Study: Applying These Principles

Imagine you’re building an internal tool to help product managers summarize weekly project updates.

Naïve prompt:

Summarize this project update.

Refined using Google’s principles:

  1. Role: "You are a senior product manager."

  2. Context: "Audience: executives who need a high-level overview with key risks."

  3. Format: "Return as three bullet points."

  4. Reasoning: "Think step by step before writing."

Final prompt:

You are a senior product manager. Audience: executives who need a high-level overview with key risks. Think step by step before writing. Summarize this project update as exactly three bullet points.

Result: more relevant, concise, and actionable output.


Why This Matters

Prompt engineering isn't just a gimmick. It's a core skill for effectively working with LLMs, much like writing SQL for databases or creating good test cases for software.

Google’s guide makes clear that better prompts = better outputs, but also that prompting is:

  • Context-specific

  • Iterative

  • Collaborative (sometimes between you and the model itself)

The difference between a mediocre prompt and a well-engineered one can be the difference between hours of manual cleanup and an immediately usable answer.


Conclusion

The biggest lesson I learned from Google’s guide is that prompt engineering is the interface layer between human intent and machine capability.

Whether you’re a developer, analyst, or creative, knowing how to design, test, and refine prompts will help you get more value from any LLM you use.

I’ve used these principles in my own work, from data processing scripts to creative ideas, and the improvement is clear.
If you’re working with LLMs, invest time in mastering these skills.


📖 Full Guide: https://www.kaggle.com/whitepaper-prompt-engineering
💬 What about you? Have you experimented with Chain of Thought, Step-back prompting, or Automatic Prompt Engineering? Which technique made the biggest difference for your use case?

0
Subscribe to my newsletter

Read articles from Filippo Mameli directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Filippo Mameli
Filippo Mameli

Hi! I'm Filippo Mameli and I'm a Ai Engineer. I studied Computer Science at the University of Florence and have a Master in Data Science I like Machine Learning, Data Engineering and Web Development. You can find all my personal projects on my Github page. I enjoy listening to music, photography, cinema, and video games.