Elamur Research

N-gram and Neural Models for Uralic Language Identification: NRC at VarDial 2021

Paper · 2021 · Gabriel Bernier-Colborne, Serge Leger and Cyril Goutte

Summary

A short passage can contain enough evidence to identify its language, even when it shares much of its spelling and vocabulary with another variety. The harder case is a collection where the languages of interest are scarce and most passages come from elsewhere. At VarDial 2021, the Uralic language identification task asked systems to identify the main language of a short text drawn from 178 varieties. The evaluation singled out 29 Uralic varieties as targets, while the other labels included both unrelated languages and widely represented Uralic languages such as Finnish, Estonian, and Hungarian. A system therefore had to recognize the target varieties and avoid assigning their labels to other texts that resembled them.

The authors compared two ways to extract evidence from the same basic input, a sequence of characters. Their probabilistic classifier, Probcat, uses each overlapping run of five characters as a feature, an example of a character n-gram. The neural system first learns to reconstruct characters hidden in passages from the training collection. It then learns to turn the full passage into a language prediction. The second approach can use evidence from farther apart in a sentence. It also depends on decisions about how frequently to show it examples from each language and when to stop training.

On the official test, Probcat placed first on the tracks that emphasized the target varieties. It achieved 0.814 macro F1 and 0.967 micro F1, compared with 0.800 and 0.963 for the HeLI baseline. Macro F1 gives the evaluated labels equal weight when averaging their scores, while micro F1 pools decisions before scoring them. The best neural scores were 0.743 and 0.953 on those tracks. When the evaluation used macro F1 across the full language inventory, HeLI led with 0.925, followed by Probcat at 0.908 and the neural system at 0.904.

The neural runs scored strongly in internal development, but the settings selected there transferred unevenly to the official test. The internal split deliberately gave target examples about as much representation as other examples. Probcat assigned a target label to only 1.4% of official test passages, and its high pooled F1 led the authors to believe that the actual target share was close to that prediction rate. The study establishes a strong result for character 5-grams under the shared task’s conditions. It also shows how much the value of a validation score depends on the mixture of languages in the passages used to obtain it.

Deep dive: N-gram and Neural Models for Uralic Language Identification: NRC at VarDial 2021

A Uralic language identification study compares character 5-grams with a pretrained neural network on short texts from many languages. · about 32 minutes to read

The problem and its context

Identifying the main language of a short passage

Language identification assigns a language label to a piece of text. The unit in this task was a short passage, typically a sentence. Each system had to choose from the full set of labels. A passage could include material from multiple languages, in which case the annotation sought the main one. That condition matters because a recognizably foreign phrase can occur inside an otherwise coherent sentence. A system that accumulates strong clues without accounting for their place in the passage can give an embedded phrase more influence than the language surrounding it.

The task was framed around Uralic varieties that the organizers designated as relevant. Here, relevant is an evaluation term. It identifies the labels that receive special treatment in the scoring rules. The distinction does not coincide with a linguistic boundary, since Finnish, Estonian, and Hungarian were among the non-relevant varieties. Throughout the study, a non-relevant label is still a valid answer. Predicting it correctly can matter to the all-language score, and mistaking a passage from that group for a target variety can reduce the target-focused scores.

This creates a classification problem with related decisions. A system must determine which of the target varieties a passage most resembles, and the evidence for that decision must hold up against the other candidate labels. A short passage can provide persuasive evidence for being Uralic while offering less evidence for distinguishing two neighboring varieties. Familiarity with the broad language family therefore settles only part of the task. The candidate set also spans various other families, so a system has to resolve both close distinctions and more general differences in character use.

The class inventory includes varieties with very little training material. The paper describes some of the target varieties as already extinct. Scarcity matters directly to a character-based system. When a spelling pattern is missing from a small training collection, its absence is weak evidence that the pattern is absent from the language. A much larger collection for a related label can document that same pattern well. The resulting difference in what the systems have had a chance to learn can complicate a comparison between labels, even if the spelling itself is informative. This is the setting in which the paper discusses low-resource languages.

The practical example in the paper is collecting texts from the web to build monolingual corpora. In that setting, a language identifier can act as a filter over a larger multilingual collection. If the desired variety is uncommon, incorrect inclusions can have a large effect on the material that makes it through. A filter also has to retain genuine examples, since those passages are the material the collection is intended to recover. The Uralic task gives the authors a test of these competing demands with short passages and a large range of possible source languages.

Why character patterns were an established starting point

The wider research context comes from earlier work on language identification and the discrimination of similar varieties. The authors point to surveys of both areas, including the survey of automatic language identification in texts. They describe character n-gram classifiers as established competitors on language identification benchmarks. A short sequence of characters can register a recognizable spelling, part of a word, or a recurring local pattern. Different occurrences can support the same label even when they appear in different words.

An important boundary in the study is between what the authors ask a feature to represent and what the feature might end up capturing. A character window does not need a linguistic label assigned to it in advance. If a sequence occurs in a characteristic set of passages, it can become useful evidence regardless of whether a human analyst would identify it as a particular spelling convention or a piece of morphology. That is one reason the same feature construction can be used across a large language inventory without defining separate linguistic rules for each label.

The task was a rerun of the Uralic evaluation held at VarDial 2020. In that earlier evaluation, the NRC team had used a neural approach related to the one in this paper. The authors trace its earlier difficulties to how they sampled material for training and evaluation. Sampling was particularly consequential because the available collection combined an imbalance between target and non-target material with substantial imbalances among individual languages. The repeat evaluation gave the team an opportunity to change the sampling procedure and try the approach again.

The group had also applied character-based neural classification to cuneiform language identification at VarDial 2019. The paper describes that as a smaller task with 7 varieties and less complicated class imbalances. It cites the cuneiform submission as an example of a neural system leading a shared task. That experience makes the Uralic comparison a test of whether a similar approach remains effective under a much larger inventory and a different distribution of training examples. The earlier success concerns Akkadian and cuneiform NLP.

From the authors’ perspective, the open question was whether contextual character representations could provide dependable gains over local features. The neural system could represent a character differently depending on what surrounded it, and its pretraining task offered a way to learn those representations from the competition’s passages before using their labels for classification. The established classifier had the advantage of relying on patterns it could collect directly for each language. The shared task’s closed-data rule put these approaches on the same footing with respect to the allowed corpus. The choice was how to use that corpus.

The method, step by step

Turning local strings into a language decision

Probcat starts from short, contiguous strings of characters. To picture the input representation, imagine a window that moves along a passage. At each position it reads a fixed number of consecutive characters. Moving to the next position produces another feature, with much of the previous window still in view. This overlap lets a spelling pattern contribute evidence through several adjacent features. With a fixed window length, the feature itself records the order of its characters and covers only its local section of the passage.

The authors tested different window lengths and used character 5-grams alone in the competition submission. For the classification task, the training text is grouped by its assigned language labels and provides evidence about which strings are associated with each label. At prediction time, a passage contributes the strings extracted from it. The classifier uses the language evidence carried by those strings to choose a label for the whole passage. A string shared by related varieties offers less help with their distinction than a string whose distribution differs between them.

The paper describes Probcat as closely related to multinomial Naive Bayes, the familiar text classifier in which a document label serves as the common class behind the document’s observed features. Probcat relaxes the assumption that the observed n-grams all originate from one class. The classifier still returns a single language label for evaluation. The distinction is between the way the algorithm treats feature evidence and the form of its final answer. A passage’s character strings can point in different directions even though the task asks for its main language.

That description also sets a boundary on what can be reconstructed about the implementation. The authors cite their earlier work for the full probabilistic algorithm and explain the feature length and the training conditions used here. An account of Probcat as ordinary multinomial Naive Bayes with a product of feature probabilities would erase the distinction the paper makes. The demonstrated setup is a classifier trained on labeled competition text, using one length of character sequence in the final submission.

Learning contextual character representations

The neural branch likewise begins with characters. The authors build an alphabet from the training portion of their internal split. A character appears in that alphabet if it occurs more than once in that portion. Other characters are mapped to a special unknown-character symbol before encoding. The restriction defines which distinctions the system can represent directly. A character with its own entry can receive its own learned representation, while characters that fall outside the alphabet share the fallback entry.

Each input character is converted into a vector, a list of learned numerical values called an embedding. The encoder transforms that initial representation as it processes the sequence. Its output retains a vector at each character position. By the end of the encoder, a vector describes the character in its context, so occurrences of the same symbol can have different final representations depending on their neighbors and more distant parts of the passage. There are also positional embeddings, which give the network information about where a character occurs in the input.

The stack uses a bidirectional Transformer. Its attention mechanism lets the representation at a position draw information from other positions on either side. Each encoder layer uses multiple attention heads, which are parallel ways of combining information from the sequence, and a feed-forward component that transforms the resulting representations. The architecture is grounded in Attention Is All You Need.

The authors train the encoder for two successive purposes. First, they hide selected characters and ask the network to reconstruct them from their positions and the surrounding text. The passages supply their own answers for this exercise. Second, they retain the encoder, attach a new component that predicts the passage’s language, and continue updating the network on labeled examples. The first stage follows the masked prediction approach used by BERT.

From character sequences to neural language predictions

The steps in order.

From character sequences to neural language predictionsStep 1: Build an alphabet from the training partition1. Build an alphabet from the training partitionStep 2: Sample passages and mask selected characters2. Sample passages and mask selected charactersStep 3: Embed positions and encode the visible context3. Embed positions and encode the visible contextStep 4: Train the encoder to reconstruct masked characters4. Train the encoder to reconstruct masked charactersStep 5: Replace the reconstruction head with a language head5. Replace the reconstruction head with a language headStep 6: Average the contextual character representations6. Average the contextual character representationsStep 7: Fine-tune the network on labeled passages7. Fine-tune the network on labeled passagesStep 8: Select checkpoints using development F18. Select checkpoints using development F1

Pretraining by reconstructing characters

For pretraining, the system samples a passage and chooses character positions at random. It replaces the characters at those positions with a masking symbol before the embedding stage. The encoder can then use surrounding evidence to form a representation at each masked position. A prediction head takes the final vector at that position and scores the possible original characters. The target for training is the symbol that was removed.

The head uses a softmax, an operation that turns the scores for candidate characters into a probability distribution over the alphabet. The loss is cross-entropy, which penalizes the system when it puts low probability on the observed answer. As the system processes more masked passages, the training process adjusts the encoder and the prediction head to make the hidden characters easier to recover. The boundaries of the exercise are clear. Reconstruction can reward sensitivity to local spellings as well as context farther away. The scores for reconstruction are not themselves used as language predictions.

Using passages from many languages gives the encoder opportunities to learn the different surface regularities that make masked characters predictable. That opportunity depends on which passages enter training and how frequently the rare languages are seen. Pretraining is self-supervised in the sense that the masked characters furnish the prediction targets. The sampling procedure can still use the dataset’s language labels to determine which examples the encoder sees.

The encoder has 8 Transformer layers, with 12 attention heads, a hidden size of 768, and a feed-forward size of 3072. The hidden size is the number of values in the representation carried through the stack for each position. The feed-forward size describes the intermediate transformation within a layer. The authors report GELU as the hidden activation, a nonlinear transformation, and set the dropout probability to 0.1. Dropout suppresses a fraction of activations during training. They use Adam to update the parameters and explain that they use fewer layers than the base BERT architecture to save time and memory.

The pretraining batch size is 64 and the maximum input length is 128 characters. The reported learning rate is 1e-4. The learning rate governs the size of the parameter updates, and warmup brings training up to its working schedule over the initial steps. The run is configured for 1M pretraining steps with 10K warmup steps. A step corresponds to a parameter update using a batch. Those figures characterize the learning procedure, while the number of examples available in each language determines what training material can be sampled.

Switching from character reconstruction to language classification

After pretraining, the authors remove the component that predicts missing characters. They keep the contextual encoder and give it a language classification head. The encoder still produces a vector for each character, but the new output is a single label for the passage. The head therefore needs to turn a sequence of vectors into a single fixed-size representation before scoring the languages.

It does so by average pooling. Each coordinate of the passage vector is the average of that coordinate across the final character representations. The averaging works over contextual vectors. Accordingly, information about character order can already be present in the values being averaged. The operation summarizes the sequence at the point where the network must make a passage-level decision. The paper links this pooling choice to Sentence-BERT.

The pooling layer is followed by a ReLU activation, which sets negative inputs to zero and preserves positive inputs, and then by a softmax over the 178 language labels. Cross-entropy now penalizes low probability on the passage’s annotated language. In this stage the system can adjust its contextual features toward distinctions needed for identification, including differences that helped little with the earlier objective of filling in a missing character. This is the role of fine-tuning.

Fine-tuning uses batches of 32. The maximum length is increased to 256 characters. The additional position embeddings begin with random values and are learned during fine-tuning, since those positions were beyond the pretraining limit. The authors compare learning rates of 3e-6 and 1e-5 and choose 1e-5 for their submissions. With the new head, longer inputs, and different sampling rules, this stage involves continued training of the system, beyond simply applying a classifier to a fixed set of pretrained representations.

Adjusting which languages appear during training

The authors use sampling to determine how often different examples enter the neural system’s batches. Drawing uniformly over passages in the corpus would give frequent languages proportionally more influence, since they contribute more passages. Drawing uniformly over classes instead gives each language the same probability at the class-selection stage. The two strategies can yield very different training streams when examples are concentrated in a small set of large classes.

Their frequency-based scheme treats target and non-target languages as separate groups at first. Within each group, it calculates relative language frequencies. It then raises those frequencies to an exponent, written α, to adjust how strongly the original imbalance is retained. The target group’s weights are multiplied by a coefficient, written γ. Finally, the two sets of weights are put together and normalized into a single distribution. The exponent sets the strength of the frequency effect, while the coefficient adjusts how much weight the target group receives when the distributions are combined.

For pretraining, the authors use α = 1 and γ = 1. The exponent leaves the within-group frequencies unchanged. With the two relative-frequency distributions retaining equal group weight, targets and non-targets are sampled in roughly equal proportions. There are fewer languages in the target group, so the authors describe its average language as sampled about 5 times as often as the average language in the other group. Individual languages within either group can still differ greatly in how often they appear.

For fine-tuning, the authors try frequency-based sampling with different parameter choices, class-wise uniform sampling, and sampling that reacts to the classifier’s development performance. The accuracy-based approaches periodically estimate a score for each class using a one-versus-rest decision on the development set. For a given language, a passage either belongs to that language or belongs to the rest of the inventory. Accuracy counts both passages correctly assigned to the language and passages correctly recognized as outside it. This score is used to guide sampling. The official evaluation continues to use F1.

The first accuracy-based approach allocates probability in proportion to the remaining error in that class’s binary decisions.

pᵢₙᵥ(mᵢ) = (1 − mᵢ) / ∑ⱼ (1 − mⱼ)

Here m denotes the collection of class-wise accuracy scores, and mᵢ is the score for language i. The number 1 represents perfect accuracy on that scale, so 1 − mᵢ is the error for that binary decision. The index j ranges over the languages, and ∑ⱼ adds the corresponding errors. The quotient pᵢₙᵥ(mᵢ) gives the sampling probability for language i under the inverse-accuracy rule. A language with more measured error receives greater weight, with the denominator putting the weights onto a common probability scale.

The second approach uses the ordering of the same scores.

pᵣₐₙₖ(mᵢ) = rank(mᵢ, m) / ∑ⱼ rank(mⱼ, m)

The expression rank(mᵢ, m) gives the rank of the score mᵢ within the collection m. The index i identifies the language being considered, and j runs over the languages whose ranks are added by ∑ⱼ. The value pᵣₐₙₖ(mᵢ) is the resulting sampling probability for the language. The rank rule uses position in the accuracy ordering as the weight. The inverse rule uses the magnitude of the measured error. Thus score gaps can affect the inverse rule even when the ordering remains fixed.

The accuracy-based rules make development performance part of the training process. When the score estimates change, the probabilities can change with them, which changes the mix of examples in subsequent updates. Frequency sampling follows a preset schedule of class probabilities derived from the corpus. Uniform sampling also supplies a fixed schedule at the class level. This difference is important when reading the comparison, since a development set used for accuracy-based sampling is providing information during optimization as well as during checkpoint selection.

Making batches and selecting checkpoints

The authors also revise how sequences are prepared within a fine-tuning batch. Sequences in a batch need a common working length. The implementation uses the longest sequence in that batch, subject to the 256-character cap, to set that length. Shorter inputs are padded, while any material beyond the cap is truncated. The paper reports that over 99% of training examples are shorter than 256 characters. Padding every batch out to that limit would therefore cause the network to process many positions added solely to make the input arrays fit.

This implementation decision reduces redundant work relative to the team’s earlier setup. It changes how much padding the encoder handles, while the sampling rule changes which examples it handles. The paper presents both as changes to the earlier neural approach. It gives development scores for the sampling alternatives and describes the padding change in terms of computation time. The authors made their implementation available in a repository named vardial2021, using the Transformers library.

The final fine-tuning experiments allow as many as 820K steps and check performance every 20K steps. The authors use either the target-focused macro F1 score or the full-inventory macro F1 score as the criterion for early stopping. Early stopping selects a checkpoint based on how it performs on the designated development measure, so the best checkpoint may occur before the step limit. The two criteria look at different portions of the task. Favoring one can select a network that performs differently on the other, and the official test makes it possible to see how those choices transfer.

Experiments and results

The official corpus and the internal splits

The evaluation was closed, so the supplied training material was the only corpus available to the competitors. It contained 29 relevant and 149 non-relevant varieties, for 178 possible labels. The relevant portion of the training set contained 646,043 examples. The non-relevant portion contained 63,772,445. The paper describes that as about 100 times as much material for the non-relevant group and about 20 times as many examples per language on average for that group.

Averages conceal the spread within each group. Among the relevant languages, the number of training examples per label ran from 19 to 214,225. Among the non-relevant languages it ranged from 10,000 to 3,000,000. A class can therefore be small because it lies in the underrepresented target group, because it lies at the low end of the distribution inside its own group, or both. The sampling scheme addresses the group-level imbalance and can damp the imbalance inside groups. It cannot supply genuinely new passages for a language whose examples are repeatedly drawn from a small collection.

The organizers did not supply an official development set. The authors drew a dev set of 20,000 examples and a devtest set of 100,000 examples from the competition’s training data. They used the frequency-based sampling rule with α = 1 and γ = 1 for both splits. That made target and non-target examples approximately equally prevalent at the group level. The purpose was to have a split for tuning choices and a separate split for judging the choices once made.

For the comparison of Probcat feature lengths, the authors trained on their remaining training partition and reported scores on both internal splits. They later trained the official Probcat submission on the entire supplied training set. In their final neural selection experiment, time constraints led them to return devtest to the fine-tuning pool and use dev for selection. This increased the material available to those runs, while leaving a different train-validation arrangement from the one used in the Probcat development comparison. The official test supplies the common comparison for the submissions.

What the tracks count

The tracks use F1, a measure that combines precision and recall. For a given language, precision asks what share of passages assigned that label actually belong to it. Recall asks what share of passages belonging to that language receive the label. An incorrect assignment can therefore lower precision for the predicted language and recall for the actual language. F1 combines those quantities so that a strong value for one cannot fully compensate for a weak value for the other.

Track 1 uses macro F1 with attention restricted to the relevant side of the task. The scoring considers passages for which the annotated or predicted label is relevant. This includes passages that should receive a target label and passages to which a system applies a target label incorrectly. Macro averaging makes performance on individual evaluated labels visible in the aggregate by giving the label-level scores equal weight. A system can consequently lose ground on this track if it misses distinctions among rarely encountered target varieties.

Track 2 uses the same relevance condition, but calculates micro F1. The decisions are pooled, so labels with more examples can exert more influence on the final result. A high micro score paired with a weaker macro score can occur when a system does well on the largest share of the evaluated decisions but handles some labels less reliably. The paper does not supply official per-language scores, so the overall scores show how the aggregate changes under the weighting rule without identifying all the languages responsible.

Track 3 uses macro F1 over all examples. The broader scope makes quality across the entire language inventory part of the evaluation. A method can therefore be strongest for the targeted varieties while another wins on the full inventory. The study’s comparison uses HeLI, the organizers’ baseline method, alongside Probcat and the best neural submission for each track.

Performance on the target varieties

On track 1, Probcat scores 0.814 on the official test, ahead of the HeLI baseline at 0.800 and the best neural run at 0.743. The authors report that another submission also cleared the baseline. It combined support vector machines with Naive Bayes classifiers using 3-, 4-, and 5-grams and scored 0.809 on this track. They report the latter result from the leaderboard at the time of writing. Probcat’s result thus came in a comparison that already included strong systems based on local strings.

Official ULI test set, track 1 macro F1 for relevant languages

Probcat leads the target-focused macro comparison, with the other n-gram submission also ahead of HeLI.

Official ULI test set, track 1 macro F1 for relevant languagesHeLI baseline: 0.800HeLI baseline0.800SVM and Naive Bayes ensemble: 0.809SVM and Naive Bayes ensemble0.809Probcat (this paper): 0.814Probcat (this paper)0.814Best neural run: 0.743Best neural run0.743
The numbers
System or settingmacro F1
HeLI baseline0.800
SVM and Naive Bayes ensemble0.809
Probcat (this paper)0.814
Best neural run0.743

Track 2 gives Probcat 0.967, HeLI 0.963, and the best neural run 0.953 on the official test. On this track, no system other than Probcat outperformed the baseline. The other submission that exceeded HeLI on track 1 scored 0.593 on track 2. That change in relative standing shows how differently the two target-focused measures can judge the same submission. Probcat’s lead holds under both rules, although the paper’s central comparison looks closer on the pooled measure.

Official ULI test set, track 2 micro F1 for relevant languages

Probcat is the only submission reported above the HeLI baseline on the pooled target-language measure.

Official ULI test set, track 2 micro F1 for relevant languagesHeLI baseline: 0.963HeLI baseline0.963Probcat (this paper): 0.967Probcat (this paper)0.967Best neural run: 0.953Best neural run0.953
The numbers
System or settingmicro F1
HeLI baseline0.963
Probcat (this paper)0.967
Best neural run0.953

The results also explain why the authors describe the neural approach as competitive on track 2 while recording a much less favorable comparison on track 1. Its high pooled score establishes that it made many of the target-focused decisions successfully. The macro score shows that this success did not carry over in the same way when the evaluated labels received equal weight. Without the gold labels, the authors could inspect disagreements and predicted counts, but attributing that gap to particular languages remained outside the reported analysis.

Performance across the inventory

For track 3, HeLI scores 0.925 on the official test. Probcat reaches 0.908 and the best neural submission 0.904. The authors report that the baseline remained unbeaten on this track. Probcat still leads the paper’s two approaches in the all-language comparison, while the change in winner shows that success on the target subset does not settle performance on the wider inventory.

Official ULI test set, track 3 macro F1 across all languages

HeLI leads the full-inventory evaluation, and Probcat finishes slightly ahead of the neural approach.

Official ULI test set, track 3 macro F1 across all languagesHeLI baseline (this paper): 0.925HeLI baseline (this paper)0.925Probcat: 0.908Probcat0.908Best neural run: 0.904Best neural run0.904
The numbers
System or settingmacro F1
HeLI baseline (this paper)0.925
Probcat0.908
Best neural run0.904

The official table gives the best neural score attained for each track. Those scores are drawn from different runs. The highest neural score on track 1 belongs to the frequency-sampled run tuned for track 3. The other two neural maxima belong to the rank-sampled run tuned for track 1. Reading across the best-scores table therefore describes the range of what the team achieved with its final neural submissions. Reading across the individual runs gives the results that a single choice of sampling and checkpoint actually delivered.

Computing time in the reported setup

The authors report training and prediction times separately. Probcat took about five and a half hours to train and about four and a half hours to run on the official test using four Intel Xeon CPUs at 2.6 GHz. Its memory requirement was below 32 GB. They note that more CPUs could reduce its prediction time. The number of official passages, 1,510,315, makes it important to distinguish a short classification input from the time needed to classify the whole collection.

A single GPU equipped with 12 GB of memory was used for the neural experiments. Pretraining took about 10 days, and the authors fine-tuned for about 3 days. Prediction on the official test took about 70 minutes on a v100. These measurements show where the authors incurred the larger cost in their neural workflow, as well as the shorter prediction time on its reported hardware. The CPU and GPU timings describe the systems as run by the team. The paper offers no same-hardware comparison from which to isolate the effect of the algorithms on prediction speed.

What the ablations show

The effect of changing the length of Probcat’s features

The closest thing to a direct ablation is the comparison of character window lengths with Probcat. The classifier family stays fixed while the authors change the number of consecutive characters in its features. They test lengths from 2 to 5 on both development splits. Across every track and both splits, the reported scores increase with the tested length. The result supports choosing a single window length for the official submission and shows that the choice matters even within the same basic feature family.

On track 1, the dev macro F1 scores for lengths 2, 3, 4, and 5 are 0.760, 0.917, 0.960, and 0.963. On devtest the corresponding values are 0.763, 0.844, 0.916, and 0.936. The ordering is consistent across the splits, although the score at a given length can change noticeably. The case for choosing the longest tested window comes from the repeated ordering, rather than from treating one split’s best score as an estimate that should recur on another distribution.

For track 2, the dev micro F1 values in increasing order of length are 0.769, 0.941, 0.973, and 0.978. The devtest values are 0.774, 0.936, 0.970, and 0.976. Track 3 shows the same ordering for full-inventory macro F1. Its dev values are 0.766, 0.912, 0.939, and 0.951. The values on devtest are 0.743, 0.890, 0.929, and 0.943. The consistency spans a pooled target score and both kinds of macro score, so it is more than an effect of one metric’s weighting.

Longer windows can distinguish strings that look alike when seen in smaller pieces. That is a plausible reading of the improvement, especially for varieties that share many local patterns. The experiment measures aggregate classification performance. It does not trace the gain to particular spellings or indicate whether still longer windows would improve the scores. After the official evaluation, the authors also tried combining different lengths and report that they saw no improvements on their internal splits. Since those combinations were explored after submission, the evidence for that decision comes from development performance.

What changed when fine-tuning sampled languages differently

The final neural selection experiment compares three families of training schedules. In the frequency family, the authors try α = 1 with γ = 1, α = 0.75 with γ = 1, and α = 0.75 with γ = 0.5. Reducing the exponent dampens the differences due to within-group frequencies. Reducing the coefficient decreases the target group’s weight before normalization. The other two families are class-wise uniform sampling and accuracy-based sampling, with separate variants for error magnitude and rank. The table reports the best development scores by sampling approach, making it a comparison of the strongest observed settings in each category.

On track 1, frequency sampling reaches 0.977 on dev macro F1, uniform sampling 0.973, inverse-accuracy sampling 0.974, and rank sampling 0.975. On track 2, the dev micro F1 values in the same order are 0.989, 0.986, 0.988, and 0.987. For track 3, the dev macro F1 values are 0.978, 0.969, 0.977, and 0.974. The frequency-based approach leads in each column. Both adaptive alternatives also show some benefit over uniform classification sampling in this development comparison.

Rank weighting and inverse-accuracy weighting trade places depending on which track is used. On the target macro measure, the rank-based version scores higher. On the pooled target measure and the macro measure over all languages, the inverse-accuracy version has the higher score of the two. This indicates that reacting to a class-wise development signal can be useful on the internal split, while the particular conversion of that signal into sampling probabilities can change which metric benefits most.

There are two reasons to read this table within the experiment that produced it. First, the best score by sampling approach need not correspond to the same checkpoint or the same configuration for each track. Second, the development split has the group balance introduced by the sampling rule, and it also provides the feedback that drives the accuracy-based alternatives. The table can guide the choice of runs to submit. A comparison of its numbers with Probcat’s internal scores would overlook the use of devtest in the neural training pool and the different role of dev during fine-tuning.

How the four selected runs transferred to the official test

The final runs pair training schedules with different checkpoint criteria. For track 1, run 1 uses frequency sampling with α = 0.75 and γ = 0.5, and run 2 uses the rank-based accuracy rule. Both use track 1 macro F1 for early stopping. For track 3, run 1 uses the same frequency settings and run 2 uses the inverse-accuracy rule. Both use track 3 macro F1 to select a checkpoint. Evaluating every run on all tracks allows the reader to see how a choice made for one measure performs on the others.

The frequency-based run tuned for track 1 scores 0.718, 0.928, and 0.898 on official tracks 1, 2, and 3, respectively. The rank-based run tuned for track 1 scores 0.737, 0.953, and 0.904. That second run leads the neural submissions on both pooled target F1 and full-inventory macro F1. Its success on those tracks shows that selecting a checkpoint on the target macro measure did not confine its gains to the measure used for selection.

The frequency-based run tuned for track 3 scores 0.743 on official track 1, 0.928 on track 2, and 0.899 on track 3. It has the highest target macro score among the neural runs. The inverse-accuracy run tuned for track 3 scores 0.615, 0.830, and 0.784 on the same official measures. Its development sampling family came close to frequency sampling on track 3. The individual submission nonetheless finishes behind the other neural runs on each official track.

The two frequency-based submissions provide a particularly direct comparison because they share the reported values of α and γ and differ in their stated early-stopping objective. In the official results, the run selected for track 3 posts a better track 1 score, the same track 2 score, and a slightly higher track 3 score. The comparison suggests that selecting for a track on dev did not reliably identify the strongest submission for that track. The adaptive submissions vary both the sampling rule and the checkpoint objective, so the difference between them cannot be assigned cleanly to either decision.

The stopping points also vary. Track 1 run 1 stops at step 649,375 and track 1 run 2 at 651,875. Track 3 run 1 stops at 726,875 and track 3 run 2 at 590,625. The earliest stopping run is the weakest on the official test. The narrative describes the last-stopping run as best on track 3, but the individual results table puts that run’s track 3 score at 0.899 and the rank-sampled run at 0.904. By the tabulated scores, the last-stopping run leads the neural runs on track 1.

The authors estimate that the run with the latest stopping point processed about 23 million training samples at the reported batch size. That count includes repeated examples from smaller classes and falls below the number of training examples available. They take the checkpoint observations as a reason to consider longer fine-tuning. The duration comparison is observational. Each run reached its stopping point under its own selection procedure, and those procedures were tied to the sampling schedules. An experiment that held those choices fixed while varying the training duration would be needed to measure the effect separately.

How predictions differed on the official test

The authors examine the predicted number of target passages as another way to understand transfer. Probcat assigns a relevant label to 21,051 of the 1,510,315 test cases, reported as 1.4%. Its track 2 F1 of 0.967 leads the authors to infer that this tally is close to the actual number of target passages. That is an inference from predictions and the aggregate result. They did not have the official labels with which to count the exact prevalence at the time.

The weakest neural submission assigns a target label to 27,901 cases. The authors interpret this as possible over-detection. The count compares the overall tendency of each system to choose a target label. It cannot identify which individual selections were false positives or whether some target passages had been missed. Together with the differing scores, it shows a concrete way in which a run’s behavior can shift when a classifier trained and selected on a target-enriched distribution encounters an official collection dominated by other languages.

They also compare Probcat’s predictions with those of the rank-sampled neural run that leads on tracks 2 and 3. Treating the stronger overall classifier as a provisional reference produces a directional table of disagreements. Among all labels, there are 10,110 cases in which Probcat predicts Indonesian and the neural run predicts Sundanese, and 9897 with Probcat predicting Tatar and the neural run predicting Bashkir. A Croatian-to-Bosnian disagreement occurs in 5312 cases. The authors cite that last pair as an example of varieties that are difficult to tell apart.

Restricting the comparison to pairs involving a relevant variety makes different patterns visible. Probcat predicts Standard Estonian where the neural run predicts Võro in 467 cases. There are 388 cases in the opposite direction. Finnish predicted by Probcat and Tornedalen Finnish predicted by the neural system makes up 51 disagreements, with 35 in the reverse direction. Some of the frequent pairs also include Ludian with Veps or Livvi. A repetition in both directions shows that the two systems differ in how they draw boundaries between related labels, while the direction of a disagreement simply records which system assigned each label.

The authors manually read some passages that Probcat labeled English. They found multilingual examples in which English appeared inside a passage mainly written in another language. One embedded English material in the form of song titles, and another contained an English expression within a longer passage. They also found passages whose wording and spelling resembled English while differing from Standard English. This inspection illustrates why recognizing a familiar string and identifying the passage’s main variety are distinct judgments. It offers examples of potentially difficult cases without furnishing a gold-standard error count for them.

Limitations

Limits stated by the authors

The authors treat their neural results as evidence about the systems they managed to evaluate under the time constraints of the shared task. The final experiment concentrated on sampling and checkpoint selection. Earlier exploratory work included swapping out tanh for ReLU in the pooling head and adjusting settings including batch size and learning rate. The paper gives the final architecture and learning rate but omits full results for the exploratory trials. Consequently, the paper cannot assign measured portions of the improvement over the team’s earlier neural approach to each of those changes.

They identify several ways the neural comparison could have been extended. Fine-tuning could have continued for longer or used the complete training collection. More random initializations and a broader or more efficient hyper-parameter search could have tested the stability of the results. The authors also suggest possible adaptation to unlabeled test passages using masked character prediction or using the system’s own language predictions as training targets. These are avenues they discuss after reporting the shared-task results. The paper does not report gains from such adaptation.

The lack of official test labels at the time of writing is an explicit limit on the error analysis. Aggregate test scores measure the quality of the submitted predictions under the scoring rules. Inspecting examples and comparing system outputs can show where their decisions differ. Only the gold labels would establish which system made the correct call in each disagreement. The authors say they intended to conduct a fuller analysis once those annotations became available.

The suggested source of some disagreements is likewise tentative. Several relevant-variety pairs involve Standard Estonian or Finnish, which raises the possibility that their large training collections contain passages from varieties assigned different labels by the evaluation. Confirming that explanation would require checking the training passages and their annotations. The disagreements could also arise from the systems relying on different parts of genuine shared spelling or vocabulary. The paper reports the pattern and poses the question without measuring the amount of corpus noise.

Limits visible in the design

The inclusion of a development split enriched for the scarce target varieties made it easier to obtain a meaningful internal assessment for those languages. It also produced a different mixture of target and non-target passages from the one inferred for the official test. Even when evaluation filters out correct non-target decisions, that broader mixture can affect how many non-target passages are incorrectly brought into the scoring set by target predictions. A validation split can therefore give a reasonable picture of performance on its own distribution while offering a weaker basis for choosing among systems on the official one.

There are several uses of the same development data in the final neural experiment. It determines the early-stopping score, and it supplies the one-versus-rest performance estimates used by the adaptive sampling rules. The original devtest holdout is part of the training pool for those runs. The official test still provides a common external comparison, but the internal neural scores answer a different question from the original two-split experiment planned for development and independent checking. This distinction matters most when interpreting very high dev scores or comparing them across the neural and Probcat tables.

One-versus-rest sampling accuracy creates a further difference between the feedback signal and the competition objective. For each class, the rest of the inventory can contribute many correct negative decisions even if genuine examples of that class are hard to recognize. The adaptive score can therefore be high despite poor recall for a rare language. Macro F1 directly incorporates recall and precision at the label level. The paper’s adaptive-sampling results establish what happened with this specific binary-accuracy feedback, leaving open how a sampling rule built around another class-specific signal would behave.

The final comparison establishes the relative scores of character 5-grams, the submitted character encoder, and HeLI on this evaluation. It does not isolate a causal effect of pretraining. There is no matched neural run that starts without masked-character pretraining and holds the rest of the setup fixed. Nor is there a factorial comparison separating encoder changes, sampling, and training duration. The empirical conclusion is about the trained submissions and their design choices taken together. Attribution to an individual neural component would need a more controlled comparison.

The local-feature result has a similar boundary. The length study supports 5-grams among the tested choices, and the official submission confirms that this choice can be highly competitive on the task. It does not establish a general optimum length or show that longer context is inherently unhelpful in language identification. The paper’s broader motivation concerns robustness in collecting rare-language text, but its evaluation measures predictions on the competition passages. Quality of a corpus assembled through sustained language filtering, and behavior on future collections with different mixtures of varieties, remain outside what was measured.

What came after

The later paper linked to this study takes up a related problem on a different group of languages. Published in 2022, it applies adaptive Naive Bayes to Italian language and dialect identification and to detection of regional French varieties. Like the Uralic work, it concerns classification when candidate labels include linguistic varieties that can share substantial surface evidence. It continues the line of work that tests probabilistic classifiers on those distinctions. Italian and French variety identification using adaptive Naive Bayes

The documented connection is a citation and a related choice of classification problem. The later study names adaptive Naive Bayes as its method. The connection alone does not establish that it reused Probcat’s scoring rule, its choice of character 5-grams, or any of the neural sampling procedures. The comparison that can be drawn is one of scope and method family. The Uralic study tests a probabilistic character classifier against a pretrained encoder across a broad inventory with a targeted subset. The later work applies a probabilistic approach to Italian and regional French variety identification, extending the set of language distinctions studied with that general family of methods.

Cite

Cite as Gabriel Bernier-Colborne, Serge Leger and Cyril Goutte. 2021. N-gram and Neural Models for Uralic Language Identification: NRC at VarDial 2021. Proceedings of the Eighth Workshop on NLP for Similar Languages, Varieties and Dialects.

The paper itself, not this page. BibTeX from the library's record of the work.

@inproceedings{berniercolborne2021n,
  title = {{N-gram and Neural Models for Uralic Language Identification: NRC at VarDial 2021}},
  author = {Gabriel Bernier-Colborne, Serge Leger and Cyril Goutte},
  booktitle = {Proceedings of the Eighth Workshop on NLP for Similar Languages, Varieties and Dialects},
  year = {2021},
  url = {https://aclanthology.org/2021.vardial-1.15/}
}

↑ back to top

This page in Markdown https://md.research.elamur.ai/free/en/papers/colborne-2021-n-gram-neural-models-uralic/