A Sentence-Level Hierarchical BERT Model for Document Classification with Limited Labelled Data

Jinghui Lu, Maeve Henchion, Ivan Bacher, Brian Mac Namee

Abstract

The Hierarchical BERT Model (HBM) addresses two critical limitations in natural language processing: the 512-token input limit of standard Transformer models and the high data requirements for fine-tuning. By utilizing a frozen RoBERTa backbone for token-level encoding and a trainable sentence-level BERT encoder, HBM effectively classifies long-form documents even with extremely limited labeled data (as few as 50 examples). Furthermore, the model's attention mechanism enables the identification of "salient sentences," which has been shown to improve human annotation efficiency by approximately 40%.

Introduction

Modern Natural Language Processing (NLP) is dominated by Transformer-based models like BERT, which excel at capturing deep contextual relationships. However, these models face two significant hurdles in practical applications:

  1. The Length Ceiling: Standard BERT architectures are capped at 512 tokens. For long-form content such as news articles or legal documents, researchers often resort to truncation or crude averaging, both of which discard vital structural information.
  2. Data Scarcity: Deep learning models typically require thousands of labeled examples. In specialized industries, experts may only have the capacity to label a few dozen documents.

The Hierarchical BERT Model (HBM) is proposed to tackle these "low-shot" scenarios for long-text classification by understanding document structure without requiring massive datasets.

Methodology

The HBM processes text through a three-stage hierarchical architecture designed to preserve general language knowledge while learning document-level patterns.

Architecture of the Hierarchical BERT Model (HBM), showing the flow from token-level encoding to sentence-level processing and final prediction.

1. Token-level RoBERTa Encoder

Each sentence in a document is passed through a pre-trained RoBERTa model to generate a vector representation. Crucially, these weights are frozen. This prevents "catastrophic forgetting" and overfitting on small datasets, allowing the model to act as a stable feature extractor.

2. Sentence-level BERT Encoder

This layer serves as the "brain" of the hierarchy. It receives the sequence of sentence vectors and employs a multi-head self-attention mechanism to model inter-sentence relationships. Unlike the token layer, this component is trained specifically on the classification task.

Detailed view of the sentence-level BERT layers, illustrating the attention mechanism (BertAtt) and the generation of the document representation S.

3. Prediction Layer and Saliency

A final feed-forward network outputs the document class. A unique feature of HBM is its ability to calculate Saliency Scores. By aggregating attention weights within the sentence-level encoder, the model identifies which sentences were most influential in its decision-making process.

Experimental Setup

The model was evaluated across six binary classification datasets:

  • Long Documents: Movie Reviews (Rotten Tomatoes), Blog Author Gender, and Guardian 2013 News.
  • Short/Medium Documents: Multi-domain Customer Reviews (Amazon), Reuters, and 20 Newsgroups.

To simulate "limited data" environments, the researchers subsampled these datasets into training sets of 50, 100, 150, and 200 instances.

Key Results and Insights

Performance in Low-Data Regimes

HBM consistently outperformed state-of-the-art models on long-document datasets. For instance, on the Movie Review dataset with only 50 labels, HBM achieved an AUC of 0.9139, significantly surpassing fine-tuned RoBERTa (0.8878) and the previous Hierarchical Attention Network (0.7013).

The Importance of Hierarchy and Freezing

The results suggest that in low-data scenarios, freezing the token-level encoder is a critical design choice. It allows the model to focus purely on document-level logic rather than re-learning basic language features. Furthermore, the attention mechanism proves that the relative positioning and relationships of sentences are more informative than simple mathematical means (averaging).

Human-in-the-Loop Efficiency

The model’s saliency highlights provide a tangible benefit for human annotators. In a user study, highlighting "salient sentences" reduced the average time to label 10 documents from 645 seconds to 375 seconds—a 42% increase in efficiency—without compromising accuracy.

Conclusion

While HBM is highly effective for long-form prose, it is less advantageous for short-form content where standard BERT models suffice. Future research may explore integrating different pre-trained backbones like Longformer or extending the framework to multi-class classification tasks.

Summary updated

BibTeX
@inproceedings{lu2021sentence,
  author = {Jinghui Lu and Maeve Henchion and Ivan Bacher and Brian Mac Namee},
  title = {{A Sentence-Level Hierarchical BERT Model for Document Classification with Limited Labelled Data}},
  booktitle = {DS},
  year = {2021},
  url = {https://openreview.net/forum?id=-LUB_6ZvIXf},
}
Figure