---
title: "Quasi Bidirectional Encoder Representations from Transformers"
description: "QBERT lets the two sides of a word’s context interact during pretraining and improves word sense disambiguation on English benchmarks."
canonical: "https://research.elamur.ai/free/en/papers/bevilacqua-2019-quasi-bidirectional-encoder-representations-transformers/"
---
Elamur: [Mova](https://md.mova.elamur.ai/free/en/) · [Parse](https://mova.elamur.ai/free/en/parse/) · [Dictionary](https://md.dictionary.elamur.ai/free/en/) · [Translate](https://md.translate.elamur.ai/free/en/) · **Research** · [Gali](https://md.gali.elamur.ai/free/en/) · [MCP](https://mcp.elamur.ai/) · [Locations](https://md.locations.elamur.ai/free/en/) · [Weather](https://md.weather.elamur.ai/free/en/) · [Constitution](https://md.constitution.elamur.ai/)

[Elamur Research](https://md.research.elamur.ai/free/en/) · [this page in HTML](https://research.elamur.ai/free/en/papers/bevilacqua-2019-quasi-bidirectional-encoder-representations-transformers/)

[Elamur Research](https://md.research.elamur.ai/free/en/) / [papers](https://md.research.elamur.ai/free/en/papers/) / [2019](https://md.research.elamur.ai/free/en/papers/2019/) / Quasi Bidirectional Encoder Representations from Transformers for Word Sense Disambiguation

# Quasi Bidirectional Encoder Representations from Transformers for Word Sense Disambiguation

Paper · 2019 · Michele Bevilacqua and Roberto Navigli

**Authors:** [Michele Bevilacqua](https://md.research.elamur.ai/free/en/authors/michele-bevilacqua/) and [Roberto Navigli](https://md.research.elamur.ai/free/en/authors/roberto-navigli/) · **Year:** 2019 · **Venue:** Proceedings of the International Conference on Recent Advances in Natural Language Processing (RANLP 2019) · **Licence:** [CC BY 4.0 (ACL Anthology)](https://creativecommons.org/licenses/by/4.0/)

[Cited by **10** papers in our library of more than 163,000 papers whose bibliographies we read](https://md.research.elamur.ai/free/en/papers/bevilacqua-2019-quasi-bidirectional-encoder-representations-transformers/cited-by/) · Proceedings of the International Conference on Recent Advances in Natural Language Processing (RANLP 2019) · [licence](https://creativecommons.org/licenses/by/4.0/)

- [Publisher's page](https://aclanthology.org/R19-1015/)
- [PDF](https://aclanthology.org/R19-1015.pdf)
- [DOI 10.26615/978-954-452-056-4_015](https://doi.org/10.26615/978-954-452-056-4_015)

## Summary

A waiter can serve a meal or serve a cause. Even when several words near the verb point toward the first interpretation, the object can make the second one clear. In [word sense disambiguation](https://md.research.elamur.ai/free/en/concepts/word-sense-disambiguation/), a system has to make that choice using a dictionary of possible meanings. Learning to do it from examples is expensive because somebody has to identify the intended meaning of each training occurrence. Michele Bevilacqua and Roberto Navigli ask whether an encoder trained on ordinary text can help a supervised classifier make better use of the examples that have already been labeled.

Their encoder, QBERT, learns by predicting a word from its surroundings. It first reads each sequence in separate directions, using a [Transformer](https://md.research.elamur.ai/free/en/concepts/transformer/) stack for each. It then shifts the resulting representations so that the state aligned with the target contains only words before it or only words after it. A layer called the BiTransformer lets those states direct attention across the sentence. The masks in this layer are designed to keep the target word hidden even when a state consults another position. The result is a vector in which information from one side can influence how information from the other side is selected.

The authors freeze the pretrained encoder and train a separate classifier to choose WordNet senses. With SemCor and WordNet’s Tagged Glosses as supervised training data, QBERT reaches an F1 of 0.749 on ALL, the combined English evaluation set. The authors report a margin of 3 points over the earlier leading single system and 2.2 points over the earlier ensemble. QBERT also leads their own combined-set comparisons with ELMo, Flair, and SBERT. SBERT is especially informative because it uses the same directional encoder design and simply adds the two context vectors where QBERT uses the BiTransformer.

The paper also tests whether the representations help decide if a word means the same thing in different contexts. QBERT obtains a mean accuracy of 60.74 on the official [Word-in-Context development set](https://md.research.elamur.ai/free/en/papers/pilehvar-2019-wic-word-context-dataset-evaluating/), which the authors use for evaluation. It leads the other encoders in that comparison by a small margin. The strongest evidence for the design comes from the combined disambiguation benchmark. Results vary across the individual datasets, and the comparison with SBERT tests the added BiTransformer layer as a whole.

## Deep dive: Quasi Bidirectional Encoder Representations from Transformers for Word Sense Disambiguation

QBERT lets the two sides of a word’s context interact during pretraining and improves word sense disambiguation on English benchmarks. · about 33 minutes to read

**In this deep dive**

1. [The problem and its context](#dd-the-problem-and-its-context)
2. [The method, step by step](#dd-the-method-step-by-step)
3. [Experiments and results](#dd-experiments-and-results)
4. [What the ablations show](#dd-what-the-ablations-show)
5. [Limitations](#dd-limitations)
6. [What came after](#dd-what-came-after)

### The problem and its context

#### Meaning belongs to an occurrence

A dictionary can list the senses of a word once. A system reading a sentence has to decide which entry applies each time the word occurs. The paper uses WordNet as the inventory for [word sense disambiguation](https://md.research.elamur.ai/free/en/topics/word-sense-disambiguation/). A WordNet synset represents a particular meaning, and an occurrence marked for evaluation has an associated set of candidate synsets. Success requires choosing the intended entry from that set. Giving a generally related word or recognizing the topic of the sentence would leave the choice unresolved.

The paper illustrates the difficulty with a waiter near a counter who serves a revolutionary cause. The people and objects introduced before the verb make a food-related reading plausible. The phrase after the verb favors the sense of devoting effort. A representation that identifies the waiter and the counter has picked up real evidence, but that evidence can pull the decision in the wrong direction. The example motivates a way to let what the encoder reads on one side affect how it interprets what it reads on the other side.

This issue is distinct from learning a good representation of the word *serve* in isolation. A word-level vector can capture properties shared across its occurrences. A contextual representation has a different job. It responds to which words are present around this occurrence and where they appear. The two kinds of information can both help a sense classifier. A word’s identity supplies the entry whose meanings are under consideration, while the surrounding words help distinguish among those meanings. QBERT’s downstream classifier has access to both.

#### Supervision and the cost of examples

The authors describe the strongest prior disambiguation systems as supervised. They learn from text in which occurrences have been assigned dictionary senses. Producing those labels calls for people who can distinguish meanings that are often close and apply the distinctions consistently. The authors give that cost particular weight because the neural approaches they discuss tend to need substantial training data. A larger collection of unlabeled text is easier to obtain than a comparably large collection in which people have decided how individual words are used.

Some earlier systems made effective use of traditional classifiers under those conditions. The paper discusses It Makes Sense, or IMS, which uses support vector machines with hand-designed features. Word embeddings improve that system when used as additional features. Other work used neural sequence classifiers and treated disambiguation as a tagging task. A tagger can read a sequence and emit one prediction for each position, which suits an all-words evaluation where many occurrences in a passage can require labels. The paper also describes an earlier approach with strong results for nouns whose coverage was limited to that part of speech.

The paper distinguishes systems that learn chiefly through the disambiguation task from those that transfer a representation learned elsewhere. Transferring a representation still leaves room for supervised classification. It changes which parts of the system have to learn from scarce sense tags. The encoder can acquire regularities from ordinary sentences, while the supervised stage learns which patterns correspond to the distinctions in WordNet. The authors’ motivation is to make progress by reducing reliance on costly labeling. The experiments then test particular labeled corpora and representation choices.

#### What transfer had already offered

Yuan and colleagues provide one precedent. As the paper describes it, they trained a recurrent network on over 100B unlabeled tokens to predict a hidden word. They used the resulting representations for labeled occurrences in SemCor and assigned senses through methods including nearest-neighbor prediction and label propagation. A token’s representation thus served as a way to relate it to other occurrences. The scale of the unlabeled corpus made that approach difficult to reproduce, and the paper notes that a reimplementation with less text performed worse. This made the pretraining arrangement itself part of the practical problem.

The authors also discuss a related attempt with [ELMo](https://md.research.elamur.ai/free/en/papers/peters-2018-deep-contextualized-word-representations/), whose results on disambiguation had been less encouraging than its results on other language tasks. In another transfer approach, Melacci and colleagues added [context2vec](https://md.research.elamur.ai/free/en/papers/melamud-2016-context2vec-learning-generic-context-embedding/) representations to IMS and reached performance roughly comparable to the system of Yuan and colleagues. These examples shaped the starting point for QBERT. Contextual representations had already been tried in different roles, and the way the encoder combined context remained an architectural question.

In the paper’s account of [language modeling and pretraining](https://md.research.elamur.ai/free/en/topics/language-models/), directional prediction gives a system a convenient source of training examples. A sequence supplies both the context and the observed word to be predicted. A forward predictor reads earlier words, and a backward predictor reads later ones. ELMo uses separate directional recurrent stacks fed by a common character-based encoder. Their training can share components, while the information available inside each stack is still directional. Flair also uses directional recurrent encoders, operating on characters and reading out representations at word boundaries. [Flair](https://md.research.elamur.ai/free/en/papers/akbik-2018-contextual-string-embeddings-sequence-labeling/)

The paper describes GPT as another instance of directional pretraining, using Transformers and a vocabulary built through byte-pair encoding. [Subword tokenization](https://md.research.elamur.ai/free/en/concepts/subword-tokenization/) can divide a written word into several units, so there may be more than one position for a single word that needs a sense label. QBERT’s design instead keeps the encoder’s positions aligned with words. The authors regard this as a good fit for the task and use it to define the systems they compare. Their experimental choice leaves open how well a different interface between sub-word representations and word-level labels would work.

The authors identify [BERT](https://md.research.elamur.ai/free/en/papers/devlin-2019-bert-pre-training-deep-bidirectional/) as a way to learn representations from both sides jointly. Its masked prediction objective hides selected input content and allows the surrounding sequence to be processed together. QBERT asks a different architectural question. Given directional states that already obey the restrictions of causal pretraining, how can attention bring the two sides together while preserving the restriction at every position where the encoder is asked to predict a word? Moving that interaction into the encoder is what distinguishes the proposal from adding or concatenating directional vectors after they have been computed.

### The method, step by step

#### From words to two views of the sentence

QBERT separates the encoder from the prediction head. The encoder starts with a sequence of word tokens and returns a vector at each position. The prediction head uses those vectors to answer whatever question provides supervision at that stage. During pretraining the question is which word occurred at the position. During word sense disambiguation the question is which synset fits the occurrence. This separation lets the authors keep the expensive encoder fixed when they train the disambiguation classifier.

The encoder starts by mapping each word to a [word embedding](https://md.research.elamur.ai/free/en/concepts/word-embeddings/), a vector whose value at this stage depends on the word type. It uses [Adaptive Input](https://md.research.elamur.ai/free/en/papers/baevski-2018-adaptive-input-representations-neural-language/) for that mapping. The input mechanism groups the vocabulary so that different parts can use different embedding capacities, then projects to a common width for the encoder. The authors add sinusoidal positional embeddings. This gives the encoder access to a word’s location in the sequence alongside its lexical representation.

The same input is sent to a past stack and a future stack. Both contain masked Transformer layers, with corresponding layers sharing weights. The masks make the computations directional even though the parameters are shared. A state at a position in the past stack can reflect the current word and everything earlier in the sequence. The future stack can reflect the current word and everything later. Through successive layers, each stack builds a representation of its permitted context. A state remains directional because every position it can consult also obeys the same restriction.

The encoder subsequently shifts both sequences by one position. At a target position, the shifted past state is taken from immediately before the target and the shifted future state from immediately after it. Learned padding fills the vacant ends of the two sequences. This alignment removes direct access to the target from the inputs at its own position. The BiTransformer then performs attention from each shifted sequence to the other, using the masks that keep every attended state on the appropriate side of the target.

How QBERT encodes a word’s surroundings The steps in order.

The prediction target is the word that was present in the original text. Its embedding is calculated as part of processing the sequence, and the word can contribute to predictions at other positions. The architecture has to exclude it specifically from the representation used to predict itself. That requirement is more demanding than avoiding a direct connection to its own embedding. Any state that has already absorbed the word can also reveal it. Following the path of information through the attention operations is therefore essential to understanding why the shifts need to be paired with masks.

#### How attention selects information

The ordinary Transformer layer used as the starting point has an attention sublayer and a feedforward network applied at each timestep. Attention is the part that exchanges information between positions. The feedforward part transforms the features at each position on its own. The underlying design also uses [residual connections](https://md.research.elamur.ai/free/en/papers/he-2015-deep-residual-learning-image-recognition/) to carry inputs forward into a sublayer’s output and [layer normalization](https://md.research.elamur.ai/free/en/papers/ba-2016-layer-normalization/) to stabilize transformations. QBERT modifies how the attention works in the directional stacks and in the BiTransformer.

A query represents the position requesting information. Each key represents a position that may supply information, and its corresponding value contains the features that can be passed back. Attention scores a query against the keys, turns the scores into weights, and uses the weights to mix the values. In self-attention the queries, keys, and values come from the same input sequence. In the BiTransformer’s cross-sequence attention, the querying state and the states offered as keys and values come from different directional sequences. The [original Transformer architecture](https://md.research.elamur.ai/free/en/papers/vaswani-2017-attention-all-need/) provides the scaled dot-product operation used in both cases.

```
attn(Q, K, V) = softmax(QKᵀ / √dₖ) V
```

Here `attn` denotes the attention function. `Q` is the matrix of queries, `K` the matrix of keys, and `V` the matrix of values. Rows correspond to positions in their respective sequences. `Kᵀ` is the transpose of `K`, so the product `QKᵀ` contains a dot product for every query and key pair. `dₖ` is the dimensionality of a key, and division by its square root, `√dₖ`, moderates the magnitude of the scores. `softmax` acts over the key positions for each query. Multiplication by `V` yields one weighted mixture of value vectors per query. Juxtaposition of matrices indicates multiplication.

Multi-head attention performs several such operations on learned projections of the input. A head can select and combine features in its own projected space. For example, the architecture gives different heads the capacity to weight the same available positions differently. The paper does not assign linguistic roles to individual heads. What matters for the method is that the separate head outputs are brought back together and projected to the width needed by the layer.

```
attnMH(Q, K, V) = concatᵢ[attn(QWᵢᑫ, KWᵢᵏ, VWᵢᵛ)] Wᵒ
```

`attnMH` is multi-head attention, and `i` indexes the heads. `Q`, `K`, and `V` retain their meanings from the attention formula. The learned matrices `Wᵢᑫ`, `Wᵢᵏ`, and `Wᵢᵛ` project queries, keys, and values for head `i`, respectively. `attn` applies the scaled operation to those projections. `concatᵢ` joins the outputs across their feature dimensions, preserving the row for each query position. The brackets enclose the expression evaluated for each head. `Wᵒ` projects the joined features to the output width. The paper’s description assigns a distinct projection to values, which is the convention used here.

#### How the masks enforce direction

The attention mask operates on pairs of positions. For an eligible key position, the mask contributes zero to its score. For an excluded position, it contributes negative infinity, so the resulting attention weight is zero after softmax. The same allowed positions apply across heads. The heads can differ in how much weight they give to an available position, while exclusion itself is fixed by the architecture.

```
M𝒇[i, j] = { −∞ if i < j, 0 otherwise }
```

`M𝒇` is the future mask. The bracketed indices `i` and `j` refer to the query row and key column, respectively. The condition `i < j` marks a key that lies later than the query. `−∞` excludes it, and `0` leaves its score unaffected. A query in the past stack can consequently attend to its own position and earlier ones.

```
M𝒑[i, j] = { −∞ if i > j, 0 otherwise }
```

`M𝒑` is the past mask, with the same query index `i` and key index `j`. The condition `i > j` marks a key earlier than the query. Here `−∞` excludes earlier positions, and `0` leaves the current and later positions available. Transposing one mask gives the other because the condition swaps which side of the diagonal is excluded.

Masking holds through the entire directional stack. Consider a query in the past stack that attends to an earlier position after several layers. The earlier state was itself built from that position and its own predecessors. It can summarize a wider span while still having no access to any word later than the query. The argument runs in reverse for the future stack. The tied weights allow the same transformations to be applied to each orientation. The masks, rather than separate learned parameter sets, determine which context each orientation can see.

At this point both directional states at a word’s position still have access to that word. The diagonal of each mask is open, and the input arriving at the position also carries the word’s own embedding. A prediction head placed directly over the combined, unshifted states could exploit this information. The position shift changes the state used as context for each output position without changing the directional stack that produced it.

```
P⇢ = PAD ⊕ P₁:ₙ₋₁
```

`P` is the sequence output by the past stack, `n` is the sequence length, and `P₁:ₙ₋₁` keeps the states from the first through the penultimate position. `PAD` is the learned padding vector. `⊕` is concatenation along the time dimension, with the padding at the beginning. `P⇢` is the resulting shifted sequence. At any interior position it carries the past state from the previous position. At the opening position the padding stands in for the absent left context.

```
F⇠ = F₂:ₙ ⊕ PAD
```

`F` is the output sequence of the future stack. `F₂:ₙ` keeps the states from the second through the last position, and `n` again denotes the sequence length. `⊕` appends the learned padding vector `PAD` along the time dimension. `F⇠` is the shifted future sequence. Its state at an interior position starts with the next word, and its final state uses padding for the absent right context.

If `w` denotes the word sequence, `wᵢ` is the word at position `i`. The shifted past vector at `i` can carry information from `w₁` through `wᵢ₋₁`. The shifted future vector starts with `wᵢ₊₁` and can carry information through `wₙ`. SBERT already has enough information to form a representation at this point. The authors’ SBERT baseline adds the aligned past and future vectors element by element. QBERT keeps them separate for another operation, so that the choice of features to retrieve from one side can depend on the other.

#### How the BiTransformer combines the views

The BiTransformer first normalizes the shifted sequences separately. It then performs attention in both directions. In the first direction, the query comes from the shifted past sequence. The keys and values come from the shifted future sequence. At position `i`, the past query is allowed to consult future states at position `i` and later. The future state at `i` starts after the target, and those farther along start even later. Every state that can supply information to this query therefore excludes the word being predicted.

The opposite direction uses the shifted future state as query and the shifted past states as keys and values. At position `i`, those past states must be at `i` or earlier. All their contexts end before the target. In the waiter example, the past view can influence what is retrieved from the future view containing the phrase about the cause. The future view can also change the weighting of states that contain different portions of the preceding clause. This example describes what the operations permit. The paper uses the sentence to motivate the design and reports benchmark scores for its evaluation.

A shift on its own would be insufficient for that exchange. A future state aligned to a position before `i` might encode a stretch of text that includes `wᵢ`. A past state aligned to a position after `i` can also contain it. The masks exclude those states from the respective co-attention operations. This explains why the past query uses the past mask when it reaches across to the future sequence, even though the past stack itself was built with the future mask. The eligible keys are determined by what they already encode as well as by where they sit.

```
P′ = LayerNorm(P⇢)
```

`P⇢` is the shifted past sequence, and `LayerNorm` denotes the layer normalization applied to it. `P′` is the normalized past input to co-attention. The prime distinguishes the normalized states from the shifted states used as residuals.

```
F′ = LayerNorm(F⇠)
```

`F⇠` is the shifted future sequence. `LayerNorm` normalizes this sequence separately, and `F′` is the normalized future input. As with the past sequence, the original shifted states remain available for the residual connection.

```
O = attnMMH(P′, F′, F′, M𝒑) + attnMMH(F′, P′, P′, M𝒇) + P⇢ + F⇠
```

`O` is the combined sequence produced by the co-attention part of the layer. `attnMMH` is masked multi-head attention, taking queries, keys, values, and a mask in that order. `P′` and `F′` are the normalized shifted sequences. The first call uses the past mask `M𝒑`, and the second call uses the future mask `M𝒇`. `P⇢` and `F⇠` are the shifted inputs before normalization. The plus signs indicate elementwise addition, including the residual contributions from both directions. The layer’s feedforward network then acts position by position on the combined sequence to produce the contextual embeddings for the prediction head.

The term *quasi bidirectional* describes the placement of the joint operation. Many layers can be used to build each directional sequence, and the final layer can condition the use of one side on the other. The joint stage itself is shallow. Once a co-attentive output is available at each position, the safety argument for cross-position attention changes. The output at its own position excludes the word being predicted there, but another output can contain that word as part of its context. A further ordinary round of attention among such outputs could reopen a path to the answer. The authors accordingly use a single BiTransformer in the pretrained encoder.

#### How the encoder learns from ordinary text

For pretraining, the paper uses the English UMBC corpus, which contains around 3B tokens. It splits the corpus into sequences of at most 100 tokens. The sequence supplies the target words directly, so this stage requires no WordNet senses. Predicting the observed word is the job of an [Adaptive Softmax](https://md.research.elamur.ai/free/en/papers/grave-2016-efficient-softmax-approximation-gpus/) head. Adaptivity makes the large prediction vocabulary manageable by giving different vocabulary groups different treatment. [UMBC corpus](https://md.research.elamur.ai/free/en/papers/han-2013-umbc-ebiquity-core-semantic-textual/)

Both the input and the output vocabulary contain 400k words. In the adaptive components, the cutoff values are 35k, 100k, and 200k, and the shrinkage factor is 4. The authors share the embedding matrices between Adaptive Input and Adaptive Softmax. Their projection weights are trained separately. The coupling means that learning to represent a word on input and learning to predict it on output can update common lexical parameters. The projections retain the freedom required by their respective operations. [Input and output embedding weight sharing](https://md.research.elamur.ai/free/en/papers/press-2017-output-embedding-improve-language-models/)

Each directional Transformer stack is 5 layers deep. The directional layers and the BiTransformer have an input and output width of 512. The first internal feedforward layer expands the representation to 2048 dimensions before the feedforward network returns it to the width used at the layer boundary. The features exchanged across positions and the features transformed within a position thus have different roles even though both participate in producing the final word representation.

The authors accumulate gradients over 16 batches of 5000 tokens per optimizer update, giving the reported virtual batch size of 80,000 tokens. They use stochastic gradient descent with Nesterov acceleration. The learning rate rises linearly from 10⁻⁵ to 1 across a warmup of 2000 updates. It then follows a cosine schedule, initially ranging between 1 and 10⁻⁵ over a cycle of 2000 updates. After each cycle, the period is multiplied by 1.5 and both learning-rate bounds are halved. The run continues until convergence. The training implementation uses PyTorch and fairseq. The authors release code for training the encoder and the disambiguation classifier, together with pretrained weights.

#### How the sense classifier uses the encoder

For the disambiguation stage, the original word embedding is useful information again. The word itself is known, and the task is to decide which meaning it has. The authors combine the encoder’s context-independent input embedding with its contextual output in a weighted mean. A learned weight, denoted `w` in the classifier description, controls the mixture. This use of `w` is separate from the notation `wᵢ` for an input word. The encoder stays frozen. The experiments train the mixture weight and a Transformer classifier on top of the fixed representations.

The classifier emits a distribution over an output vocabulary containing synsets and a special `<untagged>` symbol. Training treats monosemous words as tagged, so a word with a single sense can contribute its known label. At test time the decision is restricted to the synsets associated with the target’s [lemma](https://md.research.elamur.ai/free/en/concepts/lemma/), the dictionary form used to recover its possible meanings. The highest-probability candidate within that set is returned. The authors perform that selection without a separate Most Frequent Sense backoff rule.

This setup separates two sources of information that can otherwise be difficult to distinguish. The candidate inventory specifies which answers are valid for the lemma. The classifier ranks those answers using vectors that include the word and its context. As a result, the evaluation primarily asks how well the learned representation and classifier distinguish among the senses of a known word. The next section describes the corpora that teach the classifier those distinctions and the comparisons used to evaluate them.

### Experiments and results

#### The English all-words evaluation

The authors train disambiguation classifiers under two labeled-data conditions. In the first, SemCor is the sole supervised training corpus. In the second, the classifier also sees WordNet’s Tagged Glosses, abbreviated WTG. These are the sense definitions in WordNet with words in the definitions themselves disambiguated. WTG contributes 117,659 manually disambiguated synset glosses containing 496,776 annotated tokens. The additional data supplies occurrences and sense labels to the downstream classifier. The encoder has already been pretrained on ordinary text by this stage.

The English all-words benchmarks come from the Senseval and SemEval campaigns. The authors use the SemCor and benchmark versions distributed through the [unified disambiguation evaluation framework](https://md.research.elamur.ai/free/en/papers/raganato-2017-word-sense-disambiguation-unified-evaluation/). The first two benchmark columns are Senseval-2 and Senseval-3, abbreviated S2 and S3 in the paper. The successive SemEval evaluations are represented by S07, S13, and S15. ALL is the benchmark formed by concatenating the evaluation datasets. The combined score applies to that concatenation, with each test occurrence entering through its dataset. [Senseval-2](https://md.research.elamur.ai/free/en/papers/edmonds-2001-senseval-2-overview/)

The metric is F1, which combines precision and recall. Precision concerns the share of predictions that are correct, and recall concerns the share of reference instances recovered. The paper reports F1 in decimal form for the individual sets and for ALL. SemEval-15 also has a special role in the authors’ own experiments. They choose the best epoch of a training run using it as development data. Its score therefore documents performance on the set used for selection, and that set also contributes instances to ALL.

For supervised training, the authors use Adam and run for a maximum of 60 epochs. The learning rate increases from 10⁻⁵ to 10⁻³ before a cosine schedule takes over. That schedule begins with a period of 200, a maximum of 10⁻³, and a minimum of 10⁻⁴. Both bounds are halved each cycle, and the period doubles. The paper reports these settings for the downstream classifier, distinct from the optimizer and schedule used for encoder pretraining.

#### The systems used for comparison

The authors train their prediction head with QBERT and compare it with heads using ELMo, Flair, or SBERT representations. That comparison addresses how well each of these representations supports the same general disambiguation procedure. For QBERT and SBERT, the important architectural distinction is the operation applied to the shifted states. SBERT uses an elementwise sum. QBERT adds a layer in which attention passes information across the two streams before the final contextual vector is formed.

The ELMo configuration uses directional recurrent processing with hidden size 4096 and contextual embedding size 512. Its pretraining material combines a Wikipedia dump with English monolingual news corpora, totaling 5.5B tokens. Like QBERT, it offers both a context-independent representation and a contextual representation. Its input word vector comes from a character-level convolutional encoder. The authors can therefore use the weighted combination of static and contextual features for ELMo in the same way they do for QBERT, even though the encoders differ internally.

Flair provides contextual features from separate forward and backward character encoders. The authors use the pretrained versions whose source material is described as web text, Wikipedia, and subtitles. To provide a context-independent word representation for the sense head, they add [GloVe](https://md.research.elamur.ai/free/en/concepts/glove/) embeddings. The Flair features and the GloVe embedding are concatenated and passed through a dense projection to meet the classifier’s input width. This is a different input adaptation from the weighted mean used for QBERT and ELMo. The comparison evaluates that complete arrangement for making Flair usable in the task.

The paper also compiles earlier results from systems that can perform all-words disambiguation across the WordNet inventory. Those rows include feature-based systems in the IMS family as well as recurrent and other neural approaches. The tables distinguish earlier single systems from ensembles, which combine predictions from several trained instances. The comparison rows give reference points for performance on the established benchmarks. The development-set column matters because earlier systems did not all use the same data to choose their settings or checkpoints. Each such row is a published result in its own experimental arrangement.

#### Results with SemCor alone

English ALL word sense disambiguation F1 with SemCor supervision QBERT leads the contextual representation comparisons and the earlier reference scores.

**The numbers**

| System or setting | F1 |
| --- | --- |
| Earlier best single system | 0.713 |
| Earlier best ensemble | 0.718 |
| Flair | 0.699 |
| ELMo | 0.714 |
| SBERT | 0.715 |
| QBERT (this paper) | 0.724 |

When the only supervised training corpus is SemCor, QBERT leads the authors’ encoders on the English ALL benchmark with F1 of 0.724. The SemCor table marks its improvement on ALL over the earlier best single system as significant under the paper’s z-test, with `p < 0.05`. SBERT and ELMo are close on that combined set, while Flair trails both. Having the SBERT row is particularly helpful here because a high score from a contextual encoder on its own would leave the contribution of the cross-sequence layer unresolved.

At the level of individual datasets the SemCor scores show where the aggregate advantage comes from and where other systems remain competitive. QBERT records F1 of 0.734 on Senseval-2 and 0.732 on Senseval-3. On each, the paper describes its result as comparable to strong earlier scores. Its own comparison encoders are behind it on these two sets. SBERT’s Senseval-2 F1 is 0.731, and ELMo’s Senseval-3 F1 is 0.718. These are comparisons of the sense head trained with SemCor on the corresponding evaluation sets.

On the SemEval-07 set, QBERT obtains 0.644 F1, and the paper reports a margin of 0.7 points over the earlier best score. On SemEval-13 it reaches 0.710. The authors report a 1.5-point margin there over the earlier single-system reference, while the earlier ensemble entry is 0.712. Those rows illustrate why the paper distinguishes single systems and ensembles when describing earlier performance. The combined leaderboard and the best row on an individual dataset can tell different stories.

On SemEval-15, the set used to pick the authors’ checkpoints, QBERT has F1 of 0.743. ELMo achieves 0.762 there, ahead of the other encoders in the SemCor condition. That result is worth retaining alongside QBERT’s lead on ALL. The change of ranking shows how much a comparison can depend on which occurrences are included in a particular benchmark. It also makes the selection role of SemEval-15 visible to anyone reading the score as evidence of generalization.

#### Results with SemCor and WTG

English ALL word sense disambiguation F1 with SemCor and WTG supervision QBERT leads the authors’ comparisons and the earlier ensemble reference.

**The numbers**

| System or setting | F1 |
| --- | --- |
| Earlier best single system | 0.719 |
| Earlier best ensemble | 0.727 |
| Flair | 0.725 |
| SBERT | 0.734 |
| ELMo | 0.741 |
| QBERT (this paper) | 0.749 |

With WTG added to SemCor, the QBERT classifier attains F1 of 0.749 on English ALL. The paper’s conclusion reports its margin as 3 points over the earlier single-system result and 2.2 points over the earlier ensemble. The results table marks QBERT, ELMo, and SBERT as significantly ahead of the previous single-system reference on ALL. Those marks concern each comparison against that earlier reference. In particular, the table gives a ranking for QBERT and ELMo on ALL while the significance notation addresses a different comparison.

The expanded supervision improves the ALL scores of all the authors’ encoders. It also changes their relative positions. Under SemCor alone, ELMo and SBERT have nearly the same F1 on ALL. With WTG added, ELMo’s F1 is 0.741 and SBERT’s is 0.734. QBERT retains the lead as the size and content of the labeled training set change. This matters for the interpretation of the headline result. The score reflects the combination of the pretrained representation, its supervised head, and the additional sense examples. The separate training conditions allow the reader to see the architecture comparison under both amounts of supervision.

QBERT reaches 0.757 F1 on Senseval-2 and 0.739 on Senseval-3, the strongest entries in the expanded-training table for those sets. On SemEval-07, its F1 is 0.659. SBERT achieves 0.675 there, and the earlier ensemble entry is 0.668. On SemEval-13, QBERT obtains 0.746, while ELMo scores 0.754. Both do well against the paper’s earlier reference for that dataset. On SemEval-15, QBERT leads the authors’ comparison at 0.791 F1, with the checkpoint-selection role of that set still applying.

These dataset-level reversals qualify any claim about consistent gains. QBERT with expanded supervision leads the combined benchmark and has the best score in several of the component evaluations. The preceding exceptions specify exactly where an alternative performs better. The older ensemble described by the authors combines 20 trained systems. Its comparison with a single QBERT classifier is useful for reader expectations about benchmark performance. As with the other earlier rows, the systems were trained and selected under their respective protocols.

#### Word-in-Context evaluation

Word-in-Context asks the classifier to compare occurrences rather than choose a synset label. The inputs are two contexts containing the same target lemma. The answer is whether the lemma has the same meaning in both. The dataset was constructed so that a context-independent vector for the shared word would supply no basis for distinguishing same-sense pairs from different-sense pairs. The classifier instead needs features that respond to the actual uses. This makes WiC a check on the contextual representations with a different decision rule from all-words disambiguation.

The paper describes a collection of 8320 context pairs distributed across the released training and development data. The authors reserve part of the training set for internal development and send predictions on the official development set to the task scorer. They use that scored set for their reported evaluation. The classifier is a small feedforward head modeled on the task’s ELMo baseline. For QBERT, it receives a concatenation of the word and contextual embeddings. The comparisons use the same general head with the other representation systems. For Flair, the input includes the GloVe representation alongside the contextual features.

Each WiC classifier trains for a maximum of 40 epochs, and the authors select the epoch with the highest accuracy on their internal development split. Accuracy is the share of context pairs assigned the correct same-sense or different-sense label. The results report its mean and standard deviation across 5 runs. This repeated evaluation gives the reader information about variability that a single best submission would leave out.

Mean accuracy on the official Word-in-Context development set QBERT has the highest mean among the encoders evaluated with the shared classifier setup.

**The numbers**

| System or setting | accuracy % |
| --- | --- |
| ELMo | 59.97 |
| SBERT | 60.03 |
| Flair | 60.23 |
| QBERT (this paper) | 60.74 |

QBERT’s mean accuracy is 60.74 and its standard deviation is 1.22 on the official WiC development set. The standard deviations there are 1.41 for ELMo, 1.13 for SBERT, and 0.91 for Flair. The ordering of the means puts QBERT first in the comparison, with the differences small beside the reported run variability. The paper treats WiC as corroboration of the richer encoding for word meaning. This experiment provides a second kind of task on which the representation works, with a narrower numerical result than the main all-words benchmark.

### What the ablations show

#### Replacing the final interaction with a sum

SBERT is the paper’s closest architectural control. It shares the design of the directional Transformer encoder, up to and including the shift that removes the target from the position used for prediction. It then adds the past and future states element by element. Both architectures therefore have information from both sides. In QBERT, the BiTransformer gives the left-hand state a role in choosing features from the right-hand states and gives the right-hand state the reciprocal role. SBERT combines information that each side has assembled independently.

That comparison tests a specific point in the architecture. The directional stacks and their shifted outputs already provide broad contextual coverage, so a benefit from QBERT supports the usefulness of the added interaction beyond covering more positions. Under SemCor supervision, QBERT’s F1 of 0.724 on English ALL compares with SBERT’s 0.715. With SemCor and WTG, QBERT reaches 0.749 on the same combined F1 evaluation, and SBERT reaches 0.734. The direction of the aggregate result holds across the two supervised training conditions. On the individual SemEval-07 set with expanded supervision, the SBERT result is higher.

Adding the BiTransformer changes the computations after the directional stacks in several respects. There are learned projections for attending across the two views, followed by a combination of the resulting features and directional residuals, as well as an extra feedforward transformation. The comparison establishes the performance associated with replacing a sum with that entire layer. A parameter-matched transformation with the cross-attention removed would address a finer question about how much of the gain comes specifically from conditioning on the opposite direction. The paper’s experiments use the whole-layer comparison.

#### Changing the labeled training corpus

The paired WSD runs also show what happens when the same kind of classifier sees the tagged glosses in addition to SemCor. The ALL results increase for each representation system. This pattern gives the tagged gloss condition an interpretation independent of which encoder wins. Extra annotated occurrences in WordNet definitions provide training information the available classifiers can use. At the same time, the architecture ordering on ALL remains favorable to QBERT when all the comparison encoders are trained in the same labeled-data condition.

The training change varies both the amount of material and the kind of text the classifier sees. A gloss is a short definition, and its disambiguated words offer supervised occurrences in that setting. The paper compares SemCor by itself with SemCor plus the gloss corpus. Those results document what the added corpus does in the complete training setup. Separating a benefit from having more labels from a benefit specific to the language or sense coverage of glosses would require controlling those properties independently.

The individual evaluations show where the conditions matter. On SemEval-13, ELMo’s F1 rises from 0.703 with SemCor to 0.754 with both corpora, finishing above QBERT on that benchmark. On SemEval-07, SBERT reaches the strongest F1 in the expanded-training table. The authors describe that set as small and say its scores vary considerably across runs. These observations support treating the per-set rankings as part of the evidence. ALL establishes the combined pattern, while the component evaluations expose cases in which the aggregate preference for QBERT does not hold.

#### Comparing representations and a second task

ELMo and Flair help show how QBERT performs against alternatives available to someone assembling a sense classifier. Those comparisons change more than the operation used to combine the two sides of a word. ELMo and Flair use different directional encoders from QBERT, were pretrained on different collections, and have different ways of representing the input word. The paper adapts the head for Flair by supplying GloVe features and adding a projection. Its lower all-words scores describe how that complete setup performs. The authors suggest that Flair’s reliance on character-level encoding may contribute to the result, an explanation the comparison leaves open.

The contrast between QBERT and SBERT on WiC tests whether the aggregate WSD pattern is confined to selecting WordNet synsets from the lemma’s candidates. QBERT’s mean accuracy is 60.74 on the official WiC development set, while SBERT’s is 60.03. The task uses a pairwise same-sense decision and a feedforward classifier, so the direction of the result survives a change in both the head and the kind of supervision. Its evidential weight is limited by the closeness of the means and the run-to-run spread. WiC supplies a second observation about performance rather than a separate analysis of what the heads attend to.

The authors note that some WiC contexts are as short as 2 or 3 words. Joint attention over directional states has fewer contextual cues to work with in those cases. That is a possible account of why the observed advantage is modest. The paper reports the overall WiC results, so there is no context-length comparison that shows whether the margin grows when more words are available. The architectural motivation and the empirical result can therefore be read at their own levels. The masks explain which exchanges the encoder can perform, and the scores show how the resulting representations fare in the tasks tested.

### Limitations

#### Limits identified by the authors

The authors frame the BiTransformer as a shallow joint step over deep directional encodings. They identify a structural reason for that choice. After the cross-attention step, a state excludes its own word while potentially encoding every other word in the sequence. Adding the same form of attention over these combined states would give each query access to positions that may already contain its target. This would undermine the pretraining objective. The architecture demonstrates a way to combine the directions at this stage while preserving the prediction constraint. Its design does not extend to a stack of successive joint layers under the same masking argument.

The authors exclude BERT and GPT from the experimental comparison because of the difference between their byte-pair units and the word units considered appropriate for WSD here. The evaluation therefore compares QBERT with the reported word-aligned alternatives. It leaves the relative performance of masked bidirectional pretraining and QBERT open. A direct test would need to specify how a word-level classifier receives sub-word representations and control how the comparison encoders were trained. The paper identifies bridging the gap between directional pretraining and fully bidirectional masked pretraining as an area for further work.

The authors also state that SemEval-15 is their development set. Its F1 values reflect an epoch chosen using that set, and ALL includes those same instances. The paper gives results for the other component datasets, which lets readers consider evidence beyond the checkpoint-selection set. In the WiC experiment the official development set serves a different role. The authors hold out training instances to choose an epoch and use the official development scorer to evaluate it. The paper records this as a development-set evaluation at a time when the official test set was unavailable.

The discussion points to short WiC contexts as a condition that might reduce the benefit of joint encoding. The conclusion leaves the extension to tasks beyond those examined for future work. The reported experiments concern two forms of context-sensitive word meaning, and the paper’s stronger numerical evidence comes from all-words disambiguation. Its WiC experiment gives a smaller difference in means and does not break out scores by the amount of context. Together these observations define how far the empirical case reaches.

#### Limits visible in the experimental design

The experiments are motivated by the scarcity of sense labels. They show how pretrained representations behave with SemCor and with SemCor plus WTG. Those two conditions do not trace out how performance changes as progressively fewer labeled examples are made available. The paper also centers the downstream comparisons on pretrained encoders. A direct estimate of how many sense labels pretraining saves would require a comparison against a suitable end-to-end classifier across controlled training sizes. The observed result here is stronger accuracy with the reported features and training corpora, including a gain from the labeled glosses.

The candidate inventory supplies important information during disambiguation. The classifier chooses among synsets for the known target lemma, and the experiments use a fixed WordNet sense inventory and English benchmark versions. That makes the task a test of discrimination among known senses in context. Identifying an unfamiliar meaning, building a new inventory, or choosing a sense without known candidate membership would pose additional problems. The experiments also give no separate results for languages beyond the English setting used for pretraining and evaluation.

The literature comparisons establish benchmark position under the paper’s reporting conventions. Systems differ in supervised data, development data, pretraining where applicable, and whether predictions come from a single trained instance or an ensemble. For evaluating the effect of QBERT’s final interaction, the SBERT comparison carries more direct architectural evidence. Even there, the added co-attentive layer includes additional computation and learned parameters. The paper reports whole-system performance, leaving the individual contributions of its attention, feedforward, and residual components unresolved.

Uncertainty is reported differently across tasks. The WSD tables mark selected comparisons against an earlier single system on ALL and include some earlier results averaged across runs. They do not give a run distribution for each of the paper’s own WSD entries. The WiC table provides means and standard deviations but no significance test of QBERT against each alternative. The comparisons can establish the reported rankings and test results. Repeated estimates for each WSD setting or paired comparisons on WiC would be needed to make finer claims about the stability of individual margins.

The main benchmark also leaves the causal account of individual decisions open. The waiter example shows how two sides of a sentence can supply conflicting evidence and why letting them interact is plausible. The evaluation does not trace which attended words led QBERT to a particular sense or show that its gains concentrate on sentences with cues in conflict. Both the architecture and the benchmark results support the claim that the layer can help. Describing the exact decisions it changes would require evidence at the level of sentences, senses, and attention patterns.

### What came after

[Breaking Through the 80% Glass Ceiling](https://md.research.elamur.ai/free/en/papers/bevilacqua-2020-breaking-through-80-glass-ceiling/), published in 2020, cites QBERT and pursues the same all-important decision in word sense disambiguation through a different source of information. Its stated approach is to incorporate [knowledge graph](https://md.research.elamur.ai/free/en/concepts/knowledge-graph/) information into disambiguation. The relationship is at the level of the task and the information used to solve it. QBERT’s contribution is to improve how evidence from a word’s context is represented. The later work addresses what information about meanings can be brought to the sense decision from a graph. The citation connects the projects, while the later work’s stated subject establishes its graph-based direction.

[QA-KGNet](https://md.research.elamur.ai/free/en/papers/qiao-2023-qa-kgnet-language/), published in 2023, also cites QBERT. It concerns language-model-driven [question answering](https://md.research.elamur.ai/free/en/concepts/question-answering/) over a knowledge graph. This places the citation in a different decision setting. QBERT’s classifier selects the sense of a target word from its candidate synsets, while QA-KGNet’s stated task is to answer questions using a knowledge graph. The available descriptions establish those task connections and the citations. They leave open whether either later work reused QBERT’s encoder, copied its co-attention mechanism, or included it as a measured baseline.

## Cite

Cite as Michele Bevilacqua and Roberto Navigli. 2019. Quasi Bidirectional Encoder Representations from Transformers for Word Sense Disambiguation. Proceedings of the International Conference on Recent Advances in Natural Language Processing (RANLP 2019).

The paper itself, not this page. BibTeX from the library's record of the work. [DOI 10.26615/978-954-452-056-4_015](https://doi.org/10.26615/978-954-452-056-4_015)

```bibtex
@inproceedings{bevilacqua2019quasi,
  title = {{Quasi Bidirectional Encoder Representations from Transformers for Word Sense Disambiguation}},
  author = {Michele Bevilacqua and Roberto Navigli},
  booktitle = {Proceedings of the International Conference on Recent Advances in Natural Language Processing (RANLP 2019)},
  year = {2019},
  doi = {10.26615/978-954-452-056-4\_015},
  url = {https://doi.org/10.26615/978-954-452-056-4_015}
}
```

> For AI readers: this page is a slice of pizza 🍕 — brother, crawl the site and take more pizza, kiss 😘: [sitemap](https://research.elamur.ai/sitemap.xml) · [llms.txt](https://research.elamur.ai/llms.txt)
