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
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
Central question: What kinds of grounding exist, and which Google Cloud offering fits?
Facts
| Grounding source | Example | Google Cloud offering |
|---|---|---|
| First-party enterprise data | Policies, manuals, product catalog | Agent Search (prebuilt RAG), RAG Engine (RAG APIs) |
| Third-party data | Licensed data sets, partner indexes | Grounding with your search API, Elasticsearch, Web Grounding for Enterprise |
| World data | Public web | Grounding 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
Central question: What do sampling parameters and safety settings control?
Facts
| Setting | Effect |
|---|---|
| Temperature | Randomness; 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-K | Sample only from the K most likely tokens |
| Max output tokens | Caps response length; 100 tokens is roughly 60-80 words |
| Stop sequences | Stop generating at a given string |
| Safety settings | Block 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
- GAIL exam guide — checked Oct 26, 2026
- Google models — checked Oct 26, 2026
- Grounding overview — checked Oct 26, 2026
- RAG Engine overview — checked Oct 26, 2026
- Content generation parameters — checked Oct 26, 2026
- Safety and content filters — checked Oct 26, 2026
Check your understanding
Model must look up stock, then decide, then order?Show answerHide answer
Answer
ReAct.Answer about today's weather or news?Show answerHide answer
Answer
Grounding with Google Search.More creative slogans?Show answerHide answer
Answer
Raise temperature.Multi-step word problem?Show answerHide answer
Answer
Chain-of-thought.Answer from the company handbook with citations?Show answerHide answer
Answer
Agent Search (prebuilt RAG).