CoolFace
Modelpublic

jeffwuu32/biored-ner-gemma-4-E2B-it

sourceHugging Faceupdated 12d agoView on Hugging Face
0likes73downloads
Model Card

biored-ner-gemma-4-E2B-it

LoRA adapter for NER span extraction on BioRED, fine-tuned from the open-weights google/gemma-4-E2B-it.

For reproducing results, refer to this GitHub repository.

Getting Started

python
from transformers import AutoModelForMultimodalLM, AutoProcessor
from peft import PeftModel

base = AutoModelForMultimodalLM.from_pretrained("google/gemma-4-E2B-it", device_map="auto")
model = PeftModel.from_pretrained(base, "jeffwuu32/biored-ner-gemma-4-E2B-it")
processor = AutoProcessor.from_pretrained("jeffwuu32/biored-ner-gemma-4-E2B-it")

This loads the weights only. See the repo for complete generation setup.

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)

categoryPRF1
micro0.7370.7350.736
macro0.7240.6680.687
&nbsp;&nbsp;CellLine0.7930.4600.582
&nbsp;&nbsp;ChemicalEntity0.6970.7920.741
&nbsp;&nbsp;DiseaseOrPhenotypicFeature0.6930.7550.722
&nbsp;&nbsp;GeneOrGeneProduct0.8370.7290.779
&nbsp;&nbsp;OrganismTaxon0.7830.7790.781
&nbsp;&nbsp;SequenceVariant0.5430.4940.517

Positional (char-level)

categoryPRF1
micro0.7650.7750.770
macro0.7320.6960.708
&nbsp;&nbsp;CellLine0.7010.4440.544
&nbsp;&nbsp;ChemicalEntity0.7650.8470.804
&nbsp;&nbsp;DiseaseOrPhenotypicFeature0.7680.8140.790
&nbsp;&nbsp;GeneOrGeneProduct0.8190.7390.777
&nbsp;&nbsp;OrganismTaxon0.7080.7720.738
&nbsp;&nbsp;SequenceVariant0.6290.5610.593

Remarks

  • —0/204 (0.0%) of test set generations were unparseable (no credit).
  • —Reported numbers were produced on a Colab Pro L4 GPU under this repo's default config.
  • —Expect minor result variance (usually <0.01 F1) across different environments. This is likely due to precision differences (fp16 vs bf16) -- not a reproducibility failure.

Citation

Training data: Luo et al., "BioRED: a rich biomedical relation extraction dataset," Briefings in Bioinformatics, 2022.