Efficient Attribute Injection for Pretrained Language Models

Reinald Kim Amplayo, Kang Min Yoo, Sang-Woo LeearXiv 2021

Abstract

Pretrained Language Models (PLMs) often lack the ability to incorporate external context or metadata, leading to "ungrounded" interpretations of text. We introduce INJECTORS, a lightweight and memory-efficient method for feeding attributes (e.g., user IDs, research areas) into PLMs. By combining adapter modules with low-rank mathematical approximations, our approach achieves state-of-the-art performance across eight datasets while reducing additional parameters by up to 192x compared to naive methods.

Introduction

While PLMs like BERT excel at understanding general language, they frequently ignore the specific context surrounding a document. For instance, a review stating "this dish is very sweet" may be a compliment or a complaint depending on the user's preferences. Existing methods for injecting such metadata often require retraining massive models or fail to scale when dealing with thousands of unique attributes. The challenge lies in providing PLMs access to rich metadata without exploding the parameter count or degrading the model's underlying knowledge.

The INJECTOR Architecture

The core of our method is the INJECTOR module, which extends the concept of adapters—small, trainable bottleneck layers inserted between fixed PLM layers.

Dual Injection and Modularity

Attributes are injected in two distinct ways: first as a bias (representing a general disposition, like a "harsh grader") and second as weights (modifying how the model interprets specific words based on the attribute).

Integration of the Injector module with task adapters and attribute vectors.

This modular design allows the same sentence to be processed differently based on the associated metadata. Furthermore, these modules are portable; an attribute module trained on one task can be "plugged" into another with minimal performance loss.

Parameter Efficiency via Low-Rank Math

To manage massive attribute vocabularies (e.g., 98,000 unique items in the Beeradvocate dataset), we employ low-rank approximations and Parameterized Hypercomplex Multiplications (PHMs). This allows the model to generate large weight matrices from a significantly smaller set of learned parameters.

Low-rank weight generation mechanism for parameter-efficient attribute injection.

This mathematical optimization reduces the number of parameters required for injection by 192x compared to naive implementations, making it feasible to deploy on standard hardware even with vast metadata vocabularies.

Experimental Evaluation

We evaluated INJECTORS on eight diverse datasets, including sentiment analysis (Yelp, IMDB, Beeradvocate), classification (AAPR, PolMed), and new benchmarks for spoiler detection (Goodreads) and cooking time prediction (Food.com).

Key Results

  • Performance: INJECTORS outperformed BERT-base and previous state-of-the-art (SOTA) methods on 7 out of 8 datasets.
  • Spoiler Detection: On the Goodreads dataset, the model achieved a 57.78 F1 score, a significant improvement over the 41.98 baseline.
  • Sparsity Mitigation: The model demonstrated robust performance on "sparse" attributes—users or products with very few reviews—suggesting that low-rank information sharing aids generalization even when specific attributes are rarely seen.

Discussion and Limitations

A notable limitation was observed on the IMDB dataset, where the model slightly underperformed previous SOTA. This is likely due to BERT’s 512-token limit; previous non-PLM models (like BiLSTMs) could process entire long-form reviews that BERT must truncate. Future work will explore attribute injection for text generation, potentially enabling AI to adopt specific authorial styles or generate personalized product descriptions.

Summary updated

BibTeX
@misc{amplayo2021efficient,
  author = {Reinald Kim Amplayo and Kang Min Yoo and Sang-Woo Lee},
  title = {{Efficient Attribute Injection for Pretrained Language Models}},
  year = {2021},
  eprint = {2109.07953},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2109.07953},
}
Figure