# Kenya Clinical Reasoning Challenge – Low‑Resource NLP for Healthcare
This repository contains my solution for the **Kenya Clinical Reasoning Challenge** on Zindi.
The goal is to predict a clinician’s free‑text response given a clinical vignette (nurse background + patient presentation). The evaluation metric is **ROUGE score**, and solutions must respect strict deployment constraints (≤1B parameters, <100ms inference, <2GB RAM).
**Final scores:**
- Public leaderboard: **0.35075**
- Private leaderboard: **0.35945**
- Benchmark (random/naive): 0.00271 / 0.00362
---
## 📖 Problem Overview
Frontline healthcare workers in rural Kenya face complex decisions with limited specialist support.
The dataset consists of ~400 training and 100 test examples – authentic clinical prompts paired with expert clinician responses.
The challenge simulates real‑world constraints: fast, accurate, and deployable on edge devices (e.g., NVIDIA Jetson Nano).
**Key constraints:**
- Model parameters ≤ 1 billion
- Inference time < 100 ms per vignette
- Inference RAM < 2 GB
- Quantization required
- Training ≤ 24 hours on T4 GPU
---
## 🧠 Approach
### 1. Model Architecture
- **Base model:** `t5-base` (222M parameters) – well under the 1B limit.
- Fine‑tuned as a sequence‑to‑sequence task:
Input: `"summarize: " + enhanced_prompt`
Output: clinician’s summary/assessment.
### 2. Preprocessing & Prompt Engineering
- Cleaned text (standardised county names, removed problematic IDs).
- Created an **enhanced prompt** by injecting metadata (nursing competency, clinical panel, years of experience) and patient age/gender when available.
- All inputs prefixed with `"summarize: "` to align with T5’s pre‑training.
### 3. Training Strategy
- **Stratified split** (80/20) based on clinician response length to preserve diversity.
- Gradient accumulation (batch size 4, accumulation steps 8) to fit in T4 memory.
- FP16 mixed precision.
- Optimizer: AdamW (lr=3e-4) with cosine warmup.
- Early stopping b …