Clinical named entity recognition in the Portuguese language: a benchmark of modern BERT models and LLMs
Authors: Vinicius Anjos de Almeida, Sandro Saorin da Silva, Josimar Chire, Leonardo Vicenzi, Nícolas Henrique Borges, Helena Kociolek, Sarah Miriã de Castro Rocha, Frederico Nassif Gomes, +3 more
Organizations: Spesia, Curitiba - PR, Brazil · Faculdade de Medicina, Universidade de São Paulo, São Paulo - SP, Brazil · Pontifícia Universidade Católica do Paraná (PUCPR), Curitiba - PR, Brazil · Universidade Federal do Paraná (UFPR), Curitiba - PR, Brazil · Florida Atlantic University, Boca Raton - FL, USA
Clinical notes contain valuable unstructured information. Named entity recognition (NER) enables the automatic extraction of medical concepts; however, benchmarks for Portuguese remain scarce. In this study, we aimed to evaluate BERT-based models and large language models (LLMs) for clinical NER in Portuguese and to test strategies for addressing multilabel imbalance. We compared BioBERTpt, BERTimbau, ModernBERT, and mmBERT with LLMs such as GPT-5 and Gemini-2.5, using the public SemClinBr corpus and a private breast cancer dataset. Models were trained under identical conditions and evaluated using precision, recall, and F1-score. Iterative stratification, weighted loss, and oversampling were explored to mitigate class imbalance. The mmBERT-base model achieved the best performance (micro F1 = 0.76), outperforming all other models. Iterative stratification improved class balance and overall performance. Multilingual BERT models, particularly mmBERT, perform strongly for Portuguese clinical NER and can run locally with limited computational resources. Balanced data-splitting strategies further enhance performance.
Figures & tables
Entity
Number of records
Examples
Procedures
984
‘medicada’, ‘soroterapia’, ‘mudança de decúbito’
Disorders
979
‘sonolenta’, ‘dependente’, ‘diabetes’
Concepts & Ideas
887
‘2 dias’, ‘2 anos’
Living Beings
715
‘filho’, ‘neto’
Anatomy
705
‘calcâneo’, ‘pescoço’, ‘perna E’
Chemicals & Drugs
601
‘tazocin’, ‘ATB’, ‘cálcio’
Table 1: Number of records per entity in the SemClinBr dataset and entity examples. The UMLS semantic groups ‘Genes & Molecular Sequences’, ‘Occupations’, and ‘Geographic Areas’ were not included in this study due to the small number of examples in the dataset.
Entity
Number of records
Example (entity in bold)
ER
346
‘IHQ: RE- /RP-/Her2 3+/ gata3 +++’
HER2
343
‘IHQ: RE-/RP-/ Her2 3+ / gata3 +++’
Histological type
336
‘ adenocarcinoma pouco diferenciado associado a…’
PR
335
‘IHQ: RE-/ RP- /Her2 3+/ gata3 +++’
Surgery
296
‘ Mastectomia mama dir + EA em 2011’
Menopause status
212
‘Paciente de 51 anos, pré-menopausa ’
Table 2: Number of records per entity in the breast cancer clinical notes dataset and entity examples. ER, estrogen receptor; HER2, human epidermal growth factor receptor 2; PR, progesterone receptor; BRCA, breast cancer susceptibility gene; FISH, fluorescence in situ hybridization; CISH, chromogenic in situ hybridization; SISH, silver in situ hybridization.
Role
Prompt
system
Extract the following entities from the given clinical note in order of appearance. Use exact text for extractions. Do not paraphrase or overlap entities. The entities to extract are: {entities} . See the examples below for the expected format. # Clinical note example: {example_text} # Ideal response example: {example_response}
user
# Clinical note: {input_text}
Table 3: Prompt strategy used for entity extraction in clinical notes using LLMs. The fields defined with curly brackets were replaced by the respective entities, text and JSON object expected as the response.
Effort level
Time
Token usage
Cost
minimal
18.3
3064
9.57
low
81.4
6090
39.83
medium
115.5
10,508
84.01
Table 4: Resource usage of the gpt-5 model in each reasoning effort level. The measures of time, token usage and cost represent the average across all responses. Time is measured in seconds. Cost is estimated per 1000 responses and is presented in USD considering the pricing at November 14th, 2025. Token usage refers to the total number of tokens (prompt and completion tokens).
Model
SemClinBr
Breast cancer dataset
Macro F1-score
Micro F1-score
Macro F1-score
Micro F1-score
IO
BIO
IO
BIO
IO
BIO
IO
BIO
BioBERTpt
biobertpt-all
0.6443
0.6207
0.6830
0.6573
0.7473
0.3671
0.7602
0.6124
biobertpt-clin
0.6489
0.6470
0.6981
0.6959
0.7527
0.3982
0.7728
0.6508
biobertpt-bio
0.5839
0.5543
0.6548
0.6208
0.7268
0.3741
0.7458
0.6319
Table 5: Benchmark metrics for each model (BERT and LLMs) and each dataset. With respect to BERT models, the reported results reflect the use of weighted loss function. Iterative stratification was used to split the data. Results may vary due to stochastic processes on training, such as in weight initialization and token sampling in the case of LLMs. Specific LLMs versions: gpt-5 refers to gpt-5-2025-08-07 ; gpt-5-nano, gpt-5-nano-2025-08-07 ; gpt-5-mini, gpt-5-mini-2025-08-07 ; gpt-4.1, gpt-4.1-2025-04-14 . Gemini models are stable models and have the same name in the API. * ‘minimal’, ‘low’, ‘medium’ and ‘high’ refer to the reasoning effort. ** Inference with gpt-5 with high reasoning effort was aborted due to very long inference time and higher cost, even with optimized prompt.
Methods
Macro F1-score ( ± std)
Micro F1-score ( ± std)
SemClinBr
Random data split
0.6567 ( ± 0.0200)
0.6904 ( ± 0.0287)
IS (Iterative Stratification)
0.7139 ( ± 0.0050)
0.7646 ( ± 0.0094)
IS with weighted loss
0.6672 ( ± 0.0094)
0.6773 ( ± 0.0140)
IS with weighted loss and clamped weights
0.7118 ( ± 0.0125)
0.7604 ( ± 0.0202)
IS with OS (oversampling)
0.7154( ± 0.0117)
0.7634 ( ± 0.0073)
Table 6: Comparison of methods to deal with imbalanced classes using mmBERT-base model. For this comparison, both datasets were used with the IO data annotation scheme. Training for each data split method was repeated for 10 iterations. The mean and standard deviation (std) of the micro and macro F1-score are reported. Clamped weights, in this context, mean fixing the minimum weight for the classes at 1.0.
Figure 1: Left image: precision-recall curve using random data split. Right image: precision-recall curve using iterative stratification. The iterative stratification results in curves that better approximate the top-right corner of the plot, demonstrating better precision-recall trade-off.
Large Language Models are transforming the support for clinical decision and their application in real scenarios. Yet, most benchmarks are conducted in English, and cross-lingual evaluation is needed to tackle the language gaps in global access. We introduce ClinicalBr, the first bilingual benchmark for clinical decision built from real Brazilian case reports. The corpus contains 2,892 cases drawn from 28 SciELO medical journals, spanning 18 specialties, and is structured as parallel Portuguese-English pairs. Each case supports four evaluation tasks: diagnosis retrieval, differential diagnosis, exam recommendation, and treatment planning. We evaluate four models: MedGemma-27B, Sabiá-4, DeepSeek-R1, and o3-mini, across both languages. The central finding is that the Portuguese-English performance gap is task-dependent, not general. In diagnosis retrieval, English yields a consistent advantage across all models, with +7.5-12.1 accuracy points. This advantage disappears in differential diagnosis, exam recommendation, and treatment planning, where confidence intervals cross zero for most models and Portuguese completeness scores are marginally higher. Brazilian-endemic conditions proved easier than the full corpus, not harder, indicating that tropical presentations are adequately represented in current pre-training. Exam recommendation was the hardest task across all models and both languages, with F1 scores below 0.10, well below the differential diagnosis ceiling of 0.20-0.27.
Giordano de Pinho Souza, Glaucia Melo, Josefino Cabral Melo Lima +1
Federal University of Rio de Janeiro · Toronto Metropolitan University Toronto, CA
ClinicalEncoder26AM is a multilingual Diagnosable ColBERT for clinical and biomedical texts, which aligns at multiple levels its token-level semantic with ClinicalMap25, a clinical latent space inspired by BioLORD-2023 and enriched with synthetic and annotated supervision. The post-training recipe builds upon BGE-M3, and combines synthetic clinical notes, patient--doctor conversations, and annotated resources such as MedMentions, while considering both named-entity-level and sentence-level representations in a multi-adapter distillation, along with a ColBERT-style retrieval objective. In this system demonstration paper, we evaluate the model in the MultiClinNER shared task by finetuning it as a BIO tagger for patient symptoms, disorders, and procedure spans, using a lightweight two-layer CNN head to improve local boundary detection. The resulting system remains simple, processes most documents in a single 8192-token window, and achieves state-of-the-art multilingual entity recall, while achieving Top 5 overall across all entity types and languages in Character-weighted F1 scores. Training curves further show that ClinicalEncoder26AM is markedly more data-efficient than the base M3 model, supporting the usefulness of its clinical post-training for downstream information extraction. The model can be downloaded on https://huggingface.co/Parallia/ClinicalEncoder26AM-Diagnosable-Colbert-L2-for-multilingual-medical-texts
High-quality corpora are essential for advancing Natural Language Processing (NLP) in Portuguese. Building on previous encoder-only models such as BERTimbau and Albertina PT-BR, we introduce NorBERTo, a modern encoder based on the ModernBERT architecture, featuring long-context support and efficient attention mechanisms. NorBERTo is trained on Aurora-PT, a newly curated Brazilian Portuguese corpus comprising 331 billion GPT-2 tokens collected from diverse web sources and existing multilingual datasets. We systematically benchmark NorBERTo against Strong baselines on semantic similarity, textual entailment and classification tasks using standardized datasets such as ASSIN 2 and PLUE. On PLUE, NorBERTo-large achieves the best results among the encoder models we evaluated, notably reaching 0.9191 F1 on MRPC and 0.7689 accuracy on RTE. On ASSIN 2, NorBERTo-large attains the highest entailment F1 (~0.904) among all encoders considered, although Albertina-900M and BERTimbau-large still hold an advantage. To the best of our knowledge, Aurora-PT is currently the largest openly available monolingual Portuguese corpus, surpassing previous resources. NorBERTo provides a modern, mid-sized encoder designed for realistic deployment scenarios: it is straight-forward to fine-tune, efficient to serve, and well suited as a backbone for retrieval-augmented generation and other downstream Portuguese NLP systems.
Enzo S. N. Silva, Pablo B. Costa, Raphael C. Vlasman +8
Itaú Unibanco, São Paulo, SP, Brasil · ICTi, São Paulo, SP, Brasil