You need to agree to share your Hugging Face information to access this model

This repository is publicly accessible, but you have to accept the conditions to access its files and content.

Log in or Sign Up to review the conditions and access this model content.

MedExtractor EU (test build)

Schema-conditioned information extraction for clinical text. You pass a document and a list of fields (name, type, description); one forward pass returns, for every field, the exact text span(s) from the document or nothing. Built on Gemma 4 E2B used as a bidirectional encoder, tuned for European languages with a focus on Polish hospital documentation.

Private test build: one training seed, not a release.

Usage

import torch
from transformers import AutoModel

model = AutoModel.from_pretrained("lion-ai/medextractor-eu-test", trust_remote_code=True, dtype=torch.bfloat16).cuda()  # or .to("mps")

note = """Pacjentka w stanie og贸lnym 艣rednim, w pe艂nym kontakcie s艂owno-logicznym. BP 128/76mmHg, HR 102/min, Sat. 96% bez tlenoterapii.
W nocy gor膮czka do 38,3. Brzuch niebolesny, perystaltyka s艂yszalna. CRP 98-->121.3. W艂膮czono fosfomycyn臋."""

fields = [
    ("cisnienie_tetnicze", "text", "warto艣膰 ci艣nienia t臋tniczego"),
    ("tetno", "text", "cz臋sto艣膰 akcji serca (t臋tno)"),
    ("temperatura", "list[text]", "zmierzone warto艣ci temperatury cia艂a"),
    ("badanie_brzucha", "text", "opis badania brzucha, ca艂y zapis"),
    ("leki_w_szpitalu", "list[text]", "leki podane lub w艂膮czone w trakcie hospitalizacji (nazwy lek贸w)"),
    ("alergie", "list[text]", "substancje, na kt贸re pacjent jest uczulony"),
]
print(model.extract(note, fields))
# with character offsets and scores: model.extract(note, fields, with_spans=True)
  • Field types: text, number, date, duration and list[...] of those. Scalar fields return a string or None; list fields return a list.
  • The description decides what is returned: say "ca艂y zapis" (whole entry) or "sama warto艣膰" (value only), "nie zaprzeczenia" (no negations), "przed przyj臋ciem" / "przy wypisie".
  • Up to 32 fields and 8192 tokens (document plus schema) per call; extract accepts a list of documents. A field asked as text returns one piece of evidence; ask list[text] to get every mention.
  • Thresholds: null_threshold and list_threshold (defaults in config.json, calibrated on development data) can be passed to extract; a lower null_threshold fills fewer scalar fields. For presence decisions use with_spans=True and 1 - p_null.
  • Apple silicon (MPS): dtype=torch.bfloat16 works and is about 3x faster than float32 (same decisions in an external test); on CPU use dtype=torch.float32.

Model details

Base Gemma 4 E2B (text model, bidirectional attention mask)
Parameters 4.6B stored (2.8B embedding tables), 1.9B computed per token
Requires transformers >= 5.0 with Gemma 4 support, trust_remote_code=True

Development results

Set Metric Score
Out-of-distribution field accuracy (dev) exact span 94.1
List fields, in-distribution dev F1 79.8
Open-schema clinical notes, field families not in training (EN / PL) exact or overlapping span 71.3 / 72.6
Zero-shot biomedical NER, two suites of unseen corpora (EN) strict F1 57.8 / 60.3
Polish real-style notes (15 documents, 25 fields each) strict F1 / false fills on empty fields 0.91 / 0.4%
Admission-audit style schema on the same notes (presence of evidence, one threshold for all fields) accuracy / F1 98.0% / 0.90

The Polish real-style sets guided data design, so their scores are development numbers.

Limitations

Test build from a single seed. Polish hospital style is learned from synthetic notes; other languages rely on public clinical corpora. Extraction only: the model copies spans and does not normalise or infer values. Not a medical device.

Downloads last month
8
Safetensors
Model size
5B params
Tensor type
BF16
路
Inference Providers NEW
This model isn't deployed by any Inference Provider. 馃檵 Ask for provider support

Model tree for lion-ai/medextractor-eu-test

Finetuned
(527)
this model