End-to-end pipeline to build a fine-tuned Spanish medical triage model for offline/edge deployment.
┌─────────────────────────────────────────────────────────────────────────┐
│ 1. Data Prep → 2. CPT → 3. SFT → 4. Distill │
│ OpenMed + MTS Spanish Med Triage SFT MiniMax-M2.5 │
│ │
│ 5. GRPO → 6. DPO → 7. Quantize → 8. Deploy │
│ Rewards Preference GGUF Q5 Offline App │
└─────────────────────────────────────────────────────────────────────────┘
med-llm-es/
├── configs/
│ └── config.py # Configuration settings
├── data/
│ ├── raw/ # Downloaded OpenMed datasets
│ ├── translated/ # Spanish translations
│ ├── triage/ # Generated triage prompts
│ ├── distilled/ # Teacher-generated data (~10MB)
│ └── preference/ # DPO preference pairs (~10MB)
├── models/
│ ├── cpt-spanish-medical-v1/ # CPT model
│ ├── sft-spanish-triage-v1/ # SFT model
│ ├── grpo-spanish-triage-v1/ # GRPO model
│ ├── dpo-spanish-triage-v1/ # DPO model
│ └── gguf/ # Quantized models (~2GB total)
├── scripts/
│ ├── 01_download_opendmed.py # Download datasets
│ ├── 02_translate_to_spanish.py # Translate to Spanish
│ ├── 03_generate_triage_data.py # Create triage prompts
│ ├── 04_cpt_spanish_medical.py # Continued Pre-Training
│ ├── 05_sft_triage.py # Supervised Fine-Tuning
│ ├── 06_distillation_generate.py # Knowledge Distillation
│ ├── 07_create_preference_data.py # Create DPO dataset
│ ├── 08_grpo_triage.py # GRPO training
│ ├── 09_dpo_triage.py # DPO training
│ ├── 10_quantize_gguf.py # Quantization
│ └── 11_monitor_grpo.py # Passive GRPO run monitor
├── checkpoints/ # Training checkpoints
├── reports/ # Documentation
├── DEPLOYMENT_GUIDES.md # Edge deployment instructions
└── README.md
1BASE_MODEL = "LiquidAI/LFM2.5-1.2B-Base"
2TEACHER_MODEL = "MiniMaxAI/MiniMax-M2.5"
3MINIMAX_API_KEY = "your-api-key-here"
4
5# Paths (use your drive)
6DATA_DIR = "E:/med-llm-es/data"
7MODELS_DIR = "E:/med-llm-es/models"
This project is for educational/research purposes only.