AI-powered emergency decision support for community first responders.
BEACON puts WHO/SPHERE/IMCI emergency protocols in the hands of frontline responders — via voice, photo, or text — in 6 languages, with spoken guidance. Fine-tuned Gemma 4 E4B, offline-capable RAG, zero clinical jargon.
Live demo: https://web-ten-delta-62.vercel.app
Model: https://huggingface.co/dhyey166/beacon-gemma4-e4b
A responder in the field describes a situation — by typing, speaking, or photographing — and BEACON returns:
- Urgency level (IMMEDIATE / URGENT / ROUTINE)
- Immediate actions — step-by-step, plain language
- Do not — common dangerous mistakes to avoid
- Escalate if — signs that require referral
- Spoken audio guidance — auto-read aloud so hands stay free
All output is auto-translated and spoken in the responder's language.
English · Swahili · Hindi · French · Arabic · Hausa
Language is auto-detected from input. UI labels, guidance, and audio all shift to match.
beacon/
├── data/ Corpus ingestion, chunking, BM25 embedding pipeline
├── training/ Gemma 4 E4B QLoRA fine-tuning (Colab A100)
├── backend/ FastAPI inference server + RAG (Docker)
├── hf_space/ HuggingFace Space deployment (public API)
├── mobile/ React Native app — on-device offline RAG
└── web/ Next.js web app — deployed on Vercel
Base: Gemma 4 E4B (gemma-4-e4b-it)
Method: QLoRA fine-tuning via Unsloth + TRL (SFTTrainer)
Hardware: Colab A100
Dataset: 700 instruction pairs grounded in actual corpus chunks, generated using Gemma 4 26B (via HuggingFace Inference API) reading each protocol chunk and producing realistic field scenarios in the BEACON output schema
Final loss: 0.018
Published: https://huggingface.co/dhyey166/beacon-gemma4-e4b
Source documents (all public domain / open license):
- WHO/SPHERE Humanitarian Standards Handbook (2018)
- IMCI Emergency Protocols
- Red Cross First Aid Manual
- UNHCR Field Operations Guide
Pipeline: ingest.py → chunk.py → embed.py → BM25 index
cd data
pip install -r requirements.txt
python ingest.py
python chunk.py
python embed.pyOutputs land in data/outputs/ and are copied to mobile/assets/ and backend/data/outputs/.
cd training
pip install -r requirements.txt
python generate_training_data.py # generates training_data.jsonl
python format_data.py # formats for SFTTrainer
python train_e4b.py # QLoRA fine-tune on Colab A100
python evaluate.py # benchmark against base modelThe Colab notebook (BEACON_Finetune_Colab.ipynb) is self-contained and reproducible.
FastAPI server wrapping the fine-tuned model via Ollama + RAG retrieval.
cd backend
cp .env.example .env # set OLLAMA_HOST, OLLAMA_MODEL
docker-compose upAPI runs on http://localhost:8000 locally. In production, deployed on HuggingFace Spaces with T4 Small GPU hardware.
Next.js app with voice input, photo triage, streaming guidance, and TTS audio.
cd web
npm install
echo "NEXT_PUBLIC_OPENAI_KEY=your_key_here" > .env.local
npm run devDeployed at: https://web-ten-delta-62.vercel.app
Input modes:
- Type a description
- Speak (browser Speech Recognition, language-selectable)
- Upload a photo (GPT-4o vision describes the medical scene)
React Native (Expo) app with fully on-device RAG — no internet required after initial setup.
cd mobile
npm install
npx expo run:ios # requires XcodeOn-device pipeline: BM25 retrieval from assets/chunk_metadata.json → Gemma 4 E4B inference via the backend API.
| Criterion | How BEACON addresses it |
|---|---|
| Health & Sciences | WHO/IMCI protocol grounding, urgency triage, do-not guidance |
| Global Resilience | Offline-capable mobile app, works without clinic or data center |
| Digital Equity | 6 languages, auto-detected, voice-first for low-literacy contexts |
| Gemma 4 usage | Fine-tuned E4B (edge model), on-device inference, multimodal input |