许可证:apache-2.0
语言:
- 英语
库名称:gliner
数据集:
- knowledgator/GLINER-multi-task-synthetic-data
- knowledgator/biomed_NER
流水线标签:token-classification
标签:
- 命名实体识别(NER)
- GLiNER
- 信息抽取
- 编码器
- 实体识别
- 生物医学
基础模型:
- microsoft/deberta-v3-base
- BAAI/bge-small-en-v1.5
评估指标:
- F1值
GLiNER-BioMed
该模型在论文《GLiNER-biomed:高效开放生物医学命名实体识别模型套件》中提出。
代码可在 https://github.com/ds4dh/GLiNER-biomed 获取。
GLiNER 是一种命名实体识别(NER)模型,能够使用双向Transformer编码器(类似BERT)识别任何实体类型。它为传统NER模型提供了实用替代方案,后者仅限于预定义实体,而大型语言模型(LLMs)尽管灵活,但在资源受限的场景中成本高昂且体积庞大。
GLiNER-biomed 是与日内瓦大学 DS4DH 合作开发的,基于GLiNER框架的专用高效开放生物医学NER模型套件。GLiNER-biomed利用从大型生成式生物医学语言模型中提取的合成标注,在生物医学实体识别任务中实现了最先进的零样本和小样本性能。
使用方法
通过pip安装官方GLiNER库:
pip install gliner -U
安装GLiNER库后,可以轻松加载GLiNER-biomed模型并执行命名实体识别:
from gliner import GLiNER
model = GLiNER.from_pretrained("Ihor/gliner-biomed-bi-base-v1.0")
text = """
患者为一名45岁男性,被诊断为2型糖尿病和高血压。
医生开具了二甲双胍500mg每日两次和赖诺普利10mg每日一次的处方。
最近的实验室检查显示HbA1c水平升高至8.2%。
"""
labels = ["疾病", "药物", "药物剂量", "用药频率", "实验室检查", "实验室检查值", "人口统计信息"]
entities = model.predict_entities(text, labels, threshold=0.5)
for entity in entities:
print(entity["text"], "=>", entity["label"])
预期输出:
45岁男性 => 人口统计信息
2型糖尿病 => 疾病
高血压 => 疾病
二甲双胍 => 药物
500mg => 药物剂量
每日两次 => 用药频率
赖诺普利 => 药物
10mg => 药物剂量
每日一次 => 用药频率
HbA1c水平 => 实验室检查
8.2% => 实验室检查值
如果有大量实体需要预嵌入,请参考以下代码片段:
labels = ["您的实体"]
texts = ["您的文本"]
entity_embeddings = model.encode_labels(labels, batch_size=8)
outputs = model.batch_predict_with_embeds(texts, entity_embeddings, labels)
基准测试
我们在8个复杂的真实数据集上测试了模型,并与其他GLiNER模型进行了比较。
加入我们的Discord
通过 Discord 加入我们的社区,获取模型相关新闻、支持与讨论。
引用
本工作
如果您使用了GLiNER-biomed模型,请引用:
@misc{yazdani2025glinerbiomedsuiteefficientmodels,
title={GLiNER-biomed: A Suite of Efficient Models for Open Biomedical Named Entity Recognition},
author={Anthony Yazdani and Ihor Stepanov and Douglas Teodoro},
year={2025},
eprint={2504.00676},
archivePrefix={arXiv},
primaryClass={cs.CL},
url={https://arxiv.org/abs/2504.00676},
}
先前工作
@misc{zaratiana2023gliner,
title={GLiNER: Generalist Model for Named Entity Recognition using Bidirectional Transformer},
author={Urchade Zaratiana and Nadi Tomeh and Pierre Holat and Thierry Charnois},
year={2023},
eprint={2311.08526},
archivePrefix={arXiv},
primaryClass={cs.CL}
}
@misc{stepanov2024gliner,
title={GLiNER multi-task: Generalist Lightweight Model for Various Information Extraction Tasks},
author={Ihor Stepanov and Mykhailo Shtopko},
year={2024},
eprint={2406.12925},
archivePrefix={arXiv},
primaryClass={id='cs.LG' full_name='Machine Learning' is_active=True alt_name=None in_archive='cs' is_general=False description='Papers on all aspects of machine learning research (supervised, unsupervised, reinforcement learning, bandit problems, and so on) including also robustness, explanation, fairness, and methodology. cs.LG is also an appropriate primary category for applications of machine learning methods.'}
}