Generative AI uses machine-learning models to create new content, such as text, code, images, audio, and video.
π Overview
Many generative AI applications use foundation models (FMs): large machine-learning models pretrained on broad datasets. FMs are a starting point for applications; teams can use them directly, ground responses in external data, or customize supported models for a task.
π§± AWS Generative AI Stack
The stack has three layers:
- user-facing applications
- services for building generative AI applications
- infrastructure used to build and run models

The top layer contains tools people use directly.
Amazon Quicksupports research, knowledge work, automation, analytics, and app building.Kirosupports AI-assisted software development, including spec-driven workflows.Amazon QDeveloper provides assistance for building and operating AWS applications;
AWS has announced that support for its IDE plugins ends on April 30, 2027, so check the current notice before choosing it for a new workflow.
| Product | Typical use |
|---|---|
| Amazon Q Developer | AWS development help, code chat and completion, security scanning, and code upgrades |
| Amazon Quick | Business research, connected-data questions, automation, and analytics |
| Kiro | Software development with specs, agents, and code workflows |
Amazon Bedrock provides API access to foundation models and managed capabilities for building generative AI applications, including model evaluation, knowledge bases, and model customization.
Bedrock supports 100+ foundation models from providers including Amazon, Anthropic, DeepSeek, Moonshot AI, MiniMax, OpenAI, and xAI. You can swap models through one API, with the same IAM, KMS, VPC endpoints, CloudWatch, and CloudTrail integration across all of them.
Normally, using Claude, Llama, and Mistral means three vendors, three SDKs, three API keys, and three billing setups. In Bedrock you call the same API (e.g., Converse or InvokeModel) and change only the model ID:
import boto3
client = boto3.client("bedrock-runtime")
response = client.converse(
modelId="anthropic.claude-sonnet-...", # change this line to switch models
messages=[{"role": "user", "content": [{"text": "Summarize this ticket..."}]}]
)
Amazon SageMaker provides managed infrastructure and tools for building, training, and deploying machine-learning models. AWS-designed Trainium and Inferentia accelerators and GPUs provide compute options for training and inference workloads.
π§© Customize a Foundation Model
Two common approaches solve different problems. RAG retrieves external information at request time; fine-tuning updates a supported model using examples. They can also be combined.
Retrieval-Augmented Generation (RAG) searches a data source at query time and adds relevant results to the model’s prompt. The model’s weights do not change. With Amazon Bedrock, Knowledge Bases can manage parts of the ingestion, retrieval, and response-grounding workflow.
RAG is useful when answers must draw on private or changing information. It can provide citations and support permission-aware retrieval when the data pipeline is configured for it; retrieval does not guarantee a correct answer, so evaluate sources, access controls, and generated responses.
Fine-tuning trains a supported model with curated examples to improve behavior on a task, such as following a tone or output format. It changes model parameters, but it is not a dependable way to keep frequently changing facts current.
Amazon Bedrock supports model-specific customization methods, including supervised fine-tuning for supported models. Training format, availability, evaluation, deployment options, and cost depend on the selected model and Region; check its current documentation.
| Question | RAG | Fine-tuning |
|---|---|---|
| Main goal | Give the model relevant external context for this request | Adapt supported model behavior using examples |
| Update knowledge | Update/re-index the data source; freshness depends on ingestion | New training or customization may be needed |
| Typical data | Documents or other searchable sources | Curated examples in the model’s required format |
| Main risks | Retrieval misses, stale data, weak grounding, or access-control mistakes | Overfitting, poor examples, or behavior regressions |
| Choose when | The answer needs current or private source material | The model needs a repeatable style, format, or task behavior |
RAG Example: An HR Assistant
Say your company has a 200-page employee handbook, and an employee asks:
A base model like Claude or Nova has never seen your handbook. Without help, it will guess or give generic answers.
With RAG:
- Retrieve: the system searches the handbook and finds the 3 to 5 most relevant passages, for example the “Parental Leave: EMEA” section.
- Augment: it builds a prompt like this:
Example prompt and retrieved context
Answer using the supplied context. If it does not contain the answer, say so.
Context:
[Passage 1] Parental leave (Germany): employees are entitled to ...
[Passage 2] Leave must be requested ...
Question: How many weeks of parental leave do I get if I am based in Germany?
- Generate: the model reads that prompt and writes a grounded answer, ideally citing the passage.
The model learned nothing permanent. The handbook text was handed to it for that one request, like giving a smart new hire the right page before asking them a question.
Fine-Tuning Example: Support Replies
Say your company wants an assistant that drafts customer-support replies. Every reply must:
- use your brand voice (warm, concise, no jargon),
- follow a fixed structure (greeting, resolution, next step, sign-off),
- return a JSON object that your ticketing system can parse.
You can try to get this from a general model with a long prompt full of rules and examples. That often works, but the prompt is long (costly on every call), and the model still drifts: sometimes it adds chatty preambles, breaks the JSON, or slips into a generic tone. Fine-tuning teaches the model the pattern so it follows it by default, even with a very short prompt.
A model-specific fine-tuning workflow
Collect examples of ideal behavior.** You need many input/output pairs showing exactly what a great response looks like. Typically hundreds to a few thousand curated examples, reviewed for quality. Quality matters more than quantity.
Format examples using the selected model’s required training schema. Some customization methods use JSONL, but the fields are model-specific.
[ { "prompt": "Customer: My invoice shows two charges for March. Can you fix it?", "completion": { "greeting": "Hi Sam, thanks for flagging this.", "resolution": "We found the duplicate charge and refunded $49.", "next_step": "The refund appears in 3-5 business days.", "signoff": "Happy to help anytime, The Billing Team" } }, { "prompt": "Customer: How do I reset my password?", "completion": { "greeting": "Hi there, happy to help.", "resolution": "Use the 'Forgot password' link on the sign-in page.", "next_step": "You'll get a reset email within a minute.", "signoff": "Cheers, The Support Team" } } ]Keep evaluation examples separate from training data. Compare the customized model against the base model with a well-designed prompt.
Run a supported Bedrock model customization job. Training controls and supported methods vary by model.
Evaluate task quality, such as format validity, tone, and factual correctness, using held-out and real-world test cases.
Deploy using the option available for that model. Review current throughput requirements and pricing before estimating cost.
Fine-tuning can encourage a format or tone, but it does not guarantee valid JSON or correct answers. Validate outputs in the application.
What are “weights”?
A neural network is a huge set of numbers (billions of them) that determine how it turns input into output. These numbers are the weights, also called parameters.
- During training, the weights are adjusted over and over until the model gets good at predicting text. That’s where its general knowledge and skills are stored.
- During inference (when you chat with it), the weights are frozen. They are only read, never changed.
So “the model’s weights don’t change” means that after your question, the model is exactly the same as before. It hasn’t absorbed your handbook. It only used the text in its prompt (its context window) for that response.
Fine-tuning is the opposite: it runs more training on your data, which does change the weights, so the information or behavior gets baked into the model itself.
An analogy: weights are what the model has studied, and the prompt is the open-book notes on the desk during the exam. RAG hands it the right notes. Fine-tuning makes it study more.
Where do vectors come in?
The hard part of RAG is step 1: how do you find the right passages among thousands? Keyword search fails when wording differs. The handbook might say “maternity and paternity entitlement” while the user wrote “parental leave.” Vectors solve this by searching on meaning.
Embeddings
An embedding model converts a piece of text into a list of numbers (a vector), typically hundreds or thousands of dimensions long. Texts with similar meaning get vectors that point in similar directions.

The full pipeline
Indexing (done ahead of time):
- Split documents into chunks (say 300 to 500 words each).
- Run each chunk through an embedding model to get its vector (on AWS: Titan or Nova embeddings, Cohere Embed).
- Store the chunks and vectors in a vector database (OpenSearch Serverless, Aurora pgvector, and so on).
Query time (on every question):
- Embed the user’s question with the same embedding model.
- Ask the vector database for the chunks whose vectors are closest to the question’s vector (using a measure like cosine similarity). This is the “nearest neighbor” search.
- Optionally rerank the top results with a model like Cohere Rerank for better precision.
- Put the winning chunks in the prompt and send it to the LLM.
Why “hybrid” search?
Pure vector search can miss exact terms like product codes, error IDs, or names (for example, “policy HR-4471”). Keyword search (BM25) catches those. Hybrid search combines both scores, which usually beats either alone.
Summary
| Piece | Role |
|---|---|
| Weights | The model’s frozen, trained knowledge. RAG leaves them untouched |
| Embeddings / vectors | Numeric fingerprints of meaning, used to find relevant text |
| Vector database | Fast “find the nearest meanings” lookup |
| Prompt | Where retrieved text is handed to the model so it can answer from it |
The LLM does the writing, and vectors do the finding. In Amazon Bedrock Knowledge Bases, all of this (chunking, embedding, storing, retrieving) is handled as a managed service.
π₯οΈ Compute for AI Workloads
The infrastructure layer supplies compute for machine-learning development and workloads. SageMaker AI offers managed tools and infrastructure; Trainium, Inferentia, and GPUs are hardware choices for supported training and inference workloads. Compare availability, performance, and cost for the specific model and workload.