Source-linked AI summary
Out of Order: How Important Is The Sequential Order of Words in a Sentence in Natural Language Understanding Tasks?
Thang M. Pham, Trung Bui, Long Mai, Anh Nguyen
TL;DR
The paper asks whether high-performing BERT-based models use word order when solving NLU tasks. It tests their predictions on shuffled inputs and finds that many remain insensitive to word order, suggesting GLUE does not necessarily require syntax or complex reasoning.
Problem
Although BERT-based models achieved human-surpassing GLUE scores, it remained unknown whether classifiers actually use word order when performing NLU tasks.
Source: §1 · p. 2Method
The study tests BERT-based models on seven GLUE tasks by shuffling words in one selected input sentence at varying degrees.
Source: §1 · p. 2Results
Takeaways & Limitations
The findings suggest GLUE does not necessarily require syntactic information or complex reasoning, while self-attention extracts superficial cues in sequence-pair tasks.
Source: §5 · p. 9The proposed self-attention mechanism for matching similar words between a question and answer is a hypothesis.
Source: §3.4.2 · p. 7
Abstract
from arXiv · showhide
Do state-of-the-art natural language understanding models care about word order - one of the most important characteristics of a sequence? Not always! We found 75% to 90% of the correct predictions of BERT-based classifiers, trained on many GLUE tasks, remain constant after input words are randomly shuffled. Despite BERT embeddings are famously contextual, the contribution of each individual word to downstream tasks is almost unchanged even after the word's context is shuffled. BERT-based models are able to exploit superficial cues (e.g. the sentiment of keywords in sentiment analysis; or the word-wise similarity between sequence-pair inputs in natural language inference) to make correct decisions when tokens are arranged in random orders. Encouraging classifiers to capture word order information improves the performance on most GLUE tasks, SQuAD 2.0 and out-of-samples. Our work suggests that many GLUE tasks are not challenging machines to understand the meaning of a sentence.
1 Introduction
The paper asks whether BERT-based models use word order in NLU, and tests their sensitivity by shuffling words in one input sentence. It reports that shuffled inputs often preserve predictions, suggesting models can rely on word-level cues instead of syntax or complex reasoning.
- 65% of groundtruth labels across 5 GLUE tasks can be predicted when one sentence’s words are shuffled.Source: §1 · p. 2
- In some GLUE tasks, an individual word’s contribution to classification is almost unchanged after its surrounding words are shuffled.Source: §1 · p. 2
- In SST-2, the polarity of a single salient word is ≥60% predictive of the sentence label.Source: §1 · p. 2
- Sequence-pair GLUE models use self-attention heads to find similar tokens shared between inputs.Source: §1 · p. 2
- Increasing RoBERTa models’ sensitivity to word order improves performance on SQuAD 2.0 and most tested GLUE tasks, except SST-2.Source: §1 · p. 2
- Most GLUE-trained models behave similarly to Bag-of-Words models, and GLUE does not necessarily require syntactic information or complex reasoning.Source: §1 · p. 2
2 Methods
The methods compare BERT-family classifiers on real and word-shuffled examples from selected GLUE tasks and STS-B. The evaluation uses correctly classified, balanced examples and modifies one sentence while leaving the rest of each input unchanged.
2.1 Datasets
- The study uses six binary-classification GLUE tasks and also tests STS-B, a sentence-similarity regression task.Source: §2.1 · p. 2
2.2 Classifiers
- BERT, RoBERTa, and ALBERT base encoders receive a classification layer and are fine-tuned on each GLUE task.Source: §2.2 · p. 3
2.3 Constructing sets of real and shuffled examples for experiments
- The experiments shuffle n-grams of sizes 1, 2, or 3 in one sentence while keeping the remaining input unchanged.Source: §2.3 · p. 3
2.3.1 Selecting real examples
- The real-example subsets retain correctly classified examples, balance positive and negative labels, and filter out about 34% of the original data on average.Source: §2.3 · p. 3, §2.3.1 · p. 3
2.3.2 Creating shuffled sets
- Each shuffled set modifies one sentence: for QNLI, the question is shuffled while the answer, often a paragraph, remains unchanged.Source: §2.3.2 · pp. 3–4
3 Experiments and Results
Across most tested GLUE tasks, correct predictions often survived word-order disruption, with different patterns for similarity, sentiment, and sentence-pair tasks. A synthetic word-order finetuning step increased sensitivity and improved benchmark performance on most tested tasks.
3.1 How much is word order information required for solving GLUE tasks?
- For five of six binary-classification tasks, 75%–90% of correct predictions persisted after unigram shuffling, and at least 65% of ground-truth labels remained predictable; CoLA fell near chance.Retention reached 95.32% for QNLI with longer n-gram shuffling, while CoLA accuracy fell to 50.69%–56.36%.Source: §3.1 · p. 4
3.2 How sensitive are models trained to predict the similarity of two sentences?
- Above 83% of correct QQP predictions persisted after shuffling, while STS-B Spearman correlation fell by less than 2 points, from 89.67 to 87.80.STS-B similarity-score distributions for real-shuffled and real-real pairs also closely matched (Figure 2).Source: §3.2 · p. 5, Figure 2 · p. 5
3.3 How important are words to classification after their context is shuffled?
- Except on CoLA and RTE, word-importance scores changed only marginally after unigram shuffling, suggesting finetuned embeddings became less contextual than pretrained BERT embeddings.The reported change for the other four tasks was 0.008, compared with decreases of 0.036 on CoLA and 0.019 on RTE.Source: §3.3 · p. 5
3.4.1 SST-2: Salient words are highly predictive of sentence labels
- A single top-attribution word could predict at least 60% of SST-2 dev labels; positive top words corresponded to positive labels 100% of the time, and negative ones to negative labels 94.4%.Similar conclusions were reported with ALBERT classifiers and the SentiWords dictionary.Source: §3.4.1 · p. 6, Figure 3
3.4.2 Self-attention layers matching similar words in both the question and the answer
- In QNLI, 15 attention heads matched similar question-answer words regardless of order, and three heads handled 87% of this matching; the same three locations accounted for 76%–89% in three other tasks.The analyzed QNLI examples included at least three matching word pairs in about 58% of cases.Source: §3.4.2 · p. 7
- Ablating the 15 word-matching heads reduced QNLI accuracy by 24.5% on the full dev set, versus only 1%–3% after random-head ablation.The authors report that the 15 heads enabled at least about half of correct predictions.Source: §3.4.2 · p. 7, Table 3 · p. 8
3.5 Does increasing word-order sensitivity lead to higher model performance?
- Synthetic-task finetuning raised word-order sensitivity scores by about 1.5–2×, or 148%–194% in the table summary, relative to standard RoBERTa classifiers.The approach first trained RoBERTa to distinguish real sentences from versions with two words swapped, then finetuned on downstream tasks.Source: §3.5 · p. 8, Table 4 · p. 8
- GLUE performance exceeded the RoBERTa baseline on every task except SST-2; RTE rose from 72.2% to 73.21% average (74.73% best model), and SQuAD 2.0 F1 rose from 80.62% to 81.08%.These comparisons followed synthetic-task finetuning intended to increase word-order sensitivity.Source: §3.5 · p. 8
4 Related Work
Prior work examined word-order information in pretrained models, language generation, and other NLP tasks, while this work studies its use in downstream-finetuned models and compares sensitivity across NLU tasks.
Word-order information in pretrained models
- Prior studies found positional information in pretrained BERT fades after layer three and word shuffling reduces masked-word prediction accuracy by about 1.3 to 2×.The paper distinguishes those pretrained-model studies from its focus on models finetuned for downstream tasks.Source: §4 · pp. 8–9
Word-ordering as an objective
- Finetuning pretrained RoBERTa on synthetic tasks improved dev-set performance on SQuAD 2.0 and tested GLUE tasks except SST-2.The passage reports this result in Table 5.Source: Table 5 · p. 9
- StructBERT added word-ordering and sentence-ordering pretraining objectives, while this work studies word order alone and proposes finetuning as an alternative.The cited work reported improved GLUE performance, but its improvements were inconsistent across tasks and models.Source: §4 · p. 9
Word-order insensitivity in other NLP tasks
- Prior work reports word-order insensitivity in reading comprehension, dialog, natural language inference, essay scoring, text classification, and word prediction.This paper presents its study as the first word-order analysis on an NLU benchmark to contrast sensitivity across tasks.Source: §4 · p. 9
Humans can also be word-order invariant
- Human studies also report word-order invariance under some conditions, including high local mutual information or a semantically plausible interpretation.The authors describe their findings as documenting a similarity between humans and advanced NLU models.Source: §4 · p. 9
Invariance to patch-order in computer vision
- Image-classifier accuracy has also been reported to drop only marginally when image patches are shuffled.The cited vision studies provide a parallel case of order insensitivity in another modality.Source: §4 · p. 9
5 Discussion and Conclusion
Across three BERT variants and two model sizes, GLUE-trained models are often insensitive to word order unless explicitly asked to detect it. The authors also report similar insensitivity on ANLI and connect sequence-pair performance to superficial cues.
Discussion and conclusion
- Across three BERT variants and two model sizes, GLUE-trained models are often word-order invariant unless explicitly asked for, as in CoLA.The authors conclude that such models may neither use syntactic information nor complex reasoning, while self-attention extracts superficial cues in sequence-pair tasks.Source: §5 · p. 9
Adversarial NLI
- RoBERTa-based models also remained not always sensitive to word-order randomization on ANLI, with a reported Word-Order Sensitivity of 0.63.The authors suggest this indicates a common issue in existing benchmarks.Source: §5 · p. 9
A Self-attention layers that match question-words to similar words in the answer
The appendix analyzes QNLI self-attention patterns to identify heads that match question and answer words despite shuffled word order. It reports that a small set of heads captures these correspondences in many examples.
Experiment
- 89.4% of QNLI correct predictions remained correct after question-word shuffling, motivating an analysis of attention to matching question-answer words.The study began with the 2,500 positive dev-r examples and selected examples whose predictions remained unchanged across five random shuffles.Source: A Self-attention layers that match… · p. 13
- The analysis shuffled each question, ranked cross-input attention weights, and selected a matrix whose top-three word pairs had the smallest combined character-level edit distance.The chosen matrix was then checked on the original example; the stated threshold allowed minor spelling or punctuation differences.Source: A Self-attention layers that match… · p. 13
Results
- At the matching stage, 1,590 of 1,776 examples had attention connecting three pairs of matching words under the stated edit-distance threshold.The table caption describes counts across several thresholds; the passage reports the result for a combined distance of at most four.Source: A Self-attention layers that match… · p. 13
- After replacing shuffled questions with originals, 83% of the same word pairs remained among the top three attended pairs in the same matrices.The passage reports that attention shifted to different pairs in the remaining 17% of cases.Source: A Self-attention layers that match… · p. 13
- 15 self-attention heads explicitly capture question-to-answer word correspondence regardless of word order.The authors report that about 58% of positive QNLI examples have at least three shared question-answer words captured by one or more of these heads.Source: A Self-attention layers that match… · p. 13
- Figure A1 reports that 92% of duplicate-word attending is mostly handled in the first three layers among the 144 matrices examined.It identifies 15 word-matching matrices in the RoBERTa QNLI classifier.Source: Figure A1 · p. 14