LocalMedAI LoRA v2
A LoRA adapter fine-tuned on top of Gemma 3n E2B (instruction-tuned) using Apple MLX,
trained for structured interpretation of clinical laboratory results. Built for LocalMedAI —
a privacy-first, on-device health document analysis system for iOS.
⚠️ Medical Safety Notice
This is not a medical device. It is not for diagnosis, treatment, or clinical decision-making.
It does not replace clinical judgement or professional medical advice.
SaMD (Software as a Medical Device) classification for the LocalMedAI application is under
active assessment and is unresolved. No regulatory clearance of any kind should be inferred
from the existence of this model or its publication.
Model Details
| Field | Value |
|---|
| Base model | mlx-community/gemma-3n-E2B-it-lm-bf16 |
| Base model family | Google Gemma 3n E2B (instruction-tuned) |
| Adapter format | LoRA (adapters.safetensors) |
| Framework | MLX-LM (Apple Silicon) |
| Adapter version | 2.0.0 |
| Languages | English, German, French |
Licence
This adapter is released under the
Gemma Terms of Use,
which governs the base model and applies to derivatives. Use of this adapter implies acceptance
of those terms.
Intended Use
In scope:
- Structured interpretation of blood test and clinical laboratory results
- Mapping free-text or semi-structured lab output to a normalised biomarker schema
- Multi-language support for lab terminology (EN, DE, FR)
- On-device inference on Apple Silicon hardware via MLX
Out of scope (do not use for):
- Clinical diagnosis or differential diagnosis
- Treatment recommendations
- Interpretation of imaging, pathology, or any non-laboratory medical data
- Real-time clinical decision support in a care setting
- Any use where an incorrect output could directly harm a patient without human review
This model is designed to operate as one component of a larger application pipeline with
explicit user consent and human-readable output, not as a standalone medical authority.
Training Data and Provenance
Training examples: 1,830
Source: Synthetically generated. All training examples were produced programmatically using a purpose-built Python generator (generate_v3_data.py) with fictional patient archetypes and biomarker values drawn from curated pools derived from published clinical reference ranges. No real patient data was used as training input.
Third-party patient data: None. A forensic grep across the complete v2 training corpus for known real-patient identifiers and values returned zero matches on both development gateways. Real patient documents used as parser-development fixtures during application development were stored in a separate directory and never entered the fine-tuning pipeline.
Founder's own health data: The broader development training lineage (v5 corpus, not published) contains a small number of de-identified values from the founder's own blood test results, included to validate output quality against a known ground truth. Forensic review confirmed these did not propagate into the published v2 adapter weights.
Consent and handling: The fictional archetypes and synthetic values carry no consent requirements. The founder's own values, present only in an unpublished development corpus, are self-owned and were handled exclusively on private local hardware.
Categories covered (from curation metadata): diet/lifestyle, doctor preparation, edge cases, emotional support, general interpretation, medication interactions, cross-marker patterns, specific markers, supplements, symptoms — across EN, DE-CH, DE-DE, FR-CA, FR-CH, FR-FR locale variants.
Training Procedure
| Parameter | Value |
|---|
| Framework | MLX-LM |
| Hardware | Apple M4 (ARM, Apple Silicon) |
| Fine-tune type | LoRA |
LoRA rank (r) | 8 |
| LoRA scale (alpha/rank) | 20.0 (equivalent alpha ≈ 160 in standard PEFT notation) |
| LoRA dropout | 0.0 |
| LoRA layers | Last 16 transformer layers |
| Target modules | MLX-LM defaults for Gemma architecture (query, key, value, output projections) |
| Training iterations | 1,000 |
| Learning rate | 1e-5 |
| Optimizer | Adam |
| Batch size | 1 |
| Gradient accumulation steps | 1 (effective batch size: 1) |
| Gradient checkpointing | Yes |
| Max sequence length | 2,048 tokens |
| Precision | BF16 (inherited from base model) |
| Quantisation | None applied during fine-tuning |
| Validation frequency | Every 200 steps (20 validation batches) |
| Checkpoints saved | Every 200 steps |
Evaluation
Validation loss was monitored during training at 200-step intervals. No formal held-out test
evaluation was run (test: false in training config). No published benchmark results exist for
this adapter.
Informal evaluation was conducted as part of the LocalMedAI application development pipeline,
testing structured output fidelity against known laboratory reference values across EN, DE, and
FR terminology. Results from this evaluation are not yet formalised or published.
Formal evaluation is pending. This section will be updated when results are available.
Limitations, Risks, and Biases
- No clinical validation. This model has not been evaluated in a clinical setting, against
clinical outcomes, or against a patient cohort. Accuracy on any given lab report is unknown.
- Training distribution unknown until data provenance is confirmed (see above).
- Language coverage is uneven. DE and FR terminology coverage reflects what was present in
training data; EN is expected to be the strongest supported language.
- Reference range variability. Laboratory reference ranges vary by analyser, reagent, age,
sex, and population. The model does not account for all sources of this variation.
- Structured output brittleness. As a generative model, outputs can be malformed or
hallucinated. All outputs in the LocalMedAI application are subject to downstream validation.
- Base model limitations. Gemma 3n E2B is a small model (2B effective parameters). It
carries all limitations of the base model including potential factual errors, particularly
outside its training distribution.
LocalMedAI Context
This adapter was built for
LocalMedAI, a personal
health intelligence platform designed around a privacy-first, on-device-first architecture for iOS.
Key design principles:
- On-device by default. The on-device inference path (this model, running via MLX) is the
primary architecture, not a fallback. No health data leaves the device unless the user
explicitly consents to the frontier AI pathway.
- Biomarker coverage. The surrounding application covers 272 biomarkers, 120 cross-marker
patterns, and 141 clinical severity thresholds across EN, DE, and FR.
- Document ingestion. Paired with a custom 3-tier PDF extraction pipeline
(PDFKit → CGPDFScanner with font-encoding resolution → Vision OCR) to handle complex and
non-standard lab report formats.
Citation
No formal citation exists for this work at this time.
Model card written by the author. Last updated: 2026-08-10.