File size: 4,951 Bytes
85bff17
a48f52b
85bff17
a48f52b
 
85bff17
a48f52b
85bff17
 
a48f52b
85bff17
a48f52b
 
 
 
85bff17
 
a48f52b
 
 
 
 
 
 
 
 
 
 
 
85bff17
a48f52b
 
 
 
 
 
 
 
 
 
 
 
85bff17
8a836aa
 
a48f52b
1053fbd
a48f52b
 
8a836aa
 
a48f52b
8a836aa
a48f52b
 
 
 
8a836aa
 
a48f52b
 
8a836aa
 
a48f52b
b54c636
a48f52b
 
8a836aa
b54c636
a48f52b
 
 
 
 
 
 
 
 
 
 
 
 
8a836aa
 
 
 
a48f52b
 
8a836aa
a48f52b
 
 
 
 
 
 
 
 
 
8a836aa
 
1053fbd
85bff17
a48f52b
 
1053fbd
a48f52b
 
85bff17
a48f52b
85bff17
a48f52b
 
85bff17
a48f52b
 
 
 
85bff17
a48f52b
85bff17
a48f52b
85bff17
a48f52b
85bff17
a48f52b
 
 
 
 
 
 
 
 
 
 
 
 
1053fbd
a48f52b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
---
library_name: openmed
license: apache-2.0
language:
- en
pipeline_tag: token-classification
base_model: OpenMed/OpenMed-NER-DNADetect-BigMed-278M
tags:
- openmed
- onnx
- medical-nlp
- medical-ner
- android
- webassembly
- webgpu
---

<div align="center">
<img src="https://raw.githubusercontent.com/maziyarpanahi/openmed/master/docs/brand/openmed-mascot-lockup.png" alt="OpenMed: on-device clinical AI" width="360">

# OpenMed DNA NER 278M

`OpenMed/OpenMed-NER-DNADetect-BigMed-278M-v1-onnx-android`

**A 278M XLM-RoBERTa model for extracting DNA and gene mentions in English clinical and biomedical text.**  
Runs locally after download on Python CPU, in the browser, and on Android.

[OpenMed](https://github.com/maziyarpanahi/openmed) | [Documentation](https://openmed.life/docs) | [Model collection](https://huggingface.co/OpenMed) | [Paper](https://arxiv.org/abs/2508.01630)
</div>

## Model

| Field | Value |
|---|---|
| Task | DNA named-entity recognition |
| Language | English |
| Architecture | XLM-RoBERTa |
| Parameters | 278M (278,000,000) |
| Maximum sequence length | 512 tokens |
| Entity labels | `DNA`, `RNA`, `cell_line`, `cell_type`, `protein` |
| Source model | [`OpenMed/OpenMed-NER-DNADetect-BigMed-278M`](https://huggingface.co/OpenMed/OpenMed-NER-DNADetect-BigMed-278M) |
| License | apache-2.0 |

## OpenMed in Python on CPU

```bash
pip install --upgrade "openmed[onnx-runtime]"
```

```python
from openmed import OnnxModel

model = OnnxModel.from_pretrained("OpenMed/OpenMed-NER-DNADetect-BigMed-278M-v1-onnx-android")
entities = model("A BRCA1 mutation was detected in the tumor sample.")

for entity in entities:
    print(entity.to_dict())
```

OpenMed selects the CPU-oriented INT8 graph by default and returns labels, confidence scores, exact character offsets, and source text.

## OpenMed in Web

```bash
npm install openmed @huggingface/transformers onnxruntime-web
```

```typescript
import { loadOnnxModel } from "openmed";

const repo = "OpenMed/OpenMed-NER-DNADetect-BigMed-278M-v1-onnx-android";
const model = await loadOnnxModel(repo);
const entities = await model("A BRCA1 mutation was detected in the tumor sample.");
```

The default INT8 path runs with WebAssembly. For WebGPU, select the FP16 graph:

```typescript
const model = await loadOnnxModel(repo, {
  variant: "fp16",
  device: "webgpu",
});
```

## OpenMedKit for Android

Add JitPack to the consumer application's `settings.gradle.kts`:

```kotlin
dependencyResolutionManagement {
    repositories {
        google()
        mavenCentral()
        maven {
            url = uri("https://jitpack.io")
            content { includeGroup("com.github.maziyarpanahi") }
        }
    }
}
```

Use the latest OpenMed build from the `master` branch:

```kotlin
dependencies {
    implementation("com.github.maziyarpanahi:openmed:master-SNAPSHOT")
}
```

After downloading this model repository into an app-controlled directory:

```kotlin
import com.openmed.openmedkit.OpenMedKit

OpenMedKit.fromDirectory(modelDirectory).use { model ->
    val entities = model.analyzeText("A BRCA1 mutation was detected in the tumor sample.")
}
```

Inference and tokenization remain on-device.

## Included Artifacts

| Artifact | Recommended use |
|---|---|
| `model_int8.onnx` | CPU, WebAssembly, and Android default |
| `model_fp16.onnx` | WebGPU and compatible accelerated runtimes |
| `model.onnx` | Full-precision reference |
| `model.ort` | Custom ONNX Runtime Mobile integration |
| `tokenizer.json` | Cross-platform tokenizer |
| `openmed-onnx.json` | Runtime contract and operator metadata |

All graphs use opset 18, dynamic batch and sequence axes, stable tensor names, and source-text offset metadata.

## The OpenMed Ecosystem

This model is part of **OpenMed**, an Apache-2.0, local-first clinical AI stack:

- **2,000+ medical models** for clinical NER, biomedical extraction, and privacy.
- **PII detection and de-identification** across 55+ identifier types and 17 languages.
- **Python, MLX, Swift, Android, React Native, Web, REST, and gRPC** runtimes.
- **Structured and multimodal intake** for OCR, documents, DICOM, FHIR, and HL7.
- **Offline and air-gapped deployment** with no telemetry by default.

## Intended Use and Limitations

This model is intended for extracting DNA and gene mentions. It does not diagnose conditions or make clinical decisions. Evaluate recall, thresholds, and span behavior on appropriately governed data before deployment. Local execution supports privacy-preserving workflows but does not by itself guarantee regulatory compliance.

All examples in this card are synthetic.

## Citation

```bibtex
@misc{panahi2025openmedneropensourcedomainadapted,
  title={OpenMed NER: Open-Source, Domain-Adapted State-of-the-Art
         Transformers for Biomedical NER Across 12 Public Datasets},
  author={Maziyar Panahi},
  year={2025},
  eprint={2508.01630},
  archivePrefix={arXiv},
  primaryClass={cs.CL}
}
```