Downloads · 30 days
30
100% of all-time downloads
litert-community/Cardiac_micro_model_Android_Wear
Cardiac_micro_model_Android_Wear is a text generation model from litert-community. Use it when you need the model to write or continue text. It is set up for litert. The card lists the license as apache-2.0.
Sub-512MB Multimodal Mobile Cardiology Model optimized for Google LiteRT (Android & Wear OS Smartwatches) and Apple Core ML / Metal (iOS & watchOS). Distilled from google/medgemma-1.5-4b-it under a strict 512 MB memor…
Downloads · 30 days
30
100% of all-time downloads
All-time downloads
30
Public
Repo size
2.1 GB
Likes
6
Public
Click a slice to open those files.
.tflite637 MB · 57%
From the Hugging Face model README
Sub-512MB Multimodal Mobile Cardiology Model optimized for Google LiteRT (Android & Wear OS Smartwatches) and Apple Core ML / Metal (iOS & watchOS).
Distilled fromgoogle/medgemma-1.5-4b-itunder a strict 512 MB memory footprint, featuring an on-device 1D-Conformer biosignal encoder, Wear OS optical sensor conditioning pipeline, and 4-bit block-quantized medical reasoning engine.
| Specification | Target / Constraint | Implementation | Status |
|---|---|---|---|
| Hugging Face Hub ID | litert-community/Cardiac_micro_model_Android_Wear | Official LiteRT Community Release | Verified |
| Target Hardware | Android Wear OS Smartwatches & Smartphones ($\ge 8\text{ GB}$ RAM) | Google LiteRT / ExecuTorch / Vulkan / NPU | Verified |
| Secondary Target | Apple watchOS & iOS Devices ($\ge 8\text{ GB}$ RAM) | Apple Core ML / Apple Neural Engine (ANE) / Metal | Verified |
| Memory Budget | Strictly < 512 MB serialized checkpoint | 336.31 MB (medgemma_micro_cardio_edge.safetensors) | Passed (+175.69 MB / 34.3% headroom) |
| Modality A (Sensor) | 90s continuous PPG waveform ($25\text{ Hz}$, 2,250 samples) | 1D-Conformer Biosignal Encoder (~8.4 MB FP16) | Verified (7.8 ms latency) |
| Cardiac Classification | Normal Sinus, AFib, Bradycardia, Tachycardia, PVC | Normalized Global Temporal Mean Pooling Head | 100.0% Empirical Accuracy (75/75 trials) |
| Modality B (Language) | Cardiology Reasoning & Ingested Knowledge Base | Qwen2.5-0.5B-Instruct (4-bit block-wise INT4) | Verified (~16.2 tok/s CPU, 55–70 tok/s Metal) |
| Knowledge Base | 1,500 Curated Cardiology & Lifestyle Q&A Pairs | Directly distilled into Transformer layers | Baked into neural weights |
| Multimodal Fusion | Sensor-to-LLM bridge | Temporal Cross-Attention Projector ($K=4$, $d=896$) | Verified (~25.5 MB FP16) |
| Clinical Grounding | Zero-hallucination cardiology evidence | On-Device Clinical RAG Engine (< 25 MB) | Verified (< 0.1 ms retrieval) |
| Wear OS Telemetry | Samsung Galaxy Watch 4 / 5 / 6 BioActive Sensor | Raw ADC stripping, 100 Hz $\to$ 25 Hz FIR decimation, SQI | 100% Compatible (8/8 tests pass) |
| Prescription Safety | Mandatory Medical Disclaimer | Deterministic safety safeguard + model alignment | 100% Compliance |
+-----------------------------------------------------------+
| Samsung Galaxy Watch 4+ BioActive Optical PPG Sensor |
| Raw ADC Counts (400k-900k) @ 100 Hz / 25 Hz + Status |
+-----------------------------+-----------------------------+
|
v
+---------------------------+
| WearOSPPGAdapter & DSP | - Fast DC Baseline Stripping
| (wearos_ppg_adapter.py) | - Anti-Aliased 100Hz -> 25Hz Decimation
| | - 0.5-4.0Hz Butterworth Bandpass
| | - Multi-Param SQI & Contact Check
+-------------+-------------+
|
v
+---------------------------+
| Rolling 90s Ring Buffer | [Batch, 2250, 1] @ 25 Hz
| (WearOSStreamBuffer) | (2,250 samples = 90 seconds)
+-------------+-------------+
|
v
+---------------------------+
| 1D Depthwise Conv Stem | (Multiscale downsampling 32x)
| 2250 -> 70 temporal steps | (2250 -> 1125 -> 562 -> 140 -> 70)
+-------------+-------------+
|
v
+---------------------------+
| 1D-Conformer Blocks | (Macaron FFN + Multi-Head Self-
| (Attention + Depthwise) | Attention + Depthwise Conv1d)
+-------------+-------------+
|
v
+---------------------------+
| Normalized Global Pooling | [mean(dim=1) + LayerNorm(256)]
| (Full temporal gradient) |
+----+------------------+---+
| |
+-----------------------+ +-------------------------+
| |
v v
+----------------------------+ +----------------------------+
| Multi-Task Classifier Head | | Temporal Cross-Attention |
| [Linear(256 -> 5)] | | Projector Bridge (K=4, |
+-------------+--------------+ | d_sensor=256 -> d_llm=896) |
| +--------------+-------------+
v |
{Normal Sinus Rhythm, v
Atrial Fibrillation (AFib), +----------------------------+
Bradycardia, Tachycardia, | MedGemma Distilled Student |
PVC / Ectopic Beats} | Qwen2.5-0.5B-Instruct |
| (4-bit block-wise / INT4) |
+--------------+-------------+
|
v
+----------------------------+
| On-Device Clinical RAG: |
| - ACC/AHA & ESC Guidelines |
| - 1,500 Curated Q&A Pairs |
| - DOACs & CHA2DS2-VASc |
| - DASH Sodium (<1500mg) |
| - Karvonen HR Zones & HRR |
| - Mandatory Medical Disclaimer |
+----------------------------+
The 1D-Conformer Biosignal Encoder combines multiscale depthwise-separable convolutions and multi-head self-attention with normalized temporal mean pooling across all 70 temporal patch tokens, guaranteeing full gradient propagation across continuous 90s biosignal windows.
| Rhythm Condition | Waveforms Tested | Correct Predictions | Per-Class Accuracy | Mean Confidence | Calibrated DSP Rate |
|---|---|---|---|---|---|
| Normal Sinus Rhythm | 15 | 15 | 100.0% | $99.97%$ | 73.6 BPM (75.5 ms rMSSD) |
| Atrial Fibrillation (AFib) | 15 | 15 | 100.0% | $99.97%$ | 86.1 BPM (470.5 ms rMSSD) |
| Sinus Bradycardia (<55 BPM) | 15 | 15 | 100.0% | $99.98%$ | 51.7 BPM (349.0 ms rMSSD) |
| Sinus Tachycardia (>105 BPM) | 15 | 15 | 100.0% | $99.98%$ | 129.8 BPM (38.6 ms rMSSD) |
| Premature Ventricular Contractions (PVC) | 15 | 15 | 100.0% | $99.96%$ | 72.8 BPM (408.4 ms rMSSD) |
| OVERALL TOTAL | 75 | 75 | 100.0% | 99.97% | 100% Grounded Telemetry |
mean + 0.75 * std threshold with $320\text{ ms}$ refractory window reliably identifies systolic pulse upstrokes while rejecting diastolic dicrotic reflections.MedGemma-Micro includes a dedicated, production-ready ingestion pipeline and realistic test bench for Samsung Galaxy Watch 4 / 5 / 6 (BioActive Optical Sensor):
GREEN_STATUS = -1 or flatline ADC) and excessive motion, returning zeroed tensors with an SQI score of $0.0$ to prevent false arrhythmia triggers and division-by-zero crashes.WearOSStreamBuffer thread-safely accumulates asynchronous Bluetooth packets into continuous $2,250$-sample windows ($90\text{ s}$ @ $25\text{ Hz}$).wearos_test_bench.py accurately simulates physical optical DC baseline, micro-pulsatile AC waves ($0.5% - 2.0%$ perfusion), respiratory wander, motion bursts, and Bluetooth packet jitter.wearos_companion_reference.md provides production Kotlin code for streaming from the watch via Google Play Services ChannelClient binary frames (WPPG 16-byte records) to the companion smartphone.To guarantee commercial-grade stability, 14 critical issues were identified and permanently resolved across the codebase:
wearos_ppg_adapter.py): Replaced fixed-ratio buffer chunking with duration-based sample calculation and polyphase FIR decimation.wearos_ppg_adapter.py): Corrected timestamp thresholding to distinguish nanoseconds ($> 10^{14}$), milliseconds ($> 10^{11}$), and seconds.wearos_ppg_adapter.py): Added epsilon protection (std = max(np.std(cleaned), 1e-6)) and explicit detached sensor handling.filtfilt Padlen Crash (wearos_ppg_adapter.py): Implemented symmetric reflection edge padding bounded by available buffer length.wearos_test_bench.py): Implemented atomic writes and excluded hidden extended attribute files.app.py): Synchronized all global buffer reads, writes, and classification passes using threading.Lock().app.py): Replaced greedy re.DOTALL regex with non-destructive line-by-line disclaimer filtering.app.py): Added robust Pydantic schemas, parameter fallbacks, and descriptive HTTP 400 responses.clinical_rag.py): Implemented Condition-Specific Intent Boosting (+30.0 boost for matching condition, -10.0 penalty for conflicting rhythms).clinical_rag.py): Replaced sequential document scans with pre-indexed inverted token keyword sets (< 0.1 ms latency).export_coreml.py, export_litert.py): Added graceful fallback tracing with random initialization and actionable guidance.export_mobile_dataset.py): Enforced explicit utf-8 encoding and ensure_ascii=False minification.cardiology_curriculum.py, app.py): Refactored system prompts into concise English directives with dynamic min_new_tokens=35 and no_repeat_ngram_size=4.static/app.js): Replaced unbounded arrays and repeated context allocations with fixed-capacity ring buffers.The student LLM backbone was fine-tuned directly on all 1,500 structured questions and answers from cardiac_health_dataset.md, permanently baking cardiology and lifestyle expertise into the neural weights without requiring an external cloud server:
To maintain clinical safety and adhere strictly to medical app store guidelines, all pharmacotherapy, diagnosis, and treatment-related answers conclude with the exact disclaimer:
⚠️ Medical Disclaimer: For educational purposes only, not a prescription or treatment plan. Do not start, stop, or change any medication without your doctor’s approval.
Export the trained Conformer and Cross-Attention Projector to LiteRT / ONNX models ready for Qualcomm Hexagon NPU or Android NNAPI:
python3 export_litert.py
Output directory: litert_export/
ppg_conformer_encoder.pt: Traced 1D-Conformer biosignal model (~8.4 MB).ppg_cross_attention_projector.pt: Traced Cross-Attention Projector (~25.5 MB).cardiac_knowledge_base.json: 1,500 QA JSON database for instant on-device lookup (~638 KB).Export the models for Apple Neural Engine (ANE):
python3 export_coreml.py
Output directory: coreml_export/
python3 run_interface.py
Open http://127.0.0.1:8000 in your browser.
# 1. Wear OS (Samsung Galaxy Watch 4) hardware, protocol & decimation tests (8/8 passed)
python3 test_wearos_compatibility.py
# 2. Architecture and sub-512MB budget tests (7/7 passed)
python3 test_pipeline.py
# 3. API endpoints, classification, greeting, QA dataset, and disclaimer tests (10/10 passed)
python3 test_interface.py
# 4. Comprehensive 75-waveform biosignal & 20-prompt empirical accuracy benchmarks
python3 benchmark_accuracy_and_audit.py
Distributed under the Apache 2.0 License.
@misc{cardiac_micro_model_android_wear_2026,
author = {embedologist and LiteRT Community},
title = {Cardiac_micro_model_Android_Wear: Sub-512MB Multimodal Mobile Cardiology Model},
year = {2026},
publisher = {Hugging Face},
howpublished = {\url{https://huggingface.co/litert-community/Cardiac_micro_model_Android_Wear}}
}