[KongchangAI]
· 2 min read· 1,034 words

BERT vs Open-Source LLMs: A Fine-Grained Comparison for Japanese Clinical NER

BERT vs Open-Source LLMs: A Fine-Grained Comparison for Japanese Clinical NER

Controlled comparison: zero-shot LLMs far underperform BERT, but ≥13B models fine-tuned with QLoRA and sufficient output limits can surpass BERT-CRF.

This paper systematically compares BERT-CRF with nine open-source LLMs on 113-class fine-grained Japanese clinical NER. Under zero-shot prompting, the highest relaxed F1 for LLMs is only 0.337, far below BERT's 0.836–0.841, and JSON Schema constraints bring almost no improvement. After QLoRA fine-tuning, all LLMs with ≥13B total parameters surpass BERT under larger output token limits, with relaxed F1 reaching 0.882–0.914. Output limits significantly affect results: increasing the limit raises relaxed F1 by an average of 0.052–0.085 and reduces recall loss caused by truncation. Medically specialized models show no consistent advantage. The conclusion is that fine-tuned open-source large models can replace BERT-CRF, but two prerequisites must be met: parameter scale and output capacity.

Introduction

In clinical natural language processing, named entity recognition (NER) is a key step for extracting structured information. Traditional approaches rely on encoder models (such as BERT) combined with conditional random fields (CRF), while the rise of generative large language models (LLMs) offers a new angle on this task. However, there remains a lack of systematic evaluation of how well LLMs perform on fine-grained Japanese clinical extraction tasks and how generation settings affect their performance. A recent paper conducted a controlled comparison on this topic, providing an important reference for practitioners.

rss source: Fine-Grained Japanese Clinical Named Entity Recognition: A Controlled Comparison of BERT and Open-We

Named Entity Recognition (NER) and Conditional Random Fields (CRF)
NER aims to identify entity mentions of predefined categories (such as diseases, drugs, symptoms) from unstructured text. In clinical text, entity boundaries are often ambiguous, nesting is frequent, and there are numerous abbreviations and variants. The traditional approach uses encoders like BERT to output contextual representations for each token, then feeds them into a CRF layer that models transition constraints between adjacent labels (e.g., "I-disease" cannot immediately follow "O"), thereby ensuring the global validity of the label sequence. The introduction of CRF significantly improves boundary consistency in sequence labeling, which is a key reason why BERT-CRF has become a strong baseline for clinical NER.

Generative Large Language Models and Zero-Shot Prompting
Generative LLMs (such as the Llama and Qwen series) treat NER as a text generation task: given a prompt, the model directly outputs structured text containing entities and their categories (e.g., JSON). Zero-shot prompting provides no task examples and relies solely on instructions to describe the task; its performance depends heavily on the model's prior understanding of the task format and domain knowledge. Since fine-grained clinical Japanese entity categories number as many as 113, zero-shot prompting makes it difficult for models to accurately recall all category definitions and boundary rules, resulting in performance far below supervised fine-tuned encoder models.

Experimental Design: iCorpus and 113 Entity Classes

The study is based on the iCorpus dataset, which defines 113 entity categories covering fine-grained information in Japanese clinical case reports. The training set contains 1,672 sentences, and the test set consists of 433 sentences from 36 documents. The comparison targets include two fine-tuned BERT-CRF baselines and nine open-weight LLMs (ranging from billions to tens of billions of parameters). Evaluation metrics are sentence-level relaxed label-surface matching F1 and exact surface F1.

LLMs are evaluated under two settings: zero-shot prompting (with and without JSON Schema constraints) and three-seed QLoRA fine-tuning. Fine-tuned models are tested under different output token limits, including 900 and larger model-specific limits (2,600 or 4,096 tokens). This design aims to reveal the impact of generation capacity on performance.

Zero-Shot Performance: LLMs Far Behind BERT

Under zero-shot prompting, the highest relaxed F1 for LLMs is only 0.337, while the BERT baselines reach 0.836–0.841. This gap indicates that generative models without task fine-tuning have limited performance on fine-grained Japanese clinical NER. Even with JSON Schema constraints, zero-shot performance does not improve significantly—across seven models, relaxed F1 changes range from -0.014 to +0.008 (excluding two reasoning-oriented configurations). Output structure constraints alone cannot compensate for the lack of task knowledge.

Reversal After Fine-Tuning: Large-Parameter Models Surpass BERT

After QLoRA fine-tuning, all eight LLMs with at least 13B total parameters surpass the BERT baselines under larger output limits. Relaxed F1 reaches 0.882–0.914, and exact surface F1 is 0.840–0.880. This means that task-specific fine-tuning combined with sufficient generation capacity can significantly improve LLM extraction performance. One detail worth noting: output token limits have a major impact on comparison results—after increasing the limit, relaxed F1 improves by an average of 0.052–0.085, while recall rises and length-limited outputs decrease.

QLoRA Fine-Tuning
QLoRA is a parameter-efficient fine-tuning technique: the base model is first quantized to 4-bit to greatly reduce memory usage, then low-rank adapters (LoRA) are attached to the quantized weights, and only these small adapter parameters are updated during training. This makes it possible to fine-tune 13B–70B models on a single consumer-grade GPU while maintaining performance close to full-parameter fine-tuning. In this paper, three-seed QLoRA fine-tuning means independently training each model with three different random seeds to assess performance stability and avoid the chance effects of a single run.

Impact of Output Limits and Medical Specialization

The study further analyzes the role of output token limits. Under a 900-token limit, some LLMs suffer performance degradation due to output truncation; after relaxing to 2,600 or 4,096 tokens, performance improves noticeably. This suggests that in real deployment, generation length needs to be adjusted according to model characteristics, otherwise LLM capabilities may be underestimated.

Another interesting finding is that medically specialized models do not show a consistent advantage when compared in pairs with general models. This indicates that on the current benchmark, gains from domain pretraining may be overshadowed by fine-tuning data, or that task characteristics depend more on fine-tuning than on domain knowledge.

Relaxed F1 and Exact Surface F1
Relaxed F1 judges at the sentence level whether a predicted entity and the gold standard are "label-consistent and have overlapping surface forms" as a hit, with some tolerance for boundary deviations; exact surface F1 requires the predicted entity text to match the gold standard verbatim. Combining the two can distinguish whether a model "found the right entity but with inaccurate boundaries" or "completely failed to find it." In fine-grained clinical NER, exact surface F1 better reflects the usability of downstream structured extraction.

Conclusions and Implications

This controlled comparison conveys several key messages: for fine-grained Japanese clinical NER, fine-tuned open-source LLMs can surpass traditional BERT-CRF, but only if the model has enough parameters (≥13B) and sufficient output capacity. Zero-shot LLMs perform poorly, and JSON Schema constraints cannot replace fine-tuning. Output token limits are an important variable affecting the fairness of comparisons. These findings provide empirical evidence for technology selection in clinical NLP systems and also point out engineering details that need attention when deploying generative models.

rss source: Fine-Grained Japanese Clinical Named Entity Recognition: A Controlled Comparison of BERT and Open-We


This article is based on the abstract of a paper from an RSS source; data and conclusions are all quoted from the original text.

#Japanese clinical NER#BERT-CRF#open-source LLM#QLoRA fine-tuning#named entity recognition
Share:

Related articles