Sina Heydari, Amirreza Abbasi, Mohsen Hooshmand, Majid Ramezani
5 min
Pre-trained language models have significantly improved sentence representation learning, yet their embedding remain sensitive to semantic preserving textual perturbations such as synonym substitution, masking and word dropout. This work proposes a lightweight Contrastive Denoising Autoencoder (CDAE) that refines pre-trained BERT embedding by jointly optimizing contrastive and reconstruction objective to learn perturbation-invariant representation. We evaluate the proposed framework using multiple perturbation strategies with varying strengths and compare it against the original BERT embeddings and SimCSE. Experimental results show that CDAE consistently preserves higher embedding similarity under perturbations, with the improvements becoming more pronounced as framework effectively enhances representation stability while preserving semantic information, highlighting perturbation-invariant learning as a promising direction for improving sentence embeddings. The source code is publicly available at: https://github.com/ComputationIASBS/CDAE
Pre-trained language models like BERT are highly effective at generating sentence embeddings, but these representations are often sensitive to minor, semantic-preserving textual perturbations such as synonym substitution, word masking, and word dropout. This paper investigates whether a lightweight, post-hoc refinement framework can enhance the stability of these embeddings without requiring full model retraining or fine-tuning of the underlying transformer weights.
The authors propose a Contrastive Denoising Autoencoder (CDAE) that operates on top of a frozen BERT backbone. The architecture consists of an encoder and a decoder that map the 768-dimensional BERT output into a 128-dimensional latent space. The model is trained using a dual-objective function:
By keeping the BERT backbone frozen, the framework introduces only a small number of trainable parameters, making it computationally efficient to integrate with existing embedding architectures.
Experimental results demonstrate that CDAE consistently outperforms both raw BERT embeddings and SimCSE across all tested perturbation strategies (synonym replacement, masking, and dropout). The performance gap between CDAE and the baselines widens as the perturbation strength increases, indicating that CDAE provides more graceful degradation under noise. The model effectively learns a perturbation-invariant latent space that preserves semantic information while significantly reducing the sensitivity of the representation to lexical variations.
This work highlights that pre-trained models are not inherently robust to natural linguistic variations, even if they perform well on standard benchmarks. By demonstrating that a lightweight, modular refinement layer can significantly improve stability, the authors provide a practical pathway for developers to harden existing embedding models for real-world applications where input quality may vary or be subject to noise.
Sam: It trains on three specific types of disruption. First, synonym replacement — swapping words for similar ones. Second, word dropout — deleting words entirely. Third, masking — hiding words from view. By training across all three, the model learns to identify the underlying meaning of a sentence regardless of which surface-level words happen to appear.
Alex: It's learning to look past the specific words to the intent behind them. Did that actually outperform existing methods?
Sam: The evidence suggests so. They compared their approach against the raw BERT model and a popular method called SimCSE. Across all three types of noise, the CDAE consistently maintained higher similarity scores. Crucially, as the noise level increased, the other models dropped off much faster. The CDAE degraded more gradually.
Alex: So even when the input gets really messy — someone typing quickly, making lots of errors — the CDAE still holds onto the original meaning more reliably?
Sam: That's what the results indicate. And there's a design choice that helps explain why. The encoder is updated by both learning signals — the one pushing similar meanings together, and the one checking reconstruction. But the decoder is updated only by the reconstruction signal. This forces the encoder to organize its internal map primarily around meaning, while the decoder acts as a strict auditor to make sure nothing critical gets lost.
Alex: That's a smart way to balance two competing goals — staying stable under noise while not throwing away important information.
Sam: Exactly. And it's worth being clear about what this study doesn't yet show. The work is limited to a frozen BERT backbone. It doesn't demonstrate whether these gains hold for much larger, more modern language models, or whether the approach scales to very long pieces of text.
Alex: So it's a promising result, but we don't yet know if this noise-canceling layer works just as well for the giant models people are actually using today.
Sam: The authors are cautious about generalizing too far. They note that future work needs to examine how this robustness changes across different internal layers of the model — which could reveal exactly where the filtering is happening and why.
Alex: It's an interesting thought — that the model already understands the meaning, but just needs a little help focusing on it. Sometimes the fix isn't making the system bigger. It's making it smarter about what it pays attention to.
Sam: That's a good way to put it. And it's a useful reminder more broadly: in a world where user input is rarely perfect — full of typos, informal phrasing, and imprecise word choices — building systems that can handle that gracefully matters quite a lot.
Alex: Thanks for walking me through that, Sam.
Sam: My pleasure. Thanks for listening to ResearchPod.