Source-linked AI summary
On the Sentence Embeddings from Pre-trained Language Models
Bohan Li, Hao Zhou, Junxian He, Mingxuan Wang, Yiming Yang, Lei Li
TL;DR
Untuned BERT sentence embeddings poorly capture semantic similarity because their semantic information is not fully exploited in an anisotropic, nonsmooth space. The paper analyzes this problem and applies unsupervised normalizing flows to map embeddings into a smooth isotropic Gaussian space, producing gains across semantic similarity benchmarks.
Problem
Method
Results
BERT-flow consistently improved BERT by up to 12.70 points, averaging 8.16 points in Spearman correlation across 7 semantic textual similarity benchmarks without downstream supervision.
Source: §1 · p. 2Takeaways & Limitations
The analysis identifies anisotropic, nonsmooth embedding geometry as a source of problematic similarity, while flow-based calibration improves performance and can remedy excessive lexical correlation.
Source: §1 · pp. 1–2, §2.2 · p. 4Flow calibration is learned over the full target dataset, including train, validation, and test sentences, though it uses no provided labels.
Source: §4.1 · p. 6
Abstract
from arXiv · showhide
Pre-trained contextual representations like BERT have achieved great success in natural language processing. However, the sentence embeddings from the pre-trained language models without fine-tuning have been found to poorly capture semantic meaning of sentences. In this paper, we argue that the semantic information in the BERT embeddings is not fully exploited. We first reveal the theoretical connection between the masked language model pre-training objective and the semantic similarity task theoretically, and then analyze the BERT sentence embeddings empirically. We find that BERT always induces a non-smooth anisotropic semantic space of sentences, which harms its performance of semantic similarity. To address this issue, we propose to transform the anisotropic sentence embedding distribution to a smooth and isotropic Gaussian distribution through normalizing flows that are learned with an unsupervised objective. Experimental results show that our proposed BERT-flow method obtains significant performance gains over the state-of-the-art sentence embeddings on a variety of semantic textual similarity tasks. The code is available at https://github.com/bohanli/BERT-flow.
1 Introduction
BERT sentence embeddings without fine-tuning perform poorly on semantic similarity despite BERT’s broader NLP success. The paper attributes this gap to underexploited semantic information and proposes unsupervised flow-based calibration.
- BERT sentence embeddings without fine-tuning can underperform even averaged GloVe embeddings, hindering use where labeled data is costly or unavailable.Source: §1 · p. 1
- The paper asks whether BERT embeddings lack semantic information or whether their semantic information is difficult to exploit without external supervision.Source: §1 · p. 1
- Theoretical analysis connects BERT pretraining with semantic similarity, while empirical probing finds a nonsmooth, poorly defined sentence-embedding space.Source: §1 · pp. 1–2
- BERT-flow uses an invertible normalizing-flow mapping to transform BERT sentence embeddings into a smooth, isotropic Gaussian distribution while keeping BERT fixed.Source: §1 · p. 2
- 12.70 points maximum and 8.16 points average improvement were obtained across 7 semantic textual similarity benchmarks in Spearman correlation without downstream supervision.Source: §1 · p. 2
- On natural language inference and QNLI, the method outperformed sentence-BERT embeddings and showed superiority without task-specific supervision.Source: §1 · p. 2
2 Understanding the Sentence Embedding Space of BERT
The paper examines why BERT’s theoretically meaningful contextual embeddings yield weak sentence similarity. It links the failure to anisotropy, frequency bias, sparse regions, and poorly defined areas of the embedding space.
- BERT sentence embeddings lag behind state-of-the-art semantic embeddings and can be less competitive than averaged GloVe on STS-B.Source: §2 · p. 2
- BERT sentence vectors are commonly formed by averaging contextual embeddings or using the [CLS] embedding, with averaging reported as consistently better.Source: §2 · p. 2
BERT pretraining
- Masked language modeling predicts masked tokens from corrupted bidirectional contexts, reducing pretraining to conditional token-distribution modeling.Source: §2.1 · p. 2
Semantic connection
- Context-word dot products encode co-occurrence statistics, with PMI serving as a mathematical surrogate for word-level semantic similarity.Source: §2.1 · p. 3
- Pretraining can implicitly relate context embeddings through higher-order co-occurrence when different contexts connect to the same words.Source: §2.1 · p. 3
Anisotropic space
- Anisotropy concentrates embeddings in a narrow cone, while word frequency further biases their spatial distribution.Source: §2.2 · pp. 3–4
- High-frequency words cluster densely near the origin, whereas low-frequency words lie farther away and disperse sparsely.Source: §2.2 · pp. 3–4
- Sparse low-frequency regions create holes where averaged sentence embeddings may land, making semantic meaning poorly defined and similarity problematic.Source: §2.2 · pp. 3–4
3 Proposed Method: BERT-flow
BERT-flow calibrates BERT sentence embeddings by learning an invertible mapping to a standard Gaussian latent space without changing BERT. The Gaussian target provides isotropy and full-space density, while flows preserve information and enable unsupervised likelihood training.
Core approach
- BERT-flow uses an invertible mapping from BERT’s embedding space to a standard Gaussian latent space to calibrate sentence representations.The invertibility condition preserves mutual information between embeddings and data examples.Source: §3 · p. 4
Gaussian target
- Standard Gaussian distributions provide isotropy, with angularly uniform density and samples that can be viewed as uniformly distributed on a unit sphere after normalization.Source: §3.1 · p. 4
- Mapping to an isotropic distribution can flatten the embedding space’s singular spectrum and suppress dominating word-frequency-related directions.Source: §3.1 · pp. 4–5
- The Gaussian density covers the entire real space, avoiding poorly defined “hole” regions in probability.Source: §3.1 · p. 5
Flow model
- The method instantiates the mapping with a flow-based generative model, an invertible transformation between latent space Z and observed space U.The observable space consists of extracted BERT sentence embeddings.Source: §3.2 · p. 5
Training
- Training maximizes the likelihood of generating BERT sentence embeddings from a standard Gaussian latent variable in a fully unsupervised manner.Only flow parameters are optimized; BERT parameters remain unchanged, and the learned inverse maps embeddings to Gaussian representations without information loss.Source: §3.2 · p. 5
4 Experiments
Experiments evaluate BERT-flow on semantic textual similarity and question-answer entailment, with and without NLI supervision. Across these settings, flow-based calibration improves sentence-embedding performance and reduces excessive lexical-similarity effects.
Semantic Textual Similarity
- Experiments cover seven semantic textual similarity benchmarks, using cosine similarity between sentence embeddings and reporting Spearman correlation with human similarity labels.The benchmarks include STS-B, SICK-R, and STS tasks from 2012–2016.Source: §4 · p. 5, §4.1 · pp. 5–6
- Without NLI supervision, BERT-flow improves BERTbase and BERTlarge by 5.88 and 8.16 average points, respectively.Learning flows on target datasets generally yields larger improvements than learning flows on NLI, except on SICK-R.Source: §4.1 · pp. 6–7
- With NLI supervision, the isotropic embedding space consistently improves SBERT baselines in most cases and outperforms state-of-the-art SBERT/SRoBERTa results by a large margin.The flow parameters remain learned without supervision labels.Source: §4.1 · pp. 6–7, Table 3 · p. 7
Unsupervised Question-Answer Entailment
- BERT-flow consistently improves AUC on the QNLI validation set, with target-dataset flow learning outperforming flow learning on NLI.QNLI evaluates question-answer entailment without task-specific supervision for the sentence embeddings.Source: §4.2 · p. 7
Comparison with Other Embedding Calibration Baselines
- Standard normalization improves STS-B but trails nulling top-k singular vectors, while combining both methods yields further gains; BERT-flow still performs much better.The authors attribute the advantage to invertible isotropic mapping without discarding information.Source: §4.3 · p. 8
Semantic Similarity Versus Lexical Similarity
- BERT-induced similarity correlates strongly with edit distance, whereas gold-standard and flow-induced similarities show less evident lexical correlation.For sentence pairs with edit distance ≤4, BERT’s excessive lexical proximity is especially pronounced; flow suppresses this influence.Source: §4.4 · pp. 8–9
5 Conclusion and Future Work
The paper identifies deficiencies in BERT sentence embeddings for semantic textual similarity and proposes flow-based calibration to improve performance.
- The paper investigates deficiencies in BERT sentence embeddings for semantic textual similarity.Source: §5 · p. 9
- It proposes a flow-based calibration method to address these deficiencies.Source: §5 · p. 9
- The authors identify flow-based generative representation learning as a direction for future work.Source: §5 · p. 9
A Mathematical Formula of the Invertible Mapping
The flow model is composed of stacked invertible transformations, including additive coupling layers with explicitly computable inverses.
- A flow-based model stacks multiple invertible transformation layers as f = f1 ◦ f2 ◦ . . . ◦ fK.Source: A Mathematical Formula of the… · p. 11
- Each transformation in the approach uses an additive coupling layer.Source: A Mathematical Formula of the… · p. 11
- The coupling function gψ can use a deep neural network to increase expressiveness.Source: A Mathematical Formula of the… · p. 11
- The inverse mapping is explicitly written, supporting invertibility of the transformation.Source: A Mathematical Formula of the… · p. 11
B Implementation Details
Implementation uses the official TensorFlow BERT codebase and flow-specific training settings, with sequence length limited to 64 and hyperparameters tuned only initially.
- The implementation adopts the official TensorFlow BERT codebase and clips maximum sequence length to 64.Source: B Implementation Details · p. 11
- The flow models train for 1 epoch on target datasets and 0.15 epoch on NLI datasets using Adam.Source: B Implementation Details · p. 11
- Hyperparameters are tuned on the STS-B development set before being reused across other datasets.Source: B Implementation Details · p. 11
- Table 7 reports the flow hyperparameters.Source: Table 7 · p. 11
C Results with Different Random Seeds
The random-seed analysis reports variability in NLI fine-tuning but finds that the proposed flow-based method consistently improves results.
- The experiment uses 5 runs with different random seeds in the NLI-supervised STS-B setting.Source: C Results with Different Random Seeds · p. 12
- Results with standard deviation and median are reported in Table 8.Source: C Results with Different Random Seeds · p. 12
- Despite non-negligible NLI-finetuning variance, the flow-based method consistently improves performance.Source: C Results with Different Random Seeds · p. 12
- Table 8 presents results obtained with different random seeds.Source: Table 8 · p. 12
Related papers
This paper cites
- Attention Is All You Need2017
- BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding2018
- GLUE: A Multi-Task Benchmark and Analysis Platform for Natural Language Understanding2018
- Glow: Generative Flow with Invertible 1x1 Convolutions2018
- Supervised Learning of Universal Sentence Representations from Natural Language Inference Data2017
- SentEval: An Evaluation Toolkit for Universal Sentence Representations2018
Cited by
- EmbeddingGemma 2: Unified and Efficient Multimodal Representations2026
- SkillRep: Characterizing and Understanding the Representation Design Space of Agent Skill Retrieval2026
- Mitigating Over-Optimization in PRM-Guided Search in Mathematical Reasoning by Optimizing the Guide2026
- Tlow: Flow-based Item Tokenizer for Recommendation2026
- Aligning Biomedical Texts and Knowledge Graphs: A Systematic Comparison of Lightweight Alignment Strategies2026
- Your UnEmbedding Matrix is Secretly a Feature Lens for Text Embeddings2026