Enhancing Natural Language Representation with Large-Scale Out-of-Domain Commonsense

Wanyun Cui, Xingran Chen

Abstract

Large Language Models (LLMs) often struggle with "low-frequency" commonsense knowledge—basic facts humans take for granted—due to domain discrepancies between general text and structured knowledge bases. We present the OK-Transformer (Out-of-domain Knowledge enhanced Transformer), an architecture that integrates explicit external commonsense descriptions into language models like BERT. By utilizing a specialized knowledge integration module and a dedicated knowledge token, OK-Transformer avoids the "catastrophic forgetting" associated with traditional continued pre-training. Our approach achieves state-of-the-art performance across various reasoning and text classification benchmarks, demonstrating the efficacy of treating commonsense as an explicit external input rather than implicit training data.

Introduction

While models like BERT and RoBERTa are powerful, they frequently fail to capture basic human commonsense. For instance, a model might not inherently know that if "Jim comforted Kevin," Jim is likely "sympathetic."

Figure 1: Example of commonsense reasoning challenges and candidate knowledge from ATOMIC2020.

The standard solution is "continued pre-training" on commonsense datasets. However, this often fails due to domain discrepancy. Commonsense knowledge bases (like ATOMIC2020) use specific "if-then" formats that differ significantly from the general prose found in downstream tasks. This mismatch often leads to "catastrophic forgetting," where the model gains specific commonsense but loses its general linguistic abilities.

Methodology: The OK-Transformer

To address these challenges, we propose the OK-Transformer, which "plugs in" external knowledge on the fly. The architecture consists of three specialized modules:

  1. Transformer(1) (Knowledge Enhancement): Encodes the target sentence and introduces a special knowledge token [k] that acts as a bridge between the sentence and external knowledge.
  2. Transformer(2) (Single Commonsense Representation): Encodes individual commonsense descriptions retrieved from the ATOMIC2020 knowledge base.
  3. Transformer(3) (Knowledge Integration): Uses an attention mechanism where the [k] token from the first module "queries" the descriptions from the second module, allowing the model to selectively attend to the most relevant context.
Extracted figure from page 3 of Enhancing Natural Language Representation with Large-Scale Out-of-Domain Commonsense

Crucially, this architecture can be adapted to existing models "for free." The first two modules can be initialized with weights from a standard BERT model, avoiding the need for massive retraining from scratch.

Key Insights and Results

The OK-Transformer's success stems from its use of explicit knowledge. By providing commonsense as an extra input, the model sidesteps the domain discrepancy problem. Furthermore, the architecture maintains parameter stability; the authors found that OK-Transformer keeps core language model parameters very close to their original pre-trained state, whereas other methods cause larger shifts that degrade performance.

Performance Benchmarks

The OK-Transformer consistently outperformed base models and "continued pre-training" versions across the board:

  • Reasoning: OK-RoBERTa achieved 91.58% on the WSC273 benchmark, a significant jump over the standard RoBERTa (90.10%).
  • GLUE Tasks: The model showed improvements across almost all classification tasks, such as hitting 93.69% on SST-2 (sentiment analysis) compared to BERT's 91.97%.
  • Low-Resource Resilience: The model is particularly effective in settings where it has only seen specific commonsense descriptions a few times, successfully using contextual information to reason correctly.

Conclusion and Future Work

The OK-Transformer demonstrates that integrating large-scale, out-of-domain commonsense as explicit input is a robust alternative to continued pre-training. While the model introduces some computational overhead due to processing multiple descriptions, it provides a clear path toward more knowledgeable language representations. Future work will focus on optimizing retrieval logic through dense vector search and reducing computational costs for massive datasets like MNLI.

Summary updated

BibTeX
@inproceedings{cui2022enhancing,
  author = {Wanyun Cui and Xingran Chen},
  title = {{Enhancing Natural Language Representation with Large-Scale Out-of-Domain Commonsense}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2022},
  url = {https://openreview.net/forum?id=CwPf30W9n-W},
}
Figure