AIF-C01 notes
Developing generative AI solutions

Improving the Performance of an FM

Four ways, and one last resort

The story: Your new driver isn't performing well enough. You can give better instructions, hand them a map book, send them on a route-training course, or give them an assistant who plans multi-stop trips. Raising a driver from childhood is the very last resort.

In AI/AWS terms: Four ways to improve a selected FM: prompt engineering, RAG, fine-tuning, and agents. Building a model from scratch is the last resort.

For the exam: Try prompt engineering, RAG, fine-tuning, or agents before considering building from scratch.

Prompt engineering

The story: The quickest fix is how you give directions. "Deliver this" is vague. "Deliver this to the blue house at number 12, ring twice, and leave it with the neighbor if nobody answers, like you did last week" works much better. You try different ways of phrasing it, combine the best ones, and keep a list of what works.

In AI/AWS terms: Prompt engineering is the fastest way to steer an LLM: you craft the instructions, context, and examples in the prompt.

  • Aspects: design, augmentation (examples, constraints), tuning (iterating on prompts), ensembling (combining prompts), and mining (finding effective prompts).
  • Techniques: zero-shot, few-shot, chain-of-thought (CoT), self-consistency, tree of thoughts (ToT), RAG, Automatic Reasoning and Tool-use (ART), and ReAct.

For the exam: Prompt engineering is the fastest and cheapest way to improve output. It doesn't change the model.

Retrieval-augmented generation (RAG)

The story: Instead of expecting the driver to memorize every address, you give them the company's map book. For each delivery, they look up the right page and then drive. They answer from what's in the book, not from guesswork.

In AI/AWS terms: RAG combines a retrieval system, which finds relevant passages in a knowledge source (looking up the page), with a generative model, which writes an answer using them (driving).

Business applications:

  • Question-answering systems grounded in company knowledge, such as support bots and virtual assistants
  • Expanding and enriching knowledge bases
  • Generating content such as articles, reports, and summaries

Knowledge Bases for Amazon Bedrock gather your data sources into a repository that RAG applications draw on (the map book), for customer service, legal research, or healthcare Q&A.

For the exam: Answers grounded in company documents → RAG, with Knowledge Bases for Amazon Bedrock.

Fine-tuning

The story: A driver who'll deliver medicine goes on a course about handling medical supplies. The course changes how they drive and what they know, permanently. There are two kinds of course: one with written examples of how to respond to each type of instruction, and one where an instructor rides along and says "better" or "worse" after each choice.

In AI/AWS terms: Fine-tuning further trains a pre-trained model on task- or domain-specific labeled data. It changes the model's weights.

  • Instruction fine-tuning: examples of how to respond to instructions. Prompt tuning is one type.
  • RLHF: human feedback aligns the model with human preferences.

Use it when the model needs domain terminology and knowledge, for example fine-tuning on medical journals.

For the exam: Fine-tuning changes the model's weights using labeled, domain-specific data.

Building from scratch

The story: Raising a driver from childhood: you decide everything they learn, but it takes years, a fortune, and expert teachers. You'd only do it for a job no existing driver could ever do.

In AI/AWS terms: Building from scratch means defining the architecture, curating a huge dataset, and training from random weights. Full customization at a very high cost in compute, time, and expertise. It suits research or cases where no pre-trained model fits.

For the exam: Building from scratch is the most expensive option. Choose it only when no pre-trained model fits.

Cost versus accuracy

The story: Better instructions cost nothing. A map book costs a little. A training course costs more. Raising a driver from childhood costs the most. Each step can make the driver better, but also takes more money, material, and experts.

In AI/AWS terms: From cheapest to most expensive: prompt engineering → RAG → fine-tuning → pre-training from scratch. More customization can mean higher accuracy but also more cost, data, and expertise.

For the exam: Cost order: prompt engineering < RAG < fine-tuning < pre-training from scratch.

Agents

The story: For a day with twenty stops, the driver gets a dispatcher. The dispatcher plans the order ("pick up the cake before delivering it"), logs each stop, handles many drivers at once, and talks to the warehouse and the payment system.

In AI/AWS terms: Agents are software that carry out multi-step tasks autonomously. In Amazon Bedrock, they:

  • Coordinate tasks: run subtasks in the right order and manage dependencies. This is their core role.
  • Report and log progress and diagnostics
  • Handle scalability and concurrency
  • Integrate with other systems through APIs and message queues

For the exam: An agent's core role is coordinating multi-step tasks in the right order.

On this page