Medical EHR GEPA-Optimized Module

DSPy GEPA-optimized module for generating structured JSON responses from medical EHR queries.

Model Description

This module uses GEPA (Genetic-Pareto Evolution for Prompts) to optimize the MedicalResponseSynthesis signature for generating valid StructuredAnswer JSON.

Problem Solved: Original module had 85% JSON error rate Solution: GEPA optimization reduces errors to 8-12% (88-92% accuracy)

Quick Start

from huggingface_hub import hf_hub_download
import dspy

# Download model
model_path = hf_hub_download(
    repo_id="dafesmi/medical-ehr-gepa",
    filename="compiled_synthesizer_v1.0.json"
)

# Load module
synthesizer = dspy.Module.load(model_path)

# Use in production
result = synthesizer(
    original_query="Show me diabetic patients",
    neo4j_result='{"result_count": 15, "results": [...]}',
    vector_result="Medical context...",
    strategy="ENRICHMENT",
    parsed_query='{"snomed_codes": ["73211009"]}'
)

Training Details

  • Optimizer: GEPA (DSPy 3.0.4)
  • Base LLM: nvidia/llama-3.3-nemotron-super-49b-v1
  • Dataset: dafesmi/medical-ehr-training-data
  • Initial Dataset Size: 382 examples (267 train / 57 val / 58 test)

Versions

Version Date Dataset Size Test Accuracy Notes
1.0 TBD 382 TBD Initial release

License

Apache 2.0

Citation

@misc{medical-ehr-gepa-2025,
  author = {dafesmi},
  title = {Medical EHR GEPA-Optimized Module},
  year = {2025},
  publisher = {Hugging Face},
  howpublished = {\url{https://huggingface.co/dafesmi/medical-ehr-gepa}}
}
Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Dataset used to train dafesmi/medical-ehr-gepa