Exams / GCP-GAIL / D3 Techniques to improve gen AI model output
Techniques to improve gen AI model output
- Exam domain: Techniques to improve gen AI model output
Prompt engineering
Prompt engineering is "the iterative process of creating a prompt and accessing" the model's response to steer it toward the desired result. A prompt can hold instructions, context, few-shot examples and partial input.
| Technique | What you do | Use when |
|---|---|---|
| Zero-shot | Plain request, no examples | Simple tasks |
| Few-shot | Add several examples | Dictate style, tone, format; show successful interactions |
| Role / persona | "You are a …" in the system prompt | Tone, audience, policy-aware voice |
| Context | Add audience, keywords, facts | Generic or off-brand output |
| Prompt chaining | Split a task; one output feeds the next prompt | Complex, multi-step tasks |
| Chain-of-thought | Spell out reasoning steps | Reasoning tasks |
Multi-turn chat is different: the model "tracks the history of a chat conversation" and uses it as context.
Grounding and RAG
Grounding is "the process of connecting a model's output to verifiable sources". It reduces hallucinations. RAG is the common implementation: search finds relevant information and adds it to the prompt, so new or private data needs no retraining and is cheaper than fine-tuning.
Parameters
| Setting | Effect |
|---|---|
| Temperature | Randomness of token selection; low = predictable |
| Top-P / Top-K | Which candidate tokens are considered |
| Max output tokens | Caps response length (concise summaries) |
| Safety settings | Filter harmful content |
Other levers
- Human-in-the-loop review for nuance (sarcasm, satire) and critical decisions.
- De-identification (mask, delete, obscure PII) before training on sensitive data.
Exam traps
- Hallucination or stale knowledge: grounding/RAG, never higher temperature or safety filters.
- Missing brand/tone: richer prompt (role, context), not a longer output limit.
- Private PII in training data: anonymize; access control alone is not enough.
- "Remember earlier turns" is worded as prompt chaining on the exam although docs call it chat history.
- New documents, cost-effective: RAG, not fine-tuning.
- Google Vids = avatar + AI voiceover videos.
Docs
- https://docs.cloud.google.com/docs/generative-ai/glossary
- https://docs.cloud.google.com/docs/ai-ml/generative-ai/develop-generative-ai-application
- https://docs.cloud.google.com/vertex-ai/generative-ai/docs/learn/prompts/introduction-prompt-design
- https://docs.cloud.google.com/vertex-ai/generative-ai/docs/learn/prompts/prompt-design-strategies
- https://docs.cloud.google.com/vertex-ai/generative-ai/docs/model-reference/inference
- https://docs.cloud.google.com/gemini-enterprise-agent-platform/models/prompts/break-down-prompts
- https://docs.cloud.google.com/gemini-enterprise-agent-platform/models/chat/chat-prompts
- https://docs.cloud.google.com/sensitive-data-protection/docs/deidentify-sensitive-data
- https://support.google.com/docs/answer/16334946