Instructions to use kiwiki196/biored-ner-gemma-4-E2B-it with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use kiwiki196/biored-ner-gemma-4-E2B-it with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("google/gemma-4-E2B-it") model = PeftModel.from_pretrained(base_model, "kiwiki196/biored-ner-gemma-4-E2B-it") - Notebooks
- Google Colab
- Kaggle
biored-ner-gemma-4-E2B-it
LoRA adapter for NER span extraction on BioRED, fine-tuned from google/gemma-4-E2B-it. Gemma 4 is gated -- request access on its model page before loading this adapter.
For reproducing results, refer to this GitHub repository (TBD).
Getting Started
from transformers import AutoModelForMultimodalLM, AutoTokenizer
from peft import PeftModel
base = AutoModelForMultimodalLM.from_pretrained("google/gemma-4-E2B-it", device_map="auto")
model = PeftModel.from_pretrained(base, "kiwiki196/biored-ner-gemma-4-E2B-it")
tokenizer = AutoTokenizer.from_pretrained("kiwiki196/biored-ner-gemma-4-E2B-it")
See repo for more details.
Prompt
Inference uses the following system prompt:
Extract text naming ChemicalEntity, DiseaseOrPhenotypicFeature, GeneOrGeneProduct, OrganismTaxon, SequenceVariant, or CellLine from the input. The text has positional markers already embedded (`<unused0>N<unused1>`, e.g. `<unused0>58<unused1>`) — each marker's id is arbitrary, not a reading-order count, so markers do not necessarily appear in ascending numeric order. These markers are not part of the content; never extract one as a match.
Copy each match verbatim from the input, including any irregular internal whitespace or embedded line breaks. Include negated, uncertain, and hedged mentions, but not the negation/hedging words themselves. Do not include anything outside the categories above.
Before every match, write the id of the nearest `<unused0>N<unused1>` marker before it, followed by `<unused2>` — repeat this prefix before EVERY match, even consecutive matches under the same marker; never omit or dedupe it — then the match text, then its `<CATEGORY_TOKEN>`, as `N<unused2>TEXT<CATEGORY_TOKEN>` (text first, category token last — not the other way around, and no other characters — never write markup like `<span>`). `<CATEGORY_TOKEN>` is one of: `<unused3>` ChemicalEntity, `<unused4>` DiseaseOrPhenotypicFeature, `<unused5>` GeneOrGeneProduct, `<unused6>` OrganismTaxon, `<unused7>` SequenceVariant, or `<unused8>` CellLine. Tag every occurrence separately, even repeats of the same text — do not deduplicate. Output only this, with no explanation or markdown fences.
Results
Category + text (multiset)
| category | P | R | F1 |
|---|---|---|---|
| micro | 0.730 | 0.737 | 0.733 |
| macro | 0.724 | 0.673 | 0.689 |
| CellLine | 0.786 | 0.449 | 0.571 |
| ChemicalEntity | 0.677 | 0.785 | 0.727 |
| DiseaseOrPhenotypicFeature | 0.691 | 0.749 | 0.719 |
| GeneOrGeneProduct | 0.833 | 0.732 | 0.779 |
| OrganismTaxon | 0.760 | 0.785 | 0.772 |
| SequenceVariant | 0.598 | 0.537 | 0.566 |
Positional (char-level)
| category | P | R | F1 |
|---|---|---|---|
| micro | 0.814 | 0.838 | 0.826 |
| macro | 0.731 | 0.694 | 0.704 |
| CellLine | 0.693 | 0.435 | 0.535 |
| ChemicalEntity | 0.706 | 0.839 | 0.767 |
| DiseaseOrPhenotypicFeature | 0.767 | 0.812 | 0.789 |
| GeneOrGeneProduct | 0.793 | 0.725 | 0.758 |
| OrganismTaxon | 0.683 | 0.764 | 0.721 |
| SequenceVariant | 0.746 | 0.586 | 0.656 |
Note: 2/201 (1.0%) of test set generations were unparseable (no credit).
Citation
Training data: Luo et al., "BioRED: a rich biomedical relation extraction dataset," Briefings in Bioinformatics, 2022.
- Downloads last month
- 6
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support