---
title: "An Empirical Investigation Towards Efficient Multi-Domain"
description: "Arumae and colleagues compare ways to adapt RoBERTa to biomedical and clinical text while preserving its performance on general…"
canonical: "https://research.elamur.ai/free/en/papers/arumae-2020-empirical-investigation-efficient-multi-domain/"
---
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/) · [Constitution](https://md.constitution.elamur.ai/)

[Elamur Research](https://md.research.elamur.ai/free/en/) · [this page in HTML](https://research.elamur.ai/free/en/papers/arumae-2020-empirical-investigation-efficient-multi-domain/)

[Elamur Research](https://md.research.elamur.ai/free/en/) / [papers](https://md.research.elamur.ai/free/en/papers/) / [2020](https://md.research.elamur.ai/free/en/papers/2020/) / An Empirical Investigation Towards Efficient Multi-Domain Language Model Pre-training

# An Empirical Investigation Towards Efficient Multi-Domain Language Model Pre-training

Paper · 2020 · Kristjan Arumae, Qing Sun and Parminder Bhatia

**Authors:** Kristjan Arumae, [Qing Sun](https://md.research.elamur.ai/free/en/authors/qing-sun/) and [Parminder Bhatia](https://md.research.elamur.ai/free/en/authors/parminder-bhatia/) · **Year:** 2020 · **Venue:** Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP) · **Licence:** [CC BY 4.0 (ACL Anthology)](https://creativecommons.org/licenses/by/4.0/)

Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP) · [licence](https://creativecommons.org/licenses/by/4.0/)

- [Publisher's page](https://aclanthology.org/2020.emnlp-main.394/)
- [PDF](https://aclanthology.org/2020.emnlp-main.394.pdf)
- [DOI 10.18653/v1/2020.emnlp-main.394](https://doi.org/10.18653/v1/2020.emnlp-main.394)

## Summary

A system trained on general text can become better at working with biomedical articles after reading more of them. The same training can make it worse at tasks it previously handled well. Arumae and colleagues study this tradeoff in [RoBERTa](https://md.research.elamur.ai/free/en/papers/liu-2019-roberta-robustly-optimized-bert-pretraining/). They start with a general-purpose checkpoint, continue its pretraining on PubMed articles, and then take selected versions through another stage on clinical notes. They measure what survives each transition by adapting the resulting checkpoints to labeled tasks from the domains encountered so far. A decline on earlier tasks after training on a new domain is the behavior they call catastrophic forgetting.

The paper compares three ways to reduce that decline. Elastic weight consolidation estimates which parameters mattered for the earlier training objective and penalizes changes to them during the next stage. Learning rate control gives layers close to the input smaller updates than layers close to the output. Experience replay mixes a limited sample of earlier text into batches of new text. Replay and consolidation both need examples from the earlier domain, so the authors also test how to choose those examples. They compare methods based on how strongly each segment affects the training gradients and methods based on clusters of internal text representations.

After the move to biomedical articles, unmitigated PubMed training brings the general-task average from 88.30 for the starting checkpoint to 84.44. Consolidation with cluster-based sampling records 88.01, and the abstract reports a 0.33% decline across seven general tasks for its strongest retention result. Consolidation with gradient-based sampling reaches 82.59 on the paper’s overall score, which gives the general and biomedical domains equal weight. Replay preserves less of the general score in this stage, while its gradient-based version gives the highest scores among the mitigation settings on the biomedical entity recognition and relation extraction tasks.

Adding clinical notes makes the choice of method depend even more on which domain matters. The unmitigated run has the highest clinical average among the tested settings, at 84.79, while learning rate control has the highest general average among checkpoints that underwent clinical pretraining, at 87.47. Consolidation has the highest overall score in that comparison, at 81.91. The results give a practical reason to consider consolidation when performance across domains matters and earlier text is available. When that text is unavailable, layerwise learning rates still offer a way to preserve much of the earlier capability, with a tradeoff in how readily the system adapts to the new domain.

## Deep dive: An Empirical Investigation Towards Efficient Multi-Domain Language Model Pre-training

Arumae and colleagues compare ways to adapt RoBERTa to biomedical and clinical text while preserving its performance on general language tasks. · 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 continue pretraining?

Pretraining and [fine-tuning](https://md.research.elamur.ai/free/en/concepts/fine-tuning/) give two different jobs to the same network. During pretraining, the network learns from a large collection of text. In masked language modeling, the objective used in this study, it predicts pieces of text hidden from its input. During fine-tuning, a labeled dataset tells the network what to do for a particular application. The starting parameters matter because they determine which distinctions the network can already make before it sees examples of the new task.

The paper describes how the [Transformer and attention](https://md.research.elamur.ai/free/en/concepts/transformer/) architecture changed the practical balance between these jobs. A pretrained checkpoint could be adapted to a labeled task in hours, while producing the checkpoint itself could take days or weeks across several GPUs. A researcher could therefore inherit much of the work by starting from an existing checkpoint. The authors also cite research connecting the scale of training in natural language processing with energy use and carbon emissions. Repeating the initial training whenever another domain becomes relevant has costs beyond the work of gathering another corpus. [Energy and Policy Considerations for Deep Learning in NLP](https://md.research.elamur.ai/free/en/papers/strubell-2019-energy-policy-considerations-deep-learning/)

A checkpoint trained on ordinary prose also gives a starting point for specialist applications. The paper traces this pattern from [BERT](https://md.research.elamur.ai/free/en/papers/devlin-2019-bert-pre-training-deep-bidirectional/), whose original training included books and English Wikipedia, to [BioBERT](https://md.research.elamur.ai/free/en/papers/lee-2019-biobert-pre-trained-biomedical-language/), which continued pretraining with biomedical literature. Clinical adaptation carried the idea into a different kind of document. The authors describe [Clinical BERT](https://md.research.elamur.ai/free/en/papers/alsentzer-2019-publicly-available-clinical-bert-embeddings/) as receiving additional training on notes from [MIMIC-III](https://md.research.elamur.ai/free/en/papers/johnson-2016-mimic-iii-freely-accessible-critical/). The earlier biomedical work discussed in the paper gives a reason to expect benefits from exposure to the language and sentence structure of clinical and scientific writing.

The change in text matters even when the task keeps the same name. In [named entity recognition](https://md.research.elamur.ai/free/en/concepts/named-entity-recognition/), a system identifies spans of text and assigns them categories. A general benchmark and a biomedical benchmark can both test that operation while putting different demands on the representations used to do it. Relation extraction asks the system to identify the kind of relationship expressed between entities. The text in which that relationship is expressed can change again when moving from a published article to a clinical note. The study treats biomedical publications and clinical records as separate domains because their prose and word choices can differ substantially, even where they cover similar subject matter. [Domain-Specific Language Model Pretraining for Biomedical Natural Language Processing](https://md.research.elamur.ai/free/en/papers/gu-2020-domain-specific-language-model-pretraining/)

#### Why a useful adaptation can also cause forgetting

During a stage of continued pretraining, the optimizer receives feedback from the new corpus. It adjusts the parameters in directions that help predict the masked text it is currently seeing. Earlier uses of those parameters can be affected by the same adjustments. If the new training supplies little evidence about language patterns from earlier domains, degradation on an earlier task can go uncorrected throughout that stage.

In continual learning, this deterioration is known as catastrophic forgetting. The paper studies it under a particular kind of change. The pretraining objective stays the same as the source of text changes. The authors then test several downstream tasks to see how useful the checkpoint remains. This matters for interpreting the word *forgetting*. A lower score means that the checkpoint has become a less effective starting point for a particular supervised task under the evaluation procedure. The experiment measures that loss of usefulness through labeled examples. The movement of individual parameters and the behavior of intermediate layers require separate analyses.

The authors contrast sequential training with joint training. If examples from all domains remain in the training data, updates can respond to the demands of several domains throughout the run. The paper relates this intuition to [multi-task learning](https://md.research.elamur.ai/free/en/papers/ruder-2017-overview-multi-task-learning-deep/), in which shared parameters can be shaped by feedback from several tasks. In the paper’s joint-training baseline, the domains share the masked prediction objective, and it is the source of the examples that varies.

Joint training assumes access to the earlier text and enough resources to process it alongside the new corpus. The authors point out that the original large training sets are often difficult to obtain. The exact configurations used to train a released checkpoint can also be difficult to recover or reproduce. A new domain may therefore arrive in a setting where the old checkpoint is easy to obtain, a small amount of relevant earlier text may be recoverable, and the full original training pipeline is impractical to run. The mitigation methods address different versions of that situation.

Maintaining a separate checkpoint for each domain is another approach described in the paper. Each checkpoint can be fine-tuned on the tasks associated with its own domain. The study asks whether one sequence of pretraining stages can instead produce a checkpoint from which tasks in several domains can be fine-tuned. The resulting checkpoint acts as a shared starting point. Each labeled task still has its own fine-tuning procedure and output.

#### The earlier work behind the comparison

The paper draws on three lines of work on forgetting. One constrains how much parameters can move as new training proceeds. Earlier research explored regularization and changes to activations. Elastic weight consolidation puts a different constraint on each parameter according to an estimate of its importance to earlier training. That distinction matters because the network has many possible ways to distribute the changes required by a new domain. [Overcoming catastrophic forgetting in neural networks](https://md.research.elamur.ai/free/en/papers/kirkpatrick-2016-overcoming-catastrophic-forgetting-neural-networks/)

A second line controls the size of updates at different depths. The authors borrow that idea from ULMFiT, a staged approach originally applied to recurrent networks. ULMFiT used different learning rates for different layers and also changed the schedule of those rates. This study takes the layerwise part of the approach into a Transformer and applies it during continued pretraining. The appeal is that the user can inherit a checkpoint and control how aggressively it changes without assembling a sample from the previous corpus.

A third line uses a small memory of earlier examples. The paper describes earlier studies that paired replay with local adaptation or examined how to update a limited memory over time. The authors bring replay to a larger pretraining setup and focus on what belongs in the buffer. A small buffer can preserve some of the feedback of joint training, but its contents determine which parts of the previous domain keep supplying feedback.

The authors also distinguish their question from earlier work on intermediate training. They describe STILTs and TandA as inserting a data-rich task before fine-tuning on a target task to reduce variability or improve adaptation. They cite work showing the value of narrowing masked pretraining towards a domain or task. The question here is what happens to earlier capabilities once those useful additional stages are introduced. A new stage can be valuable for its target application and still need a separate evaluation of retention. [Don’t Stop Pretraining](https://md.research.elamur.ai/free/en/papers/gururangan-2020-don-t-stop-pretraining-adapt/)

### The method, step by step

#### Follow the same checkpoint through changing text

The authors take RoBERTa BASE as their starting point. RoBERTa inherits BERT’s general architectural approach and trains on masked text prediction without the next-sentence prediction objective. The paper uses the RoBERTa training hyper-parameters except where it specifies changes and implements the mitigation methods in the fairseq RoBERTa setup. The authors make the study code available under the repository name `aws-health-ai/multi_domain_lm`.

Think of a checkpoint as a saved set of parameter values from which training can resume. The general checkpoint supplies those values for every main experiment. For the first domain transition, the authors resume pretraining on PubMed articles. They can let the updates proceed normally, constrain the changes, or keep examples of earlier text in circulation. For the clinical transition, they resume from selected checkpoints that already went through the PubMed stage. The order of the text is therefore part of the experiment. The clinical stage inherits whatever the biomedical stage has retained or changed.

The labeled task data enter at evaluation. To see what a checkpoint offers, the authors fine-tune a copy on the labeled examples for the task they want to measure. They do this for tasks associated with the new domain and with earlier ones. The mitigation is applied during pretraining, so the evaluation asks whether its effects carry over to supervised tasks. In particular, a result on an earlier domain is evidence that the adapted checkpoint remains useful there after task-specific training.

Sequential pretraining and evaluation across domains The steps in order.

The selection step applies to replay and consolidation. Learning rate control operates on the new text and the inherited parameters. The unmitigated setting also needs no earlier sample. For comparison, the mixed-domain run processes the full general and biomedical training sets together. These settings share the starting checkpoint and broadly comparable evaluation procedures while differing in the information available to each pretraining update.

#### Consolidation estimates which parameters to protect

Elastic weight consolidation, or EWC, starts with a simple distinction. Some changes to the checkpoint may have little effect on its performance in the earlier domain. Others may disrupt patterns that were important there. The method gives those changes different costs. A saved copy of the earlier parameter values supplies the reference point, and a sample of earlier text supplies the evidence for how strongly to protect each value.

The statistical motivation is to keep information about the parameters learned from the earlier domain while optimizing the objective for the new domain. The exact posterior distribution over the earlier parameters is intractable for this use. The method approximates the information it needs with the diagonal of a Fisher information matrix. In the paper’s implementation, the diagonal is estimated using squared gradients from examples of the earlier domain at the trained checkpoint. Using the diagonal gives the penalty a separate coefficient for each parameter. Interactions between pairs of parameters are outside that approximation.

```
Fᵢ,ᵢ = (1/N) ∑ⱼ₌₁ᴺ (∂Lₐ⁽ʲ⁾ / ∂θᵢ)²
```

Here `Fᵢ,ᵢ` is the diagonal entry for parameter `i`. `N` is the number of earlier-domain examples used to estimate it, and `j` indexes those examples. `Lₐ⁽ʲ⁾` is the loss for example `j` from the earlier domain `A`. `θᵢ` is the parameter at position `i`. The partial derivative `∂Lₐ⁽ʲ⁾ / ∂θᵢ` measures how the example’s loss changes locally with that parameter. The exponent `²` squares the gradient, so both positive and negative gradients contribute non-negative values. The summation runs from `1` through `N`, and the factor `1/N` makes the result an average across the sampled examples.

This calculation gives large contributions to parameters whose gradients have large magnitudes on the sampled text. Once the estimate is built, the new stage has two things to take into account. It should do well on the text it is currently learning from, and it should pay a penalty when certain parameter values move away from the earlier checkpoint. The following expression is the objective for that stage.

```
L(θ) = Lᵦ(θ) + λ ∑ᵢ Fᵢ,ᵢ (θᵢ − θ*ₐ,ᵢ)²
```

`L(θ)` is the complete objective for the current set of parameters `θ`. `Lᵦ(θ)` is the ordinary pretraining loss on the new domain `B`. The summation runs over the parameter index `i`, and `Fᵢ,ᵢ` is the earlier-domain estimate defined above. `θᵢ` is the current value at that position. `θ*ₐ,ᵢ` is the value at the same position in the saved checkpoint from domain `A`, with the star marking the fixed reference. Subtracting that value gives the displacement, and squaring it makes displacements in either direction costly. The hyper-parameter `λ` scales the entire penalty relative to the new-domain loss.

For the same displacement, a larger `Fᵢ,ᵢ` therefore produces a larger penalty. The coefficient `λ` controls the strength of the constraint across the network, while the diagonal controls where the constraint falls. The authors vary `λ` over `0.5`, `1.0`, `5.0`, and `10.0`. They also vary the sample size for the diagonal estimate across `0.1%`, `1.0%`, and `10.0%` of the earlier corpus. Those two choices affect different parts of the procedure. The sample size and composition govern the evidence for which parameters to protect. The coefficient governs how much influence that evidence gets during adaptation.

The earlier examples used by consolidation do their work when the diagonal is estimated. During the new stage, the penalty can use the saved values and their estimated importance. In practical terms, EWC trades a computation at the domain boundary for an extra term in the objective. The sampling experiments ask whether that computation can use a compact set of examples and still produce a helpful set of weights.

#### Learning rate control makes depth matter

Learning rate control, or LRC, reduces updates by assigning different learning rates to different layers. A learning rate controls the size of an optimizer step. The authors start at the output end of the network and lower the rate as they move toward the input. A layer near the input can still be updated, but its step size is smaller than that of a layer nearer the output.

```
η⁽ˡ⁻¹⁾ = η⁽ˡ⁾ / ρ
```

`η` denotes a learning rate and `l` indexes a layer. The superscript in parentheses identifies which layer the rate belongs to. `η⁽ˡ⁾` is the rate in layer `l`, and `η⁽ˡ⁻¹⁾` is the rate in the adjacent layer towards the input. The `1` marks that move by one layer. `ρ` is the decay factor. Dividing by `ρ` at each move gives progressively smaller rates when `ρ` exceeds `1`.

The paper counts 14 layers for this purpose. There are 12 Transformer layers, with an input layer and a head for masked prediction also included. Repeated division across that depth makes the effect of the decay factor more pronounced toward the input. The authors test values of `1.3`, `1.7`, and `2.6`. With a stronger decay, much of the adjustment is concentrated towards the output. This preserves the earlier values in the lower layers more closely while giving the less constrained layers room to respond to the new text.

The schedule uses depth as the criterion for which changes to slow. EWC gets its constraints from gradients and applies them at the level of individual parameters. LRC gets its constraints from the position of a layer and gives the same rate to its parameters. It can therefore run with the newly available corpus even when examples from the earlier training are inaccessible.

#### Replay gives earlier text a place in new batches

Experience replay, or ER, keeps a buffer of earlier examples. The authors bring text from that buffer into batches during continued pretraining. For the comparison with consolidation they use the same earlier-domain subset, but they put it to a different use. Consolidation uses it to estimate parameter importance. Replay uses it as training input, so an earlier example can contribute a new gradient as the parameters change.

The paper describes mixing general text into each batch in a proportion tied to the sizes of the available datasets. The main new source of training remains the target corpus. At the same time, replay supplies direct feedback for a limited part of the earlier domain. This is the connection to joint training. The full mixed-domain baseline can draw on both complete corpora. Replay asks what can be preserved with a much smaller sample of the earlier one.

The buffer size makes selection consequential. The paper notes that `1.0%` of its general pretraining data corresponds to over `400k` segments. A small percentage can still require substantial processing. And segments drawn from the same corpus can vary in what they tell the optimizer about important text patterns. The authors test both variation in the strength of the training signal and variation in the kinds of text represented in the sample.

#### Select earlier examples by gradients or by clusters

The gradient method gives each segment a single feature, the sum of its squared gradients. This feature has a different job from the EWC diagonal. The diagonal takes information across examples and produces a value for each parameter. The selection feature takes information across parameters and produces a value for each example. The same underlying kind of training signal can thus be used either to rank text segments or to decide which parameter changes to penalize.

The authors describe the distribution of segment scores as strongly skewed, with a long tail of large values. They test four ways of drawing from it. Random sampling gives segments equal treatment. Low-gradient sampling takes segments from the low end of the ordering, and high-gradient sampling takes them from the high end. The uniform-gradient method groups segments into bins by their gradient scores and draws across those bins. A random sample reflects the frequency of segments in the corpus. Sampling across bins deliberately gives different regions of the gradient distribution a chance to be represented.

In these selection experiments, each strategy draws `0.1%` of the general corpus, approximately `42k` segments. The authors use each resulting sample to estimate the EWC diagonal and also test it as a replay buffer. That design holds the kind of selection fixed while changing how the examples enter training. A sample that produces a helpful set of parameter weights can therefore be assessed separately from its usefulness as text to replay.

The cluster method starts with a vector for each segment. The authors compare taking the representation of RoBERTa’s initial special token `<s>` with averaging the token representations from the last encoder layer. The special token gives one position from which to read a segment representation. Averaging combines information across positions. Both procedures turn a segment of text into a single vector suitable for grouping with other segments.

The vectors are reduced with principal component analysis, or PCA, to a dimension of `50` or `100`. This gives the clustering procedure a smaller set of coordinates to work with. The authors fit a Gaussian mixture with `5` or `10` clusters and draw examples across the groups. A mixture groups examples through their positions in the reduced representation space. The study asks whether these groupings can help cover forms of prose, diction, and formality that a single gradient score leaves undifferentiated. The main cluster-based comparison uses `5` clusters and `100` dimensions.

The two selection routes also have different processing costs. The gradient route must recover information about how a training loss responds to the parameters for each example. The cluster route can obtain vectors for batches of examples before reducing and grouping them. That distinction is important at the scale of the general corpus. Even a small improvement from selecting examples has to be weighed against the work required to identify them.

### Experiments and results

#### Corpora, labeled tasks, and scores

The general pretraining pool combines BookCorpus and English Wikipedia with CommonCrawl Stories and OpenWebText. The authors report roughly `18B` tokens in that pool. Their biomedical corpus uses full PubMed articles, processed to remove figures, equations, tables, and references. The resulting biomedical corpus contains over `4B` tokens. Training, validation, and test portions of the pretraining corpora are sampled by document in a ratio of `8:1:1`. Splitting at that level keeps segments from the same document assigned together.

For general language understanding the authors draw on [GLUE](https://md.research.elamur.ai/free/en/papers/wang-2018-glue-multi-task-benchmark-analysis/). Their main RoBERTa comparisons use CoLA and SST-2, along with MNLI, QNLI, and RTE. These tasks include judgments about sentence acceptability, sentiment, and relationships between sentences. The subset is intended to emphasize tasks susceptible to the previous BERT-to-BioBERT change. The paper points to QQP and MRPC as examples of tasks that were comparatively robust to the choice of initialization. The GLUE scores in the main experiments are reported on the development sets, and the methods section describes their metric as accuracy.

The other general evaluations are entity recognition on [CoNLL-03](https://md.research.elamur.ai/free/en/papers/sang-2003-introduction-conll-2003-shared-task/) and [question answering](https://md.research.elamur.ai/free/en/concepts/question-answering/) on [SQuAD](https://md.research.elamur.ai/free/en/papers/rajpurkar-2016-squad-100-000-questions-machine/). The paper uses SQuAD 1.1 and reports F1 there. These evaluations give the general side a span-labeling task and a reading-comprehension task alongside the GLUE subset. The aggregate gives each of the selected GLUE tasks its own place alongside CoNLL and SQuAD. The displayed GLUE average is thus a summary of several evaluations within the larger general average.

The biomedical tests cover different outputs. BC5CDR tests recognition of chemical and disease mentions, using expert annotations of PubMed abstracts. Chemprot tests extraction of chemical–protein relations, with annotations drawn from PubMed text. BioASQ is formatted as a binary classification problem in this study. The decision is whether the supplied context contains the answer to the question. The authors follow the format and splits described in the biomedical pretraining work by Gu and colleagues.

For the entity and relation tasks, the paper reports micro-F1, which combines decisions across examples before summarizing precision and recall. The evaluation setup identifies accuracy as the BioASQ metric. As a result, the biomedical average combines task scores with different meanings. The overall score after biomedical pretraining averages the general and biomedical domain scores with equal weight. This aggregation gives the smaller collection of biomedical tasks the same influence as the larger collection of general tasks.

#### A first check with BERT and BioBERT

Before running their controlled RoBERTa comparison, the authors fine-tune BERT BASE and BioBERT across the full GLUE suite. The comparison asks whether an existing biomedical checkpoint already shows the behavior that motivates the study. BioBERT has received further training on PubMed text, and its scores decline across much of the general suite. The authors report a relative error increase of `7.64%` for the comparison.

The changes are uneven. On CoLA, BERT BASE scores `57.82` and BioBERT scores `37.78`. On WNLI, the corresponding scores are `53.52` and `28.17`. The movement can also favor the adapted checkpoint. On MRPC, BERT BASE scores `86.74` and BioBERT scores `88.44`. The authors point out that some of the largest losses occur on tasks where the initial checkpoint already struggles. That observation motivates a closer examination with a shared RoBERTa initialization and explicit controls over the domain shift.

The off-the-shelf comparison serves as a diagnostic for where losses can show up. Its individual tasks also reveal why reporting only a single benchmark average would be incomplete. A change that is large on an acceptability task can coexist with a gain on a paraphrase task. The follow-up experiments track both the general aggregate and individual scores, and add biomedical tasks so that the gains from adaptation can be seen beside the losses.

#### The move from general text to PubMed articles

The central comparison starts with the unchanged RoBERTa BASE checkpoint and an unmitigated continuation on PubMed, called PMC. A full mixed-domain baseline, called MDL in the paper, uses the combined general and biomedical training sets. The remaining runs continue on PubMed with LRC, replay, or consolidation. For both replay and consolidation, the paper gives a uniformly sampled gradient setting and a cluster-based setting. The authors fine-tune the checkpoints after a single epoch of PubMed training.

Unmitigated PMC improves on the biomedical average, where it scores `75.74` compared with `74.69` for the general checkpoint. Its general-task average is `84.44`, compared with `88.30` for RoBERTa BASE. That movement is visible on all the displayed general measures. For instance, SQuAD falls from `90.20` F1 to `88.73`, and CoNLL falls from `90.11` micro-F1 to `87.35`. The selected GLUE development-task average moves from `87.56` to `83.00`. PubMed pretraining thus changes which tasks are best served by the same underlying architecture.

LRC reaches a general average of `87.72` in the main comparison. On SQuAD it reaches `90.35` F1. On biomedical tasks its results are mixed, including `85.47` micro-F1 on BC5CDR and `62.30` micro-F1 on Chemprot. Its biomedical average is `74.39`. These results identify a setting with strong general retention whose adaptation benefits depend on the particular biomedical task.

Both consolidation settings fare well on general tasks. Gradient-based EWC has a general average of `87.90`, and cluster-based EWC has `88.01`. The clusters give the strongest CoNLL result among the settings shown, at `90.46` micro-F1. Gradient-based consolidation has the stronger SQuAD result of the consolidation pair, at `90.43` F1. The two settings differ on the biomedical side as well. The gradient setting records `77.28` there and the cluster setting records `75.90`.

General downstream task averages after PubMed pretraining Cluster-based consolidation comes closest to the unchanged RoBERTa checkpoint.

**The numbers**

| System or setting | average task score |
| --- | --- |
| RoBERTa BASE | 88.30 |
| PMC without mitigation | 84.44 |
| Full mixed-domain training | 86.15 |
| Learning rate control | 87.72 |
| Replay with gradient sampling | 86.04 |
| Replay with cluster sampling | 85.65 |
| Consolidation with gradient sampling | 87.90 |
| Consolidation with cluster sampling (this paper) | 88.01 |

Replay shows a different balance. With gradient sampling it reaches `87.20` micro-F1 on BC5CDR and `67.40` micro-F1 on Chemprot. Those are the strongest results among the mitigation settings for those tasks. The same replay setting has a general average of `86.04`. Cluster-based replay has a general average of `85.65`, and its biomedical average of `77.65` is the highest in the table. As the per-task scores illustrate, the choice of sample can favor different things even within a single mitigation method.

For BioASQ, the table shows `82.42` for cluster-based replay and `77.13` for gradient-based replay. It shows `75.41` for the unchanged checkpoint, unmitigated PMC, MDL, and LRC. The authors call attention to the repeated value as an observed result. The methods description calls the BioASQ measure accuracy, although the discussion calls it F1. The scores can be compared within the column while keeping that inconsistency in view.

The full mixed-domain baseline gives `86.15` on the general average and `75.44` on the biomedical average. Its biomedical result exceeds that of the untouched checkpoint, but its general result is lower than those from LRC and both EWC settings. The authors had included mixed-domain training as a potential upper bound, given the amount of earlier text it sees. Its measured outcome shows why the upper-bound designation was an expectation to test. Under this training setup, access to the full combined data does not guarantee the best balance in the downstream evaluation.

The overall score puts gradient-based EWC first, at `82.59`. Cluster-based EWC follows at `81.96`. Both replay settings also score above the unmitigated PMC run on this domain-balanced measure. The ranking reflects the chosen weight on the general and biomedical averages. A reader interested only in a particular biomedical task would use the score for that task to make a different comparison.

Overall scores for general and biomedical tasks after PubMed pretraining Gradient-based consolidation leads when the general and biomedical averages receive equal weight.

**The numbers**

| System or setting | domain-balanced average score |
| --- | --- |
| RoBERTa BASE | 81.49 |
| PMC without mitigation | 80.09 |
| Full mixed-domain training | 80.79 |
| Learning rate control | 81.05 |
| Replay with gradient sampling | 81.64 |
| Replay with cluster sampling | 81.65 |
| Consolidation with gradient sampling (this paper) | 82.59 |
| Consolidation with cluster sampling | 81.96 |

#### The move from PubMed articles to clinical notes

The second transition tests whether a strategy that worked after PubMed remains useful when the next kind of text arrives. The authors process `659M` tokens from de-identified clinical notes. They continue training from the biomedical checkpoints for LRC, gradient-based replay, and cluster-based EWC. For comparison, they also continue the unmitigated PubMed checkpoint on clinical text and retain the unchanged RoBERTa BASE checkpoint. Both prior adaptation and the new clinical stage contribute to the behavior of a final checkpoint.

The clinical evaluations include i2b2 entity recognition and i2b2 relation extraction, along with n2c2 relation extraction for adverse drug events. The paper reports micro-F1 for these tasks. It evaluates the checkpoints after `5` epochs of clinical training. The authors say they checked the clinical entity recognition score at each epoch and chose an endpoint once it leveled off. The reported comparison therefore uses a training duration informed by one of the clinical evaluations.

For the general task average, the checkpoint trained without mitigation through both stages scores `82.98`. LRC records `87.47`, EWC records `86.99`, and replay records `84.51`. The unchanged checkpoint remains at `88.30`. LRC again preserves the strongest general average among the continued-training settings. The biomedical column tells a different story. The unmitigated run scores `76.53`, compared with `75.85` for replay, `75.04` for EWC, and `74.33` for LRC. The original checkpoint has `74.69` in that column.

The unmitigated run leads on the clinical average at `84.79`. Replay comes closest to it among the mitigated settings, with `84.20`. The individual tasks show why it helps to keep the clinical scores visible. EWC leads on i2b2 relation extraction with `79.59` micro-F1. The unmitigated run leads on i2b2 entity recognition at `85.96` and on adverse drug event relation extraction at `88.96`. The best clinical average belongs to a different setting from the best overall average.

Clinical average micro-F1 on i2b2 and n2c2 after clinical pretraining Unmitigated pretraining leads on the clinical tasks, with replay closest among the mitigation methods.

**The numbers**

| System or setting | average micro-F1 |
| --- | --- |
| RoBERTa BASE | 82.03 |
| PubMed and clinical notes without mitigation (this paper) | 84.79 |
| Learning rate control | 83.26 |
| Replay with gradient sampling | 84.20 |
| Consolidation with cluster sampling | 83.47 |

Across all three domains, the reported overall scores are close. EWC reaches `81.91`, LRC `81.69`, and replay `81.52`. The untouched general checkpoint has `81.67`, and the unmitigated run through both domains has `81.43`. The proximity of those results can conceal large changes within a domain. In particular, the unmitigated setting leads on the biomedical and clinical averages while recording the lowest general average in this comparison. EWC has the strongest overall score because its general performance remains closer to the starting checkpoint while the two specialist averages both improve on that checkpoint.

### What the ablations show

#### How the earlier text is selected

The first controlled selection comparison uses the same fraction of the general corpus for every sampling rule. The authors continue pretraining for one epoch on PubMed and evaluate retention on the selected GLUE tasks and SQuAD 1.1. Because the samples are all the same size, the differences show what can happen when the selection rule changes the composition of an equally large buffer or Fisher-estimation sample.

For replay, uniform gradient-bin sampling gives a combined general score of `85.53`. Low-gradient sampling gives `84.82`, and the authors report the difference as `0.71` points. Random and high-gradient selection give `85.10` and `85.15` respectively. The average favors a sample that includes examples with larger gradients over a sample restricted to the low tail. The task columns make the comparison more specific. High-gradient replay reaches `84.59` on the GLUE development-task average, but its SQuAD result is `87.99` F1, compared with `89.70` for uniform gradient-bin sampling.

Consolidation is less sensitive to the selection rule on this aggregate. The paper reports a variance of `1.8e−2` across the EWC sampling settings, compared with `6.4e−2` for replay. The EWC average is `87.61` for high-gradient sampling and `87.60` for uniform gradient-bin sampling. Low-gradient selection gives the lowest combined EWC result, `87.28`, but produces the strongest SQuAD F1 in that part of the comparison, `90.49`. Large-gradient examples help several combined scores. Their usefulness can still change with the task used to judge retention.

The latent-cluster experiment varies the representation used to group examples, the dimension after PCA, and the number of clusters. The authors find that using `100` dimensions gives stronger results in several comparisons and that the effect of choosing `5` or `10` clusters is hard to interpret consistently. For instance, in the average-pooling comparison at `100` dimensions, EWC records `87.83` on the combined GLUE and SQuAD score with `5` clusters and `87.24` with `10`. Replay records `84.96` and `85.39` for those respective settings. The direction of the change depends on what the sampled examples are used for.

The authors also time the selection work. They report that accumulating gradients for `1MM` examples takes roughly five days on an NVIDIA V100. Obtaining latent representations for the same amount of data takes less than four hours, with PCA and clustering adding another four to five hours. They attribute much of the difference to the ability to batch the representation step. This is a comparison of how quickly the selection features can be prepared. Together with the downstream results, it is the basis for their preference for latent representations when selection cost is important.

#### What happens when the constraints change?

The authors remove the Fisher weights from the EWC penalty to test whether pulling all parameters towards the earlier checkpoint is sufficient. The resulting penalty still prefers small displacements but assigns the same coefficient to each parameter. The paper reports that the biomedical results in this setting average `3.68%` below the listed biomedical EWC scores. This ablation supports the importance of distributing the constraint selectively. A checkpoint may need to change substantially in some directions to learn the new domain, and the diagonal gives the procedure a way to distinguish those directions at the level of individual coordinates.

The authors also find that EWC is sensitive to the overall scale of the penalty. With `λ` above `1.0`, they observe that general performance can be preserved almost completely while biomedical performance suffers. Changing the total penalty can therefore reverse the practical value of a good importance estimate. Retaining the old parameters very closely can leave too little flexibility to improve the downstream tasks that motivated the adaptation.

Layerwise decay shows a related pattern using a different control. The authors report a general-task average of `88.28` for a learning rate decay factor of `2.6`, with more difficulty adapting to later domains. In the clinical stage, changing that decay factor produces a `1.49`-point range in the average clinical score. LRC simplifies the tuning problem by making the depth schedule depend on a single factor, but the target domain still affects what value works well. A schedule selected for general retention can place a stronger limit on clinical performance than a schedule selected with both domains in view.

#### Where the weights change

The authors compare corresponding weights before and after biomedical pretraining using cosine similarity, a measure of how closely two vectors point in the same direction. The comparison is layer by layer. First they compare the unchanged general checkpoint with unmitigated PMC. The layers nearer the input have more similar weights. Changes become more visible farther toward the output.

They then compare mitigated checkpoints with the general and biomedical endpoints. Replay produces weights more similar to the biomedical endpoint, consistent with its stronger new-domain results and weaker general retention in several of the downstream comparisons. EWC keeps a configuration closer to both endpoints. LRC exhibits the depth pattern expected from its design. The authors find substantial movement primarily at the last layer when the learning rates toward the input are very small.

Removing the Fisher weights also changes the picture. The authors report cosine similarity below `0.2` between the resulting EWC setting and RoBERTa BASE. They relate this result to the weaker downstream performance of the unweighted penalty. Weight similarity supplies evidence about where training moved the network. The downstream evaluations establish whether that movement was accompanied by gains or losses on specific tasks.

#### What a small task head can read from each layer

The paper uses entity recognition to test what information is accessible at different depths. For each layer, the authors take its output as the representation of the text and train only the task-specific layers. They limit the capacity of those layers so the probe depends heavily on the features already available at the chosen depth. This keeps the test distinct from full fine-tuning, during which the encoder can change to make the task easier.

Layers towards the output generally support stronger entity recognition results, with an exception at the final layer. Biomedical entity recognition improves more rapidly across layers than general entity recognition. After biomedical training, the plotted comparison shows a loss on CoNLL and a gain on BC5CDR. The authors interpret the progression as consistent with grammatical information becoming usable relatively early and more domain-specific information being expressed farther up the network. They relate that interpretation to earlier work on what different layers encode. [What Does BERT Learn about the Structure of Language?](https://md.research.elamur.ai/free/en/papers/jawahar-2019-what-does-bert-learn-about/)

The probe and the weight comparison answer complementary questions. The weight comparison locates changes in the learned parameters. The probe tests where a restricted task head can read out a useful signal. Read together, they support the authors’ interest in letting adaptation concentrate in layers toward the output. The final-layer exception also matters for that interpretation. A layer can change substantially under pretraining while the layer just below it offers a better representation for a particular supervised probe.

#### What the examples add

A qualitative comparison uses spans from the CoNLL test split and shows entity labels and confidences produced by systems initialized with different checkpoints. One example contains the place name Norilsk. The authors describe it as rare in the newswire material and more frequent in PubMed, whose overall corpus is smaller. The example illustrates how access to text from both domains can help with a word that is uncommon in one source. The paper presents replay and EWC as ways of combining that exposure through a sequence of training stages.

The examples provide a view of the kinds of prediction that can differ between checkpoints. They also show why a corpus-level label such as *general* or *biomedical* gives only a partial account of which words the corpus can help with. A name with a useful pattern of occurrence in PubMed can matter to a general entity recognition task. The aggregate entity scores remain the evidence for how the checkpoints compare across many examples.

### Limitations

#### Limits and trade-offs the authors identify

The authors emphasize the dependence of EWC and replay on earlier text. When the earlier corpus is unavailable, the sample used to estimate the Fisher diagonal or fill the replay buffer becomes a practical barrier. LRC remains available in that situation. Its tuning results show the associated compromise. A depth schedule strong enough to keep much of the earlier behavior can also slow the adaptation that is needed in the target domain. The conclusion identifies faster methods that can operate without earlier text as an open direction, along with adapting the decay schedule in light of the layer analyses.

The authors also identify tradeoffs within the data-dependent methods. EWC can preserve more general performance with a larger penalty, at the cost of worse biomedical results. Replay gives strong specialist results at several points but preserves less of the general score. The best choice therefore depends on the target and the material available at the domain boundary. The clinical stage makes this dependence particularly clear because the leading settings for general retention, clinical performance, and the overall average differ.

Collection and processing effort are part of the practical argument. The authors compare the cost of gradient features with clustering, and discuss the expense of training on complete corpora. Those measurements concern particular steps and hardware. The evidence for efficiency is strongest for the difference between the two feature extraction procedures. The experiments give a more limited basis for an end-to-end accounting of training time, memory, storage, or emissions across the mitigation settings.

#### Limits apparent from the design and reporting

The main experiments trace one encoder family along a particular order of domains. They establish that the mitigation methods can affect retention when RoBERTa moves from general text into PubMed and then into clinical notes. They leave open how the same methods behave if the order changes, if the text domains have a different relationship, or if more shifts are added. The second stage also takes selected configurations from the first stage. It gives a direct comparison of those continuation paths, while the rankings for other choices of buffer, penalty, or learning rate remain unmeasured there.

The main GLUE subset was chosen to emphasize deterioration after the authors inspected the BERT and BioBERT comparison. That makes it useful for detecting losses. It also means general retention in the main experiment should be read in terms of the named tasks. The rationale for the subset is imperfectly documented. WNLI has a large loss in the initial comparison and is absent from the main subset, even though the paper characterizes its selection in terms of the largest losses. There is a separate counting inconsistency. The main task list and the abstract indicate seven general tasks, while the single-stage results caption also refers to nine. The named tasks and reported scores are firmer grounds for comparison than the conflicting count in the caption.

There are further ambiguities in the metric descriptions. The evaluation procedure calls the BioASQ measure accuracy, while part of the results discussion calls it F1. The biomedical average combines tasks for which the methods specify different metrics, so its interpretation is a mean of task scores. The Fisher explanation also contains a mismatch between its verbal account and the written objective. In the equation, a larger Fisher entry multiplies the squared displacement and therefore penalizes the same change more strongly. That is the interpretation used when reading the EWC procedure and its ablation.

The reported scores show the outcomes of the given runs and settings. The main comparisons offer limited information about how much the close rankings would vary across repeated runs. This matters most where several overall scores sit close together. The pattern of domain differences is easier to see in the domain columns, and readers can judge the practical significance of those differences for the applications they care about. The overall averages encode an explicit choice about how much each domain counts.

Finally, the layer analysis and examples address mechanisms at different levels of evidence. The cosine comparisons describe how the weights changed. The probes describe how well particular features support a restricted entity recognition head. The qualitative examples describe individual decisions. Together they motivate the authors’ interpretation of where adaptation is concentrated and how exposure to both corpora can help. Claims about which layer uniquely carries a grammatical distinction, or how often cross-domain exposure improves predictions for rare words, extend beyond what those analyses measure.

### What came after

Subsequent uses of the paper’s approach are undocumented here. The paper closes with two directions for follow-up. One is to develop faster methods that preserve earlier capabilities when the original text is inaccessible. The other is to investigate learning rate schedules that reflect what the layer analysis found, including the stronger transfer from layers toward the output and the exception at the final layer. Those directions follow from different parts of the evidence. The sampling experiments show why access to and processing of old text can shape the choice of method. The layer comparisons show why depth is a plausible source of information for controlling adaptation when that text is unavailable.

## Cite

Cite as Kristjan Arumae, Qing Sun and Parminder Bhatia. 2020. An Empirical Investigation Towards Efficient Multi-Domain Language Model Pre-training. Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP).

The paper itself, not this page. BibTeX from the library's record of the work. [DOI 10.18653/v1/2020.emnlp-main.394](https://doi.org/10.18653/v1/2020.emnlp-main.394)

```bibtex
@inproceedings{arumae2020empirical,
  title = {{An Empirical Investigation Towards Efficient Multi-Domain Language Model Pre-training}},
  author = {Kristjan Arumae, Qing Sun and Parminder Bhatia},
  booktitle = {Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP)},
  year = {2020},
  doi = {10.18653/v1/2020.emnlp-main.394},
  url = {https://doi.org/10.18653/v1/2020.emnlp-main.394}
}
```

> 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)
