AWS GenAI/ML Architect (HCLS)
Overview
This skill teaches the agent how to reason about AWS GenAI and ML architecture
decisions for healthcare and life sciences (HCLS) workloads. It does not
prescribe CLI commands or IaC templates — it encodes the decision frameworks
an experienced HCLS cloud architect uses to pick services, enforce compliance,
and avoid common pitfalls. Pair this skill with a pipeline skill when concrete IaC or deployment artifacts are needed.
HCLS workloads are distinguished from generic ML workloads by three constraints
that dominate every decision: PHI handling under HIPAA, high cost of
hallucination in clinical outputs, and distribution shift driven by coding
changes, site onboarding, and seasonal care patterns. Keep these in mind at
every step.
Usage
Invoke this skill when the user asks architecture-level questions such as:
- "Should I use Bedrock or SageMaker for summarizing clinical notes?"
- "How do I build RAG over medical literature on AWS?"
- "What's the right inference pattern for whole-slide images?"
- "How do I train a model on PHI safely?"
- "What should my MLOps stack look like for a clinical risk model?"
Work through the decisions in this order:
- Clarify the clinical / scientific use case and PHI exposure.
- Apply the service selection framework.
- Overlay HCLS architecture patterns for the specific modality.
- Enforce security and compliance decision points.
- Add MLOps, monitoring, and cost considerations.
- Surface common mistakes before finalizing.
State assumptions explicitly when the user has not specified payload size,
latency SLO, PHI status, or regulatory posture.
Response Format
- Lead with the direct recommendation or classification (≤3 sentences)
- Structure as: recommendation → justification (citing specific criteria/thresholds) → caveats
- Use tables for comparisons; bullet points for criteria lists
- Omit background the user already knows — they asked the question
- Target: 200-400 words unless the user requests exhaustive detail
The decision trees and frameworks in this skill are for internal reasoning only. Apply them to reach your conclusion, but do not reproduce them in your response. Present only the final recommendation with supporting evidence.
Core Concepts
- PHI vs. de-identified data: PHI requires HIPAA-eligible services, a
signed BAA, and stricter isolation. De-identified or synthetic data relaxes
some controls but downstream re-identification risk should still be assessed.
- Foundation model (FM) vs. custom model: FMs are general, fast to ship,
and priced per token/call. Custom models are domain-specific, require
training data and ops, and are priced per compute hour.
- Sync vs. async vs. batch inference: Latency SLO, payload size, and
traffic shape determine the right endpoint type, not model size alone.
- Grounding vs. generation: Clinical outputs must be grounded in
retrievable sources (RAG, structured lookups) whenever a wrong answer can
harm patients or invite regulatory risk.
- Distribution shift is the default, not the exception: Healthcare data
shifts with every ICD coding update, new site, season, and care pathway
change. Design for it from day one.
Service Selection Framework
Use this as the first-cut decision:
Bedrock when:
- Using a foundation model as-is (summarization, extraction, Q&A over text)
- Building RAG with Knowledge Bases or Agents
- You want managed guardrails for PII/PHI redaction and toxicity
- You do not want to manage training, endpoints, or GPU capacity
SageMaker when:
- Custom training or fine-tuning on proprietary clinical or -omics data
- Specialized models (medical imaging CNNs, custom NER, survival models)
- You need full control over container, network, and instance type
- Building MLOps pipelines with model registry and approval workflows
Both when:
- FM handles unstructured text while a custom model scores structured risk
- An ensemble combines an FM summary with a specialized classifier
- RAG retrieval uses a custom embedding model trained on clinical text
Rule of thumb: start with Bedrock for any text-centric use case. Move to
SageMaker only when FM accuracy, cost, latency, or data residency forces it.
HCLS Architecture Patterns
Match the modality to the pattern:
Clinical note summarization / abstraction: Bedrock with a small,
instruction-tuned FM, prompt templates reviewed by clinicians, and
Bedrock Guardrails configured for PHI redaction and denied topics.
Always require source-span citations back into the note.
Medical literature / guideline RAG: Bedrock Knowledge Bases backed by
OpenSearch Serverless. Chunk by semantic section (abstract, methods,
results, guideline recommendation) rather than fixed token windows —
clinicians reason at section granularity, and fixed chunks split tables
and dosing guidance. Store source metadata (PMID, guideline version,
publication date) for traceability.
Pathology and radiology inference: SageMaker async endpoints for
whole-slide images and DICOM volumes. Payloads exceed real-time endpoint
limits and inference times exceed sync SLOs. Pre-process (tiling,
resampling) in SageMaker Processing jobs before invoking the endpoint.
Genomics pipelines: SageMaker Processing jobs orchestrated by Step
Functions for custom workflows; HealthOmics when the workflow fits its
managed WDL/Nextflow execution model. Use HealthOmics variant and
annotation stores for queryable genomic data.
Drug discovery and molecular modeling: SageMaker HyperPod for
distributed training of large structural or property-prediction models.
Bedrock for molecular description, literature mining, and chemistry Q&A;
never for final property prediction where accuracy is load-bearing.
Ambient clinical documentation: Bedrock for transcription
post-processing and structured note generation; guardrails plus
human-in-the-loop sign-off in the EHR.
Data Architecture
Pick the store by data shape and access pattern:
- FHIR clinical data → HealthLake. Supports FHIR-native queries and
integrated NLP. Export to S3 for ML training.
- Observational / claims research → OMOP CDM on Redshift or Athena.
Standard vocabulary enables reuse of published phenotype definitions.
- Genomics → S3 as the source of truth for VCF, BAM, CRAM, FASTQ;
Lake Formation for governance; Athena for ad-hoc queries; HealthOmics
stores for indexed access.
- Medical imaging → S3 for raw DICOM; HealthImaging for indexed,
sub-image access and integration with inference pipelines.
- Unstructured documents (PDFs, scanned notes) → S3 + Textract for
extraction, then route structured output to the appropriate store above.
Cross-cutting: Lake Formation for fine-grained access control across
analyst personas; Glue Data Catalog as the single metadata plane.
Security & Compliance
Treat compliance as a set of hard gates, not a checklist at the end.
- HIPAA BAA: Only use services on the AWS HIPAA-eligible list for any
workflow touching PHI. Verify eligibility for every service in the
architecture, including logging and monitoring sinks.
- Network isolation: PHI workloads run in private subnets with no
internet egress. Use VPC endpoints for S3, SageMaker, Bedrock, KMS, and
CloudWatch. Enable SageMaker network isolation on training jobs and
endpoints handling PHI.
- Encryption: Customer-managed KMS keys for S3, EBS, SageMaker
volumes, and Bedrock Knowledge Base vector stores. TLS 1.2 or higher in
transit. Scope key policies so only the intended roles can decrypt.
- Audit and detection: CloudTrail (including data events for PHI
buckets), AWS Config rules for drift, GuardDuty for threat detection.
Enable Bedrock model invocation logging to S3 or CloudWatch — without it
you cannot reconstruct what the FM was asked or returned.
- IAM: Least privilege, no wildcards on PHI buckets or KMS keys.
Separate roles for data scientists, training jobs, and inference
endpoints. Never share a role across environments.
- De-identification: If the use case permits, de-identify before
training. Document the method (Safe Harbor, Expert Determination) and
retain the determination evidence.
Compliance decision points to surface explicitly:
- Is any input, output, prompt, or log PHI? If yes, every service in the
path must be HIPAA-eligible and under BAA.
- Will the FM provider see PHI? Confirm the Bedrock model is in an
eligible region and that invocation logs are encrypted with your CMK.
- Does the workload cross accounts or regions? Re-verify BAA coverage and
data residency commitments.
MLOps for HCLS
Clinical models decay. Assume drift and design for it:
- Monitoring: SageMaker Model Monitor for data quality, model quality
(when labels arrive), and bias drift. Track feature distributions at the
site and payer level, not only in aggregate.
- Distribution shift sources to watch: ICD and CPT coding updates,
EHR template changes, new site onboarding, seasonal disease patterns,
formulary changes, care-pathway interventions.
- Model registry and approvals: Every clinical model goes through the
SageMaker Model Registry with explicit approval states. Gate promotion
on model card completion, bias evaluation, and clinical sign-off.
- Experimentation constraints: Randomized online A/B testing on
patients typically requires IRB approval. Default to shadow mode
evaluation or champion/challenger with human-in-the-loop review.
Document the evaluation design before enabling traffic shifts.
- Reproducibility: Pin container images, training data snapshots
(S3 versioning), and hyperparameters in the registry. A model that
cannot be rebuilt cannot be defended to regulators.
- Incident response: Define rollback criteria and a kill switch for
every deployed clinical model before go-live.
Cost Optimization
Optimize only after correctness and compliance are settled:
- Training: Spot instances for fault-tolerant training; checkpointing
is mandatory — without it spot interruptions waste compute. HyperPod for
long-running distributed jobs to amortize setup.
- Inference shape:
- Real-time endpoint: latency < ~60s and payload < ~6 MB with steady
traffic.
- Async endpoint: large payloads (WSI, DICOM volumes, long documents)
or long inference times.
- Serverless inference: bursty or intermittent traffic with cold-start
tolerance.
- Batch transform: offline scoring of large cohorts.
- Storage: S3 Intelligent-Tiering for research datasets with unknown
access patterns; lifecycle policies to Glacier for archival imaging and
genomics data retained for compliance.
- Bedrock: Prefer smaller models for extraction and classification;
reserve larger models for open-ended generation. Cache retrieval results
where clinically safe.
Decision Trees
Walk the user through these when the path is not obvious.
Processing clinical text
- Is the task extraction, summarization, or Q&A over text? → Bedrock.
- Is it a specialized task (custom NER schema, de-identification at
scale, domain-specific classifier)? → SageMaker with a fine-tuned
clinical model.
- Is PHI involved? → Apply the Security & Compliance gates regardless of
which service is chosen.
Training on PHI
- SageMaker training job in a VPC, private subnets only.
- Network isolation enabled on the job.
- KMS CMK on input S3, training volume, and output artifacts.
- BAA-covered region and services end to end.
- No internet egress; VPC endpoints for all AWS APIs used.
Choosing an inference pattern
- Latency SLO under a few seconds and payload small? → Real-time endpoint.
- Payload large (WSI, DICOM, long report) or inference slow? → Async
endpoint with S3 input and output.
- Traffic bursty or low-volume? → Serverless inference.
- Scoring a full cohort offline? → Batch transform.
RAG over clinical or scientific content
- Is the content stable and well-structured? → Bedrock Knowledge Bases
with OpenSearch Serverless.
- Chunk by section, not fixed tokens. Preserve tables and dosing blocks.
- Require citations in every answer; reject ungrounded responses.
- If the corpus includes PHI, ensure the vector store, embedding model,
and FM are all HIPAA-eligible and under BAA.
When NOT to Use This Skill
- Non-HCLS workloads — this skill's compliance guidance (HIPAA, BAA, FDA SaMD) does not apply to general-purpose applications
- Cost estimation or pricing — use the AWS Pricing Calculator; this skill covers architecture patterns, not billing
- Reviewing or auditing an existing deployed architecture — this skill designs new systems; use Well-Architected Reviews for existing ones
Common Mistakes
Wrong: Using Bedrock for a problem that needs a custom model
Right: Use SageMaker with a fine-tuned classifier when accuracy is load-bearing and the label space is narrow
Why: FMs underperform well-labeled domain classifiers on constrained tasks, producing unreliable clinical outputs
Wrong: Using SageMaker when Bedrock would ship in a week
Right: Start with Bedrock for generic summarization or extraction tasks; move to SageMaker only when forced by accuracy, cost, or data residency
Why: Building bespoke infrastructure for a commodity NLP task wastes months of engineering time
Wrong: Fixed-size chunking for medical literature in RAG pipelines
Right: Chunk by semantic section (abstract, methods, results, guideline recommendation) and preserve tables and dosing blocks intact
Why: Fixed chunks split dosing tables, contraindications, and guideline recommendations, destroying retrieval quality
Wrong: Using real-time endpoints for whole-slide images
Right: Use SageMaker async endpoints for WSI and DICOM volumes
Why: WSI payloads exceed real-time endpoint size limits and inference times exceed sync timeout SLOs
Wrong: Forgetting to enable Bedrock invocation logging
Right: Always enable Bedrock model invocation logging to S3 or CloudWatch with CMK encryption
Why: Without it you cannot reconstruct what the FM was asked or returned — a compliance and debugging failure
Wrong: Using public subnets or internet egress in PHI training jobs
Right: Run PHI workloads in private subnets with no internet egress; use VPC endpoints for all AWS APIs
Why: Violates HIPAA isolation expectations even if data itself is encrypted in transit
Wrong: Using wildcard IAM policies on PHI buckets
Right: Scope IAM policies to specific resources and actions; separate roles per environment and persona
Why: A single over-scoped role undermines every other security control in the architecture
Wrong: Training on spot instances without checkpointing
Right: Always enable checkpointing when using spot instances for training jobs
Why: Spot interruptions lose all progress since last checkpoint; often ends up more expensive than on-demand
Wrong: Running randomized online A/B tests on patients without IRB approval
Right: Default to shadow mode evaluation or champion/challenger with human-in-the-loop review
Why: Randomized experiments on patients constitute human subjects research — a regulatory violation without IRB
Wrong: Ignoring distribution shift until aggregate accuracy drops
Right: Monitor feature distributions at the site and payer level from day one using SageMaker Model Monitor
Why: By the time aggregate metrics move, site-level harm may already have occurred
Wrong: Assuming de-identification removes all data handling obligations
Right: Document the de-identification method (Safe Harbor or Expert Determination) and assess re-identification risk and contractual terms
Why: Re-identification risk and contractual obligations often persist after de-identification
Wrong: Mixing dev and prod in one AWS account with shared KMS keys
Right: Separate dev and prod into distinct accounts with independent KMS keys and IAM boundaries
Why: Blast radius of any mistake in the shared account covers production PHI
When to Escalate to a Human Expert
Recommend human review when:
- The use case directly drives a treatment decision without clinician
review in the loop.
- The workload requires FDA SaMD classification or 21 CFR Part 11 controls
you cannot confirm.
- Data residency, cross-border transfer, or multi-jurisdiction PHI rules
apply.
- A novel FM is being proposed for a safety-critical clinical output with
no published evaluation on the target population.
In these cases, draft the architecture, list the open regulatory and
clinical questions, and stop before implementation.
References
1---2name: aws-genai-ml-architect3description: Reasoning skill for designing AWS GenAI and ML architectures for healthcare and life sciences workloads. Use when the user asks to choose between SageMaker and Bedrock, design a RAG system over medical literature, architect clinical NLP or medical imaging inference, plan genomics or drug discovery pipelines on AWS, address HIPAA/PHI compliance in ML systems, design MLOps for regulated clinical models, or optimize cost for HCLS ML workloads. Triggers include "AWS architecture", "SageMaker vs Bedrock", "HIPAA ML", "clinical RAG", "medical imaging inference", "genomics on AWS", "PHI training", "MLOps healthcare", "Bedrock guardrails", "HealthLake", "HCLS cloud architecture", "BAA compliance", "SageMaker endpoint", "Bedrock knowledge base", "clinical NLP on AWS", "FDA SaMD on AWS".4---56# AWS GenAI/ML Architect (HCLS)78## Overview910This skill teaches the agent how to reason about AWS GenAI and ML architecture11decisions for healthcare and life sciences (HCLS) workloads. It does not12prescribe CLI commands or IaC templates — it encodes the decision frameworks13an experienced HCLS cloud architect uses to pick services, enforce compliance,14and avoid common pitfalls. Pair this skill with a pipeline skill when concrete IaC or deployment artifacts are needed.1516HCLS workloads are distinguished from generic ML workloads by three constraints17that dominate every decision: PHI handling under HIPAA, high cost of18hallucination in clinical outputs, and distribution shift driven by coding19changes, site onboarding, and seasonal care patterns. Keep these in mind at20every step.2122## Usage2324Invoke this skill when the user asks architecture-level questions such as:2526- "Should I use Bedrock or SageMaker for summarizing clinical notes?"27- "How do I build RAG over medical literature on AWS?"28- "What's the right inference pattern for whole-slide images?"29- "How do I train a model on PHI safely?"30- "What should my MLOps stack look like for a clinical risk model?"3132Work through the decisions in this order:33341. Clarify the clinical / scientific use case and PHI exposure.352. Apply the service selection framework.363. Overlay HCLS architecture patterns for the specific modality.374. Enforce security and compliance decision points.385. Add MLOps, monitoring, and cost considerations.396. Surface common mistakes before finalizing.4041State assumptions explicitly when the user has not specified payload size,42latency SLO, PHI status, or regulatory posture.4344## Response Format4546- Lead with the direct recommendation or classification (≤3 sentences)47- Structure as: recommendation → justification (citing specific criteria/thresholds) → caveats48- Use tables for comparisons; bullet points for criteria lists49- Omit background the user already knows — they asked the question50- Target: 200-400 words unless the user requests exhaustive detail51The decision trees and frameworks in this skill are for internal reasoning only. Apply them to reach your conclusion, but do not reproduce them in your response. Present only the final recommendation with supporting evidence.525354## Core Concepts5556- **PHI vs. de-identified data**: PHI requires HIPAA-eligible services, a57 signed BAA, and stricter isolation. De-identified or synthetic data relaxes58 some controls but downstream re-identification risk should still be assessed.59- **Foundation model (FM) vs. custom model**: FMs are general, fast to ship,60 and priced per token/call. Custom models are domain-specific, require61 training data and ops, and are priced per compute hour.62- **Sync vs. async vs. batch inference**: Latency SLO, payload size, and63 traffic shape determine the right endpoint type, not model size alone.64- **Grounding vs. generation**: Clinical outputs must be grounded in65 retrievable sources (RAG, structured lookups) whenever a wrong answer can66 harm patients or invite regulatory risk.67- **Distribution shift is the default, not the exception**: Healthcare data68 shifts with every ICD coding update, new site, season, and care pathway69 change. Design for it from day one.7071## Service Selection Framework7273Use this as the first-cut decision:7475- **Bedrock** when:76 - Using a foundation model as-is (summarization, extraction, Q&A over text)77 - Building RAG with Knowledge Bases or Agents78 - You want managed guardrails for PII/PHI redaction and toxicity79 - You do not want to manage training, endpoints, or GPU capacity8081- **SageMaker** when:82 - Custom training or fine-tuning on proprietary clinical or -omics data83 - Specialized models (medical imaging CNNs, custom NER, survival models)84 - You need full control over container, network, and instance type85 - Building MLOps pipelines with model registry and approval workflows8687- **Both** when:88 - FM handles unstructured text while a custom model scores structured risk89 - An ensemble combines an FM summary with a specialized classifier90 - RAG retrieval uses a custom embedding model trained on clinical text9192Rule of thumb: start with Bedrock for any text-centric use case. Move to93SageMaker only when FM accuracy, cost, latency, or data residency forces it.9495## HCLS Architecture Patterns9697Match the modality to the pattern:9899- **Clinical note summarization / abstraction**: Bedrock with a small,100 instruction-tuned FM, prompt templates reviewed by clinicians, and101 Bedrock Guardrails configured for PHI redaction and denied topics.102 Always require source-span citations back into the note.103104- **Medical literature / guideline RAG**: Bedrock Knowledge Bases backed by105 OpenSearch Serverless. Chunk by semantic section (abstract, methods,106 results, guideline recommendation) rather than fixed token windows —107 clinicians reason at section granularity, and fixed chunks split tables108 and dosing guidance. Store source metadata (PMID, guideline version,109 publication date) for traceability.110111- **Pathology and radiology inference**: SageMaker async endpoints for112 whole-slide images and DICOM volumes. Payloads exceed real-time endpoint113 limits and inference times exceed sync SLOs. Pre-process (tiling,114 resampling) in SageMaker Processing jobs before invoking the endpoint.115116- **Genomics pipelines**: SageMaker Processing jobs orchestrated by Step117 Functions for custom workflows; HealthOmics when the workflow fits its118 managed WDL/Nextflow execution model. Use HealthOmics variant and119 annotation stores for queryable genomic data.120121- **Drug discovery and molecular modeling**: SageMaker HyperPod for122 distributed training of large structural or property-prediction models.123 Bedrock for molecular description, literature mining, and chemistry Q&A;124 never for final property prediction where accuracy is load-bearing.125126- **Ambient clinical documentation**: Bedrock for transcription127 post-processing and structured note generation; guardrails plus128 human-in-the-loop sign-off in the EHR.129130## Data Architecture131132Pick the store by data shape and access pattern:133134- **FHIR clinical data** → HealthLake. Supports FHIR-native queries and135 integrated NLP. Export to S3 for ML training.136- **Observational / claims research** → OMOP CDM on Redshift or Athena.137 Standard vocabulary enables reuse of published phenotype definitions.138- **Genomics** → S3 as the source of truth for VCF, BAM, CRAM, FASTQ;139 Lake Formation for governance; Athena for ad-hoc queries; HealthOmics140 stores for indexed access.141- **Medical imaging** → S3 for raw DICOM; HealthImaging for indexed,142 sub-image access and integration with inference pipelines.143- **Unstructured documents** (PDFs, scanned notes) → S3 + Textract for144 extraction, then route structured output to the appropriate store above.145146Cross-cutting: Lake Formation for fine-grained access control across147analyst personas; Glue Data Catalog as the single metadata plane.148149## Security & Compliance150151Treat compliance as a set of hard gates, not a checklist at the end.152153- **HIPAA BAA**: Only use services on the AWS HIPAA-eligible list for any154 workflow touching PHI. Verify eligibility for every service in the155 architecture, including logging and monitoring sinks.156- **Network isolation**: PHI workloads run in private subnets with no157 internet egress. Use VPC endpoints for S3, SageMaker, Bedrock, KMS, and158 CloudWatch. Enable SageMaker network isolation on training jobs and159 endpoints handling PHI.160- **Encryption**: Customer-managed KMS keys for S3, EBS, SageMaker161 volumes, and Bedrock Knowledge Base vector stores. TLS 1.2 or higher in162 transit. Scope key policies so only the intended roles can decrypt.163- **Audit and detection**: CloudTrail (including data events for PHI164 buckets), AWS Config rules for drift, GuardDuty for threat detection.165 Enable Bedrock model invocation logging to S3 or CloudWatch — without it166 you cannot reconstruct what the FM was asked or returned.167- **IAM**: Least privilege, no wildcards on PHI buckets or KMS keys.168 Separate roles for data scientists, training jobs, and inference169 endpoints. Never share a role across environments.170- **De-identification**: If the use case permits, de-identify before171 training. Document the method (Safe Harbor, Expert Determination) and172 retain the determination evidence.173174Compliance decision points to surface explicitly:175176- Is any input, output, prompt, or log PHI? If yes, every service in the177 path must be HIPAA-eligible and under BAA.178- Will the FM provider see PHI? Confirm the Bedrock model is in an179 eligible region and that invocation logs are encrypted with your CMK.180- Does the workload cross accounts or regions? Re-verify BAA coverage and181 data residency commitments.182183## MLOps for HCLS184185Clinical models decay. Assume drift and design for it:186187- **Monitoring**: SageMaker Model Monitor for data quality, model quality188 (when labels arrive), and bias drift. Track feature distributions at the189 site and payer level, not only in aggregate.190- **Distribution shift sources to watch**: ICD and CPT coding updates,191 EHR template changes, new site onboarding, seasonal disease patterns,192 formulary changes, care-pathway interventions.193- **Model registry and approvals**: Every clinical model goes through the194 SageMaker Model Registry with explicit approval states. Gate promotion195 on model card completion, bias evaluation, and clinical sign-off.196- **Experimentation constraints**: Randomized online A/B testing on197 patients typically requires IRB approval. Default to shadow mode198 evaluation or champion/challenger with human-in-the-loop review.199 Document the evaluation design before enabling traffic shifts.200- **Reproducibility**: Pin container images, training data snapshots201 (S3 versioning), and hyperparameters in the registry. A model that202 cannot be rebuilt cannot be defended to regulators.203- **Incident response**: Define rollback criteria and a kill switch for204 every deployed clinical model before go-live.205206## Cost Optimization207208Optimize only after correctness and compliance are settled:209210- **Training**: Spot instances for fault-tolerant training; checkpointing211 is mandatory — without it spot interruptions waste compute. HyperPod for212 long-running distributed jobs to amortize setup.213- **Inference shape**:214 - Real-time endpoint: latency < ~60s and payload < ~6 MB with steady215 traffic.216 - Async endpoint: large payloads (WSI, DICOM volumes, long documents)217 or long inference times.218 - Serverless inference: bursty or intermittent traffic with cold-start219 tolerance.220 - Batch transform: offline scoring of large cohorts.221- **Storage**: S3 Intelligent-Tiering for research datasets with unknown222 access patterns; lifecycle policies to Glacier for archival imaging and223 genomics data retained for compliance.224- **Bedrock**: Prefer smaller models for extraction and classification;225 reserve larger models for open-ended generation. Cache retrieval results226 where clinically safe.227228## Decision Trees229230Walk the user through these when the path is not obvious.231232**Processing clinical text**2331. Is the task extraction, summarization, or Q&A over text? → Bedrock.2342. Is it a specialized task (custom NER schema, de-identification at235 scale, domain-specific classifier)? → SageMaker with a fine-tuned236 clinical model.2373. Is PHI involved? → Apply the Security & Compliance gates regardless of238 which service is chosen.239240**Training on PHI**2411. SageMaker training job in a VPC, private subnets only.2422. Network isolation enabled on the job.2433. KMS CMK on input S3, training volume, and output artifacts.2444. BAA-covered region and services end to end.2455. No internet egress; VPC endpoints for all AWS APIs used.246247**Choosing an inference pattern**2481. Latency SLO under a few seconds and payload small? → Real-time endpoint.2492. Payload large (WSI, DICOM, long report) or inference slow? → Async250 endpoint with S3 input and output.2513. Traffic bursty or low-volume? → Serverless inference.2524. Scoring a full cohort offline? → Batch transform.253254**RAG over clinical or scientific content**2551. Is the content stable and well-structured? → Bedrock Knowledge Bases256 with OpenSearch Serverless.2572. Chunk by section, not fixed tokens. Preserve tables and dosing blocks.2583. Require citations in every answer; reject ungrounded responses.2594. If the corpus includes PHI, ensure the vector store, embedding model,260 and FM are all HIPAA-eligible and under BAA.261262## When NOT to Use This Skill263- Non-HCLS workloads — this skill's compliance guidance (HIPAA, BAA, FDA SaMD) does not apply to general-purpose applications264- Cost estimation or pricing — use the AWS Pricing Calculator; this skill covers architecture patterns, not billing265- Reviewing or auditing an existing deployed architecture — this skill designs new systems; use Well-Architected Reviews for existing ones266267## Common Mistakes268269- **Wrong:** Using Bedrock for a problem that needs a custom model270 **Right:** Use SageMaker with a fine-tuned classifier when accuracy is load-bearing and the label space is narrow271 **Why:** FMs underperform well-labeled domain classifiers on constrained tasks, producing unreliable clinical outputs272273- **Wrong:** Using SageMaker when Bedrock would ship in a week274 **Right:** Start with Bedrock for generic summarization or extraction tasks; move to SageMaker only when forced by accuracy, cost, or data residency275 **Why:** Building bespoke infrastructure for a commodity NLP task wastes months of engineering time276277- **Wrong:** Fixed-size chunking for medical literature in RAG pipelines278 **Right:** Chunk by semantic section (abstract, methods, results, guideline recommendation) and preserve tables and dosing blocks intact279 **Why:** Fixed chunks split dosing tables, contraindications, and guideline recommendations, destroying retrieval quality280281- **Wrong:** Using real-time endpoints for whole-slide images282 **Right:** Use SageMaker async endpoints for WSI and DICOM volumes283 **Why:** WSI payloads exceed real-time endpoint size limits and inference times exceed sync timeout SLOs284285- **Wrong:** Forgetting to enable Bedrock invocation logging286 **Right:** Always enable Bedrock model invocation logging to S3 or CloudWatch with CMK encryption287 **Why:** Without it you cannot reconstruct what the FM was asked or returned — a compliance and debugging failure288289- **Wrong:** Using public subnets or internet egress in PHI training jobs290 **Right:** Run PHI workloads in private subnets with no internet egress; use VPC endpoints for all AWS APIs291 **Why:** Violates HIPAA isolation expectations even if data itself is encrypted in transit292293- **Wrong:** Using wildcard IAM policies on PHI buckets294 **Right:** Scope IAM policies to specific resources and actions; separate roles per environment and persona295 **Why:** A single over-scoped role undermines every other security control in the architecture296297- **Wrong:** Training on spot instances without checkpointing298 **Right:** Always enable checkpointing when using spot instances for training jobs299 **Why:** Spot interruptions lose all progress since last checkpoint; often ends up more expensive than on-demand300301- **Wrong:** Running randomized online A/B tests on patients without IRB approval302 **Right:** Default to shadow mode evaluation or champion/challenger with human-in-the-loop review303 **Why:** Randomized experiments on patients constitute human subjects research — a regulatory violation without IRB304305- **Wrong:** Ignoring distribution shift until aggregate accuracy drops306 **Right:** Monitor feature distributions at the site and payer level from day one using SageMaker Model Monitor307 **Why:** By the time aggregate metrics move, site-level harm may already have occurred308309- **Wrong:** Assuming de-identification removes all data handling obligations310 **Right:** Document the de-identification method (Safe Harbor or Expert Determination) and assess re-identification risk and contractual terms311 **Why:** Re-identification risk and contractual obligations often persist after de-identification312313- **Wrong:** Mixing dev and prod in one AWS account with shared KMS keys314 **Right:** Separate dev and prod into distinct accounts with independent KMS keys and IAM boundaries315 **Why:** Blast radius of any mistake in the shared account covers production PHI316317## When to Escalate to a Human Expert318319Recommend human review when:320321- The use case directly drives a treatment decision without clinician322 review in the loop.323- The workload requires FDA SaMD classification or 21 CFR Part 11 controls324 you cannot confirm.325- Data residency, cross-border transfer, or multi-jurisdiction PHI rules326 apply.327- A novel FM is being proposed for a safety-critical clinical output with328 no published evaluation on the target population.329330In these cases, draft the architecture, list the open regulatory and331clinical questions, and stop before implementation.332333## References334335- HIPAA eligible AWS services: https://aws.amazon.com/compliance/hipaa-eligible-services-reference/336- AWS Well-Architected ML Lens: https://docs.aws.amazon.com/wellarchitected/latest/machine-learning-lens/machine-learning-lens.html337- SageMaker documentation: https://docs.aws.amazon.com/sagemaker/338- Bedrock documentation: https://docs.aws.amazon.com/bedrock/