EXAMTOPICS / TECHNOLOGY INSIGHTS

Amazon AWS AIF-C01: Improving Generative AI on AWS

When a generative-AI application is disappointing, the right fix depends on the failure. The AWS Certified AI Practitioner AIF-C01 foundation-model domain distinguishes prompt engineering, retrieval-augmented generation (RAG), and fine-tuning because they change different parts of the system. Prompting changes the instructions and context in a request, RAG retrieves external knowledge at runtime, and fine-tuning changes model behavior through additional training.

These approaches can be combined, but they should not be stacked automatically. Start with the simplest method that addresses the observed problem, evaluate it against representative cases, and add complexity only when the previous layer cannot meet the requirement.

Use prompt engineering when the model needs clearer instructions

Prompt engineering is usually the first improvement because it changes no model weights and needs no retrieval system. It is also the easiest layer to observe directly: reviewers can read the instructions and examples that shape the response. This makes prompting a good place to resolve formatting, tone, role, and simple reasoning guidance before adding infrastructure. Clarify the role, task, constraints, output format, examples, and relevant context. Remove contradictory instructions and unnecessary text that distracts from the objective.

Zero-shot prompts rely on instructions alone, while few-shot prompts include examples that demonstrate the desired pattern. System instructions, delimiters, schemas, and negative constraints can make the expected behavior clearer. Keep prompts concise enough that important rules are not buried inside repetitive prose, and test them with inputs that try to exploit ambiguity. Prompt templates can make successful structures reusable across teams, environments, and releases with clearer operational governance and ownership. Version prompts like application code so changes can be tested and rolled back.

Prompting cannot reliably provide knowledge the model does not have

Better instructions can improve reasoning and formatting, but they do not make a model current on private company data or events outside its knowledge. Inserting a small amount of reference material directly into the prompt can work for bounded tasks, but large or frequently changing knowledge sources need a more systematic approach.

Do not keep expanding prompts indefinitely. Prompt optimization should be evidence-driven: change one major behavior at a time, run the evaluation suite, and record the effect. Without prompt versioning and tests, teams can fix one example while silently degrading another part of the workload. Large context increases cost and may reduce quality when irrelevant documents compete for attention. If the application repeatedly needs external facts, retrieval is usually a cleaner architecture.

Use RAG when answers depend on current or proprietary knowledge

Retrieval-augmented generation searches an external knowledge source at request time and provides relevant content to the model. Retrieval design should reflect the information architecture of the source: document titles, dates, access groups, product names, jurisdictions, and version metadata can all help the search layer select the right evidence instead of relying only on semantic similarity. Amazon Bedrock Knowledge Bases is one AWS option for managed RAG. The technique can improve relevance and make it possible to cite source material without retraining the foundation model every time documents change.

RAG quality depends on ingestion, chunking, embeddings, metadata, search, reranking, access control, and the final prompt. Freshness also matters. Define how quickly source updates become searchable, how deleted documents are removed, and how index failures are detected. A system cannot claim to use current policy if the knowledge base is days behind the source. A poor retriever can give the model the wrong evidence. Evaluate retrieval and generation separately so a bad answer can be traced to missing knowledge, incorrect retrieval, or model behavior.

RAG is not automatically the answer to hallucination

Grounding the model in retrieved evidence can reduce unsupported answers, but the system still needs instructions about how to use that evidence and what to do when the evidence is insufficient. The application should distinguish “no relevant source found” from “the model generated a plausible response anyway.” Define fallback behavior for missing or conflicting evidence, such as asking a clarifying question, returning a source-limited answer, or escalating to a human rather than encouraging the model to fill gaps.

Use citations, source previews, confidence cues, or human review where the business consequence justifies them. Evaluate answer faithfulness separately from retrieval relevance: the system can retrieve the correct passage and still generate an unsupported claim, or retrieve the wrong passage and accurately summarize the wrong evidence. Sensitive knowledge bases also need identity-aware retrieval so users cannot obtain documents they were never authorized to read simply by asking the model.

Use fine-tuning when behavior needs consistent adaptation

Fine-tuning changes a model using curated examples so it better follows domain-specific patterns, style, labels, or task behavior. Define the behavior that should improve before starting the training job, and compare the customized model with the base model on the same held-out evaluation set. A training job is not evidence of improvement by itself. It can be useful when many prompts would otherwise repeat the same examples or when consistent specialized output is required.

Fine-tuning is not the preferred method for frequently changing factual knowledge. It can also make behavior harder to inspect because the adaptation is embedded in model weights rather than visible prompt text. Keep the base model, training data, hyperparameters, and evaluation results versioned so customized models can be compared and rolled back. Retraining whenever a policy document changes is slower and harder to govern than retrieving the current document at runtime. Use training to shape behavior; use RAG to supply changeable knowledge unless testing shows another approach is better.

Training data quality determines fine-tuning quality

Fine-tuning data should be representative, correctly labeled, legally usable, privacy-reviewed, and aligned with the desired behavior. Duplicates, contradictions, biased examples, or low-quality synthetic data can teach the model the wrong pattern. Separate training and evaluation sets so improvements are measured on unseen cases.

More data is not automatically better. Remove sensitive or copyrighted material that the organization is not entitled to use, check representation across important user groups, and review whether examples encode undesirable shortcuts. Training-data governance is part of model governance, not merely a data-science concern. A smaller curated dataset can outperform a large noisy one. Track dataset versions and lineage so the organization can explain what changed when a customized model’s behavior changes.

Compare approaches by cost and operational complexity

Prompting is usually cheapest to start, RAG adds retrieval and data-pipeline infrastructure, and fine-tuning adds training datasets, jobs, model versions, evaluation, and deployment considerations. The total cost includes engineering, monitoring, data governance, and incident response as well as AWS service charges. RAG requires document ingestion and index maintenance; fine-tuning requires dataset curation and model lifecycle management; complex prompt systems require prompt testing and version control. Select the architecture the team can actually operate.

Choose the method that reduces the observed error at acceptable cost. Sometimes the correct fix is not an AI adaptation at all: better application logic, clearer user input, deterministic validation, a database query, or a smaller classification model may solve the problem more reliably than adding a RAG pipeline or fine-tuning job. A business FAQ may need prompt cleanup and RAG, while a highly structured classification task may benefit from a smaller specialized model. Complexity should earn its place through measured quality or operational benefit.

Evaluate after every material change

Amazon Bedrock evaluations can compare model and knowledge-base behavior using automated metrics, LLM-as-a-judge methods, or human reviewers. Keep a stable evaluation set that represents real tasks, difficult cases, policy boundaries, and failure scenarios.

Measure business outcomes too: task completion, user satisfaction, time saved, escalation rate, cost per interaction, and the percentage of answers that require correction. Include failure categories in the evaluation report so teams know whether the dominant problem is missing knowledge, poor retrieval, bad instruction following, unsafe output, latency, or model capability. A technical metric can improve while the application becomes less useful to users, so evaluation needs both model and product views.

Combine prompting, RAG, and fine-tuning deliberately

A mature application may use all three: a versioned prompt defines behavior, RAG supplies current evidence, and fine-tuning improves a recurring domain pattern. Keep the boundaries visible so operators can diagnose which layer caused a bad answer. If every layer changes at once, evaluation may show improvement or regression without revealing why. The deeper engineering concerns belong naturally with AWS Generative AI Developer Professional AIP-C01, while AI Practitioner needs the architectural decision logic rather than implementation detail.

Security and privacy remain cross-cutting requirements. The practices in AI data privacy apply to prompt histories, retrieved documents, fine-tuning datasets, evaluation records, and output. Improve generative AI by fixing the actual source of poor performance, then prove the improvement with repeatable evaluation. Keep before-and-after examples and cost measurements so the team can show that the added complexity materially improves the product instead of merely changing its architecture.

Version the evaluation set alongside the application. When a team changes a system prompt, retrieval chunking strategy, embedding model, reranker, or fine-tuned checkpoint, it should be possible to compare the new behavior against the same business cases and safety tests. That discipline prevents “improvement” from becoming subjective and helps identify whether a regression came from model behavior, retrieved context, prompt construction, or the application code around the model.