Image-Text-to-Text
Safetensors
MLX
openmed
cohere_compass
openmedkit
apple-silicon
ios
on-device
vision
multimodal
clinical
medical
privacy
native-resolution
conversational
4-bit precision
Instructions to use OpenMed/North-Micro-Vision-Instruct-4bit-mlx with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use OpenMed/North-Micro-Vision-Instruct-4bit-mlx with MLX:
# Make sure mlx-vlm is installed # pip install --upgrade mlx-vlm from mlx_vlm import load, generate from mlx_vlm.prompt_utils import apply_chat_template from mlx_vlm.utils import load_config # Load the model model, processor = load("OpenMed/North-Micro-Vision-Instruct-4bit-mlx") config = load_config("OpenMed/North-Micro-Vision-Instruct-4bit-mlx") # Prepare input image = ["http://images.cocodataset.org/val2017/000000039769.jpg"] prompt = "Describe this image." # Apply chat template formatted_prompt = apply_chat_template( processor, config, prompt, num_images=1 ) # Generate output output = generate(model, processor, formatted_prompt, image) print(output) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Atomic Chat
Document native OpenMed runtimes
Browse files- README.md +155 -146
- openmed-mlx.json +17 -5
- openmed-runtime-validation.json +83 -0
README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
---
|
| 2 |
-
library_name:
|
| 3 |
license: apache-2.0
|
| 4 |
pipeline_tag: image-text-to-text
|
| 5 |
base_model: CohereLabs/North-Micro-Vision-Instruct
|
|
@@ -17,10 +17,10 @@ language:
|
|
| 17 |
- ar
|
| 18 |
tags:
|
| 19 |
- mlx
|
| 20 |
-
- mlx-vlm
|
| 21 |
- openmed
|
| 22 |
- openmedkit
|
| 23 |
- apple-silicon
|
|
|
|
| 24 |
- on-device
|
| 25 |
- vision
|
| 26 |
- multimodal
|
|
@@ -32,195 +32,202 @@ tags:
|
|
| 32 |
|
| 33 |
# North Micro Vision Instruct — OpenMed MLX family
|
| 34 |
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
future Cohere Compass runtime in [OpenMedKit](https://github.com/maziyarpanahi/openmed).
|
| 38 |
|
| 39 |
These repositories contain MLX conversions of
|
| 40 |
[`CohereLabs/North-Micro-Vision-Instruct`](https://huggingface.co/CohereLabs/North-Micro-Vision-Instruct),
|
| 41 |
-
a compact 2.4B-parameter vision-language model released
|
| 42 |
-
Apache 2.0.
|
| 43 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
|
| 45 |
## Choose a precision
|
| 46 |
|
| 47 |
| Repository | Weight payload | Intended trade-off |
|
| 48 |
| --- | ---: | --- |
|
| 49 |
-
| [`OpenMed/North-Micro-Vision-Instruct-4bit-mlx`](https://huggingface.co/OpenMed/North-Micro-Vision-Instruct-4bit-mlx) | 2.02 GiB | Smallest affine variant; validate quality on your
|
| 50 |
| [`OpenMed/North-Micro-Vision-Instruct-5bit-mlx`](https://huggingface.co/OpenMed/North-Micro-Vision-Instruct-5bit-mlx) | 2.25 GiB | Compact middle ground |
|
| 51 |
-
| [`OpenMed/North-Micro-Vision-Instruct-6bit-mlx`](https://huggingface.co/OpenMed/North-Micro-Vision-Instruct-6bit-mlx) | 2.48 GiB | Recommended first
|
| 52 |
| [`OpenMed/North-Micro-Vision-Instruct-8bit-mlx`](https://huggingface.co/OpenMed/North-Micro-Vision-Instruct-8bit-mlx) | 2.93 GiB | Higher-fidelity quantized variant |
|
| 53 |
-
| [`OpenMed/North-Micro-Vision-Instruct-bf16-mlx`](https://huggingface.co/OpenMed/North-Micro-Vision-Instruct-bf16-mlx) | 4.63 GiB | Full converted
|
| 54 |
|
| 55 |
The 4/5/6/8-bit repositories use 64-element affine weight groups. Their
|
| 56 |
vision tower remains in source precision; eligible language-model layers are
|
| 57 |
-
quantized. This
|
| 58 |
-
|
| 59 |
|
| 60 |
-
##
|
| 61 |
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
grounding, captioning, multilingual prompts, and multi-image conversations.
|
| 65 |
-
That combination maps naturally to an OpenMedKit document pipeline:
|
| 66 |
-
|
| 67 |
-
1. Capture or import a page locally on iPhone, iPad, or Mac.
|
| 68 |
-
2. Keep image normalization, OCR/VLM inference, PII handling, and structured
|
| 69 |
-
extraction on the user's device.
|
| 70 |
-
3. Validate generated fields against the source page before they enter a
|
| 71 |
-
clinical record or workflow.
|
| 72 |
-
4. Redact or pseudonymize with OpenMedKit policies before any explicitly
|
| 73 |
-
authorized export.
|
| 74 |
-
5. Never auto-trigger diagnosis, treatment, disclosure, or another
|
| 75 |
-
consequential clinical decision from model output.
|
| 76 |
-
|
| 77 |
-
OpenMedKit's design defaults remain important even when the model is local:
|
| 78 |
-
no telemetry by default, no cloud fallback for PHI, no raw clinical text in
|
| 79 |
-
logs or analytics, synthetic fixtures in committed tests, and human review for
|
| 80 |
-
consequential use.
|
| 81 |
-
|
| 82 |
-
## Runtime status: read this before using Swift
|
| 83 |
-
|
| 84 |
-
The model weights use the standard MLX-VLM artifact layout and include the
|
| 85 |
-
source tokenizer, chat template, native-resolution image processor metadata,
|
| 86 |
-
and Cohere Compass configuration. They are validated today with the pinned
|
| 87 |
-
Python MLX-VLM Compass runtime on Apple Silicon.
|
| 88 |
-
|
| 89 |
-
The released OpenMedKit Swift package does **not yet contain a native Cohere
|
| 90 |
-
Compass VLM implementation**. Do not assume that downloading one of these
|
| 91 |
-
repositories through `OpenMedModelStore` is sufficient for iOS inference.
|
| 92 |
-
These artifacts are deliberately packaged without conversion-time Python
|
| 93 |
-
dependencies so a future OpenMedKit Compass loader can consume the same weight
|
| 94 |
-
payloads, but native Swift/iOS support must still land and pass physical-device
|
| 95 |
-
memory, thermal, image, and text parity gates.
|
| 96 |
-
|
| 97 |
-
Until that runtime ships, use MLX-VLM on an Apple Silicon Mac for the model
|
| 98 |
-
itself. OpenMedKit can still own capture, privacy policy, redaction, structured
|
| 99 |
-
validation, and the surrounding app workflow. Do not send raw PHI from an iOS
|
| 100 |
-
device to a Mac or service unless the user and deployment policy explicitly
|
| 101 |
-
authorize that transfer.
|
| 102 |
-
|
| 103 |
-
## Install the validated MLX runtime
|
| 104 |
-
|
| 105 |
-
Cohere Compass support is pinned to the exact MLX-VLM port used for conversion
|
| 106 |
-
and validation:
|
| 107 |
|
| 108 |
```bash
|
| 109 |
python -m pip install -U \
|
| 110 |
-
"git+https://github.com/
|
| 111 |
```
|
| 112 |
|
| 113 |
-
|
| 114 |
-
from that commit, and Transformers 5.15.0. Once Cohere Compass support is in a
|
| 115 |
-
released MLX-VLM package, a normal `pip install -U mlx-vlm` can replace the
|
| 116 |
-
commit pin after you rerun your own parity tests.
|
| 117 |
-
|
| 118 |
-
## Image + text example
|
| 119 |
|
| 120 |
```python
|
| 121 |
-
from
|
| 122 |
|
| 123 |
-
|
| 124 |
-
|
|
|
|
| 125 |
|
| 126 |
-
|
| 127 |
-
processor,
|
| 128 |
-
model.config,
|
| 129 |
"Read this synthetic document and list the visible medication and dose.",
|
| 130 |
-
num_images=1,
|
| 131 |
-
)
|
| 132 |
-
result = generate(
|
| 133 |
-
model,
|
| 134 |
-
processor,
|
| 135 |
-
prompt,
|
| 136 |
image="synthetic-clinical-note.png",
|
| 137 |
max_tokens=128,
|
| 138 |
-
temperature=0.0,
|
| 139 |
)
|
|
|
|
| 140 |
print(result.text)
|
|
|
|
| 141 |
```
|
| 142 |
|
| 143 |
-
|
| 144 |
-
clinical app, treat both the image and generated text as sensitive until the
|
| 145 |
-
OpenMedKit privacy policy has been applied.
|
| 146 |
-
|
| 147 |
-
## Text-only example
|
| 148 |
|
| 149 |
```python
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
"OpenMed/North-Micro-Vision-Instruct-6bit-mlx"
|
| 154 |
-
)
|
| 155 |
-
prompt = apply_chat_template(
|
| 156 |
-
processor,
|
| 157 |
-
model.config,
|
| 158 |
-
"Explain in one sentence why local processing can improve document privacy.",
|
| 159 |
-
num_images=0,
|
| 160 |
)
|
| 161 |
-
result = generate(
|
| 162 |
-
model,
|
| 163 |
-
processor,
|
| 164 |
-
prompt,
|
| 165 |
-
max_tokens=80,
|
| 166 |
-
temperature=0.0,
|
| 167 |
-
)
|
| 168 |
-
print(result.text)
|
| 169 |
```
|
| 170 |
|
| 171 |
-
|
| 172 |
-
|
|
|
|
|
|
|
| 173 |
|
| 174 |
-
##
|
| 175 |
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
|
| 179 |
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
|
| 188 |
|
| 189 |
-
|
| 190 |
|
| 191 |
-
|
|
|
|
| 192 |
|
| 193 |
-
|
| 194 |
-
|
|
|
|
| 195 |
|
| 196 |
-
|
| 197 |
-
|
| 198 |
-
|
| 199 |
-
|
| 200 |
-
|
| 201 |
-
- model type, processor assets, quantization metadata, and weight-size checks;
|
| 202 |
-
- bf16 SHA-256 payload parity with an independently published Cohere-linked
|
| 203 |
-
conversion made from the same pinned source and runtime port;
|
| 204 |
-
- quantized payload-size parity plus an explicit nonzero token-embedding gate
|
| 205 |
-
(whole-file hashes are recorded but are not treated as a correctness proxy).
|
| 206 |
|
| 207 |
-
|
| 208 |
-
|
| 209 |
-
|
| 210 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 211 |
|
| 212 |
-
|
|
|
|
|
|
|
| 213 |
|
| 214 |
-
The
|
| 215 |
-
|
| 216 |
-
|
| 217 |
-
|
| 218 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 219 |
|
| 220 |
The source model is not a reasoning model, has limited math and code ability,
|
| 221 |
-
does not support tool calling
|
| 222 |
-
|
| 223 |
-
|
|
|
|
| 224 |
|
| 225 |
This model and OpenMedKit are not medical devices. Outputs can be incomplete,
|
| 226 |
incorrect, or fabricated. A qualified human must verify consequential use.
|
|
@@ -229,11 +236,13 @@ incorrect, or fabricated. A qualified human must verify consequential use.
|
|
| 229 |
|
| 230 |
- Source: [`CohereLabs/North-Micro-Vision-Instruct`](https://huggingface.co/CohereLabs/North-Micro-Vision-Instruct)
|
| 231 |
- Pinned source revision: `373bda96ac70bf89f99f7048f420cf00dc07c149`
|
| 232 |
-
- MLX-VLM Compass port: [`dd79a5d8caf3edafd6fa9e6326d7ce4977ddcbfc`](https://github.com/Blaizzy/mlx-vlm/commit/dd79a5d8caf3edafd6fa9e6326d7ce4977ddcbfc)
|
| 233 |
- OpenMed / OpenMedKit: [github.com/maziyarpanahi/openmed](https://github.com/maziyarpanahi/openmed)
|
|
|
|
|
|
|
| 234 |
|
| 235 |
-
Thank you to Cohere for releasing North Micro Vision and to
|
| 236 |
-
|
|
|
|
| 237 |
|
| 238 |
The converted weights retain the source model's Apache 2.0 license. OpenMed's
|
| 239 |
SDK source is separately licensed under Apache 2.0.
|
|
|
|
| 1 |
---
|
| 2 |
+
library_name: openmed
|
| 3 |
license: apache-2.0
|
| 4 |
pipeline_tag: image-text-to-text
|
| 5 |
base_model: CohereLabs/North-Micro-Vision-Instruct
|
|
|
|
| 17 |
- ar
|
| 18 |
tags:
|
| 19 |
- mlx
|
|
|
|
| 20 |
- openmed
|
| 21 |
- openmedkit
|
| 22 |
- apple-silicon
|
| 23 |
+
- ios
|
| 24 |
- on-device
|
| 25 |
- vision
|
| 26 |
- multimodal
|
|
|
|
| 32 |
|
| 33 |
# North Micro Vision Instruct — OpenMed MLX family
|
| 34 |
|
| 35 |
+
Native OpenMed and OpenMedKit vision-language inference for Apple Silicon,
|
| 36 |
+
including local clinical-document and chart workflows on Mac, iPhone, and iPad.
|
|
|
|
| 37 |
|
| 38 |
These repositories contain MLX conversions of
|
| 39 |
[`CohereLabs/North-Micro-Vision-Instruct`](https://huggingface.co/CohereLabs/North-Micro-Vision-Instruct),
|
| 40 |
+
a compact 2.4B-parameter Cohere Compass vision-language model released under
|
| 41 |
+
Apache 2.0. OpenMed owns the Python and Swift runtime paths described here; no
|
| 42 |
+
`mlx-vlm` installation or model-repository Python code is required for use.
|
| 43 |
+
|
| 44 |
+
The same byte-identical README is published across all five precision
|
| 45 |
+
variants. The repository name, `config.json`, and `openmed-mlx.json` identify
|
| 46 |
+
the precision.
|
| 47 |
|
| 48 |
## Choose a precision
|
| 49 |
|
| 50 |
| Repository | Weight payload | Intended trade-off |
|
| 51 |
| --- | ---: | --- |
|
| 52 |
+
| [`OpenMed/North-Micro-Vision-Instruct-4bit-mlx`](https://huggingface.co/OpenMed/North-Micro-Vision-Instruct-4bit-mlx) | 2.02 GiB | Smallest affine variant; validate quality on your document set |
|
| 53 |
| [`OpenMed/North-Micro-Vision-Instruct-5bit-mlx`](https://huggingface.co/OpenMed/North-Micro-Vision-Instruct-5bit-mlx) | 2.25 GiB | Compact middle ground |
|
| 54 |
+
| [`OpenMed/North-Micro-Vision-Instruct-6bit-mlx`](https://huggingface.co/OpenMed/North-Micro-Vision-Instruct-6bit-mlx) | 2.48 GiB | Recommended first quality/size trial |
|
| 55 |
| [`OpenMed/North-Micro-Vision-Instruct-8bit-mlx`](https://huggingface.co/OpenMed/North-Micro-Vision-Instruct-8bit-mlx) | 2.93 GiB | Higher-fidelity quantized variant |
|
| 56 |
+
| [`OpenMed/North-Micro-Vision-Instruct-bf16-mlx`](https://huggingface.co/OpenMed/North-Micro-Vision-Instruct-bf16-mlx) | 4.63 GiB | Full converted-precision reference |
|
| 57 |
|
| 58 |
The 4/5/6/8-bit repositories use 64-element affine weight groups. Their
|
| 59 |
vision tower remains in source precision; eligible language-model layers are
|
| 60 |
+
quantized. This preserves the source visual encoder for OCR and document work
|
| 61 |
+
while reducing the decoder footprint.
|
| 62 |
|
| 63 |
+
## Python through OpenMed
|
| 64 |
|
| 65 |
+
Install an OpenMed revision that contains the native Compass runtime. Until the
|
| 66 |
+
linked implementation PR is merged and released, install its tested branch:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 67 |
|
| 68 |
```bash
|
| 69 |
python -m pip install -U \
|
| 70 |
+
"openmed[mlx] @ git+https://github.com/maziyarpanahi/openmed.git@feature/cohere-compass-runtime"
|
| 71 |
```
|
| 72 |
|
| 73 |
+
Image plus text:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 74 |
|
| 75 |
```python
|
| 76 |
+
from openmed.mlx import OpenMedMLXVisionLanguageModel
|
| 77 |
|
| 78 |
+
model = OpenMedMLXVisionLanguageModel(
|
| 79 |
+
"OpenMed/North-Micro-Vision-Instruct-6bit-mlx"
|
| 80 |
+
)
|
| 81 |
|
| 82 |
+
result = model.generate_with_metadata(
|
|
|
|
|
|
|
| 83 |
"Read this synthetic document and list the visible medication and dose.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
image="synthetic-clinical-note.png",
|
| 85 |
max_tokens=128,
|
|
|
|
| 86 |
)
|
| 87 |
+
|
| 88 |
print(result.text)
|
| 89 |
+
print(result.prompt_tokens, result.generation_tokens)
|
| 90 |
```
|
| 91 |
|
| 92 |
+
Text-only generation uses the same loaded model:
|
|
|
|
|
|
|
|
|
|
|
|
|
| 93 |
|
| 94 |
```python
|
| 95 |
+
response = model.generate(
|
| 96 |
+
"Explain why local processing can improve clinical-document privacy.",
|
| 97 |
+
max_tokens=96,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 98 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 99 |
```
|
| 100 |
|
| 101 |
+
Pass a local artifact directory instead of the Hub repository ID for a fully
|
| 102 |
+
offline deployment. OpenMed validates the Compass artifact, loads weights
|
| 103 |
+
strictly, applies the bundled chat template, performs native-resolution image
|
| 104 |
+
processing, and generates with MLX. It never enables remote model code.
|
| 105 |
|
| 106 |
+
## Swift and iOS through OpenMedKit
|
| 107 |
|
| 108 |
+
OpenMedKit implements Cohere Compass directly in Swift on MLX. Add the tested
|
| 109 |
+
OpenMed branch until the implementation is merged and included in a tagged
|
| 110 |
+
release:
|
| 111 |
|
| 112 |
+
```swift
|
| 113 |
+
dependencies: [
|
| 114 |
+
.package(
|
| 115 |
+
url: "https://github.com/maziyarpanahi/openmed.git",
|
| 116 |
+
branch: "feature/cohere-compass-runtime"
|
| 117 |
+
),
|
| 118 |
+
]
|
| 119 |
+
```
|
| 120 |
|
| 121 |
+
Load from Hugging Face and ask a question about a local image:
|
| 122 |
|
| 123 |
+
```swift
|
| 124 |
+
import OpenMedKit
|
| 125 |
|
| 126 |
+
let model = try await OpenMedVisionLanguageModel.load(
|
| 127 |
+
modelID: "OpenMed/North-Micro-Vision-Instruct-6bit-mlx"
|
| 128 |
+
)
|
| 129 |
|
| 130 |
+
let result = try await model.generate(
|
| 131 |
+
"List the visible medication and dose.",
|
| 132 |
+
imageURL: clinicalDocumentURL,
|
| 133 |
+
maxTokens: 128
|
| 134 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 135 |
|
| 136 |
+
print(result.text)
|
| 137 |
+
```
|
| 138 |
+
|
| 139 |
+
For a bundled, app-managed, or air-gapped artifact:
|
| 140 |
+
|
| 141 |
+
```swift
|
| 142 |
+
let model = try await OpenMedVisionLanguageModel.load(
|
| 143 |
+
modelDirectory: localModelDirectory
|
| 144 |
+
)
|
| 145 |
+
```
|
| 146 |
|
| 147 |
+
`OpenMedVisionLanguageGeneration` exposes decoded text, generated token IDs,
|
| 148 |
+
prompt/generation token counts, and timing. Overloads support text-only input,
|
| 149 |
+
`CIImage`, a local image URL, or multiple `UserInput.Image` values.
|
| 150 |
|
| 151 |
+
The initial Hub download is a network operation. Prompt and image inference is
|
| 152 |
+
local after the artifact is cached, with no telemetry and no cloud inference
|
| 153 |
+
fallback. For PHI workflows, pre-download or bundle the model before intake,
|
| 154 |
+
keep raw documents out of logs and analytics, and apply OpenMedKit privacy
|
| 155 |
+
policies before an explicitly authorized export.
|
| 156 |
+
|
| 157 |
+
Implementation and review status: [OpenMed PR #2885](https://github.com/maziyarpanahi/openmed/pull/2885)
|
| 158 |
+
|
| 159 |
+
## Why this model fits OpenMedKit
|
| 160 |
+
|
| 161 |
+
North Micro Vision accepts interleaved text and images, preserves native image
|
| 162 |
+
aspect ratios, and was trained for OCR, document understanding, charts,
|
| 163 |
+
grounding, captioning, multilingual prompts, and multi-image conversations.
|
| 164 |
+
That maps naturally to a privacy-first OpenMedKit pipeline:
|
| 165 |
+
|
| 166 |
+
1. Capture or import a page locally on iPhone, iPad, or Mac.
|
| 167 |
+
2. Run image normalization and VLM inference on the device.
|
| 168 |
+
3. Validate names, identifiers, medications, measurements, and other generated
|
| 169 |
+
fields against the source page.
|
| 170 |
+
4. Redact or pseudonymize with OpenMedKit policies before any authorized
|
| 171 |
+
disclosure.
|
| 172 |
+
5. Preserve provenance and require human review before consequential use.
|
| 173 |
+
|
| 174 |
+
Local inference reduces a network boundary; it does not make generated content
|
| 175 |
+
automatically safe or correct. Never auto-trigger diagnosis, treatment,
|
| 176 |
+
disclosure, or another consequential clinical action from model output.
|
| 177 |
+
|
| 178 |
+
## OpenMed runtime validation
|
| 179 |
+
|
| 180 |
+
Before the runtime and cards were published, every precision was loaded
|
| 181 |
+
independently and run through the same synthetic suite in both native runtimes:
|
| 182 |
+
|
| 183 |
+
- Python: `OpenMedMLXVisionLanguageModel`, strict safetensors loading;
|
| 184 |
+
- Swift: `OpenMedVisionLanguageModel` in an Xcode Metal-backed test bundle;
|
| 185 |
+
- coherent deterministic text-only privacy explanation;
|
| 186 |
+
- exact `Tuesday` extraction from a short synthetic note;
|
| 187 |
+
- correct name, synthetic record ID, medication, dose, frequency, and allergy
|
| 188 |
+
extraction from a generated clinical-document image;
|
| 189 |
+
- exact `Screening, 42` extraction from a generated chart image;
|
| 190 |
+
- tokenizer/chat-template and prompt-token-count parity;
|
| 191 |
+
- native image resize, patch-grid, visual-token, and multimodal decode checks;
|
| 192 |
+
- macOS execution for all five payloads and an iOS device-target build gate.
|
| 193 |
+
|
| 194 |
+
The Python and Swift tests use the same prompts, image fixtures, token counts,
|
| 195 |
+
and clinical fact acceptance criteria. Canonical fact and chart answers are
|
| 196 |
+
also token-exact. Free-form sentences can choose equivalent near-tied tokens
|
| 197 |
+
across MLX language bindings, so those are checked for coherence and required
|
| 198 |
+
facts instead of brittle punctuation or wording.
|
| 199 |
+
|
| 200 |
+
`openmed-runtime-validation.json` records the OpenMed runtime gates for this
|
| 201 |
+
variant. `openmed-validation.json` preserves the original conversion and
|
| 202 |
+
independent-reference certificate. Those fixtures are synthetic and are not
|
| 203 |
+
clinical-quality evidence.
|
| 204 |
+
|
| 205 |
+
## Artifact contract
|
| 206 |
+
|
| 207 |
+
Each repository is data-only and includes:
|
| 208 |
+
|
| 209 |
+
- `model.safetensors` plus its index;
|
| 210 |
+
- `config.json` with `model_type: cohere_compass`;
|
| 211 |
+
- tokenizer, chat-template, and generation configuration;
|
| 212 |
+
- native-resolution image processor configuration;
|
| 213 |
+
- `openmed-mlx.json` runtime/precision metadata;
|
| 214 |
+
- OpenMed conversion and native-runtime validation reports.
|
| 215 |
+
|
| 216 |
+
No conversion-time Python package or executable model code is stored in the
|
| 217 |
+
repository. Both OpenMed runtimes consume the same artifact payload.
|
| 218 |
+
|
| 219 |
+
## Scope and limitations
|
| 220 |
+
|
| 221 |
+
The source model supports visual question answering, grounding, OCR, document
|
| 222 |
+
and chart understanding, multilingual prompts, and multiple images. Cohere
|
| 223 |
+
reports multimodal training and validation up to 8K tokens; do not silently
|
| 224 |
+
claim longer multimodal reliability.
|
| 225 |
|
| 226 |
The source model is not a reasoning model, has limited math and code ability,
|
| 227 |
+
does not support tool calling, and is intended as a compact foundation for
|
| 228 |
+
prototyping and specialization. Native-resolution images can materially
|
| 229 |
+
increase memory use, latency, and thermal pressure on mobile devices. Measure
|
| 230 |
+
the exact precision, image sizes, and sustained workload on each target device.
|
| 231 |
|
| 232 |
This model and OpenMedKit are not medical devices. Outputs can be incomplete,
|
| 233 |
incorrect, or fabricated. A qualified human must verify consequential use.
|
|
|
|
| 236 |
|
| 237 |
- Source: [`CohereLabs/North-Micro-Vision-Instruct`](https://huggingface.co/CohereLabs/North-Micro-Vision-Instruct)
|
| 238 |
- Pinned source revision: `373bda96ac70bf89f99f7048f420cf00dc07c149`
|
|
|
|
| 239 |
- OpenMed / OpenMedKit: [github.com/maziyarpanahi/openmed](https://github.com/maziyarpanahi/openmed)
|
| 240 |
+
- Independent conversion reference: the Cohere Compass port contributed to
|
| 241 |
+
MLX-VLM at revision `dd79a5d8caf3edafd6fa9e6326d7ce4977ddcbfc`
|
| 242 |
|
| 243 |
+
Thank you to Cohere for releasing North Micro Vision and to the MLX and
|
| 244 |
+
MLX-VLM contributors whose prior Compass work provided a useful independent
|
| 245 |
+
reference while OpenMed implemented and tested its own Python and Swift paths.
|
| 246 |
|
| 247 |
The converted weights retain the source model's Apache 2.0 license. OpenMed's
|
| 248 |
SDK source is separately licensed under Apache 2.0.
|
openmed-mlx.json
CHANGED
|
@@ -9,9 +9,9 @@
|
|
| 9 |
},
|
| 10 |
"runtime": {
|
| 11 |
"local_only_recommended": true,
|
| 12 |
-
"
|
| 13 |
-
"
|
| 14 |
-
"
|
| 15 |
"validated_multimodal_context": 8192
|
| 16 |
},
|
| 17 |
"source_model": "CohereLabs/North-Micro-Vision-Instruct",
|
|
@@ -24,13 +24,25 @@
|
|
| 24 |
"image_clinical_document",
|
| 25 |
"image_chart"
|
| 26 |
],
|
| 27 |
-
"report": "openmed-validation.json",
|
| 28 |
"status": "passed",
|
| 29 |
"strict_weight_load": true,
|
| 30 |
-
"text_and_image": true
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
},
|
| 32 |
"weights": {
|
| 33 |
"format": "safetensors",
|
| 34 |
"path": "model.safetensors"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
}
|
| 36 |
}
|
|
|
|
| 9 |
},
|
| 10 |
"runtime": {
|
| 11 |
"local_only_recommended": true,
|
| 12 |
+
"python": "openmed.mlx.OpenMedMLXVisionLanguageModel",
|
| 13 |
+
"swift": "OpenMedKit.OpenMedVisionLanguageModel",
|
| 14 |
+
"openmed_implementation": "https://github.com/maziyarpanahi/openmed/pull/2885",
|
| 15 |
"validated_multimodal_context": 8192
|
| 16 |
},
|
| 17 |
"source_model": "CohereLabs/North-Micro-Vision-Instruct",
|
|
|
|
| 24 |
"image_clinical_document",
|
| 25 |
"image_chart"
|
| 26 |
],
|
| 27 |
+
"report": "openmed-runtime-validation.json",
|
| 28 |
"status": "passed",
|
| 29 |
"strict_weight_load": true,
|
| 30 |
+
"text_and_image": true,
|
| 31 |
+
"conversion_report": "openmed-validation.json",
|
| 32 |
+
"runtime_report": "openmed-runtime-validation.json",
|
| 33 |
+
"python": true,
|
| 34 |
+
"swift": true,
|
| 35 |
+
"ios_device_target_build": true,
|
| 36 |
+
"physical_ios_inference_run": false
|
| 37 |
},
|
| 38 |
"weights": {
|
| 39 |
"format": "safetensors",
|
| 40 |
"path": "model.safetensors"
|
| 41 |
+
},
|
| 42 |
+
"provenance": {
|
| 43 |
+
"independent_conversion_reference": {
|
| 44 |
+
"library": "mlx-vlm",
|
| 45 |
+
"revision": "dd79a5d8caf3edafd6fa9e6326d7ce4977ddcbfc"
|
| 46 |
+
}
|
| 47 |
}
|
| 48 |
}
|
openmed-runtime-validation.json
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"schema_version": 1,
|
| 3 |
+
"model_id": "OpenMed/North-Micro-Vision-Instruct-4bit-mlx",
|
| 4 |
+
"variant": "4bit",
|
| 5 |
+
"validated_at": "2026-08-14",
|
| 6 |
+
"passed": true,
|
| 7 |
+
"openmed": {
|
| 8 |
+
"implementation_pr": "https://github.com/maziyarpanahi/openmed/pull/2885",
|
| 9 |
+
"python_api": "openmed.mlx.OpenMedMLXVisionLanguageModel",
|
| 10 |
+
"swift_api": "OpenMedKit.OpenMedVisionLanguageModel"
|
| 11 |
+
},
|
| 12 |
+
"python": {
|
| 13 |
+
"passed": true,
|
| 14 |
+
"strict_weight_load": true,
|
| 15 |
+
"platform": "Apple M3 Ultra",
|
| 16 |
+
"runtime_versions": {
|
| 17 |
+
"mlx": "0.32.0",
|
| 18 |
+
"mlx-lm": "0.31.3",
|
| 19 |
+
"transformers": "5.15.0",
|
| 20 |
+
"huggingface-hub": "1.27.0",
|
| 21 |
+
"pillow": "12.3.0"
|
| 22 |
+
},
|
| 23 |
+
"test": "tests/integration/test_mlx_vlm_compass.py"
|
| 24 |
+
},
|
| 25 |
+
"swift": {
|
| 26 |
+
"passed": true,
|
| 27 |
+
"strict_weight_load": true,
|
| 28 |
+
"execution_platform": "Apple M3 Ultra, macOS 26.5.1, Xcode Metal test bundle",
|
| 29 |
+
"ios_device_target_build": true,
|
| 30 |
+
"physical_ios_inference_run": false,
|
| 31 |
+
"physical_ios_note": "No compatible physical iPhone was online for this publication run; all five payloads executed through the same Swift model and processor on Apple Silicon, and the generic iOS device target compiled successfully.",
|
| 32 |
+
"runtime_versions": {
|
| 33 |
+
"mlx-swift": "0.31.6",
|
| 34 |
+
"mlx-swift-lm": "42f08a872075fd07f9f1f40ec1a5e191e6aad86e",
|
| 35 |
+
"xcode": "26.6"
|
| 36 |
+
},
|
| 37 |
+
"test": "swift/OpenMedKit/Tests/OpenMedKitTests/OpenMedCompassTests.swift"
|
| 38 |
+
},
|
| 39 |
+
"cases": {
|
| 40 |
+
"text_privacy": {
|
| 41 |
+
"passed": true,
|
| 42 |
+
"acceptance": "one coherent sentence covering on-device locality, sensitive clinical data, and privacy risk reduction",
|
| 43 |
+
"prompt_tokens": 30
|
| 44 |
+
},
|
| 45 |
+
"text_fact_extraction": {
|
| 46 |
+
"passed": true,
|
| 47 |
+
"exact_response": "Tuesday",
|
| 48 |
+
"exact_generated_token_ids": [29445],
|
| 49 |
+
"prompt_tokens": 44
|
| 50 |
+
},
|
| 51 |
+
"image_clinical_document": {
|
| 52 |
+
"passed": true,
|
| 53 |
+
"required_facts": [
|
| 54 |
+
"Alex Rivera",
|
| 55 |
+
"SYN-2048",
|
| 56 |
+
"Metformin",
|
| 57 |
+
"500 mg",
|
| 58 |
+
"twice daily",
|
| 59 |
+
"Penicillin"
|
| 60 |
+
],
|
| 61 |
+
"prompt_tokens": 1161,
|
| 62 |
+
"fixture": "synthetic_clinical_document.png"
|
| 63 |
+
},
|
| 64 |
+
"image_chart": {
|
| 65 |
+
"passed": true,
|
| 66 |
+
"exact_response": "Screening, 42",
|
| 67 |
+
"exact_generated_token_ids": [198759, 16, 225, 3304],
|
| 68 |
+
"prompt_tokens": 1053,
|
| 69 |
+
"fixture": "synthetic_clinic_chart.png"
|
| 70 |
+
}
|
| 71 |
+
},
|
| 72 |
+
"privacy": {
|
| 73 |
+
"fixtures_are_synthetic": true,
|
| 74 |
+
"remote_model_code": false,
|
| 75 |
+
"cloud_inference_fallback": false,
|
| 76 |
+
"telemetry": false
|
| 77 |
+
},
|
| 78 |
+
"reference": {
|
| 79 |
+
"conversion_report": "openmed-validation.json",
|
| 80 |
+
"source_model": "CohereLabs/North-Micro-Vision-Instruct",
|
| 81 |
+
"source_revision": "373bda96ac70bf89f99f7048f420cf00dc07c149"
|
| 82 |
+
}
|
| 83 |
+
}
|