Exams / AIF-C01 / D4 Applications of Foundation Models
Applications of Foundation Models (part 3 of 6)
- Exam domain: Applications of Foundation Models
Customizing a foundation model
"Model customization is the process of providing training data to a model to improve its performance for specific use-cases." Pick the method from the data you have.
| Situation | Method |
|---|---|
| Labeled prompt/completion pairs, specific task | Supervised fine-tuning ("Provide labeled data to train a model to improve performance on specific tasks.") |
| Only unlabeled domain text | Continued pre-training |
| Too little labeled data | Data augmentation (synthetic data) |
| Human ratings or preferences | RLHF ("RLHF incorporates human feedback in the rewards function") |
| Knowledge that changes often | RAG, no retraining |
Fine-tuning data is a set of records with a prompt field and a completion field. During training, more epochs (passes over the data) raise accuracy until it plateaus; temperature is only an inference setting.
RAG with Amazon Bedrock
Knowledge Bases implement "the entire RAG workflow, from ingestion to retrieval and prompt augmentation". Documents are chunked, "converted to embeddings", and stored in a vector store; at question time similar chunks augment the prompt. Vector search services: Amazon OpenSearch Service (k-NN by Euclidean distance or cosine similarity).
Inference options and tools
| Need | Answer |
|---|---|
| Many prompts, not urgent | Bedrock batch inference ("generate responses asynchronously", output in S3) |
| Model chosen per request behind one endpoint | Intelligent prompt routing |
| Pretrained models, solution templates, notebooks | SageMaker JumpStart |
| Automated hyperparameter tuning | SageMaker automatic model tuning |
| Human labeling | SageMaker Ground Truth |
| Bias detection | SageMaker Clarify |
| Safeguards for GenAI | Bedrock Guardrails |
| Human evaluation of outputs | Bedrock model evaluation with a work team |
| Video generation | Amazon Nova Reel |
| Multimodal (text, image, video) fine-tunable | Amazon Nova Pro |
| Coding assistant | Amazon Q Developer |
| BI executive summaries | Amazon Q in QuickSight |
Evaluation metrics
| Metric | Use |
|---|---|
| ROUGE | Word overlap of a summary with a ground-truth summary |
| BERTScore | Semantic similarity using an ML model |
| Inference latency | Time to respond |
AI services mapping
| Task | Service |
|---|---|
| Speech to text, subtitles (WebVTT, SRT) | Transcribe |
| Text translation | Translate |
| Text to speech | Polly |
| Sentiment | Comprehend (or an LLM on Bedrock) |
| Personalized recommendations | Personalize |
| Synthetic data | GAN (generator + discriminator) |
Exam traps
- Fine-tuning needs labeled prompt/completion data; Provisioned Throughput is for serving, not training.
- Unlabeled data points to continued pre-training; scarce labeled data points to augmentation.
- Subtitles: Transcribe (+ Translate); voice-over: Polly. Translate and Textract never produce speech.
- Changing FAQ or documents: RAG, not repeated fine-tuning.
- Video: Nova Reel; images: Nova Canvas or Titan Image Generator; Nova Pro does not generate video.
- "Fully automated tuning" is SageMaker, not Personalize or Comprehend.
- A higher CFG scale makes Stable Diffusion follow the prompt more closely (not found in the AWS docs quoted here).
Docs
- https://docs.aws.amazon.com/bedrock/latest/userguide/custom-models.html
- https://docs.aws.amazon.com/bedrock/latest/userguide/kb-how-it-works.html
- https://docs.aws.amazon.com/bedrock/latest/userguide/batch-inference.html
- https://docs.aws.amazon.com/bedrock/latest/userguide/prompt-routing.html
- https://docs.aws.amazon.com/prescriptive-guidance/latest/strategy-data-considerations-gen-ai/lifecycle.html
- https://docs.aws.amazon.com/sagemaker/latest/dg/clarify-accuracy-evaluation.html
- https://docs.aws.amazon.com/transcribe/latest/dg/subtitles.html
- https://docs.aws.amazon.com/opensearch-service/latest/developerguide/knn.html