Source-linked AI summary
Fine-grained Analysis of Sentence Embeddings Using Auxiliary Prediction Tasks
Yossi Adi, Einat Kermany, Yonatan Belinkov, Ofer Lavi, Yoav Goldberg
TL;DR
Sentence embeddings are widely used, but the information they encode is not well understood. The paper introduces auxiliary prediction tasks for sentence length, word content, and word order, then compares representation methods and dimensions. CBOW and LSTM auto-encoders show different strengths across these properties, while BLEU is not fully indicative of encoder quality.
Problem
Method
The authors evaluate representations with classifiers trained on auxiliary tasks predicting sentence length, word content, and word order.
Source: §1 · p. 2, §3.1 · p. 4Results
CBOW is effective across content, length, and some word-order prediction, while sufficiently dimensional LSTM auto-encoders effectively encode content and order; BLEU is sub-optimal for model selection.
Source: §9 · pp. 8–9Takeaways & Limitations
Fine-grained auxiliary tasks expose relative strengths and weaknesses of sentence representations and reveal that larger embeddings are not always better.
Source: §9 · p. 8The empirical conclusions may not generalize beyond the measured datasets, and the tasks do not measure syntactic or semantic generalization abilities.
Source: §1 · p. 2
Abstract
from arXiv · showhide
There is a lot of research interest in encoding variable length sentences into fixed length vectors, in a way that preserves the sentence meanings. Two common methods include representations based on averaging word vectors, and representations based on the hidden states of recurrent neural networks such as LSTMs. The sentence vectors are used as features for subsequent machine learning tasks or for pre-training in the context of deep learning. However, not much is known about the properties that are encoded in these sentence representations and about the language information they capture. We propose a framework that facilitates better understanding of the encoded representations. We define prediction tasks around isolated aspects of sentence structure (namely sentence length, word content, and word order), and score representations by the ability to train a classifier to solve each prediction task when using the representation as input. We demonstrate the potential contribution of the approach by analyzing different sentence representation mechanisms. The analysis sheds light on the relative strengths of different sentence embedding methods with respect to these low level prediction tasks, and on the effect of the encoded vector's dimensionality on the resulting representations.
1 INTRODUCTION
The paper proposes fine-grained auxiliary prediction tasks to reveal what sentence representations encode, comparing CBOW and LSTM-based methods across sentence properties and dimensionalities.
- The methodology addresses the limited understanding of information captured by different sentence embedding mechanisms.Source: §1 · p. 1
- The study targets sentence length, word content, and word order as core properties for comparing sentence representations.Source: §1 · p. 2
- CBOW representations encode sentence length and permit probabilistic reconstruction of non-trivial word-order information despite disregarding order directly.Source: §1 · pp. 1–3
- LSTM auto-encoders are very effective at encoding word order and word content.Source: §1 · p. 3
- Increasing dimensionality benefits some prediction tasks more than others, while additional hidden units can degrade word-content encoding.Source: §1 · p. 3
- Auto-encoder LSTM encoders do not rely on training-sentence ordering patterns for novel sentences, unlike skip-thought encoders.Source: §1 · p. 3
2 RELATED WORK
Prior sentence-representation analyses often rely on downstream performance or model-specific hidden-unit studies, leaving the properties captured by final embeddings unclear.
- Existing comparisons commonly evaluate sentence embeddings on downstream tasks, but this approach is coarse-grained and does not explain which linguistic properties they capture.Source: §2 · p. 3
- Hidden-unit analyses associate linguistic aspects with neural representations but depend on specific learning models and do not directly characterize final sentence embeddings.Source: §2 · p. 3
- The proposed auxiliary-task methodology is orthogonal and complementary to prior work and applies to arbitrary sentence representation models.Source: §2 · p. 3
3 APPROACH
The approach measures how well classifiers predict isolated sentence properties from fixed-length representations, using controlled datasets and task-specific baselines.
- The method trains classifiers to predict isolated sentence properties from sentence vectors, treating predictability as evidence that a property is usefully encoded.Source: §3 · p. 3
- The experiments examine sentence length, word identities, and word order as core elements of sentence structure.Source: §3 · p. 3
- The corpus contains 200,000 Wikipedia sentences, divided into 150,000 training and 25,000 development and test sentences.Source: §3.1 · pp. 3–4
Length Task
- The length task predicts eight binned sentence-length classes from a representation, with majority-class baseline accuracy of 20.1%.Source: §3.1 · p. 4
Word-content Task
- The word-content task determines whether a word appears in a sentence using concatenated sentence and word representations, with a balanced 50% baseline.Source: §3.1 · p. 4
Word-order Task
- The word-order task predicts whether one sentence word precedes another using positive examples and reversed-order negatives, with a balanced 50% baseline.Source: §3.1 · p. 4
4 SENTENCE REPRESENTATION MODELS
The paper analyzes CBOW averaging and LSTM encoder-decoder representations, comparing how model design and embedding size affect sentence encodings.
- CBOW represents a sentence by element-wise averaging of word vectors, making it simple to compute but oblivious to word order.Source: §4 · p. 4
- LSTM encoder-decoder models encode sentences with an LSTM and use a decoder to map the representation back to the word sequence.Source: §4 · pp. 4–5
- The framework compares task accuracy across embedding sizes, with encoder-decoder BLEU scores included as a reference.Source: Figure 1 · p. 5
5 EXPERIMENTAL SETUP
The models are trained on a large Wikipedia corpus with controlled vocabulary, sentence-length, and embedding-size settings.
6 RESULTS
The experiments measure sentence length, word content, and word order encoding across representation models and embedding sizes, revealing distinct strengths for LSTM and CBOW.
Length
- LSTM embeddings capture sentence length well at sufficient dimensionality, reaching 82%–87% accuracy, while CBOW reaches 45%–65% against a 20% baseline.Source: §6.1 · p. 5
- LSTM length accuracy remains relatively stable from 300 dimensions onward even as encoder-decoder BLEU increases with dimensionality.Source: §6.1 · p. 5
Word content
- All representations outperform the 50% random baseline on word content, but LSTM content performance peaks at 750 dimensions and then drops.Source: §6.2 · pp. 5–6
- CBOW performs exceptionally well on word content at 100 and 300 dimensions, outperforming the sequence-aware models, but its scores drop at higher dimensions.Source: §6.2 · p. 6
Word order
- LSTM-1000 recovers word order in 91% of cases, while CBOW reaches 70% accuracy, 20% above the baseline.Source: §6.3 · p. 6
7 IMPORTANCE OF “NATURAL LANGUAGENESS”
Additional experiments test whether sentence-property predictions depend on natural-language word distributions, separating sentence information from general language statistics.
Sentence length
- Replacing every word with a random dictionary word causes only a slight CBOW length-accuracy decrease, indicating word identity is not its main source of length information.Source: §7 · p. 6
- CBOW embedding norms decrease as sentences grow longer, which the authors believe is a main reason for its strong length-prediction performance.Source: §7 · pp. 6–7
Word-order statistics
Permuted sentences
- LSTM encoder-decoder results remain comparable across natural and permuted sentences on all three tests, with a small consistent order-accuracy drop.Source: §7 · p. 7
- On permuted sentences, CBOW order accuracy falls to chance while its other test results remain unchanged.Source: §7 · p. 7
- On the permuted dataset, LSTM-1000 decoder BLEU drops from 32.5 to 8.2, suggesting language-specific information is concentrated in the discarded decoder.Source: §7 · p. 8
8 SKIP-THOUGHT VECTORS
Skip-thought embeddings perform strongly across the auxiliary prediction tasks, but their representations are sensitive to sentence word-order regularities and differ from the controlled comparisons.
- Direct comparison is limited because skip-thought was trained on a different corpus and used a recommended embedding size of 4800.Source: §8 · p. 8
- Skip-thought predicts length, word content, and order well above the baselines, with performance roughly similar across tasks.Source: §8 · p. 8
- Its performance resembles higher-dimensional encoder-decoder models, except that it lags somewhat on the order task.Source: §8 · p. 8
- Permuting sentences causes a large drop in skip-thought performance, including significant degradation for length and word-content prediction.Source: §8 · p. 8
- The degradation suggests skip-thought encoding is specialized toward natural-language texts.Source: §8 · p. 8
9 CONCLUSION
The conclusion finds distinct strengths and dimensionality effects across CBOW, LSTM auto-encoders, and skip-thought, while questioning BLEU as a sufficient encoder-selection criterion.
- CBOW is strong at content, predicts sentence length, and reconstructs a non-trivial amount of word order; 300 dimensions perform best overall.Source: §9 · p. 8
- Higher-dimensional CBOW models show greatly degraded word-content prediction performance.Source: §9 · p. 8
- LSTM auto-encoders encode word content and order effectively with enough dimensions, while dimensionality does not significantly improve length encoding.Source: §9 · p. 8
- LSTM word-content accuracy peaks at 750 dimensions and drops at 1000, while order encoding gains little beyond 500 dimensions.Source: §9 · p. 8
- Auto-encoder-trained LSTM encoders do not rely on training-sentence ordering patterns for novel sequences, unlike skip-thought encoders.Source: §9 · p. 9
- Encoder-decoder BLEU is not entirely indicative of word-identity and order representation quality, making it sub-optimal for model selection.Source: §9 · p. 9
APPENDIX I: EXPERIMENTAL SETUP
The experiments train CBOW and LSTM encoder-decoder sentence representations on Wikipedia and evaluate them with auxiliary classifiers and BLEU.
- CBOW and encoder-decoder models use 1 million Wikipedia sentences, a 50,000-token vocabulary, and sentence lengths from 5 to 70 words.Source: Appendix I · p. 11
- CBOW uses Skip-gram word vectors with hierarchical softmax, a five-word window, and embedding sizes of 100, 300, 500, 750, and 1000.Source: Appendix I · p. 11
- The encoder-decoder uses one LSTM layer for both encoder and decoder, with the decoder trained as a language model using cross-entropy loss.Source: Appendix I · p. 11
- Word and sentence representation sizes are matched, using dimensions 100, 300, 500, 750, and 1000; input sentences are reversed and gradients clipped.Source: Appendix I · p. 11
- Encoder-decoder quality is evaluated with BLEU alongside the three auxiliary prediction tasks.Source: Appendix I · p. 11
- Auxiliary predictors are single-hidden-layer multilayer perceptrons with ReLU activation, tuned separately for each task.Source: Appendix I · p. 11
APPENDIX II: TECHNICAL DETAILS
The technical appendix describes tuned training procedures, sentence-length analyses, and paired significance tests for encoder-decoder and CBOW comparisons.
Training
- Encoder-decoder parameters were tuned over learning rates, dropout rates, optimizers, and batch sizes; batch-size changes improved runtime but not performance significantly.Source: ENCODER DECODER · p. 11
- Final encoder-decoder training used learning rate 0.01, dropout 0.1, AdaGrad, batch size 32, and early stopping after five epochs without validation improvement.Source: ENCODER DECODER · p. 11
Classifiers
- The best auxiliary classifier is a one-hidden-layer ReLU network with hidden size equal to the input, task-specific softmax output, dropout 0.8, and learning rate 0.01.Source: PREDICTION TASKS · p. 12
Content versus length
- Figure 4 plots content prediction accuracy against sentence length for different models.Source: §10 · p. 12, Figure 4 · p. 12
- All models lose content accuracy as sentences lengthen, with degradation roughly linear in sentence length.Source: §10 · p. 12
Significance tests
- Paired t-tests evaluate the reported findings; most summary results are highly significant with p-value ≪0.0001.Source: APPENDIX III: SIGNIFICANCE TESTS · p. 12
- Non-significant differences include encoder-decoder sizes 500 versus 750 on order, with p-value=0.11, and CBOW sizes 750 versus 1000, with p-value=0.3.Source: APPENDIX III: SIGNIFICANCE TESTS · p. 12
Related papers
This paper cites
- ADAM: A METHOD FOR STOCHASTIC OPTIMIZATION2014
- Neural Machine Translation by Jointly Learning to Align and Translate2014
- Sequence to Sequence Learning with Neural Networks2014
- Learning Phrase Representations using RNN Encoder-Decoder for Statistical Machine Translation2014
- Distributed Representations of Words and Phrases and their Compositionality2013
- Efficient Estimation of Word Representations in Vector Space2013
Cited by
- The Emergent Symbolic Structure of Artificial Neural Networks2026
- On the Opportunities and Risks of Foundation Models2021
- Designing and Interpreting Probes with Control Tasks2019
- What you can cram into a single vector: Probing sentence embeddings for linguistic properties2018
- SentEval: An Evaluation Toolkit for Universal Sentence Representations2018
- Pointer Sentinel Mixture Models2016