Master model fine-tuning, prompt engineering, and AI agent architecture through comprehensive exam-level labs.
GenAI Expert Labs - Module 7
Fine-tuning, prompt engineering, and agent systems.
Lab 19: Model Fine-tuning Configuration
Fine-tuning / Expert
Scenario: Custom Domain Fine-tuning
MedTech AI needs to fine-tune GPT-4o-mini for medical diagnosis support using 10,000 labeled clinical cases. Configure all hyperparameters including learning rate, batch size, epochs, regularization, data processing, and validation settings to achieve >92% accuracy while staying within a $2,000 budget.
Regularization: Set dropout, weight decay, gradient clipping
Data Processing: Configure preprocessing, augmentation, validation split
Cost Optimization: Calculate training costs and optimize for budget
Fine-tuning Configuration
Configure all parameters
Training Requirements
• Training samples: 10,000 cases
• Target accuracy: ≥92%
• Max training time: 8 hours
• Budget: $2,000
• Validation required: 20% holdout
• Early stopping: enabled
Section 1: Base Model & Data Configuration
Section 2: Learning Rate & Optimization
Section 3: Batch Size & Training Parameters
Section 4: Data Preprocessing
Section 5: Cost & Performance Estimates
Calculate estimated costs and training time:
Formula: (10,000 / batch_size) × epochs
LoRA: ~2-4hrs, Full: ~6-8hrs
GPU cost + API cost if applicable
Target: ≥92%
Progress:0/24 parameters configured
Score: 0/100
0%
Lab Completed!
Excellent fine-tuning configuration!
Lab 20: Prompt Engineering Framework
Prompting / Expert
Scenario: Enterprise Prompt Template Design
GlobalCorp needs a standardized prompt engineering framework for their customer service AI. Design a comprehensive system prompt with role definition, output formatting, guardrails, few-shot examples, and chain-of-thought instructions. The system must handle 15+ query types with consistent formatting.
Learning Objectives:
System Prompts: Design role, context, and behavioral guidelines
Few-shot Learning: Design effective example patterns
Safety: Implement guardrails and content filtering
Prompt Framework Builder
Build your prompt framework
Prompt Requirements
• Response time: <2 seconds
• Languages: English, Spanish, French
• Tone: Professional, empathetic
• Max response length: 500 tokens
• Must refuse off-topic queries
• Include citation for policies
Section 1: Role & Identity Configuration
Section 2: Output Format & Structure
Section 3: Reasoning & Few-shot Examples
Section 4: Guardrails & Safety
Progress:0/22 settings configured
Score: 0/100
0%
Lab Completed!
Excellent prompt engineering!
Lab 21: AI Agent Architecture Design
Agents / Expert
Scenario: Autonomous Research Agent
ResearchLabs Inc. needs an autonomous AI agent that can conduct market research, gather data from multiple sources, analyze findings, and produce reports. Design the complete agent architecture including planning, memory, tools, and orchestration layers.
Learning Objectives:
Agent Core: Configure reasoning model and planning strategy
Tool Integration: Select and configure agent tools
Orchestration: Set up execution, error handling, and loops
Agent Architecture Builder
Design your agent
Agent Requirements
• Max execution time: 5 minutes
• Max iterations: 10 steps
• Must use web search tool
• Must produce structured report
• Budget: $1 per task max
• Human approval for actions >$0.10
Section 1: Agent Core Configuration
Section 2: Memory Architecture
Section 3: Tool Configuration
Section 4: Safety & Control
Progress:0/24 settings configured
Score: 0/100
0%
Lab Completed!
Excellent agent architecture!
Lab 19: Fine-tuning Configuration Instructions
Objective
Configure all 24 hyperparameters for fine-tuning GPT-4o-mini on medical diagnosis data. Meet the target accuracy (≥92%) within budget ($2,000) and time (8 hours).
Configuration Sections
Core Training: Base model, training type, learning rate, batch size, epochs, warmup steps.
Regularization: Validation split, sequence length, dropout, early stopping.
Data Preprocessing: Tokenization, augmentation, class balancing, shuffling.
Cost Estimates: Total steps, training time, cost, expected accuracy.
Pro Tips
LoRA is cost-effective for domain adaptation. Use learning rate 1e-4 to 5e-5 for fine-tuning. 3-5 epochs usually sufficient. Enable early stopping with patience 3.
Optimal Values
Learning rate: 2e-5 (stable) or 5e-5 (faster)
Batch size: 8-16 for most GPU memory
Epochs: 3-5 with early stopping
Validation split: 20% (as required)
Budget Constraint
Full fine-tuning is expensive (~$1,500-2,000). LoRA reduces cost to ~$200-500. Calculate total steps: (10,000 / batch_size) × epochs.
Lab 20: Prompt Engineering Instructions
Objective
Build a comprehensive prompt engineering framework for customer service AI. Configure all 22 settings across role, output, reasoning, and safety sections.
Framework Sections
Role & Identity: Agent role, persona, tone, knowledge handling.
Output Format: Response format, max length, structure, citations, confidence, language.
Reasoning: Strategy (CoT), few-shot examples, example selection, self-reflection.
Professional tone is best for enterprise. Use CoT with hidden reasoning for complex queries. Always enable jailbreak defense and PII protection.
Recommended Settings
Role: Customer Support Specialist
Tone: Professional or Empathetic
Max length: 500 tokens (as required)
Off-topic: Politely refuse
PII: Never store/repeat
Lab 21: AI Agent Architecture Instructions
Objective
Design a complete autonomous research agent architecture. Configure all 24 settings across core, memory, tools, and safety sections to meet the requirements.
ReAct is best for research tasks. Use Tavily for AI-optimized search. Vector DB for long-term memory. Human-in-the-loop for risky actions to meet approval requirement.
Required Values
Web search: Must enable (Tavily recommended)
Max iterations: 10 (as required)
Timeout: 300 seconds (5 min max)
Cost limit: $1.00 (as required)
HITL: For risky actions (>$0.10)
Constraints
Must produce structured report (select markdown/PDF/HTML). Enable error handling for robustness. Logging at info level for debugging.