bc5cdr-ner-gemma-4-E2B-it

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

For reproducing results, refer to this GitHub repository (TBD).

Getting Started

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/bc5cdr-ner-gemma-4-E2B-it")
processor = AutoProcessor.from_pretrained("jeffwuu32/bc5cdr-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 Chemical or Disease 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>` Chemical or `<unused4>` Disease. 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.692 0.733 0.712
macro 0.688 0.728 0.707
  Chemical 0.721 0.779 0.749
  Disease 0.656 0.677 0.666

Positional (char-level)

category P R F1
micro 0.728 0.771 0.749
macro 0.728 0.775 0.750
  Chemical 0.736 0.822 0.777
  Disease 0.720 0.727 0.723

Remarks

  • 4/812 (0.5%) 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

Li et al., "BioCreative V CDR task corpus: a resource for chemical disease relation extraction," Database, 2016.

Downloads last month
18
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for jeffwuu32/bc5cdr-ner-gemma-4-E2B-it

Adapter
(177)
this model