Skip to content
Google Cloud Certified Generative AI Leader (GAIL) Exam Prep

Lesson 7 of 8 · 11 min

x
7/8

Domain 3: Techniques to Improve Gen AI Model Output (Part 2 of 2)

This lesson covers 3 exam topics: Chain-of-Thought and ReAct, Grounding and RAG on Google Cloud, Sampling Parameters and Safety Settings. Each topic has a short video, then the notes: key facts, exam traps and what to check in the official docs.

1. Chain-of-Thought and ReAct

Video lesson: GAIL 26/32: Chain-of-Thought and ReAct

Central question: When do chain-of-thought and ReAct help?

Facts

  • Chain-of-thought (CoT) prompting asks the model to reason step by step before answering; it helps with math, logic and multi-step reasoning.
  • ReAct (Reason + Act) interleaves reasoning with actions (tool calls) and observations: think, call a tool, read the result, think again. It's the pattern behind tool-using agents.
  • Many current Gemini models have built-in thinking with configurable thinking levels, which does step-by-step reasoning internally (Google models page).

Exam traps

  • ReAct for a single factual rewrite. It's for tasks needing tools and multiple steps.
  • CoT when the answer needs fresh external data. Reasoning can't replace retrieval; use ReAct with tools or grounding.

2. Grounding and RAG on Google Cloud

Video lesson: GAIL 27/32: Grounding and RAG on Google Cloud

Central question: What kinds of grounding exist, and which Google Cloud offering fits?

Facts

Grounding sourceExampleGoogle Cloud offering
First-party enterprise dataPolicies, manuals, product catalogAgent Search (prebuilt RAG), RAG Engine (RAG APIs)
Third-party dataLicensed data sets, partner indexesGrounding with your search API, Elasticsearch, Web Grounding for Enterprise
World dataPublic webGrounding with Google Search (also Google Maps)
  • Grounding connects model output to verifiable sources, reduces hallucinations, anchors answers to your data and adds auditability through links to sources (Grounding overview).
  • RAG retrieves relevant content at query time and adds it to the prompt, so answers reflect current and private data without retraining.
  • Exam guide offerings: pre-built RAG with Agent Search, RAG APIs, Grounding with Google Search.

Exam traps

  • Google Search grounding for confidential HR policies. Use Agent Search or RAG Engine.
  • RAG retrains the model. It supplies context at query time.

3. Sampling Parameters and Safety Settings

Video lesson: GAIL 28/32: Sampling Parameters and Safety Settings

Central question: What do sampling parameters and safety settings control?

Facts

SettingEffect
TemperatureRandomness; low = focused and predictable, high = diverse and creative; 1.0 is the recommended starting value
Top-P (nucleus)Sample only from the most likely tokens whose probabilities add up to P
Top-KSample only from the K most likely tokens
Max output tokensCaps response length; 100 tokens is roughly 60-80 words
Stop sequencesStop generating at a given string
Safety settingsBlock thresholds per harm category
  • Temperature 0 makes responses mostly deterministic; raise temperature if output is too generic (content generation parameters).
  • For Gemini 3.6 Flash and later, custom temperature, top-P and top-K values are ignored, and penalty parameters return an error (checked 2026-10-26).
  • Configurable harm categories: hate speech, harassment, sexually explicit and dangerous content; thresholds BLOCK_LOW_AND_ABOVE, BLOCK_MEDIUM_AND_ABOVE, BLOCK_ONLY_HIGH, OFF; for Gemini 3.5 Flash and later, OFF is the default. Non-configurable filters always block prohibited content such as CSAM (safety filters docs).

Exam traps

  • High temperature for a factual extraction task. Use low temperature.
  • Safety filters change the model's behavior. They block output; use system instructions to steer behavior.
  • Max tokens improves quality. It only limits length.

References

  1. GAIL exam guide — checked Oct 26, 2026
  2. Google models — checked Oct 26, 2026
  3. Grounding overview — checked Oct 26, 2026
  4. RAG Engine overview — checked Oct 26, 2026
  5. Content generation parameters — checked Oct 26, 2026
  6. Safety and content filters — checked Oct 26, 2026

Check your understanding

  • Model must look up stock, then decide, then order?Show answer

    Answer

    ReAct.
  • Answer about today's weather or news?Show answer

    Answer

    Grounding with Google Search.
  • More creative slogans?Show answer

    Answer

    Raise temperature.
  • Multi-step word problem?Show answer

    Answer

    Chain-of-thought.
  • Answer from the company handbook with citations?Show answer

    Answer

    Agent Search (prebuilt RAG).
Previous

Progress is saved in this browser.

Next Lesson