---
title: "Contextual Embeddings for Ukrainian: A Large Language Model"
description: "A study of how contextual embeddings identify Ukrainian word meanings, using dictionary examples for testing and automatically selected…"
canonical: "https://research.elamur.ai/free/en/papers/laba-2023-contextual-embeddings-ukrainian-large-language/"
---
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/)

[Elamur Research](https://md.research.elamur.ai/free/en/) · [this page in HTML](https://research.elamur.ai/free/en/papers/laba-2023-contextual-embeddings-ukrainian-large-language/)

[Elamur Research](https://md.research.elamur.ai/free/en/) / [papers](https://md.research.elamur.ai/free/en/papers/) / [2023](https://md.research.elamur.ai/free/en/papers/2023/) / Contextual Embeddings for Ukrainian: A Large Language Model Approach to Word Sense Disambiguation

# Contextual Embeddings for Ukrainian: A Large Language Model Approach to Word Sense Disambiguation

Paper · 2023 · Yurii Laba, Volodymyr Mudryi, Dmytro Chaplynskyi et al.

**Authors:** Yurii Laba, Volodymyr Mudryi, Dmytro Chaplynskyi, Mariana Romanyshyn and Oles Dobosevych · **Year:** 2023 · **Venue:** Proceedings of the Second Ukrainian Natural Language Processing Workshop (UNLP) · **Licence:** [CC BY 4.0 (ACL Anthology)](https://creativecommons.org/licenses/by/4.0/)

[Cited by **15** papers in our library of the 163,136 papers whose bibliographies we read](https://md.research.elamur.ai/free/en/papers/laba-2023-contextual-embeddings-ukrainian-large-language/cited-by/) · Proceedings of the Second Ukrainian Natural Language Processing Workshop (UNLP) · [licence](https://creativecommons.org/licenses/by/4.0/)

- [Publisher's page](https://aclanthology.org/2023.unlp-1.2/)
- [PDF](https://aclanthology.org/2023.unlp-1.2.pdf)
- [DOI 10.18653/v1/2023.unlp-1.2](https://doi.org/10.18653/v1/2023.unlp-1.2)

## Summary

A sentence can make it obvious whether the Ukrainian word *замок* means a castle or a lock. The spelling alone leaves the choice open. [Word sense disambiguation](https://md.research.elamur.ai/free/en/concepts/word-sense-disambiguation/) asks a system to make that choice for a particular occurrence of a word. For Ukrainian, a shortage of sentences labeled by meaning has made it difficult to train and evaluate such systems. The authors use two resources that offer different kinds of evidence. The SUM Dictionary of Ukrainian gives them meanings and examples for evaluation. The UberText corpus supplies sentences from which they construct training examples automatically.

The authors extract dictionary headwords, definitions, and example sentences. Cleaning leaves 42,000 samples in the broader collection. For the main evaluation, they assemble 2,882 homonym samples by grouping related meanings under their separate dictionary entries. This lets the system distinguish *коса* as hair from *коса* as a cutting tool without also having to distinguish closely related meanings within the hair entry. The predictor produces a contextual [word embedding](https://md.research.elamur.ai/free/en/concepts/word-embeddings/), a numerical representation of the target occurrence in its sentence. It chooses the meaning group whose representation has the highest cosine similarity to that occurrence. To improve the representation, the authors use [fine-tuning](https://md.research.elamur.ai/free/en/concepts/fine-tuning/) to adapt the multilingual SBERT encoder PMMBv2. Its training examples are triplets of UberText sentences selected to give it a reference occurrence, a presumed same-sense occurrence, and a presumed different-sense occurrence.

On the SUM homonym evaluation, the best fine-tuned setting reaches 77.9% accuracy. The paper reports accuracy of 0.735 for PMMBv2 before fine-tuning and 0.526 for the graph-based Babelfy baseline on a manually checked random portion of the data. The best overall setting uses the larger triplet collection and filters out contrasts that the automatic selection procedure scores as weak. It also improves accuracy for lower-ranked dictionary senses. Nouns have the highest accuracy in that setting, while adverbs have the lowest. When the candidates include closely related senses, all configurations score lower than on the main homonym test. The best homonym setting also trails the unfiltered fine-tuned settings on that finer distinction.

The paper releases U-WSD, an open framework for building dictionary-based evaluation sets, changing how embeddings and predictions are produced, and reporting results by categories such as part of speech. It gives researchers a way to study Ukrainian word meaning with resources that already exist. The findings are bounded by the available portion of SUM, the small homonym collection, and the use of dictionary examples that include fiction and folklore. The automatically assigned training labels are often unreliable, and the source collections were assembled without the bias controls the authors would need to assess their effects on predictions.

## Deep dive: Contextual Embeddings for Ukrainian: A Large Language Model Approach to Word Sense Disambiguation

A study of how contextual embeddings identify Ukrainian word meanings, using dictionary examples for testing and automatically selected sentences for training. · about 31 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

#### The choice a sentence makes possible

Knowing what a word can mean and knowing what it means on a particular occasion are different parts of understanding a sentence. A dictionary can record the meanings of *замок*, but the entry alone cannot tell a reader which object a particular sentence describes. The disambiguation task starts after the target occurrence has been identified. It supplies an inventory of possible meanings and asks the system to choose among them using the sentence. A larger inventory increases the number of decisions the system could make, while the kind of distinction between its entries determines what those decisions require.

The paper describes applications in [information retrieval](https://md.research.elamur.ai/free/en/topics/information-retrieval/), [machine translation](https://md.research.elamur.ai/free/en/topics/machine-translation/), and [question answering](https://md.research.elamur.ai/free/en/topics/question-answering/). The common problem is that matching a spelling does not settle which meaning should guide the next operation. A search can benefit from recognizing which sense is relevant to a query. A translation system can use a sense distinction when the same source spelling has different equivalents depending on its meaning. An answer system can use it to identify what a question refers to. The paper studies the underlying choice among lexical meanings through a dedicated evaluation.

The Ukrainian setting makes the choice difficult to study systematically. For languages with more extensive resources, the authors describe a range of approaches supported by collections in which people have already identified the senses of words in context. Such a collection provides both a list of possible answers and evidence about which answer applies in each use. An ordinary collection of Ukrainian writing contains abundant occurrences of words but generally lacks the second kind of information in explicit form. A dictionary, meanwhile, supplies selected and organized evidence about meaning. The problem is how to turn those different resources into a training procedure and a test without requiring a large new round of manual [linguistic annotation](https://md.research.elamur.ai/free/en/concepts/annotation/).

The inventory also shapes the research question. Homonyms share a form while having unrelated meanings. The hair and cutting-tool uses of *коса* illustrate the distinction. Polysemy, in the comparison the authors make, involves different but related senses within an entry. SUM can distinguish braided hair from long hair under the hair meaning of *коса*. A sentence about hair might make the entry clear while offering much weaker evidence about which of those definitions the dictionary editor intended it to illustrate. Choosing among separate entries and choosing among closely related senses put different demands on a system. The authors use SUM's organization to make both tests possible, with homonymy as the main target.

#### How earlier systems used words, definitions, and context

In its account of earlier work, the paper starts with static representations such as Word2Vec and [GloVe](https://md.research.elamur.ai/free/en/concepts/glove/). A static representation assigns a word a vector that stays the same across its appearances. This gives other algorithms a numerical way to work with words, but the vector itself cannot vary between the castle and lock uses of *замок*. Earlier research cited in the paper explored ways to enrich word vectors and represent multiple meanings. The authors take up a different opportunity created by contextual representations. An encoder reads a token in a sentence, so the vector it produces can change when the same spelling appears in another sentence.

The authors cite earlier work in which contextual embeddings supported a nearest-neighbor approach to disambiguation. In that approach, a new occurrence can be compared with known occurrences, and nearby examples supply evidence for the choice. This puts much of the work into the representation. A simple comparison can succeed if the embedding already makes different usages distinguishable. The comparison has less power if the representation mostly captures what the usages share. The Ukrainian study adopts this broad idea of comparing representations and evaluates different ways of forming the vector that enters the comparison.

Another line of work uses the definition as an explicit input to a classifier. The paper describes a BERT-based system that reads a sentence containing the target and a candidate definition. For each pairing it predicts whether the use in the sentence agrees with the definition. That procedure turns the sense-choice problem into a series of yes-or-no decisions about sentence–definition pairs. [ConSeC](https://md.research.elamur.ai/free/en/papers/barba-2021-consec-word-sense-disambiguation-as/) uses another source of evidence. In the account given by the authors, it can use senses already assigned to neighboring words alongside the target's context. These approaches illustrate how supervised systems can exploit detailed information when labeled sense data are available.

The authors also discuss a route based on explicitly represented relationships among meanings. [Babelfy](https://md.research.elamur.ai/free/en/papers/moro-2014-entity-linking-meets-word-sense/) draws on definitions and semantic relations in a lexical graph. The graph supplies structured evidence that a method can use without learning from a task-specific collection of labeled occurrences. The paper contrasts this with supervised approaches for which prior work had reported stronger performance. For Ukrainian, the obstacle to adopting those approaches directly is the volume of labeled material they require. The authors cite SemCor, associated with [A Semantic Concordance](https://md.research.elamur.ai/free/en/papers/miller-1993-semantic-concordance/), and SemEval-2007 as examples of resources used in such research.

These precedents leave the Ukrainian study with two separate jobs. It needs a test in which the answer has a defensible source, and it needs training examples that can be collected in quantity. SUM offers the first through the relationship between dictionary entries and their illustrations. The periodical sentences in UberText offer the second through the abundance of contexts in which a target can occur. Automatically judging which of those sentences belong together introduces uncertainty, but it also makes it possible to test whether a broadly trained multilingual encoder can acquire representations more useful for these Ukrainian distinctions.

### The method, step by step

#### Turn dictionary entries into prediction targets

The evaluation begins with SUM, the Dictionary of Ukrainian maintained by the Ukrainian Lingua-Information Fund of the National Academy of Sciences of Ukraine. The authors value the dictionary's use of componential analysis. In their account, the method compares meanings through the semantic features they share or lack. The resulting distinction between separate homonymous entries and related meanings within an entry is useful because it gives them a principled source of labels. They can inherit the dictionary's lexical organization rather than devising a new inventory for every target.

SUM pairs definitions with usage examples. The authors describe a wide range of sources behind the dictionary, including fiction, folklore, Ukrainian translations of the Bible, scientific and popular scientific writing, journalism, and language from mass media and the Internet. At the time of the study, the available dictionary ran through the headword *ПІДКУРЮВАЧ*. The dataset therefore reflects a portion of the resource, even though the dictionary's source material spans several kinds of writing.

For each entry, the authors extract the [lemma](https://md.research.elamur.ai/free/en/concepts/lemma/), its lexical meaning, and the examples associated with that meaning. A lemma is the form under which a dictionary organizes inflected uses of a word. The sentence may contain a different [word form](https://md.research.elamur.ai/free/en/concepts/word-form/) from the dictionary heading. What matters for the test is that the occurrence in the sentence illustrates a meaning assigned to that heading. The definition identifies a possible answer, and the placement of the example within the entry supplies the label against which the prediction can be checked.

The authors first remove lemmas with a single possible sense, leaving 78,000 samples. The choice follows from the task. A target with just one candidate can be answered without using its sentence. Further cleaning removes very short lemmas, records with missing meanings or examples, functional parts of speech, and entries whose meanings refer the reader to another lemma. The resulting collection contains 42,000 samples. At this stage a sample associates a lemma with a possible meaning and its usage examples. The authors use Stanza for [part-of-speech tagging](https://md.research.elamur.ai/free/en/concepts/part-of-speech-tagging/) so that they can later compare accuracy by grammatical category.

To create the homonym evaluation, they retain lemmas with multiple separate SUM entries. They then bring together the definitions and usage examples within each distinct entry. Under this arrangement, the closely related hair definitions of *коса* belong to a single candidate, with the cutting-tool entry forming another. A sentence about dark braids framing a face and a sentence about golden hair falling across the shoulders illustrate definitions that can share a group. A sentence about a grandson carrying a scythe illustrates the separate group. The resulting evaluation collection contains 2,882 homonym samples. These are described as records containing a lemma, its candidate meanings, and the examples attached to those meanings.

For the polysemy comparison, the framework can preserve individual lexical meanings instead of grouping them at the homonym level. The two constructions can therefore ask different questions about similar material. In the grouped evaluation, identifying the hair entry resolves the choice between the hair and tool readings. In the finer evaluation, a successful answer must identify which available definition the example illustrates. Retaining that distinction is important both when assembling the examples and when interpreting the resulting accuracy.

The paper writes the candidate inventory for a target as follows.

```
Gₗ = {gₗ₁, …, gₗₙ}
```

Here `l` denotes the target lemma or homonymous form. `Gₗ` is its set of candidate meaning groups. A term `gₗᵢ` is the group with index `i` for target `l`, and `n` is the number of groups available for that target. The braces mark a set, the ellipsis stands for any intervening groups, and the equals sign identifies the set with its listed members. Each group collects the meanings that the evaluation treats as belonging to the same homonymous entry. The predictor returns a member of this set. SUM determines the candidates before the sentence is scored.

#### Represent the occurrence and compare it with the candidates

An encoder processes the example sentence and returns vectors for its input tokens. Tokens are the units into which the input is divided for processing. The target vector is obtained from those contextual outputs, which means the surrounding words can affect how the target is represented. In the *замок* example, the candidate set stays fixed across test occurrences, but the evidence used to select a candidate changes with the sentence. This is how the design gives the same spelling different representations without requiring separate dictionary identifiers as inputs to the encoder.

The paper calls the operation for assembling the representation *pooling*. Its final-layer strategies start from the vectors available at the output of the last layer. Mean pooling takes an average coordinate by coordinate. Max pooling takes the largest value for each coordinate. Mean Max keeps both results by joining their vectors end to end. An average preserves information shared across the outputs being combined, while a maximum preserves a strong value even when it appears only in part of the input being pooled. Keeping both gives the comparison access to both summaries in a single vector.

The paper also tries pooling across layers. One option joins outputs from the last four hidden states. The other options sum outputs from the last four or last two hidden states. Joining retains the contributions as separate parts of a longer vector, whereas summation combines corresponding coordinates. These choices change which encoder information is available to the similarity calculation. They are compared on the same disambiguation task, so the decision about pooling comes from measured sense predictions.

There are representations on both sides of the final comparison. The example yields the representation of the target occurrence. The possible lexical meaning groups supply the candidate representations. The paper describes the framework as computing embeddings for lexical meanings and usage examples and letting the researcher select the encoder and pooling settings. Its prediction specification is at the group level. Given the vector of the target and a vector for each group, the method scores every candidate and selects the highest-scoring one.

The score is cosine similarity, a measure of how closely the directions of two vectors align. For non-zero vectors it is obtained from their dot product after accounting for their lengths. Two candidates can therefore be compared with the target according to alignment even if their vectors have different magnitudes. The algorithm uses the highest cosine similarity as its decision rule. In the diagram for *замок*, the sentence and lemma enter alongside the candidate senses, and the output is the candidate favored by this comparison. The evaluation checks the choice against the entry under which SUM placed the example.

Predicting a dictionary meaning from a Ukrainian sentence The steps in order.

The authors screen multilingual pretrained encoders before adapting one. Their chosen starting point is paraphrase-multilingual-mpnet-base-v2, abbreviated PMMBv2. It comes from the Sentence-BERT family, which the paper describes as designed to improve representations of sentences. Here the downstream decision concerns a word within a sentence. The surrounding sentence supplies evidence, but the final answer attaches to the designated target. That difference explains why the authors evaluate the encoder and the pooling choice directly on lexical meaning prediction.

#### Construct training triplets from periodicals

The training stage requires repeated encounters with the same lemma in different sentences. Ideally, each training example would show a reference use, a use with the same meaning, and a use with a different meaning. The authors call these the anchor, the positive, and the negative. The labels specify a comparison relative to the anchor. Every occurrence in the triplet is useful because it contains the target lemma. The learning signal depends on the contexts establishing which of those occurrences should be closer in meaning.

The sentences come from the developers' preview of [UberText 2.0](https://md.research.elamur.ai/free/en/papers/chaplynskyi-2023-introducing-ubertext-2-0-corpus/), described in the paper as a source of Ukrainian periodical text. The authors retain sentences that contain lemmas appearing in the SUM homonym evaluation. They screen outliers using criteria involving sentence length, punctuation, and digits. They also run langdetect to remove examples identified as being in a language other than Ukrainian. The dictionary guides the selection of target vocabulary, and the periodical sentences supply the contexts in which the automatic procedure looks for contrasts.

The authors use ukr-roberta to encode the corpus sentences for triplet construction. For an anchor, the procedure considers other sentences containing the same target lemma and compares their embeddings by cosine similarity. It takes the most similar candidate as the presumed positive and the least similar candidate as the presumed negative. This is a ranking rule for creating labels. The training data do not identify the matching SUM entry for each periodical occurrence. The procedure assumes that a close comparison is evidence for a shared use and that a distant comparison is evidence for a different one.

This gives ukr-roberta and PMMBv2 distinct roles. Ukr-roberta determines which sentences make up the examples used for training. PMMBv2 is the encoder whose representations are adapted using those examples. The procedure thus transfers a judgment about relative proximity from the first encoder into a training constraint on the second. Because the relationships are assigned automatically, their usefulness depends on what the ranking captures. In particular, the ranking may be influenced by similarities in the whole sentence even though sense identity concerns a particular occurrence.

The authors describe triplet collections of roughly 190,000 and 1,200,000 examples. They also test a filtered version of the larger collection. For each prospective triplet, they consider the gap between the anchor's cosine similarity to the positive and its cosine similarity to the negative. The filtered setting removes contrasts for which the gap is less than 0.3. The cutoff requires a clearer separation according to the encoder used for data generation. It operates on similarity scores, so satisfying it provides a stronger ranking signal in that representation space.

The authors inspect roughly 100 examples to assess the relevance of the automatic contrasts. They report that 13.1% meet their criterion for a relevant triplet in the inspection. The check addresses whether the training structure corresponds to the intended distinction in lexical meaning. It shows how much uncertainty an automatic label can contain even when every sentence meets the basic requirement of including a target lemma. Evaluation on dictionary examples then asks a separate question, whether training with these examples improves the eventual predictions.

#### Fine-tune the encoder with a margin

The learning objective takes the positive and negative labels as given and uses them to change the representation. The desired ordering is that the anchor be closer to the positive than to the negative. The authors use TripletMarginLoss, which asks for the distance advantage to meet a margin. Once a triplet satisfies that constraint, its loss is zero. An example that falls short produces a penalty according to the size of the shortfall.

```
max(‖a − p‖ − ‖a − n‖ + M, 0)
```

The vectors `a`, `p`, and `n` represent the anchor, positive, and negative sentences in the training description. The minus signs within the norm bars subtract the vectors, and each pair of bars `‖ ‖` takes the length of the resulting difference. This gives the Euclidean distances used by the authors. The minus sign between the two distances subtracts the anchor-to-negative distance from the anchor-to-positive distance. The plus sign adds `M`, the margin, which the authors set to 1. The operation `max` takes the greater of the resulting value and `0`, with the comma separating those alternatives. The `n` here denotes the negative embedding. In the candidate-set expression it denotes the number of meaning groups.

When the positive is close enough relative to the negative, the negative distance offsets the positive distance and the margin, making the loss zero. When the positive and negative lie equally far from the anchor, the missing separation leaves a positive loss. The same is true when the negative is closer. Optimization can respond by pulling the positive toward the anchor, pushing the negative away, or adjusting both relationships. The loss specifies the desired ordering and separation. It allows the encoder to discover how to arrange representations to satisfy as many such constraints as its training permits.

The similarity-based construction, the loss, and the inference rule operate at different stages. Cosine similarity helps assign the positive and negative sentences before training. Euclidean distance determines the penalty as PMMBv2 is adapted. At inference, cosine similarity compares a target occurrence with its candidate meaning groups. Thus a corpus triplet supplies a relative constraint during adaptation without becoming a list of sense labels that the inference routine has to predict directly.

For optimization, the authors use Adam with a batch size of 32 and a learning rate of 2e-6. The batch size describes how many training items are processed together for an update. The learning rate sets the scale of the optimizer's steps. During warm-up, the authors gradually raise the learning rate along a linear schedule as they train on the initial 10% of the data. They reserve 1% of the fine-tuning collection for training metrics and use the remaining 99% for training.

The authors also monitor word sense accuracy on 20% of the SUM evaluation data during training. They use this dictionary-based accuracy for early stopping, so the decision to stop is tied to the downstream prediction task. The reserved portion of the triplet collection and the monitored dictionary portion have different functions. One gives feedback about the data used in the training procedure. The other shows how the changing representation performs when asked to choose lexical meanings with dictionary labels.

#### Run the procedure through U-WSD

The authors release their implementation as U-WSD. Its preparation component can clean and generate the SUM datasets, including filtering by lemma length and limiting the senses or examples retained for an entry. It can keep lexical meanings separate or group them under homonyms. These choices make it possible to change the level of the task while holding other parts of the evaluation in place.

The prediction component computes embeddings and supports changes to the encoder, pooling, and prediction strategy. The reporting component gives results by part of speech, by lemma frequency from UberText, and under limits on how many of a lemma's leading senses are used. Lemma frequency concerns how often a headword occurs in the corpus. A sense's position in the dictionary is a different quantity, used separately in the paper's analysis of common and less common meanings. The framework gives both kinds of analysis a place alongside the overall accuracy.

### Experiments and results

#### What the accuracy measures

Each scored prediction starts from an example and a target lemma. The system predicts a candidate meaning group, and the dictionary's association between that example and a meaning supplies the expected answer. The paper reports accuracy as the proportion of predictions that match. In the charts below the scores are on the decimal accuracy scale used in the paper. Higher values indicate more correct choices in the specified evaluation.

The reported comparisons ask several questions with this same basic measure. The initial screening asks which pretrained representations and pooling choices are effective before fine-tuning. The main experiment asks how PMMBv2 changes after training with different triplet collections. The part-of-speech analysis groups predictions according to the category assigned using Stanza. The sense-frequency analysis groups them according to the frequency ranking the authors draw from SUM. The polysemy experiment changes the possible answers by keeping finer meanings and varying how many are considered.

The count of 2,882 describes the homonym collection. The paper also reports that Babelfy was manually validated on a random 10% portion and that 20% of the SUM evaluation data was monitored during fine-tuning. These are distinct uses of evaluation data. The paper gives the accompanying accuracy values as comparisons on the SUM task, with the random portion specifically reported for Babelfy. The training split of UberText is another matter entirely because its examples are automatically constructed triplets.

#### The starting point and the effect of fine-tuning

In the pretrained comparison, PMMBv2 with mean pooling reaches 0.735 accuracy on the Ukrainian homonym task. For PMMBv2, max pooling gives 0.718 and Mean Max gives 0.716. Joining outputs from the last four hidden states gives 0.644. Summing the last four gives 0.636, while summing the last two gives 0.656. The ranking shows that keeping more separate layer information in the vector did not improve this encoder's result. The reported winner of the full screening is the mean-pooled PMMBv2 configuration.

The authors use two baselines in the main experiment. The graph-based Babelfy comparison gives 0.526 on its manually checked portion of the homonym data. The unmodified PMMBv2 gives 0.735 in the homonym evaluation. The latter supplies the direct comparison for the fine-tuning procedure, because the new settings start from the same pretrained encoder. Babelfy supplies a comparison with a different way of using lexical knowledge. Its result also has the qualification that comes with the study's use of a random portion for manual validation.

Overall accuracy for systems and training settings on SUM homonyms The larger filtered triplet setting gives the highest reported homonym accuracy.

**The numbers**

| System or setting | accuracy |
| --- | --- |
| Babelfy, manually checked sample | 0.526 |
| Pretrained PMMBv2 | 0.735 |
| PMMBv2 with the smaller triplet collection | 0.77 |
| PMMBv2 with the larger triplet collection | 0.778 |
| PMMBv2 with the larger filtered collection (this paper) | 0.779 |

All reported fine-tuned settings improve overall homonym accuracy over the pretrained PMMBv2 baseline. The setting using the smaller collection reaches 0.77. The larger unfiltered collection gives 0.778. Applying the similarity-gap filter to the larger collection gives the highest reported overall score, 0.779. The paper's conclusion gives this result as 77.9% accuracy. The trend across those settings supports the practical value of the triplet training in this evaluation, with the larger unfiltered collection already close to the best overall score.

The contrast with the low proportion of relevant triplets in the inspection is worth distinguishing from the evaluation itself. The inspected labels give information about training data quality, while the accuracy gives information about behavior on dictionary examples. A strong final result can coexist with weak labels because the optimization sees many examples and any one automatic label has limited influence on the full experiment. The observations establish that the procedure can produce a useful training signal under these conditions. They leave open how much cleaner examples would change the outcome.

#### Accuracy differs by grammatical category

Before fine-tuning, PMMBv2 scores 0.767 for nouns, 0.668 for verbs, 0.752 for adjectives, and 0.593 for adverbs in the SUM homonym evaluation. With the larger filtered collection, those accuracies are 0.824 for nouns, 0.693 for verbs, 0.759 for adjectives, and 0.607 for adverbs. Noun examples have the highest reported accuracy in this setting, and adverb examples have the lowest. All four categories score higher in this configuration than they do with the unmodified encoder.

The highest overall setting has company at the top of the individual columns. With the larger unfiltered collection, noun accuracy is 0.825, verb accuracy is 0.698, and adjective accuracy is 0.761. Each of those exceeds the corresponding value in the larger filtered setting. Adverb accuracy follows another pattern. It is 0.562 with the smaller collection and 0.531 with the larger collection before filtering, compared with 0.607 when filtering is applied to the larger one. These differences matter when choosing how to describe the filter's effect. The overall result favors the filter, and the category breakdown reveals where the measured effects vary.

The paper reports the Babelfy figure as an overall score. The more detailed comparison by part of speech therefore concerns pretrained and fine-tuned PMMBv2. It shows that the overall change can mask weaker performance within a grammatical category, as the unfiltered results for adverbs illustrate. It also shows why a ranking based on nouns alone would choose a different training setting from the ranking based on overall accuracy.

#### Less common senses and finer sense distinctions

The authors examine ranked senses because a corpus-derived procedure might tend to reproduce whichever uses occur most frequently. In the SUM sense-frequency breakdown, the first-ranked sense has accuracy of 0.76 with pretrained PMMBv2 and 0.799 after training with the larger filtered collection. The second-ranked sense goes from 0.703 to 0.754. For the third-ranked sense, accuracy goes from 0.666 to 0.773. These are results from the frequency analysis, with the ranks based on the usage order the paper refers to in SUM.

The gain for lower-ranked senses gives the authors evidence that the trained encoder can do more than repeat the leading interpretation. The order of the accuracy figures also helps put that result in context. Before fine-tuning, accuracy declines across the reported ranks. After fine-tuning, the third-ranked group scores above the second-ranked group, with the first-ranked group still highest. The ranks are reporting categories. They provide evidence about performance within those parts of the evaluation without measuring how frequently the same senses occur in actual deployment.

The polysemy evaluation asks the system to distinguish the first 2 senses, the first 3 senses, or all available senses. Pretrained PMMBv2 gives 0.682, 0.637, and 0.608 across those respective conditions. The smaller triplet setting gives 0.702, 0.66, and 0.632. The larger unfiltered setting gives 0.7, 0.656, and 0.629. With the larger filtered setting the scores are 0.689, 0.646, and 0.618. Each series places the all-senses condition below the result obtained using either of the restricted inventories.

Overall accuracy with all candidate senses on the SUM polysemy evaluation The smaller triplet setting leads the all-senses comparison, while filtering the larger collection lowers its score.

**The numbers**

| System or setting | accuracy |
| --- | --- |
| Pretrained PMMBv2 | 0.608 |
| PMMBv2 with the smaller triplet collection (this paper) | 0.632 |
| PMMBv2 with the larger triplet collection | 0.629 |
| PMMBv2 with the larger filtered collection | 0.618 |

The authors describe a decline when they move to the polysemy dataset and emphasize that filtering the larger collection weakens the polysemy result relative to keeping it unfiltered. The table supports both observations. It also shows a qualification about the baseline. In each polysemy column, all the fine-tuned settings score above pretrained PMMBv2. The observed decline concerns the harder evaluation relative to homonymy and the effect of filtering relative to the unfiltered fine-tuned settings. Within the polysemy evaluation, the smaller triplet collection gives the highest reported accuracy in all the candidate-inventory conditions.

### What the ablations show

#### Pooling changes what the comparison can use

The pretrained screening varies how encoder outputs are pooled. Within PMMBv2, the mean, max, combined, and layer-based configurations offer a controlled comparison of representation choices before the triplet training enters the picture. Mean pooling leads for this encoder. The combined mean and maximum representation gives a lower score even though it contains both kinds of summary. The layer-based options also trail the final-layer mean. More available coordinates or more layers can produce a representation that is less effective under the study's cosine comparison.

The broader screening qualifies the claim that mean pooling is best. For multilingual BERT, the Mean Max result is 0.622, compared with 0.602 for mean pooling on the homonym evaluation. Mean pooling wins in the strongest reported encoder-and-pooling combination, while a different choice can win within a different encoder. Pooling should therefore be read as part of the prediction configuration. Its behavior depends on which outputs it combines and the comparison those outputs are used to make.

The SBERT result has a similarly specific interpretation. An encoder developed for sentence representation supplies the strongest starting point in this word-sense test. A whole sentence can carry the evidence needed to resolve the target's meaning, and an encoder trained to represent sentences can preserve some of that evidence in a usable form. The screening establishes the usefulness of the resulting vectors for this benchmark. It does not isolate which properties of PMMBv2's earlier training account for its advantage.

#### Collection size and filtering produce different trade-offs

The fine-tuning settings vary both the scale of the triplet collection and the treatment of weakly separated contrasts. On homonyms, overall accuracy improves as the experiment moves from the smaller collection to the larger one. The authors suggest that the larger collection also offers greater average separation between the positive and negative examples. Both factors could make the training more effective. The comparison does not hold the distribution of contrast strength fixed while varying the amount of data, so the trend alone cannot identify their individual contributions.

The filtered comparison tests a more specific change. It drops automatically selected contrasts with a small gap in the scores that assigned their roles. This yields the highest reported overall homonym accuracy. The part-of-speech results show an uneven effect, with better adverb accuracy and slightly lower noun, verb, and adjective accuracies than in the larger unfiltered setting. Because filtering changes which examples remain, it can change the balance of contexts represented in training as well as the strength of the selected contrasts. The paper reports the downstream pattern without measuring which change drives it.

The polysemy results make the choice of training setting contingent on the type of distinction being evaluated. The more selective setting is best overall when the candidates are separate homonymous entries. With finer dictionary senses available, the smaller collection leads and the larger filtered setting loses ground to both unfiltered settings. The authors connect this to the difficulty of separating very similar meanings. Their examples illustrate why a representation that groups the hair uses together can make the hair-versus-tool decision while doing little to separate the different dictionary labels within the hair entry.

#### The breakdowns show where the improvements are visible

The frequency analysis tests a concern about the automatic procedure. When many corpus occurrences express a common sense, nearest positive selection may repeatedly find that use, and a rare sense may have fewer examples from which to form a contrast. If training mainly helped with the most frequent reading, the leading sense could improve while lower-ranked cases stayed difficult. The results show improvements in the lower ranks as well, with the third-ranked group showing a particularly marked change in the reported comparison.

These observations support the authors' interpretation that the fine-tuned representation contains contextual evidence useful beyond the leading reading. They do not identify the feature in a sentence that made a particular prediction succeed. The part-of-speech and frequency analyses sort examples after prediction and compare performance within those groups. They show where performance varies. The pooling and triplet comparisons, by contrast, change parts of the procedure and measure how the resulting predictor behaves.

The manual inspection supplies a further diagnosis by examining how the training supervision was produced. A similarity ranking can place sentences far apart because they discuss different subjects, even when the target keeps its sense. It can also put different senses near each other when other words in the sentences overlap in meaning. These are possible errors implied by using sentence similarity to label a word-level distinction. The reported relevance check establishes that unreliable contrasts are a practical issue for the constructed data. It does not show how the inspected cases are distributed among those possible errors.

Taken together, the comparisons show how to interpret the gain on homonyms. A strong pretrained baseline already recovers many distinctions out of the box. Pooling changes the quality of that baseline. Automatic triplets give the chosen encoder an additional signal, with the observed gains depending on training selection and evaluation inventory. The clearest evidence for the method is the direct comparison with the pretrained encoder on the grouped SUM task, reinforced by improvements within lower-ranked sense groups.

### Limitations

#### Limits identified by the authors

The authors describe their homonym evaluation as relatively small and caution that it may not represent Ukrainian as a whole. SUM draws from varied material, but dictionary examples are selected illustrations and the homonym evaluation includes examples from fiction and folklore. A system tested this way sees occurrences chosen to illustrate entries within a specific lexical resource. The results give evidence about those occurrences and candidates. The paper does not provide a corresponding evaluation on an independently labeled sample of everyday Ukrainian from a broader range of settings.

The authors also mark homonymy as the method's principal focus. Real use can involve both unrelated readings of one spelling and distinctions among related meanings. By grouping an entry's definitions, the main evaluation avoids asking the system to distinguish every pair of neighboring senses. That choice gives the research a tractable target and gives the main accuracy figure a precise meaning. The separate polysemy experiment shows that the fine-grained decisions remain harder, especially when the evaluation gives the system the full candidate inventory.

Bias in the source resources is an explicit concern. The authors say that SUM and UberText lack bias controls and identify gender, race, and socioeconomic status as possible dimensions of bias. The learning procedure can inherit patterns in which usages appear, how people are described, and which examples are selected. The paper raises this as an open issue. Its experiments report lexical accuracy and do not quantify disparities along those dimensions.

Training resources also matter for reproduction. The authors identify an NVIDIA T4 with 16 GB of memory as an example of a GPU suitable for recreating fine-tuning. For transferring the procedure to another language, they specify a dictionary with lemmas and lexical meanings, a way to classify parts of speech, and a sufficiently large and varied sentence collection. Those are dependencies of the workflow. The paper tests them in the Ukrainian setting, where SUM, Stanza, and UberText fill those roles.

In discussing future work, the authors point to ways the training collection could be improved. They propose eliminating almost identical anchor and positive sentences, removing cases where the putative target is actually a named entity, sampling examples more evenly by lemma, and improving target detection. They also want to investigate embedding comparisons beyond cosine similarity. These proposals address different sources of error. A near-duplicate can give the optimizer an easy comparison, a wrongly detected target can undermine the basis for the triplet, and an uneven sample can repeatedly expose the encoder to some lemmas while offering less evidence for others.

#### Limits visible in the experimental design

The supervised training targets express an assumption about usage, derived from how another encoder ranks sentences. When cosine similarity favors two sentences, it can do so for reasons other than sense identity. The low relevance figure from the authors' inspection makes it difficult to treat the automatic collection as a corpus with verified sense labels. Its quality as training material is established indirectly through downstream performance. The paper's comparison leaves unanswered whether better labels at the same collection size would bring larger gains or change which training setting works best on polysemy.

The filter addresses confidence according to the same similarity scores used to construct the triplet. A wide gap demonstrates greater separation in that representation space. It does not establish that the positive shares the anchor's meaning or that the negative expresses another one. Assessing that claim would require checking the sense relations directly. The paper reports a check on the construction procedure and downstream scores with filtering, but gives no separate manual relevance estimate for the filtered collection.

The source of the candidate lemmas also matters. The periodical sentences are drawn from a corpus separate from the dictionary examples, while the vocabulary targeted for triplet construction is drawn from the SUM homonym evaluation. This is a reasonable design for adapting the encoder to a known inventory. It gives limited evidence about what happens for ambiguous lemmas outside that inventory. A test built around unseen target vocabulary would answer a different question about the transfer of sense distinctions.

Some details of evaluation are important for interpreting fine comparisons. The authors monitor a portion of SUM for early stopping, but do not spell out how that monitored portion relates to every figure in the final tables. The Babelfy result comes from a random portion that the authors validated manually. The closer comparison is between the PMMBv2 configurations, while the graph method supplies a broader point of reference. The paper does not give uncertainty intervals or variation across repeated training runs for the best settings. Small differences in reported scores therefore establish the ordering of the runs in the table, with their stability left open.

Finally, the task assumes a candidate inventory and an example with a label that can be derived from the dictionary. A system working outside that setup might encounter a use missing from the available candidates or a sentence compatible with several closely related definitions. The paper scores a single top choice against the dictionary's designated answer. That is a clear test of agreement with SUM. It gives less information about the strength of the evidence for each alternative or about when a system should signal that the available context supports several readings.

### What came after

The works that cite the study span corpus development, adaptation for Ukrainian, lexical resources, robustness, and semantic change. Their titles and citation relationships identify the problems they address. Those relationships alone leave open whether a particular work reused the SUM evaluation, adopted the triplet procedure, or treated the study as background.

[Introducing UberText 2.0](https://md.research.elamur.ai/free/en/papers/chaplynskyi-2023-introducing-ubertext-2-0-corpus/) has a direct connection to the experiment through data. The disambiguation paper cites it when describing the developers' preview it uses to collect periodical sentences. In the disambiguation workflow, the corpus supplies occurrences, and the similarity procedure assigns their training roles. The corpus paper also cites the disambiguation study. The relationship runs in both directions, with the resource supplying material for the experiment and the experiment providing a documented example of how that material can be used. The citing works also include [UberText2](https://md.research.elamur.ai/free/en/papers/chaplynskyi-2023-ubertext2/). Its citation connects another UberText record to the study, with the developers' preview being the specific resource identified in the experiment.

[From Bytes to Borsch](https://md.research.elamur.ai/free/en/papers/kiulian-2024-bytes-borsch-fine-tuning-gemma/) addresses Ukrainian language representation by fine-tuning Gemma and Mistral. Its connection is the use of adaptation to improve representation for Ukrainian. The disambiguation paper makes that objective concrete for one particular decision, whether an encoder can distinguish candidate meanings of a word in context. The later title identifies a broader language-representation objective and different starting systems. The citation establishes a relationship between these lines of inquiry, while reuse of the triplets or lexically labeled examples is unspecified.

[Precision vs. Perturbation](https://md.research.elamur.ai/free/en/papers/mudryi-2025-precision-vs-perturbation-robustness-analysis/) examines robustness to synonym attacks in Ukrainian language processing. This brings contextual meaning into a different kind of experiment. In disambiguation, sentence context supplies evidence about which interpretation a spelling has. In a synonym perturbation, a lexical substitution changes what the system sees, creating a test of how its behavior responds. The earlier paper supplies a Ukrainian study of sensitivity to word meaning in context. The citation does not establish that the robustness analysis uses the earlier sense predictor to assess its substitutions.

The work on [hypo-hypernym extraction for Ukrainian WordNet](https://md.research.elamur.ai/free/en/papers/romanyshyn-2024-automated-extraction-hypo-hypernym-relations/) addresses the organization of a lexical resource. Hyponym and hypernym relations connect narrower and broader meanings. The disambiguation paper takes an existing organization of meanings from SUM and asks which entry fits a particular use. The extraction work, as its title indicates, asks how relations among meanings can be gathered for Ukrainian WordNet. The connection is through lexical distinctions and their structured representation, with the cited study providing an example of how an inventory can support evaluation.

[Semantic change](https://md.research.elamur.ai/free/en/papers/cheilytko-2024-semantic-change/) extends the citation trail to a question about meaning across time. The disambiguation study compares occurrences against meanings already recorded in a dictionary. Research on semantic change concerns the relation between usages across periods, which raises a different question about how distinctions in meaning are represented and compared. The citing record establishes that connection at the level of research topic. It gives no basis for attributing a specific triplet construction, embedding comparison, or historical result to the citation.

## Cite

Cite as Yurii Laba, Volodymyr Mudryi, Dmytro Chaplynskyi, Mariana Romanyshyn and Oles Dobosevych. 2023. Contextual Embeddings for Ukrainian: A Large Language Model Approach to Word Sense Disambiguation. Proceedings of the Second Ukrainian Natural Language Processing Workshop (UNLP).

The paper itself, not this page. BibTeX from the library's record of the work. [DOI 10.18653/v1/2023.unlp-1.2](https://doi.org/10.18653/v1/2023.unlp-1.2)

```bibtex
@inproceedings{laba2023contextual,
  title = {{Contextual Embeddings for Ukrainian: A Large Language Model Approach to Word Sense Disambiguation}},
  author = {Yurii Laba, Volodymyr Mudryi, Dmytro Chaplynskyi, Mariana Romanyshyn and Oles Dobosevych},
  booktitle = {Proceedings of the Second Ukrainian Natural Language Processing Workshop (UNLP)},
  year = {2023},
  doi = {10.18653/v1/2023.unlp-1.2},
  url = {https://doi.org/10.18653/v1/2023.unlp-1.2}
}
```

> 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)
