AVocaDo: Strategy for Adapting Vocabulary to Downstream Domain

Jimin Hong, Taehee Kim, Hyesu Lim, Jaegul Choo

In the world of Natural Language Processing (NLP), we’ve grown accustomed to the "pretrain then fine-tune" paradigm. We take a massive model like BERT, trained on all of Wikipedia, and then tweak it for a specific task, like analyzing medical papers or tech reviews. But there’s a hidden bottleneck: the vocabulary.

While we update the model's weights during fine-tuning, the vocabulary—the set of subwords the model "knows"—usually stays frozen. This leads to a semantic mismatch. If your model sees the word "bluetooth" and splits it into "blue" and "##tooth," it’s losing the specific technical meaning of the term.

The paper "AVocaDo: Strategy for Adapting Vocabulary to Downstream Domain" introduces a clever way to fix this without needing massive new datasets or expensive retraining.

TL;DR

AVocaDo is a strategy that dynamically expands a pretrained model's vocabulary with domain-specific terms during the fine-tuning phase. By using a novel "fragment score" to select words and a contrastive regularization term to prevent overfitting, it achieves massive performance gains (up to +13 F1 points) on specialized datasets using only the task-specific data.

What Problem Does This Paper Address?

Most modern language models use subword tokenization (like WordPiece or BPE). This is great for handling out-of-vocabulary words, but it fails when a domain-specific term is common in a new field but rare in the general pretraining data.

For example, in a reviews dataset, "otterbox" (a phone case brand) might be split into "otter" (the animal) and "box" (the container). This "over-fragmentation" forces the model to reconstruct complex meanings from unrelated parts, which is inefficient and often inaccurate.

Existing solutions like SciBERT or BioBERT solve this by pretraining from scratch or doing "adaptive pretraining" on billions of domain-specific words. This is computationally expensive and requires a massive, unlabeled corpus that you might not have. AVocaDo aims to achieve similar benefits using only the small downstream dataset you are already using for fine-tuning.

Overview of AVocaDo vs. standard fine-tuning. AVocaDo updates the vocabulary to better handle domain-specific terms.

Methods

The AVocaDo approach consists of two main pillars:

1. Vocabulary Expansion via Fragment Score

The authors introduce the Fragment Score ($f_C$), which measures how "finely" a vocabulary tokenizes a corpus. It’s essentially the ratio of subwords to original words. A high score means the model is chopping words into too many tiny pieces.

AVocaDo iteratively adds the most frequent words from the downstream data into the vocabulary until the fragment score drops below a specific threshold ($\gamma$). This ensures that important domain terms like "corticosterone" or "nlp" are treated as single units rather than a string of fragments.

2. Contrastive Regularization

Adding new words creates a problem: these new tokens have no pretrained embeddings. If you train them only on a small downstream dataset, they will quickly overfit.

To solve this, AVocaDo uses a contrastive learning framework. During training, the same sentence is tokenized twice: once with the original pretrained vocabulary ($V_P$) and once with the new adapted vocabulary ($V_A$). The model then tries to make the hidden representations of these two versions as similar as possible. This effectively "distills" the knowledge from the pretrained subwords into the new, whole-word embeddings.

Figure 2: Fine-tuning with regularization. Identical sentence "... the bluetooth function in my car ...", sampled from AMAZON, is tokenized with pretrained vocabulary (left) and with adapted vocabulary (right). The domain- specific word "bluetooth" is tokenized in two ways, which are highlighted as green and yellow respectively. The model is fine-tuned with regularization on l-th layer, highlighted as brown box, to preserve the embeddings of added words (e.g., bluetooth) from overfitting to downstream dataset.

Datasets

The authors evaluated AVocaDo across four distinct domains:

  • Biomedical (BIOMED): The CHEMPROT dataset (chemical-protein relations).
  • Computer Science (CS): The ACL-ARC dataset (citation intent).
  • News: The HYPERPARTISAN dataset (detecting political bias).
  • Reviews: The AMAZON dataset (helpfulness classification).

They also used WikiText as a representative "general domain" corpus for comparison.

Key Insights and Ideas

  • Vocabulary as an Optimizable Parameter: Instead of treating the vocabulary as a static artifact of pretraining, AVocaDo treats it as a component that should evolve with the task.
  • Mitigating the Domain Gap: The "fragment score" provides a quantitative way to see the domain gap. As shown in Figure 3, specialized domains have much higher fragmentation than the general domain (WikiText). AVocaDo successfully shifts these distributions to look more like the "natural" tokenization of the general domain.
  • Efficiency is King: AVocaDo doesn't require a large domain-specific corpus. It works with as few as 500 training examples (in the case of the News dataset), making it highly accessible for niche tasks.
Figure 3: The analysis of the pretrained and adapted vocabularies on WikiText and downstream domains. P and A denote the pretrained vocabulary and the adapted vocabulary respectively. AVocaDo mitigates the domain gap in terms of the average number of subwords tokenized from a single word.

Key Results

The quantitative improvements are striking, especially on BERT-base:

  • Reviews (AMAZON): Jumped from 55.50 to 68.51 F1 (+13.01).
  • Computer Science (ACL-ARC): Jumped from 56.82 to 67.28 F1 (+10.46).
  • Biomedical: Even when applied to models already adapted to the domain (like SciBERT or BioBERT), AVocaDo still provided a performance boost, proving that task-specific vocabulary adaptation has unique benefits.

Qualitatively, the model's "understanding" becomes much more intuitive. Instead of seeing "otter" + "box," it sees "otterbox." Instead of "sul" + "f" + "hy" + "dra" + "tion," it sees "sulf" + "hydr" + "ation"—fragments that actually carry chemical meaning.

Limitations and Future Work

  • Hyperparameter Sensitivity: The method relies on a few hyperparameters (like the threshold $\gamma$ and the regularization weight $\lambda$). While the authors found $\lambda=1.0$ worked well, $\gamma$ might need tuning for different domains.
  • Task Scope: The paper focuses primarily on text classification. It remains to be seen how this specific vocabulary adaptation affects generative tasks (like summarization) or sequence labeling (like NER) where token boundaries are even more critical.
  • Embedding Initialization: Currently, new words are initialized as the mean of their subword components. Exploring more sophisticated initialization techniques could further boost performance.

Summary updated

Abstract

During the fine-tuning phase of transfer learning, the pretrained vocabulary remains unchanged, while model parameters are updated. The vocabulary generated based on the pretrained data is suboptimal for downstream data when domain discrepancy exists. We propose to consider the vocabulary as an optimizable parameter, allowing us to update the vocabulary by expanding it with domain-specific vocabulary based on a tokenization statistic. Furthermore, we preserve the embeddings of the added words from overfitting to downstream data by utilizing knowledge learned from a pretrained language model with a regularization term. Our method achieved consistent performance improvements on diverse domains (i.e., biomedical, computer science, news, and reviews).
BibTeX
@inproceedings{hong2021avocado,
  author = {Jimin Hong and Taehee Kim and Hyesu Lim and Jaegul Choo},
  title = {{AVocaDo: Strategy for Adapting Vocabulary to Downstream Domain}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2021},
  doi = {10.18653/v1/2021.emnlp-main.385},
}
Figure