> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://blueprint.ziro.health/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://blueprint.ziro.health/_mcp/server.

# AI/ML Integration Patterns

AI in healthcare offers enormous potential but introduces unique risks. Regulatory scrutiny is increasing, and patients and clinicians must trust AI-driven recommendations.

## Model Validation for Clinical Settings

AI models in healthcare require rigorous validation:

* **Data quality**: Training data must be representative, complete, and labeled accurately
* **Bias evaluation**: Test for demographic bias across age, gender, race, and socioeconomic status
* **Generalization**: Validate on data from different institutions, geographies, and equipment
* **Edge cases**: Test on rare conditions and unusual presentations
* **Clinical relevance**: Does the model's output actually help clinical decision-making?

## Explainable AI Patterns

Black-box AI is unacceptable in healthcare:

* **Feature attribution**: Which inputs most influenced the output? (SHAP, LIME)
* **Counterfactual explanations**: What would need to change for a different result?
* **Confidence calibration**: Well-calibrated confidence scores (a 90% confident prediction should be right 90% of the time)
* **Human-readable explanations**: Natural language summaries of AI reasoning

## FDA Considerations for AI/ML SaMD

The FDA has specific guidance for AI/ML-based Software as a Medical Device:

* **Predetermined change control plan**: For continuously learning models
* **Algorithm change protocol**: Documenting when retraining is needed
* **Performance monitoring**: Ongoing surveillance for drift
* **Real-world evidence**: Post-market data collection
* **Clinical validation**: Prospective studies for high-risk AI applications

## Privacy-Preserving ML

Techniques to protect patient privacy in ML workflows:

* **Differential privacy**: Add statistical noise to prevent re-identification
* **Federated learning**: Train models across institutions without sharing raw data
* **On-device ML**: Run inference on device — PHI never leaves the phone
* **Synthetic data**: Generate realistic synthetic health data for development

## LLM Integration for Health

Large language models in healthcare require special consideration:

* **Grounding**: All LLM outputs should be grounded in clinical sources
* **Hallucination mitigation**: Validate factual claims against trusted references
* **Temperature**: Lower temperature settings for more deterministic outputs
* **Human-in-the-loop**: Critical decisions require clinician review