TechNuggets Academy

Techniques to improve gen AI model output

Free Google Cloud Generative AI Leader practice — 6 questions on Techniques to improve gen AI model output, with explanations. No sign-up. Full 12-question mixed test →

Question 1 of 6 · Techniques to improve gen AI model output
A retail company's product recommendation chatbot is generating plausible-sounding but factually incorrect product specifications (e.g., inventing features that don't exist). The model uses a generic foundation model with no access to the company's product catalog. Temperature is set to 0.2. Which single intervention will MOST effectively reduce these hallucinations?
Grounding with RAG directly addresses the root cause: the model lacks access to factual product data. RAG retrieves verified information from the product database before generation, ensuring responses are anchored in real data rather than the model's training corpus. This is the primary technique for connecting models to current, proprietary, or domain-specific facts.
Question 2 of 6 · Techniques to improve gen AI model output
An insurance company wants its claims chatbot to generate responses that strictly follow regulatory compliance language. The team debates between fine-tuning on 10,000 compliant claim decisions versus using few-shot prompting with 5 exemplar exchanges in the system prompt. Latency and cost are secondary concerns; compliance accuracy is critical. Which approach BEST fits this requirement?
Fine-tuning is justified when you need the model to deeply internalize domain-specific behavioral patterns across many scenarios. With 10,000 labeled examples and a critical requirement for consistent compliance language (not just factual retrieval), fine-tuning adjusts the model's weights to reliably produce regulation-aligned responses. This is a classic use case where fine-tuning outperforms prompting: consistent style/tone adherence across complex, nuanced requirements.
Question 3 of 6 · Techniques to improve gen AI model output
A financial services firm uses embeddings and vector search to power a document Q&A system over 50,000 internal policy PDFs. Users report that answers sometimes cite outdated policies that were replaced months ago. New policies are added weekly. Which solution BEST ensures the system uses only current policy information?
Metadata filtering at retrieval time is the correct architectural solution for data freshness in RAG systems. By tagging superseded documents and filtering them out during vector search, you ensure the model only sees current policies in its context window. This is a standard RAG best practice for managing evolving knowledge bases where older information should be excluded, not just deprioritized.
Question 4 of 6 · Techniques to improve gen AI model output
A logistics company is experimenting with top-k and top-p (nucleus) sampling to optimize route recommendation outputs. The model should balance creativity (exploring alternative routes) with reliability (not suggesting impossible routes). Current settings: temperature=0.7, top-k=40, top-p=0.9. Users complain outputs are too random. Which adjustment will make outputs more focused while preserving some route diversity?
Temperature is the primary control for output randomness. Lowering temperature from 0.7 to 0.3 makes the probability distribution sharper, causing the model to favor higher-probability tokens more strongly. This reduces randomness while still allowing some variation (not zero-shot determinism). Temperature acts before top-k/top-p filtering, so it's the most direct lever for 'too random' problems while preserving diversity.
Question 5 of 6 · Techniques to improve gen AI model output
A healthcare AI team is building a diagnostic support tool that must cite peer-reviewed medical literature for every clinical recommendation. The team compares two architectures: (A) fine-tuning a foundation model on 100,000 PubMed abstracts, or (B) using RAG with embeddings of the same abstracts plus real-time retrieval with citation links. Both use Gemini models on Google Cloud. Assume cost and latency are acceptable for both. Which approach BEST satisfies the citation requirement?
RAG architectures explicitly return source documents alongside generated text, enabling direct citation with verifiable links back to the retrieved literature. This is a fundamental advantage of RAG for use cases requiring attribution and groundedness verification. The retrieval step produces metadata (document IDs, URLs) that can be passed through to the user, whereas fine-tuned models cannot reliably cite sources—they generate text based on learned patterns without traceable provenance.
Question 6 of 6 · Techniques to improve gen AI model output
A marketing team uses a generative AI tool to draft email campaigns. They notice that when the context window contains 15 past campaign examples (approximately 12,000 tokens), the model sometimes ignores instructions in the system prompt (e.g., 'keep subject lines under 50 characters'). When context is reduced to 5 examples (4,000 tokens), instructions are followed. The model's maximum context window is 32,000 tokens. What is the MOST likely explanation?
'Lost in the middle' is a documented phenomenon in large language models where content in the middle of very long contexts receives less attention than content at the beginning or end, even well within the context window limit. When 15 examples are inserted between the system prompt and the user query, important instructions can be de-emphasized. This is a known limitation of transformer attention mechanisms at scale and explains why reducing context improves instruction-following.
Ready for the real thing?

The full course: two full-length practice tests, video lessons for every exam domain, hands-on labs and detailed explanations.

$99.99 $34.99 with code FREETEST33 — valid through September 2.

Get my $34.99 deal →