An offline-first AI medical scribe — 100% on-device
Captures doctor–patient audio → transcribes → retrieves patient history → writes a structured SOAP note.
No internet. No cloud. HIPAA-safe by design.
What if the entire AI pipeline ran on a single phone, fully offline?
A medical scribe that runs entirely on a Snapdragon phone:
All on-device → private, fast, works with no signal.
All models quantized to INT8, exported with ExecuTorch, and run on the Snapdragon NPU.
Llama-3.2, Qwen, SmolLM2 & all-MiniLM-L6-v2.model_evaluation/):
tiny / base / small → small.en won..pte and run on-device.The on-device "memory" of the app.
Mission: compile a vector database for Android, design the schema, and build cosine-similarity search over patient history — fast, and leak-free.
Tech: SQLite + sqlite-vec, compiled with the Android NDK for arm64-v8a.
Cosine distance measures the angle between vectors:
0.0 = same meaning … 1.0 = unrelated
CREATE VIRTUAL TABLE patient_vectors USING vec0(
patient_id INTEGER PARTITION KEY, -- search scoped per patient
encounter_id INTEGER, -- links a hit to its visit
embedding FLOAT[384] distance_metric=cosine,
+chunk_text TEXT -- original note, returned with the hit
);
patients, encounters, vitals20 real MiniLM vectors — search groups them by meaning, with no shared keywords:
| Patient note | Nearest note by meaning | dist |
|---|---|---|
| history of asthma, on Albuterol | Spirometry: obstructive pattern | 0.55 |
| BP elevated 150/95 | LDL cholesterol 160 mg/dL | 0.63 |
| Metformin for Type 2 Diabetes | fasting glucose 145 mg/dL | 0.67 |
| anxious, trouble sleeping | Zolpidem for insomnia | 0.49 |
→ Respiratory, cardiac, diabetic & sleep notes self-organize — validated on real embeddings.
Ran natively on the Galaxy S25 Ultra (Snapdragon 8 Elite, arm64-v8a, Android 15):
RUNNING ON: samsung SM-S938U1 · arm64-v8a · Android 15
✓ open DB ✓ apply schema ✓ insert 384-dim vectors
✓ cosine KNN (nearest = 0.000000) ✓ patient isolation
ALL PASSED
✅ Verified on-device · ✅ No memory leaks · ✅ Sub-millisecond search
open / insert / search / close) → teammates integrate without touching SQLite."No-Waiting" strategy — everyone coded against fillers (stubs), then integrated at the "Big Swap".
JNI + NPU runtime
Models → .pte + prompt
.pteVector DB + search
UI + demo data
The Big Swap: real vectors, models & JNI replaced the fillers — pre-agreed interfaces meant it just worked.
Scribend — private, offline, on-device medical AI
The memory layer: a vector search engine that runs on the phone in your pocket.
Questions?