A React Native medical AI assistant powered by Gemma 3n with RAG (Retrieval-Augmented Generation) capabilities for accurate medical information retrieval. LOMA runs entirely offline on iOS and Android devices, providing privacy-focused medical assistance with a comprehensive medical knowledge database.
- 🏥 Medical Knowledge Base: Pre-loaded database with 500k+ medical Q&A pairs and documents
- 🔍 RAG System: Retrieval-Augmented Generation for contextually accurate medical responses
- 📱 Mobile-First: Optimized for iOS and Android with on-device AI inference
- 🔒 Privacy-Focused: Completely offline operation - no data leaves your device
- 🧠 Advanced AI: Gemma 3n language model with medical context injection
- ⚡ Vector Search: Semantic search using ALL_MINILM_L6_V2 embeddings for relevant medical information
- 💾 Local Database: SQLite database with vector similarity search capabilities
- 🎯 Specialized Search: Filter by medical specialty, publication year, and relevance
- 📚 Source Citations: Automatic citation of medical sources in AI responses
- Node.js (v16 or later)
- Expo CLI
- iOS Simulator (for iOS development) or physical iOS device
- Android Studio (for Android development) or physical Android device
- Note: Web platform is not supported - LOMA is designed for mobile devices only
- Clone the repository
- Install dependencies:
npm install
LOMA is designed exclusively for iOS and Android devices with on-device AI inference:
-
Start the development server:
npm start
-
Choose your platform:
- Press
ifor iOS simulator or device - Press
afor Android emulator or device
- Press
-
First Launch Setup (automatic):
- Medical Database: Downloads medical database (~500MB) containing 500k+ medical Q&A pairs
- AI Model: Downloads Gemma 3n model (~4.79GB) for on-device inference
- Embedding Model: Initializes ALL_MINILM_L6_V2 for vector search
- Database Indexing: Sets up vector search capabilities
-
Ready to Use:
- Ask medical questions and receive AI responses with cited sources
- Browse medical database with semantic search
- All processing happens locally on your device
To use the full database chage DATABASE_DB_URL in src/lib/database-download-service.ts to:
/miriad_medical_minlm_5M.db
- React Native: Cross-platform mobile development (iOS/Android only)
- Expo: Development platform and tools
- TypeScript: Type-safe development
- llama.rn: React Native binding for llama.cpp (on-device inference)
- react-native-executorch: ExecuTorch integration for embedding models
- Gemma 3n: Google's lightweight language model optimized for mobile
- ALL_MINILM_L6_V2: Sentence transformer for text embeddings
- @op-engineering/op-sqlite: High-performance SQLite with vector extensions
- libSQL: Vector database capabilities with cosine similarity search
- Vector Indexing: Optimized vector search with 384-dimensional embeddings
- Vector Search: Semantic similarity search through medical knowledge base
- Context Injection: Dynamic context enhancement for AI responses
- Source Citation: Automatic medical source referencing
- Query Enhancement: Medical query understanding and expansion
- shadcn/ui: Modern UI components
- Lucide React: Icon system
- React Native Reanimated: Smooth animations
- Moti: Animation library
LOMA uses specialized models optimized for medical assistance on mobile devices:
- Model: gemma-3n-E2B-it-Q8_0.gguf
- Format: GGUF (GPT-Generated Unified Format)
- Size: ~4.79GB
- Quantization: Q8_0 (8-bit quantization for mobile optimization)
- Purpose: Medical question answering with context injection
- Source: Hugging Face (ggml-org/gemma-3n-E2B-it-GGUF)
- Model: ALL_MINILM_L6_V2 via ExecuTorch
- Dimensions: 384-dimensional vectors
- Purpose: Semantic search and similarity matching
- Integration: react-native-executorch for on-device inference
- Performance: Optimized for mobile vector generation
- 100% Offline: All AI processing happens locally on your device
- No Data Transmission: Medical queries and responses never leave your device
- Local Storage: Medical database and models stored securely on device
- HIPAA-Friendly: No cloud dependencies or data sharing
- Secure by Design: No user data collection or analytics
- iOS: iOS 13.0+ with at least 6GB storage space
- Android: Android 8.0+ (API level 26) with at least 6GB storage space
- RAM: Minimum 6GB recommended for optimal performance
- Storage: 30GB free space for models and fullmedical database
LOMA uses a sophisticated Retrieval-Augmented Generation (RAG) system to provide accurate medical information:
- User asks a medical question
- Question is converted to a 384-dimensional vector using ALL_MINILM_L6_V2
- Vector search finds semantically similar medical content
- Searches through 500k+ medical Q&A pairs using cosine similarity
- Retrieves relevant medical documents and their associated Q&A
- Filters results by similarity threshold and relevance
- Selected medical content is formatted into context
- Context is injected into the AI prompt with proper citations
- Gemma 3n generates response using retrieved medical knowledge
- AI provides medically-informed answers with source citations
- Sources are automatically linked for verification
- Responses include relevant medical specialty and publication information
LOMA is designed as an educational and informational tool only. It is NOT intended to:
- Replace professional medical advice, diagnosis, or treatment
- Provide emergency medical assistance
- Substitute for consultation with qualified healthcare providers
Always seek the advice of your physician or other qualified health provider with any questions you may have regarding a medical condition. Never disregard professional medical advice or delay in seeking it because of something you have read in LOMA.
If you think you may have a medical emergency, call your doctor or emergency services immediately.