A Deep Neural Network Sentence Level Classification Method with Context Information

Xingyi Song, Johann Petrak, Angus Roberts

Abstract

Sentence classification in natural language processing often overlooks surrounding context due to the computational complexity of modeling long-range dependencies. This paper presents Context-LSTM-CNN (C-LSTM-CNN), an architecture designed to incorporate context efficiently. By utilizing Fixed-size Ordinally Forgetting Encoding (FOFE) for surrounding sentences and a robust Bi-LSTM-CNN for the target sentence, the model achieves state-of-the-art results on emotion and medical datasets. Experimental results demonstrate that C-LSTM-CNN significantly outperforms standard models in accuracy while maintaining lower computational overhead than traditional LSTM-based context methods.

Introduction

In natural language processing, sentences are frequently classified in isolation. However, a sentence like "Yes! I just got the letter!" is impossible to accurately classify as "Excitement" without knowing the preceding context (e.g., "I got accepted to university"). While the importance of context is well-recognized, including it is often computationally expensive. Previous methods utilizing LSTMs or CNNs to encode every surrounding sentence do not scale well for large context windows, such as entire medical records or long dialogues. This research aims to provide models with "wide-angle vision" of surrounding text without sacrificing training or inference speed.

Methodology

The proposed Context-LSTM-CNN architecture processes the target "focus" sentence and its surrounding "context" through distinct pathways before fusion.

  1. The Focus Sentence: The target sentence is processed via a Bi-directional LSTM to capture long-range dependencies, followed by a stacked CNN with multiple kernel sizes to extract local, short-span features like n-grams.
  2. The Context: To avoid the heavy computational load of recurrent layers for surrounding text, the model employs Fixed-size Ordinally Forgetting Encoding (FOFE). FOFE represents a sequence of words as a single vector by calculating a weighted sum of word embeddings. It uses a "forgetting factor" ($\alpha$) where words further from the focus sentence have their weights reduced exponentially. The authors implement a hierarchical FOFE: words are first encoded into sentence vectors, which are then encoded into final "left context" and "right context" vectors.
  3. Fusion: Features from the focus sentence and the context vectors are concatenated and passed through a final dense layer with Softmax or Sigmoid activation for classification.
The C-LSTM-CNN architecture integrates FOFE-encoded context with a Bi-LSTM-CNN focus sentence processor.

Experimental Setup

The model was evaluated on two distinct datasets to test generalizability:

  • IEMOCAP (Interactive Emotional Dyadic Motion Capture): A dialogue dataset where sentences are labeled with emotions (Anger, Excitement, Neutral, Sadness). Context is vital here as emotional states typically flow through a conversation.
  • ADE (Drug-related Adverse Effects): Sentences from medical case reports labeled as "Positive" or "Negative" for describing drug side effects. Context was reconstructed from original PubMed documents.

Key Results and Discussion

The C-LSTM-CNN model demonstrated superior performance in both accuracy and computational efficiency compared to baseline and alternative context-aware models.

Performance comparison across models on IEMOCAP and ADE datasets, highlighting the accuracy and time efficiency of C-LSTM-CNN.

Performance Gains

On the IEMOCAP dataset, C-LSTM-CNN reached 71.49% accuracy, a significant improvement over the 59.43% achieved by a standard LSTM-CNN without context. The model also showed particular strength in difficult categories; for instance, "Excitement" classification in IEMOCAP improved from an F1-score of 56.95 to 73.11.

Efficiency and the FOFE Advantage

A version of the model using an LSTM to encode context (L-LSTM-CNN) achieved 63.84% accuracy but required approximately 1.5x more training time (1800s vs 1243s). The C-LSTM-CNN was both more accurate and significantly faster, proving that FOFE allows for the inclusion of context with almost no additional computational cost compared to processing the focus sentence alone.

Task Sensitivity and Hyperparameters

The authors found that the value of context is task-dependent; while IEMOCAP saw massive gains, the improvement on the ADE medical dataset was more modest (approximately 1%). Regarding the forgetting factor, a value of 0.9 worked best for context sentences, suggesting that proximity to the target sentence is a strong indicator of relevance. However, for words within those context sentences, a factor of 1.0 (no forgetting) was optimal, indicating that the presence of specific information in the context is more important than the exact word order.

Conclusion

The C-LSTM-CNN provides a scalable solution for context-aware sentence classification. By combining the representational power of Bi-LSTM-CNNs with the efficiency of FOFE, the model captures necessary environmental information without the prohibitive costs of fully recurrent architectures. Future work may explore the integration of dynamic embeddings or the limits of FOFE when handling extremely large context windows.

Summary updated

BibTeX
@inproceedings{song2018deep,
  author = {Xingyi Song and Johann Petrak and Angus Roberts},
  title = {{A Deep Neural Network Sentence Level Classification Method with Context Information}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2018},
  doi = {10.18653/v1/d18-1107},
}
Figure