TasksSotADatasetsPapersMethodsSubmitAbout
Papers With Code 2

A community resource for machine learning research: papers, code, benchmarks, and state-of-the-art results.

Explore

Notable BenchmarksAll SotADatasetsPapersMethods

Community

Submit ResultsAbout

Data sourced from the PWC Archive (CC-BY-SA 4.0). Built by the community, for the community.

Papers/Breaking Free Transformer Models: Task-specific Context At...

Breaking Free Transformer Models: Task-specific Context Attribution Promises Improved Generalizability Without Fine-tuning Pre-trained LLMs

Stepan Tytarenko, Mohammad Ruhul Amin

2024-01-30Text ClassificationSentiment AnalysisWord EmbeddingsSentiment ClassificationZero-Shot Text Classification
PaperPDFCode(official)

Abstract

Fine-tuning large pre-trained language models (LLMs) on particular datasets is a commonly employed strategy in Natural Language Processing (NLP) classification tasks. However, this approach usually results in a loss of models generalizability. In this paper, we present a framework that allows for maintaining generalizability, and enhances the performance on the downstream task by utilizing task-specific context attribution. We show that a linear transformation of the text representation from any transformer model using the task-specific concept operator results in a projection onto the latent concept space, referred to as context attribution in this paper. The specific concept operator is optimized during the supervised learning stage via novel loss functions. The proposed framework demonstrates that context attribution of the text representation for each task objective can improve the capacity of the discriminator function and thus achieve better performance for the classification task. Experimental results on three datasets, namely HateXplain, IMDB reviews, and Social Media Attributions, illustrate that the proposed model attains superior accuracy and generalizability. Specifically, for the non-fine-tuned BERT on the HateXplain dataset, we observe 8% improvement in accuracy and 10% improvement in F1-score. Whereas for the IMDB dataset, fine-tuned state-of-the-art XLNet is outperformed by 1% for both accuracy and F1-score. Furthermore, in an out-of-domain cross-dataset test, DistilBERT fine-tuned on the IMDB dataset in conjunction with the proposed model improves the F1-score on the HateXplain dataset by 7%. For the Social Media Attributions dataset of YouTube comments, we observe 5.2% increase in F1-metric. The proposed framework is implemented with PyTorch and provided open-source on GitHub.

Results

TaskDatasetMetricValueModel
Sentiment AnalysisIMDbAccuracy94.88Space-XLNet
Sentiment AnalysisIMDb Movie ReviewsAccuracy (2 classes)0.9488Space-XLNet
Sentiment AnalysisIMDb Movie ReviewsF1 Macro0.9487Space-XLNet
Sentiment AnalysisIMDb Movie ReviewsAccuracy (2 classes)0.8322Space-DistilBERT
Sentiment AnalysisIMDb Movie ReviewsF1 Macro0.832Space-DistilBERT
Text ClassificationIMDb Movie ReviewsAccuracy (2 classes)0.9387XLNet
Text ClassificationIMDb Movie ReviewsF1 Macro0.9487Space-XLNet
Text ClassificationSocial media attributions of YouTube commentsAccuracy (2 classes)0.8309Space-BERT
Text ClassificationSocial media attributions of YouTube commentsF1 Macro0.8006Space-BERT
Text ClassificationSocial media attributions of YouTube commentsAccuracy (2 classes)0.822BERT-base
Text ClassificationSocial media attributions of YouTube commentsF1 Macro0.7484BERT-base
Text ClassificationHateXplainAccuracy (2 classes)0.8798Space-XLNet
Text ClassificationHateXplainF1 Macro0.8797Space-XLNet
Text ClassificationHateXplainAccuracy (2 classes)0.816XLNet
Text ClassificationHateXplainF1 Macro0.8156XLNet
Text ClassificationHateXplainAccuracy (2 classes)0.811Space-BERT
Text ClassificationHateXplainF1 Macro0.8108Space-BERT
Text ClassificationHateXplainAccuracy (2 classes)0.6588BERT-base
Text ClassificationHateXplainF1 Macro0.6555BERT-base
ClassificationIMDb Movie ReviewsAccuracy (2 classes)0.9387XLNet
ClassificationIMDb Movie ReviewsF1 Macro0.9487Space-XLNet
ClassificationSocial media attributions of YouTube commentsAccuracy (2 classes)0.8309Space-BERT
ClassificationSocial media attributions of YouTube commentsF1 Macro0.8006Space-BERT
ClassificationSocial media attributions of YouTube commentsAccuracy (2 classes)0.822BERT-base
ClassificationSocial media attributions of YouTube commentsF1 Macro0.7484BERT-base
ClassificationHateXplainAccuracy (2 classes)0.8798Space-XLNet
ClassificationHateXplainF1 Macro0.8797Space-XLNet
ClassificationHateXplainAccuracy (2 classes)0.816XLNet
ClassificationHateXplainF1 Macro0.8156XLNet
ClassificationHateXplainAccuracy (2 classes)0.811Space-BERT
ClassificationHateXplainF1 Macro0.8108Space-BERT
ClassificationHateXplainAccuracy (2 classes)0.6588BERT-base
ClassificationHateXplainF1 Macro0.6555BERT-base

Related Papers

Making Language Model a Hierarchical Classifier and Generator2025-07-17AdaptiSent: Context-Aware Adaptive Attention for Multimodal Aspect-Based Sentiment Analysis2025-07-17AI Wizards at CheckThat! 2025: Enhancing Transformer-Based Embeddings with Sentiment for Subjectivity Detection in News Articles2025-07-15DCR: Quantifying Data Contamination in LLMs Evaluation2025-07-15SentiDrop: A Multi Modal Machine Learning model for Predicting Dropout in Distance Learning2025-07-14GNN-CNN: An Efficient Hybrid Model of Convolutional and Graph Neural Networks for Text Representation2025-07-10Speak2Sign3D: A Multi-modal Pipeline for English Speech to American Sign Language Animation2025-07-09The Trilemma of Truth in Large Language Models2025-06-30