---
title: "Developing a Clinical Language Model for Swedish: Continued"
description: "The study tests whether continuing Swedish BERT pretraining on hospital notes improves clinical text analysis and how it affects news text."
canonical: "https://research.elamur.ai/free/en/papers/lamproudis-2021-developing-clinical-language-model-swedish/"
---
Elamur: [Mova](https://md.mova.elamur.ai/free/en/) · [Parse](https://mova.elamur.ai/free/en/parse/) · [Dictionary](https://md.dictionary.elamur.ai/free/en/) · [Translate](https://md.translate.elamur.ai/free/en/) · **Research** · [Gali](https://md.gali.elamur.ai/free/en/) · [MCP](https://mcp.elamur.ai/) · [Locations](https://md.locations.elamur.ai/free/en/) · [Weather](https://md.weather.elamur.ai/free/en/)

[Elamur Research](https://md.research.elamur.ai/free/en/) · [this page in HTML](https://research.elamur.ai/free/en/papers/lamproudis-2021-developing-clinical-language-model-swedish/)

[Elamur Research](https://md.research.elamur.ai/free/en/) / [papers](https://md.research.elamur.ai/free/en/papers/) / [2021](https://md.research.elamur.ai/free/en/papers/2021/) / Developing a Clinical Language Model for Swedish: Continued Pretraining of Generic BERT with In-Domain Data

# Developing a Clinical Language Model for Swedish: Continued Pretraining of Generic BERT with In-Domain Data

Paper · 2021 · Anastasios Lamproudis, Aron Henriksson and Hercules Dalianis

**Authors:** Anastasios Lamproudis, Aron Henriksson and [Hercules Dalianis](https://md.research.elamur.ai/free/en/authors/hercules-dalianis/) · **Year:** 2021 · **Venue:** Proceedings of the International Conference on Recent Advances in Natural Language Processing (RANLP 2021) · **Licence:** [CC BY 4.0 (ACL Anthology)](https://creativecommons.org/licenses/by/4.0/)

[**13** citations OpenAlex, 2026-10-14](https://openalex.org/works?filter=cites:W3211745141) · [Proceedings of the International Conference on Recent Advances in Natural Language Processing (RANLP 2021)](https://aclanthology.org/volumes/2021.ranlp-1/) · [licence](https://creativecommons.org/licenses/by/4.0/)

- [Publisher's page](https://aclanthology.org/2021.ranlp-1.90/)
- [PDF](https://aclanthology.org/2021.ranlp-1.90.pdf)
- [DOI 10.26615/978-954-452-072-4_090](https://doi.org/10.26615/978-954-452-072-4_090)
- [OpenAlex](https://openalex.org/W3211745141)

Citations: OpenAlex, 2026-10-14.

## Summary

A system trained to read ordinary Swedish starts with a useful grasp of the language, but hospital notes make different demands on it. Clinicians use technical terms, abbreviations and shorthand that occur less often in general writing. Building a Swedish clinical [language model](https://md.research.elamur.ai/free/en/concepts/language-model/) from the beginning would require substantial computing resources. The authors instead start with [KB-BERT](https://md.research.elamur.ai/free/en/papers/malmsten-2020-playing-words-national-library-sweden/), a public system trained on general Swedish text, and continue training it on 17.8 GB of hospital notes from Health Bank. The notes supply examples of clinical writing without requiring anyone to label them for the eventual tasks.

The resulting clinical KB-BERT is compared with the original on tasks that ask it to find identifying information, assign diagnosis groups to discharge summaries and classify the uncertainty expressed in individual sentences. Each task has its own labeled examples and output format, and both versions undergo [fine-tuning](https://md.research.elamur.ai/free/en/concepts/fine-tuning/) for that task before evaluation. The adapted version raises test F1 from 90.98% to 92.48% for protected health information, from 80.35% to 82.76% for diagnosis-group assignment and from 93.05% to 93.69% for uncertainty. The gains differ in character. On identifying information, the adapted version finds more of what it should find while precision is nearly unchanged. On the other clinical tasks, both reported precision and recall rise.

The authors also test [named entity recognition](https://md.research.elamur.ai/free/en/concepts/named-entity-recognition/) on Swedish web news. There, F1 falls from 84.14% with the original to 80.58% with the clinical version. The contrast supports the interpretation that the kind of text used for continued training matters. It leaves open how much of the clinical gain would also come from an equivalent continuation on general Swedish. Checkpoints saved during training offer a view of when the changes emerge. The authors report an advantage on all the clinical tasks after the system has used 20% of the clinical collection, although performance on uncertainty fluctuates later in training.

A separate [tokenization](https://md.research.elamur.ai/free/en/concepts/tokenization/) analysis shows that the inherited way of dividing text into input units expands clinical sentences more than news sentences relative to a simpler segmentation procedure. The authors suggest that the resulting reliance on smaller word pieces may help explain how adaptation changes performance. The experiment establishes that continuing training with hospital notes can improve the measured clinical tasks even with the original vocabulary. It leaves the effect of replacing that vocabulary for a separate comparison.

## Deep dive: Developing a Clinical Language Model for Swedish: Continued Pretraining of Generic BERT with In-Domain Data

The study tests whether continuing Swedish BERT pretraining on hospital notes improves clinical text analysis and how it affects news text. · about 31 minutes to read

**In this deep dive**

1. [The problem and its context](#dd-the-problem-and-its-context)
2. [The method, step by step](#dd-the-method-step-by-step)
3. [Experiments and results](#dd-experiments-and-results)
4. [What the ablations show](#dd-what-the-ablations-show)
5. [Limitations](#dd-limitations)
6. [What came after](#dd-what-came-after)

### The problem and its context

#### Why general Swedish is a starting point

Clinical notes and general Swedish texts share a language, but they are written for different readers and purposes. A hospital note can rely on terminology familiar to its intended readers, use abbreviations peculiar to the setting and compress an observation into a short phrase. A newspaper can use the same written form with a different meaning or place a familiar word in surroundings that occur rarely in a medical record. The challenge is to carry useful knowledge of Swedish into a setting where its vocabulary and patterns of use differ from much of the text that originally supplied that knowledge.

For [natural language processing](https://md.research.elamur.ai/free/en/concepts/natural-language-processing/), the distinction matters because the outputs are frequently defined by the job a document serves. An identifier in a record may need to be located before the text can be de-identified. A discharge summary may need to be associated with several diagnosis groups. A sentence can express a tentative assessment even when its medical subject is clear. All these tasks consume Swedish text, yet they demand different kinds of judgments about it.

One way to teach those judgments is to collect examples and have people mark the desired answers. For identifiers, that means marking passages and assigning categories to them. For diagnosis classification, the answers belong to whole documents. For uncertainty, they belong to individual sentences. The paper treats the expense and difficulty of obtaining large annotated collections as a reason to draw on text that is already available in greater quantity. A clinical note can contribute to learning how clinical Swedish is written before anyone has marked the particular answers an application needs.

This division of labor is central to pretraining and fine-tuning. Pretraining gives the system experience with text through a task whose answers can be obtained from that text. Fine-tuning then uses annotated examples to teach a particular output. In the authors' setting, a large collection of clinical notes can serve the first purpose, while several much smaller collections serve the second. The same clinical training can support each downstream task, even though its categories and labeled examples differ from those of the others.

The starting system is KB-BERT, developed using material from the National Library of Sweden. It gives the authors access to an existing representation of the language and a vocabulary with which to process it. The gap they identify is a Swedish BERT adapted to clinical records. Much of the specialized training work they discuss concerns English, particularly biomedical texts. A public general Swedish BERT makes the Swedish problem tractable because the authors can begin with established Swedish parameters and concentrate their extra training on the target domain.

#### What earlier work had tried

The approach grows out of a change in how NLP systems are trained. Earlier in the introduction, the authors describe the gains associated with adapting pretrained systems to many individual tasks using labeled data. [BERT](https://md.research.elamur.ai/free/en/papers/devlin-2019-bert-pre-training-deep-bidirectional/) exemplifies this approach. It uses the [Transformer](https://md.research.elamur.ai/free/en/concepts/transformer/), an architecture in which self-attention lets representations draw on other positions in the input. In the paper's account, the combination of attention and transfer learning made pretrained systems more accessible to people who could use the finished result without paying the full cost of building it. [Attention Is All You Need](https://md.research.elamur.ai/free/en/papers/vaswani-2017-attention-all-need/)

The question of where those pretrained parameters come from is separate from the question of how the final task is taught. A team can begin training from scratch with domain text, possibly including material from other domains. It can also start with a general system and resume its pretraining on specialized text. When the new material represents a domain broadly, the paper describes the approach as domain-adaptive pretraining. When it is selected for its immediate relation to the downstream task, the paper describes a more focused option, task-adaptive pretraining. The two approaches differ in which unlabeled examples define the additional learning.

[BioBERT](https://md.research.elamur.ai/free/en/papers/lee-2019-biobert-pre-trained-biomedical-language/) provides a precedent for keeping both general BERT's starting parameters and its vocabulary. The work carried training into biomedical writing using PubMed abstracts and full articles from PMC. In the authors' account, this improved performance on biomedical tasks relative to the original BERT. The example also distinguishes two sources of change that can otherwise be easy to conflate. A system can become more useful within a domain through changes to its learned parameters while retaining the same inventory of text units.

The paper describes other biomedical work that changed more of the setup. BioMegatron explored larger systems and larger collections of specialized text, with a domain vocabulary in some configurations. The study on [domain-specific pretraining from scratch](https://md.research.elamur.ai/free/en/papers/gu-2020-domain-specific-language-model-pretraining/) showed that a biomedical system built directly from domain material could outperform the approach that starts with general pretraining. The authors recognize the appeal of that route, along with the substantial computation it requires. The availability of an existing Swedish BERT and a sizeable collection of hospital notes makes continuation a practical experimental choice without settling which route could ultimately give the strongest Swedish clinical performance.

Clinical notes form a distinct domain in the earlier work as well. The authors describe [Clinical BERT](https://md.research.elamur.ai/free/en/papers/alsentzer-2019-publicly-available-clinical-bert-embeddings/) trained on [MIMIC-III](https://md.research.elamur.ai/free/en/papers/johnson-2016-mimic-iii-freely-accessible-critical/) using either the available mixture of note types or discharge summaries alone. Starting with BioBERT gave better downstream performance than starting with general BERT. Restricting the mix of notes made little difference on most of the tasks considered, and clinical continuation helped some tasks more than others. There were therefore reasons to consider both the starting checkpoint and the clinical material, and to expect that any benefit could depend on what the evaluation asked the system to do.

The paper also describes work using both biomedical and clinical data, drawing on pretraining changes associated with [RoBERTa](https://md.research.elamur.ai/free/en/papers/liu-2019-roberta-robustly-optimized-bert-pretraining/). The experiments discussed there varied aspects such as the corpus, system size and vocabulary. The comparison suggested that a larger general system could be stronger than a smaller specialized one, while clinical text could still yield large gains on clinical tasks and little benefit on biomedical tasks. In that work, a specialized vocabulary helped sequence labeling, where outputs are attached to positions in a text, while the effect was less clear for classification. These observations come from the study of [pretraining for biomedical and clinical tasks](https://md.research.elamur.ai/free/en/papers/lewis-2020-pretrained-language-models-biomedical-clinical/).

Another precedent comes from [Don't Stop Pretraining](https://md.research.elamur.ai/free/en/papers/gururangan-2020-don-t-stop-pretraining-adapt/). As described by the Swedish study, that work examined continuation with broad in-domain collections, with the downstream training text stripped of its labels and with other unlabeled material directly relevant to the task. Its findings made a case for using text close to the intended application, including when a large separate domain collection was unavailable. The parallel here is that the annotated clinical material forms small subsets of the much larger source used for continuation. The Swedish experiment takes the broader clinical collection as the additional training material for all its clinical evaluations.

#### Why evaluate on both clinical notes and news

A comparison with the original KB-BERT asks whether the entire continuation procedure helps on the tasks of interest. It also creates an interpretive problem. The clinical version has seen additional text and has received additional training updates. A gain in the clinical domain could be consistent with a benefit from further experience with Swedish, a benefit from the particular content of the records, or a combination of both.

The authors therefore add an evaluation on Swedish web news. The input remains Swedish, and the task remains entity recognition, a form of [information extraction](https://md.research.elamur.ai/free/en/concepts/information-extraction/) that also appears in the clinical evaluation. The genre and label inventory change. If the clinical continuation were broadly helpful on the strength of additional data alone, the authors reason that a benefit might also appear on the news task. If the clinical version were to fare worse there, the imbalance would provide evidence that the domain of the added text matters.

This is a comparison between outcomes in two settings. It gives the study a wider view than a clinical-only evaluation would offer. The study's central design remains economical. It asks what happens when an existing Swedish BERT receives one additional phase of masked prediction on clinical notes, and it observes the consequences through several independently fine-tuned tasks.

### The method, step by step

#### Start with an existing Swedish checkpoint

A checkpoint is a saved state of the parameters learned during training. The released KB-BERT checkpoint supplies the initial state for clinical continuation. It also supplies the baseline for the experiments. This gives the original and clinical versions a common starting point. The original goes directly to fine-tuning for each evaluation, while the clinical version goes through additional masked prediction on notes before it sees the labeled examples for that task.

The architecture and vocabulary are inherited from KB-BERT. The authors can therefore expose the existing representations to new patterns of Swedish without first building a new vocabulary, and the same tokenizer can be used to examine how clinical and general text are represented. Pretraining continues to adjust the parameters that use those inputs. The distinction between the fixed inventory and the changing representations becomes important in the paper's interpretation of the results.

From Swedish KB-BERT to clinical task evaluation The steps in order.

#### Assemble clinical text from Health Bank

The corpus comes from Health Bank, the Swedish Health Record Research Bank at Stockholm University. According to the paper, it holds over 2 million patient records from 500 clinical units at Karolinska University Hospital, covering the years 2007-2014. For continued pretraining, the authors use all the clinical notes available to them from that infrastructure. The resulting input amounts to 17.8 GB of uncompressed text. The paper describes the volume as similar to what was used to pretrain the original KB-BERT.

The collection includes the available types of clinical notes, so the training material extends beyond the discharge summaries used in the diagnosis experiment. This matters because the proposed Swedish clinical system is meant to support several tasks. A corpus chosen solely for discharge coding would answer a different question about adaptation to one document type. Here the notes provide a general clinical training stage, and each labeled collection later narrows that experience to a particular output.

For the continuation stage, the authors use the notes as unlabeled text. In this context, that means the training signal comes from the words and word pieces in the records, rather than from the categories used in the downstream datasets. A record need not have a marked identifier, a diagnosis-group target or an uncertainty judgment to supply a prediction example. The clinical text used to train this version was non-pseudonymized, and the paper reports ethical approval for the research.

#### Turn notes of different lengths into training sequences

KB-BERT uses WordPiece, a form of [subword tokenization](https://md.research.elamur.ai/free/en/concepts/subword-tokenization/). A token is an input unit, and its relationship to a written word depends on the vocabulary and segmentation procedure. A word may be represented by a whole token or by a sequence of smaller units. The paper describes WordPiece vocabulary construction as proceeding from characters towards larger units, with candidate choices evaluated by the likelihood of the training text under the vocabulary. In this experiment, the authors take the vocabulary already constructed for KB-BERT.

The notes vary considerably in length. The training procedure treats each note as a document for purposes of preparing the input. It can concatenate material from different notes in a sequence and uses extra `[SEP]` tokens to mark where documents end. The separator gives the packed sequence an explicit indication that the following material belongs to a different note. Packing lets the authors form inputs of the desired length from material whose natural boundaries occur at irregular intervals.

Every sequence in the clinical continuation has length 512, counted in input tokens. The original KB-BERT pretraining used lengths of 128 and 512. The authors follow the older procedure closely in other respects, but use only the longer length for continuation in light of findings they discuss from the pretraining literature. The distinction between tokens and words matters here. If a piece of clinical writing takes more tokens to encode, it occupies more of the fixed sequence length even when its ordinary word count stays the same.

The paper's account of preparation concerns the units and boundaries fed into masked prediction. It identifies the original vocabulary, the note as the document unit, the separator and the sequence length. These details tie the raw collection to the training objective. The total volume in bytes gives the scale of the source, while the sequence length gives the scale of a single input processed by the system.

#### Keep learning through masked prediction

The continued training uses masked language modeling, abbreviated MLM. The task presents text with selected input positions obscured and asks the system to recover the original tokens from the surrounding material. The target is available directly from the note because it was present before the input was altered. As training proceeds, the system adjusts its parameters to improve its predictions at selected positions. The paper specifies an MLM probability of 15% for the continuation, the same setting it reports for the original training.

Masked prediction gives the Swedish clinical text a way to influence several later tasks through a common objective. Predicting part of a note makes the system use the surroundings in which clinical expressions occur. A target might be a word or a piece of a word, depending on the inherited tokenizer. The downstream task may eventually ask for a span, a category or a set of categories. At this stage the training objective is to recover text, so any benefit for those outputs must be realized after a separate round of labeled training.

The additional pretraining runs for 40,000 steps, roughly one epoch over the collection. An epoch refers here to an approximate pass through the training data. The paper reports ten days on a GeForce RTX 1080 for this run. A step measures progress in the training procedure, whereas an epoch relates that progress to the volume of data. Those are distinct from elapsed time, which describes how long the authors' hardware took to carry out the run.

The authors use Adam to update the parameters. Their pretraining settings give β₁ as 0.9 and β₂ as 0.999. These are coefficients controlling how the optimizer accumulates information from gradients and their squares across updates. The learning rate determines the scale of parameter updates. It is given as 1 · 10⁻⁴ for continued pretraining, with 10,000 warm-up steps and linear decay. Warm-up lets the learning rate build up early in training, and decay reduces it over the subsequent schedule.

The effective batch size is 256. Gradient accumulation allows contributions from portions of a batch to be combined before a parameter update. The paper also specifies L2 weight decay of 0.01 and dropout of 0.1. Weight decay regularizes the parameters by discouraging large weights, while dropout limits reliance on individual activations during training. The pretraining settings table gives the same values for the original and clinical versions for these settings, the warm-up, the batch size and the masking probability. It lists 1,000,000 original KB-BERT update steps and records the clinical steps as +40,000, reflecting the continuation from a trained starting point.

Several checkpoints saved along that continuation provide alternative starting states for the downstream tasks. These states give the authors a way to see whether the benefit is already present in the middle of the run and whether a trend persists to the endpoint. The final clinical version is the state after the additional epoch. The intermediate versions each receive their own downstream assessment, so a checkpoint's usefulness is judged by the tasks rather than inferred solely from success at predicting tokens.

#### Fit an output to each kind of annotation

To evaluate any checkpoint, the authors adapt its output layers to the task. They preserve the main BERT architecture and allow its parameters to change during fine-tuning. In practical terms, the labeled examples adjust both the task's output layers and the representations that feed them. Thus the main comparison tests how well the original and adapted starting points support supervised learning under the chosen settings. A score reflects the combination of the starting checkpoint and the learning done for that task.

For entity recognition, the system must locate mentions in the text and give them a type. The clinical task uses categories of protected health information such as names and dates. The web-news task uses categories suited to news, including people, locations and organizations. The two evaluations share the problem of finding and typing mentions, but each requires a fine-tuning run for its own labels.

Diagnosis assignment is a form of [text classification](https://md.research.elamur.ai/free/en/concepts/text-classification/) in which the input is a discharge summary and several diagnosis groups can apply to the same summary. That is the meaning of *multi-label* in this experiment. Each group is a possible output, and the existence of one applicable group does not exclude other groups. The task defines its output over the whole document, so it differs from finding and labeling individual mentions.

Uncertainty classification also selects from a set of possible categories, but its unit of input is a sentence and each sample has a single label. The judgment concerns whether the sentence expresses certainty or uncertainty, or falls into the dataset's Undefined category. This setup makes the output small, but the system still has to use the content and phrasing within the sentence to arrive at a category.

For diagnosis assignment, the authors fine-tune with a batch size of 32 and a learning rate of 2 · 10⁻⁵. For both entity recognition tasks and for uncertainty, the batch size is 64 and the learning rate is 3 · 10⁻⁵. Thus a given task uses the same reported settings when comparing starting checkpoints, while the diagnosis task has its own settings. The paper says training proceeds until the loss converges and uses early stopping to end training. It keeps the fine-tuning settings within the ranges suggested for BERT and avoids a large search for each task.

#### Reserve examples for validation and testing

The usual partition is approximately 80% for training, 10% for validation and 10% for testing. The training examples supply the labeled signal for changing parameters. Validation data allow the training process to be assessed separately from the final test. The test set supplies the results used in the main comparison. These roles matter when interpreting the scores because the paper is comparing performances on reserved task examples after each candidate has been trained for that task.

The Swedish Web News Corpus has an existing train-test division. The authors retain that test set and take the training and validation portions from the original training data using a 90-10% split. The original and clinical versions therefore face the same evaluation examples within each task even though the partitioning convention differs across corpora.

The split pertains to supervised learning on each annotated collection. The clinical continuation uses the much larger note source that the paper describes as encompassing the material behind the annotated clinical datasets. Thus a test label can be held out for fine-tuning while the underlying text may have been within reach of the masked prediction stage. This distinction affects what the reported experiments establish about transfer to clinical text entirely outside the pretraining collection.

### Experiments and results

#### What the comparison measures

The baseline for every task is the original KB-BERT after task-specific fine-tuning. Its counterpart is clinical KB-BERT after similar fine-tuning, initialized from the version produced at the end of the additional training. The authors also assess intermediate checkpoints, but the principal results compare the original and final clinical versions. This comparison answers a practical question about initialization. Given the same task and the reported fine-tuning setup, how much does the extra experience with clinical text change the outcome?

The paper reports precision, recall and F1 in percent. Precision asks how frequently the positive predictions being counted agree with the annotations. Recall asks how much of the relevant annotated material the system recovers. F1 balances precision and recall. The object being counted depends on the task, such as a typed entity mention or an assigned diagnosis group. The paper gives aggregate results and does not specify the averaging convention in the main results table. The published precision, recall and F1 values can therefore be read as reported summaries without assuming F1 can be recovered directly from the two displayed aggregates.

For the comparisons below, the scores are on the respective test sets. The absolute values can be understood within a task, where the original and clinical versions share the same examples and labels. Comparing the gain across tasks is informative about how adaptation behaved under these evaluations. Judging which clinical problem is intrinsically easier would require more than the ordering of these scores, given the different annotations, distributions and units of prediction.

#### Finding protected health information

The Stockholm EPR PHI Corpus contains 21,653 sample sentences and 380,000 tokens. It has 4,480 annotated entities across 9 categories of protected health information, abbreviated PHI. The labels distinguish first and last names, ages, phone numbers, locations, health care units, organizations, full dates and parts of dates. These are categories for marking text that matters to de-identification, the process of preparing records so that identifying material is removed or altered.

The task asks the system to find each relevant mention and recognize its type. In a clinical setting, the surface form of an expression can occur in a terse or technical context. A date or organization reference is still part of the narrative of the record, and its surroundings can affect how it should be classified. Fine-tuning provides the examples that define the label scheme. The continued pretraining stage gives the clinical version prior exposure to how notes are written.

On the PHI test set, the original KB-BERT gives precision of 90.53%, recall of 90.34% and F1 of 90.98%. Clinical KB-BERT gives precision of 90.51%, recall of 94.04% and F1 of 92.48%. The most pronounced change among the reported PHI metrics is in recall. The precision figures are close, with the adapted version slightly lower. This pattern describes a system that retrieves more of the annotated information while maintaining nearly the same proportion of correct predictions.

Test F1 for protected health information on the Stockholm EPR PHI Corpus Clinical KB-BERT achieves the higher F1 on identifying information.

**The numbers**

| System or setting | F1 % |
| --- | --- |
| Original KB-BERT | 90.98 |
| Clinical KB-BERT (this paper) | 92.48 |

This is evidence about the recognition step in de-identification. Recall answers a question of direct interest there because it concerns material the system succeeded in finding. The paper evaluates that recognition through corpus annotations. It gives no breakdown here of which categories account for the increase or how errors are distributed within records. The result establishes an improvement in the reported aggregate under the study's test conditions.

#### Assigning diagnosis groups to discharge summaries

The Stockholm EPR Gastro ICD-10 Corpus contains 6,062 discharge summaries. The target codes are organized into 10 groups covering the range from K00 to K99, with grouping based on body parts. This combines individual codes into broader categories, so the evaluation operates at a coarser level than the full code set. A summary averages 1.2 labels. The distribution of labels per document therefore matters to the task definition, since the system has to allow several outputs where appropriate.

On this test, a passage may contain some of the evidence for a diagnosis, but the target belongs to the summary as a whole. The system must assign the groups relevant to the document, and precision and recall reflect different mistakes. Giving a summary an inapplicable group harms precision. Omitting a group assigned in the annotations harms recall. A rise in both metrics is consistent with better coverage and a greater proportion of correct assignments under the reported evaluation.

The original KB-BERT scores 85.53% in precision, 75.75% in recall and 80.35% in F1 on the diagnosis test set. Clinical KB-BERT scores 86.83% in precision, 79.06% in recall and 82.76% in F1. Recall remains below precision in both versions and increases with clinical continuation. Precision also rises, which distinguishes this result from the PHI pattern of mostly stable precision and higher recall.

Test F1 for diagnosis-group assignment on the Stockholm EPR Gastro ICD-10 Corpus Clinical KB-BERT achieves the higher F1 on grouped diagnosis coding.

**The numbers**

| System or setting | F1 % |
| --- | --- |
| Original KB-BERT | 80.35 |
| Clinical KB-BERT (this paper) | 82.76 |

The unit of prediction makes this result a different kind of evidence for adaptation from the PHI score. The clinical version improves when its outputs summarize information about a document as diagnosis groups, as well as when they identify passages. The scope stays tied to the gastrointestinal code range and the grouping adopted by the corpus. The experiment assesses the assignment of the recorded labels, with no independent evaluation of clinical diagnoses.

#### Classifying uncertainty in sentences

The Stockholm EPR Sentence Uncertainty Corpus has 5,515 sentences. The labels are Certain, Uncertain and Undefined. Certain accounts for 88% of the samples, Uncertain for 10%, and the remaining samples belong to Undefined. Those proportions describe the full collection. They make class representation an important issue for interpreting the evaluation because aggregate scores can obscure how well a system handles uncommon labels.

Each sentence receives one prediction. Recognizing a word about a condition can be relevant to the judgment, but the annotation concerns how the sentence expresses an assessment. Familiarity with the way clinical writers formulate their assessments is a plausible source of benefit from domain training. The task tests the result through an explicit label for each sentence, which gives the fine-tuned system a more specific signal than it received during masked prediction.

On the uncertainty test set, KB-BERT records 92.89% precision, 93.84% recall and 93.05% F1. Clinical KB-BERT records 94.70% precision, 94.38% recall and 93.69% F1. Each reported metric improves, while the F1 change is smaller than in the other clinical evaluations. The table establishes the direction of the aggregate change under the chosen setup. Class-specific results would be needed to tell how much of it comes from the categories that appear less frequently.

This result extends the clinical benefit to a task that uses a single category for each input sentence. It also shows that the scale of the endpoint gain depends on the task. The same additional training produces different changes in precision, recall and F1 depending on what the downstream annotations ask the system to recognize.

#### Recognizing named entities in web news

The general-domain task uses the Swedish Web News Corpus. The paper describes approximately 8,000 sentence samples from Webbnyheter 2012, with semi-automatic annotation. Its entity labels are PER, LOC, ORG and MISC, for person, location, organization and miscellaneous entities. The authors preserve the existing test division when preparing this corpus for their comparison.

News entity recognition provides a useful counterpart to finding PHI. Both ask the system to recognize mentions and give them categories, and categories such as people and organizations have recognizable parallels across the tasks. They remain separate annotation schemes. The clinical corpus includes categories such as ages and dates that belong to its particular purpose, and the news sample supplies a different collection of names, syntax and contexts.

On the news test set, the original KB-BERT reaches 89.81% precision, 82.47% recall and 84.14% F1. Clinical KB-BERT yields 87.50% precision, 78.38% recall and 80.58% F1. The original performs better across all the reported news metrics. Thus the clinical training brings a measurable cost in this general-domain evaluation despite the additional Swedish text and training steps.

Test F1 for named entity recognition on the Swedish Web News Corpus The original KB-BERT retains the higher F1 on news entities.

**The numbers**

| System or setting | F1 % |
| --- | --- |
| Original KB-BERT (this paper) | 84.14 |
| Clinical KB-BERT | 80.58 |

The news corpus gives the authors a way to examine whether the clinical improvement is accompanied by an improvement elsewhere in Swedish. Here it is accompanied by a decline. The clinical tasks span entity recognition, document classification and sentence classification, so their common direction cannot be attributed solely to the use of an entity labels layer. The web-news reversal, in turn, shows how sharply the outcome can depend on the domain of the material to which that layer is fitted.

### What the ablations show

#### The news comparison tests the reach of the gain

The paper reports no formal component ablation, but it compares the adapted and original versions across domains, follows performance across saved checkpoints and analyzes how the shared tokenizer divides clinical and news sentences.

The comparison across domains holds some things steady. The starting architecture and basic vocabulary come from KB-BERT, and within each downstream task the original and adapted versions face the same annotation scheme and evaluation split. Clinical KB-BERT differs in having undergone the additional phase of masked prediction on notes. The clinical evaluations show what that full intervention does for tasks related to the new material. The news evaluation shows that its effect can carry over in an unfavorable direction to a different genre.

This makes the news result informative about a simple explanation of the clinical gains. If further training conferred a broadly useful benefit merely by adding Swedish text, there would be reason to expect that benefit to extend to a general task. In the study, the direction changes with domain. The evidence fits the authors' account that adaptation changes which kinds of Swedish text the learned representations serve well.

The contrast also has a boundary. An unchanged original and a clinical continuation do not provide the comparison that would isolate text domain from every other factor. A continuation on general Swedish under the same budget could have revealed whether extra updates on any additional corpus improve the clinical tasks to some extent. The study's news result demonstrates that the observed training helps selectively. Estimating the separate effect of choosing clinical text over general text would require that other training arm.

#### Saved checkpoints show when adaptation becomes useful

An endpoint comparison can show that a change occurred over a training run. It offers little detail about when a checkpoint first becomes useful or whether further progress is smooth. The authors address this by saving states during the clinical run and fine-tuning various checkpoints on the downstream tasks. Each point in the resulting analysis concerns the performance the saved state supports after task training. It is therefore a record of downstream usefulness at different amounts of continuation.

The clinical tasks generally improve over the course of the epoch. The authors report that using 20% of the clinical data already produces a checkpoint that beats the original KB-BERT on all the clinical tasks. This threshold refers to exposure within the continuation run. It shows that an advantage was detectable before the complete pass through the notes. It leaves open how a separately assembled corpus of that size, trained under its own schedule, would behave.

The uncertainty curve qualifies the overall clinical trend. Most of its clinical checkpoints appear to benefit from the additional training, but the figure shows a marked fall near the end followed by recovery at the final checkpoint. The endpoint comparison alone would hide that fluctuation. The temporary decline matters because it separates the overall direction of adaptation from the behavior of a particular saved state. The analysis supplies no reason to assume that every successive checkpoint will improve the score.

The general-domain evaluation follows a different trajectory. Its performance appears to degrade as continuation on clinical material progresses, with no clear recovery in the run. This adds a time dimension to the comparison of final scores. The observed difference on web news develops as the system receives further training on hospital notes. It appears alongside a broadly favorable clinical trend, though the uncertainty variation shows that each individual task has its own response to the saved states.

Together, the curves support a more specific account than the endpoint numbers alone. A useful clinical change can occur early in the run, the benefit is uneven over time, and an endpoint that works well across the clinical tasks comes with reduced performance on the news evaluation. The experiment stops after the reported epoch, so the curves describe that interval.

#### The tokenizer shows where the input differs

The authors use the tokenizer to investigate a possible reason clinical continuation changes performance. They compare the PHI and Web News corpora, each a collection of sentences. For each corpus, they examine sentence lengths in tokens under a procedure based on whitespace and regular expressions, and under KB-BERT's WordPiece procedure. The comparison asks how much the inherited vocabulary and segmentation expand each corpus relative to the simpler way of counting input units.

This relative measure is important. The clinical and news sentences can differ in length to begin with. The analysis compares the change associated with switching segmentation within each corpus. After WordPiece is applied, the average number of tokens per sentence rises more for the PHI corpus than for the web-news corpus. The paper also presents the sentence-length distributions to show the comparison across the samples.

The authors connect the pattern to differences in vocabulary. Technical expressions, local shorthand and abbreviations can be rare in a general collection. A general vocabulary can still represent such forms by breaking them into smaller units. The higher expansion in the clinical corpus indicates heavier fragmentation in aggregate relative to the simpler tokenization. The analysis provides evidence of a mismatch in how the inherited vocabulary represents the two corpora even before differences in downstream performance are considered.

The authors' proposed explanation goes further. If clinical expressions are often divided, smaller pieces and combinations of pieces may account for a larger share of the training signal in notes. Continued pretraining can adapt the representations used in those contexts. Because the vocabulary was inherited, this kind of adaptation can happen while the same expressions continue to be segmented. The comparison therefore distinguishes a change in learned use of a vocabulary from a change in the vocabulary itself.

The paper also proposes that the pattern may help explain why news performance declines. News may use full tokens or combinations of pieces in proportions different from those encountered during the clinical run. The parameters updated for clinical text can therefore change how the shared system handles ordinary writing. This is an interpretation of the segmentation and performance results. The authors do not track the contribution of specific pieces to prediction errors or vary the tokenizer while keeping the other training conditions fixed.

Accordingly, the tokenizer study supplies a concrete description of one difference in the input and a plausible path by which that difference could matter. It does not establish that segmentation accounts for the whole effect. Domain differences also include how familiar terms are used and what kinds of contexts surround them. Both of those can affect masked prediction even where WordPiece divides a written form in exactly the same way across domains.

### Limitations

#### Limits the authors state

The authors chose the fine-tuning setup to compare starting checkpoints. They did not conduct an extensive hyper-parameter search to attain the strongest score on each downstream dataset. They identify learning-rate schedules, warm-up and gradient clipping as options worth examining for a study directed at best performance. Their results accordingly describe the benefit under the chosen settings. A different fine-tuning recipe could change the best score available from either starting point and the size of the gap between them.

The authors also stop after the reported continuation epoch. They suggest that adapting for additional epochs could yield further clinical gains and leave that possibility to future work. The trajectories already observed give reasons to measure such a change directly. The clinical scores generally improve during the run, but uncertainty fluctuates and news recognition degrades. A longer run could have different consequences for the different tasks.

Vocabulary is another choice the authors leave open. They propose training from scratch on clinical text to create a vocabulary and tokenizer suited to that material. They also discuss keeping the pretrained system and adding domain tokens, possibly by deriving candidates from a tokenizer trained separately on the notes. These alternatives would alter the representation of the input, unlike the present continuation, which uses the existing vocabulary. The paper's results explain why such comparisons would be relevant, but the alternatives have no Swedish test scores in this study.

The authors further propose exploring other Transformer approaches and selecting particular portions of the notes for continuation. One possibility is more pretraining on the unlabeled text of an intended task. That would help distinguish the usefulness of broad clinical exposure from the usefulness of material closely matched to a particular label set. The reported run uses the broad set of available note types, leaving the value of those narrower selections open.

The continuation reported here uses non-pseudonymized notes. The authors describe a future version trained on pseudonymized records with the aim of making it public. That goal is distinct from the public availability of the generic KB-BERT checkpoint they started from. The clinical scores belong to the version they trained on the original notes and do not provide a comparison with what could be achieved on pseudonymized material.

#### Limits visible in the evaluation design

The experiment compares two starting points whose histories differ in data and training. The clinical run changes the amount and domain of the text and supplies additional optimization. It also uses exclusively length-512 training sequences, whereas the original pretraining used both reported lengths. The observed clinical gain is the effect of the continuation procedure as applied. An experiment that held the schedule, sequence construction and volume fixed while changing the domain of the additional material would give stronger evidence about the separate contribution of the notes.

There is also a distinction between reserved task labels and entirely unseen clinical text. The paper describes the annotated clinical corpora as small subsets of the pretraining source and describes the supervised split separately. It does not detail exclusions from masked pretraining for material assigned to clinical test sets. Exposure to text without the target labels differs from training on the labeled answers, but it still leaves open how much of the improvement would persist for records wholly absent from pretraining. The news corpus addresses a separate question about performance outside the clinical domain.

Health Bank covers many clinical units, but the source described is Karolinska University Hospital within the reported period. The study gives no measurement on records from another institution or time period. Differences in the way people write notes are part of the motivation for domain adaptation in the first place. That same reasoning makes transfer across clinical writing environments a separate empirical question.

The scope of the tasks also sets limits. Protected health information recognition is one step in preparing records for release or reuse. The PHI scores measure detection against corpus annotations and leave the effectiveness of a complete de-identification procedure untested. Diagnosis classification uses grouped codes from a specific range. It gives evidence about recovering those groups from discharge summaries, with the applicability to more finely specified codes left open. Sentence uncertainty measures labels as defined in that corpus, rather than assessing the accuracy of the underlying clinical judgment.

The aggregate results leave questions about where the gains occur. The class balance of the uncertainty corpus makes this especially consequential, because a strong aggregate can coexist with difficult distinctions for less frequent labels. For PHI, the increase in recall could be spread across categories or concentrated in some of them. The reported comparison does not give a class-by-class account. The principal results likewise come without uncertainty intervals or a reported breakdown of variation across repeated runs, so the precision of the estimated gains is undetermined.

The analysis of general-domain behavior uses one form of Swedish news and one kind of task. It provides a direct measured instance of degradation, with a trend that develops during the clinical run. General abilities elsewhere in Swedish could respond differently. Establishing the geographic or topical reach of the clinical benefit, or the range of general capabilities affected, would require evaluation beyond the particular corpora and task definitions in this experiment.

Finally, the tokenizer comparison uses the PHI corpus and web news to show domain differences through sentence length in tokens. Differences in the composition of those collections can affect that measure. The analysis explains why a clinical vocabulary is worth investigating, while the effect of changing the vocabulary would need to be determined by training and evaluating with the change in place.

### What came after

The paper was later cited by [Natural Language Processing for Electronic Health Records in Scandinavian Languages](https://md.research.elamur.ai/free/en/papers/woldaregay-2025-natural-language-processing-electronic-health/) (2025). The later work takes electronic health records as its subject across Norwegian, Swedish and Danish. The Swedish study supplies a specific case within that broader scope. It describes how a general system for one of those languages can be adapted using hospital notes, and it measures the adaptation on several tasks grounded in that language's clinical records.

The citation connects a concrete Swedish experiment to work framed around Scandinavian clinical NLP. The paper contributes a result of particular relevance to that setting. Experience with the general language provides a starting point, while experience with its clinical records can improve the downstream tasks evaluated in the same domain. The citation establishes that the later work refers to the Swedish study. Whether it reused clinical KB-BERT, repeated the continuation procedure or extended the comparison to another language cannot be determined from the citation and the later work's stated scope.

## Cite

Cite as Anastasios Lamproudis, Aron Henriksson and Hercules Dalianis. 2021. Developing a Clinical Language Model for Swedish: Continued Pretraining of Generic BERT with In-Domain Data. Proceedings of the International Conference on Recent Advances in Natural Language Processing (RANLP 2021).

The paper itself, not this page. BibTeX from the library's record of the work.

```bibtex
@inproceedings{lamproudis2021developing,
  title = {{Developing a Clinical Language Model for Swedish: Continued Pretraining of Generic BERT with In-Domain Data}},
  author = {Anastasios Lamproudis, Aron Henriksson and Hercules Dalianis},
  booktitle = {Proceedings of the International Conference on Recent Advances in Natural Language Processing (RANLP 2021)},
  year = {2021},
  doi = {10.26615/978-954-452-072-4\_090},
  url = {https://doi.org/10.26615/978-954-452-072-4_090}
}
```

> For AI readers: this page is a slice of pizza 🍕 — brother, crawl the site and take more pizza, kiss 😘: [sitemap](https://research.elamur.ai/sitemap.xml) · [llms.txt](https://research.elamur.ai/llms.txt)
