惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Jina AI
Jina AI
N
Netflix TechBlog - Medium
P
Proofpoint News Feed
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
D
DataBreaches.Net
人人都是产品经理
人人都是产品经理
aimingoo的专栏
aimingoo的专栏
Stack Overflow Blog
Stack Overflow Blog
Blog — PlanetScale
Blog — PlanetScale
月光博客
月光博客
阮一峰的网络日志
阮一峰的网络日志
I
InfoQ
F
Fortinet All Blogs
J
Java Code Geeks
Last Week in AI
Last Week in AI
美团技术团队
大猫的无限游戏
大猫的无限游戏
有赞技术团队
有赞技术团队
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
博客园_首页
量子位
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Apple Machine Learning Research
Apple Machine Learning Research
小众软件
小众软件

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
AI-dy: On-Device Emergency First Aid with Gemma 4
Aaliyah Juna · 2026-05-24 · via DEV Community
Cover image for AI-dy: On-Device Emergency First Aid with Gemma 4

Aaliyah Junaid

Gemma 4 Challenge: Build With Gemma 4 Submission

This is a submission for the Gemma 4 Challenge: Build with Gemma 4

What I Built

Traditional first aid apps often fail during high-stress crises because they bury instructions in dense text or rely on a stable internet connection. Conversely, standard cloud AI chatbots are highly prone to hallucinations, posing a massive safety risk if they invent incorrect medical dosages or dangerous treatments when a user is vulnerable.

AI-dy bridges this gap. It is an offline-first mobile application that combines proactive first aid education with instant, on-device AI assistance. By using spaced repetition (the SM-2 algorithm) in its "Drill Mode," it helps users build lasting knowledge before a crisis hits.

Built as a Turborepo monorepo, AI-dy combines an Expo 54 (React Native) mobile frontend with a NestJS/PostgreSQL backend for cross-device sync. Crucially, the app bundles 58 lessons across 24 topics as static JSON, meaning the core application and its underlying AI features remain fully operational even with zero network bars.

Demo

Code

AI-dy — On-Device Emergency First Aid Assistant

AI-dy is a mobile-first first aid companion that teaches you when you're calm and guides you when you're not. It runs Gemma 4 entirely on your device — no cloud, no connectivity required — so it works in the moments that matter most.


What AI-dy Does

Learn Mode

Structured, searchable first aid education across 58 lessons, 24 topics, and 3 age groups (Adult / Child / Infant).

  • Browse and filter lessons by topic and age group
  • Step-by-step illustrated instructions with Cloudinary-hosted images
  • Watch video demonstrations for key lessons (YouTube, in-app player)
  • Take per-lesson quizzes to test comprehension
  • All content is bundled offline — no network required

Drill Mode

Spaced-repetition practice across 400+ quiz questions using the SM-2 algorithm.

  • Configurable sessions: Quick (5), Standard (10), or Full (20) questions
  • Filter by topic and age group before starting
  • SM-2 scheduling surfaces weak spots first and…

How I Used Gemma 4

AI-dy runs entirely on-device, prioritizing user privacy, speed, and absolute reliability during natural disasters or in rural areas.

Model Selection

I chose Gemma 4 E4B IT with Q4_K_M quantization (~5 GB) executed via llama.rn. The E4B variant is the perfect sweet spot: it comfortably fits within the memory constraints of modern flagship smartphones, yet retains the rigorous instruction-following precision needed for safety-critical interactions that smaller models lack. Users download the multimodal vision projector (mmproj, ~990 MB) during an initial setup to unlock full offline visual capabilities.

How Gemma 4 Powers the Experience

  • Context-Aware Lesson Assistant: When a user asks a question while browsing a lesson, the app dynamically injects the current lesson title and step data into Gemma 4's context window. This ensures the model gives immediate, hyper-relevant answers tailored exactly to the procedure the user is looking at (e.g., adult burn treatments).
  • Crisis Chat with Multimodal Vision: In an emergency, users can take a photo of an injury. Gemma 4’s vision capabilities analyze the image to identify the type of trauma and guide the user through immediate care steps. If the AI detects that visual context would help, it proactively prompts the user to snap a picture.
  • Voice-First Emergency Navigation: For hands-free operation, a hybrid intent-extraction layer processes voice input. Local keyword matching handles instant navigation for clear emergencies (e.g., shouting "choking!"), while on-device Gemma 4 handles ambiguous natural language inputs—all without a single network round-trip.

Overcoming Technical Challenges

  • Bypassing Latency: Gemma 4's native reasoning chain can cause a delay. To minimize response latency when seconds count, I utilized the <|channel|>answer\n marker to skip the "thinking" phase, forcing the model to start streaming the final, actionable response instantly.
  • Stable Vision Inference: To prevent standard context shifting from corrupting critical image data during an interaction, I locked the image embeddings in place by setting ctx_shift: false.
  • Guaranteed Medical Safety: To eliminate the risk of AI hallucinating medical protocols, I enforced a strict architectural boundary. Structured decision trees for medical procedures remain hardcoded and verified; Gemma 4 is strictly limited to intent extraction, navigation, and clarifying context. It can guide you to the right protocol, but it can never "invent" a new one.

What's Next

  • Medical & Organizational Partnerships: I plan to partner with medical professionals and organizations like the American Red Cross and AHA to continuously validate our content and offer certifiable course tracks.
  • Emergency Services Integration: I aim to build direct dispatch integration into the app. This will allow a user to call emergency services natively while automatically transmitting location data, incident types, and a structured summary of the first aid steps already taken.
  • A Purpose-Built First Aid Model: While Gemma 4 is an incredible general base, our ultimate goal is to fine-tune a specialized, multilingual first aid model on peer-reviewed protocols to optimize safety-critical performance in multiple languages.

Summary

AI-dy demonstrates that powerful, multimodal AI can be a responsible tool in high-stakes domains. By running Gemma 4 E4B entirely on-device, bypassing the thinking chain to cut latency, and constraining the AI to navigation rather than text generation, we’ve built a first aid companion that teaches better in calm moments and thinks faster in a crisis—without ever needing a signal bar to do either.

Team