SIFTER: A Task-specific Alignment Strategy for Enhancing Sentence Embeddings

Chao Yu, Wenhao Zhu, Chaoming Liu, Xiaoyu Zhang, Qiuhong Zhai

Abstract

The paradigm of pre-training followed by fine-tuning on downstream tasks has become the mainstream method in natural language processing. Although pre-trained models have the advantage of generalization, their performance may still vary significantly across different domain tasks because the data distribution in different domains varies. For example, in the sentence "He married Smt. Dipali Ghosh in 1947 and led a very happy married life," different components have varying impacts on downstream tasks: similarity calculations prioritize structural words like "led" and "life," while sentiment analysis focuses on emotional anchors like "happy." This indicates that different downstream tasks have different levels of sensitivity to sentence components. We propose SIFTER, a strategy to scale model and data information according to task specifics—enhancing relevant domain information while reducing irrelevant elements. We apply SIFTER to improve SimCSE via triple-sentence similarity based on sentence stems and noise reduction, and to improve LSTM gate mechanisms by short-circuiting input gates for important words. Our experiments demonstrate that SIFTER outperforms SimCSE and LSTM baselines.

Introduction: The Generalist's Dilemma

In modern NLP, the "pre-train then fine-tune" paradigm is dominant. However, pre-trained models are generalists; they treat all parts of a sentence with a relatively uniform level of importance. This is suboptimal because different downstream tasks are sensitive to different sentence components. General-purpose embeddings often struggle with "domain shift," where a model trained on general data performs poorly on specialized tasks because it hasn't learned which specific signals to prioritize.

Task-Specific Component Sensitivity

The core motivation for SIFTER is the observation that the "importance" of a word is not an intrinsic property of the word itself, but rather a function of the task at hand.

Model performance sensitivity to sentence components across different tasks.

As shown in the figure above, empirical tests reveal that for Semantic Textual Similarity (STS-B), the "Main part" (the structural backbone) of a sentence contributes more to performance. Conversely, for Sentiment Analysis (SST-2), the "Other part" (often containing modifiers and emotional keywords) is more critical. SIFTER aims to explicitly guide models on what to ignore and what to amplify based on these task-specific requirements.

The SIFTER Strategy

We implement the SIFTER strategy across two distinct architectures to demonstrate its versatility.

SIFTER-SimCSE: Structural Alignment

Standard SimCSE uses dropout as a minimal data augmentation to create positive pairs for contrastive learning. SIFTER-SimCSE enhances this by creating two new types of task-aligned positive samples:

  1. Add Sentence Backbone: Using tools like Stanford CoreNLP and OpenIE, we extract the "stem" (subject-verb-object) and append it to the original sentence. This forces the model to prioritize structural meaning.
  2. Delete Unimportant Words: We remove semantically "thin" words like articles and conjunctions to reduce noise.
The triple similarity alignment strategy using sentence stems and noise reduction.

The model then employs a triple contrastive loss to maximize similarity between the original sentence, the backbone-enhanced version, and the noise-reduced version. This multi-way alignment ensures the resulting embeddings are robust to lexical noise while remaining anchored to the sentence's core meaning.

SIFTER-LSTM: Lexical Prioritization

For recurrent architectures used in sentiment analysis, SIFTER modifies the LSTM's "input gate," which typically decides how much new information enters the memory cell. SIFTER "short-circuits" this gate for a predefined set of "beneficial" words (emotional keywords). By replacing the learned gate with an all-one vector for these words, the model is forced to fully absorb and remember these critical signals, bypassing any learned gating that might otherwise dampen their impact.

Experimental Results

Our evaluation across semantic similarity and sentiment analysis benchmarks confirms the efficacy of task-specific alignment:

  • Semantic Textual Similarity (STS): SIFTER-SimCSE-BERT$_{base}$ achieved an average Spearman’s correlation of 78.20%, a significant improvement over the standard SimCSE baseline (76.25%). When scaled to RoBERTa$_{large}$, SIFTER reached 79.84%, outperforming state-of-the-art variants like ESimCSE.
  • Sentiment Analysis: On the SST-2 dataset, SIFTER-LSTM achieved 85.37% accuracy, surpassing both the standard LSTM (84.97%) and more complex architectures like Tree-LSTM.

Conclusion

SIFTER demonstrates that sentence embeddings can be significantly improved by moving away from task-agnostic representations. By scaling information—amplifying the sentence backbone for similarity and preserving emotional anchors for sentiment—we provide a more stable and effective training signal. Future work will explore SIFTER’s potential in text retrieval and other domains where the definition of "important information" continues to shift.

Summary updated

Abstract

The paradigm of pre-training followed by fine-tuning on downstream tasks has become the mainstream method in natural language processing tasks. Although pre-trained models have the advantage of generalization, their performance may still vary significantly across different domain tasks. This is because the data distribution in different domains varies. For example, the different parts of the sentence 'He married Smt. Dipali Ghosh in 1947 and led a very happy married life' may have different impact for downstream tasks. For similarity calculations, words such as 'led' and 'life' are more important. On the other hand, for sentiment analysis, the word 'happy' is crucial. This indicates that different downstream tasks have different levels of sensitivity to sentence components. Our starting point is to scale information of the model and data according to the specifics of downstream tasks, enhancing domain information of relevant parts for these tasks and reducing irrelevant elements for different domain tasks, called SIFTER. In the experimental part, we use the SIFTER to improve SimCSE by constructing positive sample pairs based on enhancing the sentence stem and reducing the unimportant components in the sentence, and maximize the similarity between three sentences. Similarly, SIFTER can improve the gate mechanism of the LSTM model by short-circuiting the input gate of important words so that the LSTM model remembers the important parts of the sentence. Our experiments demonstrate that SIFTER outperforms the SimCSE and LSTM baselines.
BibTeX
@misc{yu2023sifter,
  author = {Chao Yu and Wenhao Zhu and Chaoming Liu and Xiaoyu Zhang and Qiuhong Zhai},
  title = {{SIFTER: A Task-specific Alignment Strategy for Enhancing Sentence Embeddings}},
  year = {2023},
  eprint = {2306.12280},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2306.12280},
}

Loading related content...

Figure