Elamur Research

Comparison of Czech Transformers on Text Classification Tasks

Paper · 2021 · Jan Lehečka and Ján Švec

Summary

A Czech movie review and a Czech news story can use the same language in quite different ways. A reviewer may write as they speak, leave out diacritics, or express a reaction in a fragment. A news story is more likely to use edited prose and may cover several subjects at once. The paper asks how well pretrained transformers handle these different kinds of Czech text classification. Its starting point is a practical concern. A multilingual system can include Czech in its training and still give it a small share of the input. Large collections of Czech web text made it possible to test what Czech-only pretraining could offer.

The authors trained and released FERNET-C5 and FERNET-News. FERNET-C5 uses a BERT architecture and learns from 93 GB of filtered Czech pages from Common Crawl. FERNET-News uses RoBERTa and learns from a more thoroughly processed corpus composed chiefly of news articles and broadcast transcripts. The authors then used fine-tuning to adapt each system to labeled examples. They compared the resulting classifiers with published multilingual and Czech-only alternatives on movie reviews, product reviews, Facebook posts, and news articles from separate collections.

FERNET-C5 had the highest F1 among base-sized systems on all the sentiment analysis datasets. The Facebook comparison illustrates the difference between the two training sources. FERNET-News scored 75.94 F1, against 81.07 for FERNET-C5. Both new systems also led the base-sized alternatives on the news collections, where a classifier could assign several topics to an article. FERNET-C5 placed ahead of FERNET-News on CTDC in spite of the latter's news pretraining. It also scored above the much larger multilingual XLM-RoBERTa-large on CTDC, though the authors report that this difference was statistically insignificant. Across the experiments, the larger system was usually slightly ahead of the base-sized Czech systems introduced here.

The authors propose that the variety of Czech found on the web helps explain why FERNET-C5 handled both everyday writing and edited articles. The experiments establish that its particular training recipe worked across the sampled domains. Corpus size, preprocessing, vocabulary, architecture, and training schedule also changed between the FERNET systems, so the comparisons leave the contribution of each choice open.

Deep dive: Comparison of Czech Transformers on Text Classification Tasks

A comparison of Czech transformers for sentiment and news classification examines how web and news pretraining shape performance across domains. · about 34 minutes to read

The problem and its context

Including Czech in training

The paper begins with a decision faced by anyone building a Czech classifier. A published transformer can supply a set of weights already trained on a large collection of text. The weights give the classifier a starting point before it encounters examples with the labels needed for a specific task. For a researcher working on Czech, the practical question is what kind of starting point to choose. A system trained across many languages offers immediate access to a pretrained representation. One trained on Czech alone can devote its vocabulary and pretraining input to Czech, provided there is enough usable text and enough computing time to train it.

The authors describe self-attention and self-supervised training as central to the progress that made this choice worth examining. Self-attention lets the representation at a position in a sequence draw information from other positions in that sequence. In the pretraining tasks used here, the text supplies the targets for learning. A system can, for example, try to recover text that has been hidden from its input. There is no need to annotate a web archive with sentiment or news topics before using it for this stage. The classifier learns those categories later, from a separate collection with the appropriate labels. This is the distinction between language pretraining and supervised adaptation on which the study rests.

Training transformers from the beginning requires substantial computation. As the authors explain, publishing trained weights lets other researchers apply them to a range of natural language processing tasks. They describe much of the available work as either English-only or multilingual. For multilingual pretraining, a language's presence in the training collection tells a user that the system has encountered it, while leaving open how well it will handle the forms of that language encountered in practice. The authors' experience applying multilingual systems to their own tasks prompted them to explore a Czech-only alternative.

The argument about low-resource languages is relative to how text is allocated in large multilingual collections. The authors point to the underrepresentation of languages such as Czech in those collections. Their choice to train on Czech web archives rests on the availability of considerable unlabeled Czech material when it is gathered separately. Computing hardware and public web archives make that approach possible. Finding the relevant pages and turning them into a corpus of usable text remain part of the experiment.

The available starting points

The multilingual systems the authors discuss represent several ways to distribute training across languages. MultiBERT, the multilingual version of BERT used in the comparison, learned from Wikipedia dumps for 104 languages, with Czech among them. SlavicBERT narrowed the language set to Russian, Bulgarian, Czech, and Polish. It continued from MultiBERT's weights and used Wikipedia text in those languages. This offers a practical intermediate starting point for Czech work. It retains a broadly multilingual training history while adding training on a more concentrated selection of languages.

XLM-RoBERTa offers another kind of multilingual comparison. Its training used filtered Common Crawl text rather than being organized around Wikipedia alone. The authors include both its base and large versions. These share the broad multilingual web-training approach and differ substantially in parameter count. Their presence makes it possible to ask how the Czech systems compare with a web-trained multilingual alternative and how that comparison changes when a much larger published system is included.

The Czech-only alternatives also matter. Czert uses BERT and was trained on a mix that includes the Czech National Corpus, Wikipedia, and crawled news. RobeCzech uses RoBERTa and combines the Czech National Corpus and Wikipedia with articles from newspapers and magazines and Czech text from the W2C web corpus. A comparison with these systems sets a higher bar than a comparison with multilingual Wikipedia training alone. It tests the authors' particular Czech training recipes against other ways of constructing Czech-only ones. The paper places this work alongside efforts to train transformers specifically for Finnish and French.

Earlier work cited by the authors had already explored BERT for document classification and changes to pooling for large-scale multilabel classification. Pooling, in this context, means using a representation from the sequence to help make a decision about the text as a whole. The present study uses standard sequence classification components. Its focus is on what the different pretrained starting points offer under a downstream comparison. The authors train their new systems with established BERT and RoBERTa designs, rather than making a new classification architecture the center of the experiment.

Why use reviews, posts, and articles?

Sentiment and news topics pose different questions about a text. In sentiment analysis, the classifier must choose among positive, neutral, and negative labels. The datasets collect user writing from settings where people are evaluating a film or a product, or posting on a Facebook page. The paper points out that users may write with strong emotion and may use features of common spoken Czech in written posts. Diacritics and punctuation can be missing. The input can therefore differ from the edited Czech encountered in sources such as news or Wikipedia, even when the classifier's output consists of a familiar set of sentiment categories.

News topic identification uses articles and permits multiple labels. A classifier must decide both which topics fit and how many to return. The distinction matters for the experiment because a single ranked list of possible topics is not yet a set of assigned labels. A decision rule must turn the scores into that set. At the same time, the written register of the inputs makes news an obvious setting in which to test FERNET-News. Its pretraining material is closer in genre to the task inputs, an advantage the authors expected to matter.

Taken together, the tasks let the authors compare several kinds of transfer. The sentiment datasets share an output scheme while changing the source of the writing. The news datasets share the general task of topic assignment while varying substantially in the size of the collection and the number of labels. A pretrained system that fares well in each setting has succeeded at more than a single dataset. The evaluation still concerns Czech document classification, and the kind of transfer tested is from unlabeled pretraining to supervised work in those domains.

The method, step by step

The experiment has two training stages. First, the authors prepare Czech corpora and use the text to train contextual representations. Then they attach a classification component and adapt the system to a specific labeled dataset. For a movie review, pretraining supplies familiarity with patterns in text and fine-tuning teaches the system to associate relevant patterns with sentiment labels. For a news story, the same distinction applies, except that the classifier learns to score a set of possible topics. The paper applies the downstream procedure to its newly trained systems and to the published systems in the comparison.

From Czech pretraining text to classification scores

The steps in order.

From Czech pretraining text to classification scoresStep 1: Collect Czech web pages and news text1. Collect Czech web pages and news textStep 2: Clean each corpus with its own rules2. Clean each corpus with its own rulesStep 3: Train a tokenizer for each corpus3. Train a tokenizer for each corpusStep 4: Pretrain BERT or RoBERTa on unlabeled text4. Pretrain BERT or RoBERTa on unlabeled textStep 5: Fine-tune on sentiment or news topic labels5. Fine-tune on sentiment or news topic labelsStep 6: Convert classifier scores into document labels6. Convert classifier scores into document labelsStep 7: Evaluate predictions on held-out documents7. Evaluate predictions on held-out documents

Building a broad Czech web corpus

FERNET-C5 starts with Common Crawl. The authors call the resulting collection Czech Colossal Clean Crawled Corpus, or C5, and describe it as a Czech adaptation of the approach used for English C4. They use language information in Common Crawl's indexes to locate candidate Czech records and retrieve corresponding plain text from the WET archives. The language field in the index makes it possible to filter the records before taking the retrieved page text through another language check.

The crawl dated August 2018 is the earliest the authors could include using that index field. The processing covers 25 crawls, from August 2018 to October 2020. This matters because downloading pages from more crawls does not guarantee comparable growth in the amount of distinct usable text. Material can reappear across pages or crawls. The collection procedure has to distinguish new text from text already seen, and it also has to remove fragments that fail the corpus's language or formatting criteria.

Several filters act on lines. A retained line must end in a period, question mark, or exclamation mark and contain at least 3 words. Lines containing the strings javascript or cookies are discarded. The punctuation rule favors text that resembles a complete written unit, and the word minimum excludes very short lines. These are tests of visible properties. A line can pass them while still containing colloquial usage or missing punctuation elsewhere. Conversely, a short Czech utterance can fail them even if it would be useful to a sentiment classifier.

Other filters act on pages. Pages are discarded if they contain offensive terms, the string lorem ipsum, or an opening brace. A retained page must have at least 5 sentences. A separate language check with langdetect requires a Czech probability of at least 0.99. That condition works at the level of the page. It is consistent with the authors finding some non-Czech fragments in the corpus when preparing its vocabulary. Treating an entire page as Czech does not require every piece of text within it to belong to Czech.

Deduplication acts across the collection. When a line occurs more than once, a single occurrence is kept. The authors identify deduplication as the principal reason for removing about 98% of the downloaded plain text, and they note that additional crawls increasingly returned lines they had already seen. The resulting corpus has nearly 13 billion words, occupying 93 GB after cleaning. These counts describe the input material available for C5 pretraining. They say nothing by themselves about the relative frequency of reviews, posts, and edited prose inside the retained corpus.

This processing gives the web corpus a particular balance. It preserves original casing and draws from miscellaneous Czech pages, while rejecting many kinds of lines and pages that a raw crawl would include. The authors' later explanation of the sentiment results depends on the variety still present after this selection. That explanation concerns exposure to forms of Czech that the authors consider relevant to user writing. It is compatible with the presence of strict collection rules, which determine what kinds of user writing can survive into the corpus.

Preparing a more thoroughly processed news corpus

The data for FERNET-News come from the authors' own web-mining framework. Its contents are mainly crawled news articles together with transcripts of selected radio and television programs. The preparation removes boilerplate and HTML. It also applies text normalization, true-casing, and rule-based substitutions. True-casing adjusts capitalization, and the substitution rules address such issues as typos, expressions consisting of several words, and the unification of word forms.

The detailed corpus description gives 3.3 billion words and 20.5 GB of cleaned text. In the conclusion the authors describe the news collection as 21 GB. The detailed figure identifies the size reported alongside the account of how the corpus was prepared. It is smaller than C5 by the reported word and storage measures, and its sources and treatment differ as well. A comparison between the trained systems consequently concerns both how much text was available and what kinds of text remained after processing.

The cleanup makes the distinction between the corpora more specific than a contrast between news and the web. The news collection also draws substantially on online material, and its transcripts give it a component beyond articles. What sets it apart is a more concentrated set of sources and more direct intervention in the form of the text. C5 uses rules mainly to keep or remove material and preserves its original casing. The news preparation includes rules that change what is written. That difference becomes relevant when the downstream input contains a typo or an ordinary user spelling that a corpus editor might normalize.

Turning text into inputs

A transformer operates on tokens. Tokenization determines which units of a written input the system will process, and the vocabulary lists the units available to it. In subword tokenization, a word may correspond to a single unit or to a sequence of smaller ones. This matters to the experiment because the vocabularies are learned from the respective pretraining collections. Each system's first encounter with a downstream text therefore depends partly on decisions made before it saw any sentiment or topic labels.

FERNET-C5 uses a SentencePiece tokenizer trained on C5 with byte-pair encoding, abbreviated BPE. BPE builds units by combining pieces that occur together. The authors set its vocabulary size to 100 thousands, as they describe it, and keep the source casing. They tune SentencePiece's character coverage so that Czech characters are included while the vocabulary can accommodate a selected range of characters from the other text found in the corpus. This tokenizer takes the place of the WordPiece approach associated with Google's BERT implementation.

The C5 system otherwise uses the BERT-base architecture. It has 12 transformer blocks, 12 attention heads, and a hidden size of 768. Blocks are successive stages that transform the token representations. Attention heads provide separate ways for positions in a sequence to draw information from one another. Hidden size specifies the width of the representation passed through the network. Keeping these dimensions at the BERT-base configuration gives the authors an established network design on which to train their Czech vocabulary and weights.

FERNET-News also adopts RoBERTa-base, which has 12 blocks and 12 attention heads with a hidden dimension of 768. Its tokenizer uses byte-level BPE, beginning from byte representations of text, and has a vocabulary of 50,000 tokens. The matching block count and hidden dimensions are useful when thinking about the scale of the encoders. The inputs can still be divided into different units, the vocabularies differ in size, and the architectures are used with different objectives and schedules. The paper also specifies that its parameter counts include the output component used for language pretraining.

Pretraining FERNET-C5

The authors initialize FERNET-C5 from scratch and use Google's BERT training software. The objective combines masked language modeling with next sentence prediction. Masked language modeling asks the system to recover parts of the text hidden from the input. The targets come directly from the original text. The authors use whole-word masking, so pieces belonging to a selected word are masked together. This matters with a sub-word vocabulary, where hiding only part of a word can leave other pieces of the same word in view.

Next sentence prediction asks about the relationship between sentences. The system receives pairs assembled either from consecutive sentences or from sentences selected randomly from the corpus. Its job is to distinguish those cases. This is an auxiliary classification problem during pretraining. It uses the arrangement of sentences in the corpus for supervision, whereas the later news and sentiment decisions use dataset labels.

The authors report 6.5 million gradient steps in total. A gradient step is an update to the trainable weights based on a batch of training inputs. They use 3.5 M steps for sequences of length 128 with a batch size of 256, and 3 M steps for length 512 with a batch size of 128. The numbers for sequence length refer to the inputs processed by the transformer. Batch size describes how many inputs are used for an update. These are separate settings, and the longer sequence phase has a smaller batch size.

The paper reports a duplication factor of 5 for both input configurations. In preparing masked training instances, that setting permits repeated use of source examples with masking applied to them. Both configurations use whole-word masking. Over the first 100,000 steps, the learning rate ramps up to 1 × 10⁻⁴, setting the scale of the updates as it rises. The authors ran this training on an 8-core TPU with 128 GB of memory and report that it took about two months. These details describe one realized training run and its hardware setting.

Pretraining FERNET-News

The authors also train FERNET-News from scratch. This run uses masked language modeling alone, with dynamic masking. Text encountered again in a later pass can be masked differently and furnish a different prediction exercise. That is particularly relevant to the authors' use of the news corpus. They report about 40 passes through it during pretraining. A repeated pass exposes the system to familiar source text while changing which material is hidden and which material can serve as context.

The full run uses 600 thousand gradient steps and a batch size of 2048. The first 500 thousand steps use inputs of length 128, with 24,000 warmup steps and a learning rate of 4 × 10⁻⁴. For the following 100 thousand steps, the authors use inputs of length 512, with 2,000 warmup steps and a learning rate of 1 × 10⁻⁴. The larger batch and the way the run allocates steps to each input length are part of the RoBERTa recipe tested in the paper.

FERNET-News was trained with the HuggingFace Transformers software on two Nvidia A100 GPUs. The authors report about one month of training. The wall-clock reports place each run in its own hardware and software context. Reading them alongside the step counts is important because the steps differ in batch size and sometimes in input length, and the systems were trained on different hardware. The authors release the trained FERNET weights on the HuggingFace Hub for research use.

Adapting the pretrained systems to labels

For fine-tuning, the authors use the HuggingFace Transformers implementation on single GPUs. The pretrained transformer supplies contextual representations, and the sequence classification component makes predictions about the input as a whole. For BERT and RoBERTa, the authors use the standard pooling layers associated with the respective architectures. The relevant input to the classifier is the final hidden state of the opening token, written [CLS] for BERT and <s> for RoBERTa. That state is a vector computed after the input has passed through the transformer, where information from other positions can influence it.

The sentiment setup has a peak learning rate of 1 × 10⁻⁵, an input limit of 128 tokens, a batch size of 64, and 100 warmup steps. The authors run fine-tuning for 10 epochs. An epoch is a pass through the training examples used for that run. They tried other combinations of settings and report that this combination gave consistently strong results across the systems and sentiment datasets. The description gives a common recipe for the comparison and leaves the other settings and their scores unspecified.

After each sentiment training epoch, the system is evaluated on development data. When there is no supplied development set, the authors reserve 10% of the training samples at random for this purpose. The version selected through development performance is then evaluated on the test data. The separation gives the development data a role in choosing when to take the trained system. The test data measure the selected system's performance after that choice.

For topic identification, the peak learning rate is 5 × 10⁻⁵, the input limit is 512 tokens, and the batch size is 64. CTDC receives 20 training epochs. The authors use 10 on CN and explain that its larger training collection made that sufficient for their experiments. The input limit gives the news classifier scope to handle longer sequences than the sentiment setting. It still measures length in the system's own tokens. Distinct tokenizers can represent the same input with different numbers of tokens, which matters when interpreting a shared length limit.

Converting predictions into labels

The sentiment decision is a choice among the available classes. The classifier scores them, and the highest-scoring class is returned as the prediction for the document. The evaluation uses F1, a measure combining precision and recall. In classification, precision concerns how many predictions for a class are correct, and recall concerns how many instances of that class the classifier finds. The paper describes the sentiment comparison in terms of mean F1 and does not specify the within-fold averaging convention for the sentiment classes in its evaluation description.

Topic assignment has a different output structure. A sigmoid activation maps each output to a score between zero and one, allowing several labels to receive high scores for the same text. The paper expresses the score vector as follows.

s = (s₁, s₂, …, sₖ)

Here s is the ordered list of scores for the document. The parenthesized entries are scores for individual labels, with s₁ and s₂ denoting the first and second entries. The ellipsis stands for the intervening entries, and sₖ is the last. The subscript k in this notation corresponds to K, the total number of candidate labels in the paper.

sᵢ ∈ (0,1)

The index i designates a label, and sᵢ is the score for that label. The membership sign means the score lies in the displayed interval. The parentheses indicate that the endpoints 0 and 1 are excluded. These scores are the inputs to the paper's decision rule for producing a set of assigned labels.

sᵢ / max(s₁, s₂, …, sₖ) ≥ 0.5

The numerator sᵢ is the score of the candidate label under consideration. The function max selects the highest score among the entries for that document, where each index corresponds to a candidate label and k corresponds to the total K. The slash denotes division. The comparison sign means that the label is assigned when its score relative to the largest one is at least 0.5. Equality meets the rule.

The strongest topic for an article therefore sets the scale for the other decisions about that article. If the score of a second topic is close enough to the strongest score, the second topic is also returned. Since the scores are positive, the strongest label always qualifies. With a fixed cutoff of 0.5 applied directly to the sigmoid scores, a document could receive no label when all scores fall below the cutoff. The relative rule also allows an article to receive several labels when its scores are clustered near its maximum.

The news metric is sample-averaged F1. It compares the predicted and recorded label sets for each document and averages across documents. An article with several topics is evaluated as an article with a set of target labels. A system that returns a relevant topic while omitting others has recovered only part of that set. A system that returns many topics can capture more of the recorded labels while also adding incorrect ones. The resulting score reflects both effects, which is why the rule that turns raw scores into a label set matters to the reported performance.

Experiments and results

Three sources of sentiment labels

The movie review collection, CSFD, contains 91 thousand reviews from the Czech-Slovak Movie Database. The categories come from movie ratings. The accompanying review text is the classifier's input, and the rating-derived category supplies the target. This arrangement makes it possible to evaluate classification against a sizable body of user writing. The exact task is to predict the label associated with the review as encoded in this collection. A text may express its judgment indirectly or discuss different aspects of a film even when the rating turns the overall response into a single category.

MALL contains 145 thousand posts from the Czech online shop. The posts concern a range of products, and the user's rating again determines the sentiment class. The shared label scheme makes the review corpora comparable as sentiment tasks. The objects being evaluated differ, and with them the vocabulary and circumstances in which approval or dissatisfaction might be expressed. Success across both collections provides evidence about transfer between downstream domains within a common classification setup.

FCB contains 10 thousand Facebook posts gathered from pages with a large Czech audience. Several human annotators assigned sentiments to the individual posts. Following the dataset authors' recommendation, the study sets aside 248 posts marked bipolar and runs comparisons with positive, neutral, and negative classes. This means the Facebook evaluation has a different label provenance from the review collections. Its result concerns human-annotated posts under the retained category scheme, and it gives no direct measure of how either FERNET system handles the excluded mixed-sentiment items.

These differences are useful in reading the performance ordering. There are distinct sources of language and distinct routes to assigning a gold label. For CSFD and MALL, the rating connects the writer's own evaluation to the label. For FCB, the label is based on how annotators read the post. The paper attributes part of the Facebook result to the language found on social media. The dataset also changes along other dimensions, including the amount of available labeled data and the construction of the target. The observed F1 describes the outcome of all of those conditions together.

Two news topic collections

CTDC contains 12 thousand articles with category labels. The authors restrict the classification problem to the 37 most frequent labels out of 60 so that the experiment follows the setup used in earlier work. That choice defines the label inventory that the trained system has to score and makes its evaluation more comparable to prior work under the same restriction. The resulting measure concerns those retained categories. It gives no performance estimate for the original, fuller inventory.

The other news dataset, CN, contains 250 thousand articles from a 10-years period. The content comes from ceskenoviny.cz. The authors' framework keeps topic labels associated with articles and maps frequent source labels to the standardized IPTC topic tree. The paper uses articles with assigned IPTC topics from this source because the authors regard its labeling as thorough and consistent. CN has 577 labels, and each selected article carries one or more of them.

CN and CTDC offer different views of multilabel classification. CN pairs a larger document collection with a much broader inventory of candidate labels. On either dataset a system has to select a set of labels for each document, but a broader inventory changes the field of scores to which the relative threshold is applied. A comparison between the resulting scores involves the labeling scheme, the article collection, and the amount of training data as well as the system. CN is the only private dataset in the paper. The authors say that they lack a license to publish it.

Held-out evaluation and comparison systems

The study uses 10-fold cross-validation for the sentiment datasets and for CTDC, which lack a separate test dataset in this setup. Cross-validation rotates the held-out portion of the data. For each pretrained starting point and dataset, a separate fine-tuning run is performed for each fold, and results are reported as a mean and a standard deviation. The mean describes the center of the scores across folds. The standard deviation describes how dispersed those scores are across the held-out portions under the chosen procedure.

For the sentiment datasets, the folds are stratified, meaning that the split preserves the class proportions. This makes the sentiment mix more comparable from fold to fold. The paper describes the topic identification splits used for cross-validation as random. CN has separate test data and is outside the cross-validation arrangement. Its result consequently has a different evaluation basis from the fold means. The authors' report of a fold standard deviation applies to settings that have folds.

The published alternatives give the comparison several reference points. MultiBERT and SlavicBERT represent broader and more concentrated language coverage using Wikipedia. XLM-RoBERTa-base represents large-scale multilingual web pretraining. Among the published Czech-only systems, Czert and RobeCzech bring different mixtures of corpus sources and established architecture choices. These systems matter because a gain over a broad multilingual system can have a different practical reading from a gain over a Czech-only system trained with a different corpus recipe.

The authors organize their result tables around a base-size category and put XLM-RoBERTa-large in a separate row. XLM-RoBERTa has 270 million parameters in the base version and 550 million in the large version. Those counts describe the published XLM-RoBERTa systems. The large system is also considerably bigger than either FERNET system, which is why the comparison separates it. The base-size grouping makes the comparison more informative about systems with roughly comparable capacity, while allowing differences in vocabulary and architecture within the group.

Sentiment results

FERNET-C5 occupies the leading position among the base-sized systems on movie reviews, product reviews, and Facebook posts. The consistency across datasets matters because the result persists as the origin of the text changes. It covers both rating-derived review tasks and the separately annotated Facebook task. The claim is about F1 under the paper's fine-tuning and evaluation procedure. It concerns the results after adaptation to each dataset, rather than the ability to assign these labels directly from pretraining.

The paper's conclusion gives the explicit pair of F1 values for Facebook posts. The chart compares the two new Czech systems for this dataset, whose results use stratified cross-validation. A higher value indicates stronger combined precision and recall under the paper's sentiment scoring procedure.

FERNET systems on FCB Facebook sentiment, mean held-out F1

Czech web pretraining leads Czech news pretraining on the Facebook sentiment task.

FERNET systems on FCB Facebook sentiment, mean held-out F1FERNET-News: 75.94FERNET-News75.94FERNET-C5 (this paper): 81.07FERNET-C5 (this paper)81.07
The numbers
System or settingF1
FERNET-News75.94
FERNET-C5 (this paper)81.07

The authors connect this result to how people write online. They point to emotionally charged posts, forms close to spoken Czech, and omissions of punctuation or diacritics. FERNET-C5 saw text drawn from a wide range of webpages, which the authors argue gives it better exposure to those phenomena. FERNET-News had fewer and more concentrated sources and used normalization that can alter some of the forms a classifier later encounters. The study demonstrates a difference in the resulting classifiers' F1 on FCB. The connection to particular linguistic features is the authors' explanation for that difference.

The paper also describes strong sentiment results from the XLM-RoBERTa systems as consistent with a benefit from web pretraining. Their training included Common Crawl data, although their coverage spans languages and their training recipe differs from FERNET-C5's. That observation is relevant precisely because a favorable result here can coexist with multilingual training. The authors' original motivation concerns weak representation of Czech in many multilingual systems. The sentiment comparison also shows why source coverage is a separate part of the explanation from the choice between multilingual and Czech-only training.

The conclusions identify 75.94 and 81.07 as F1 values on Facebook sentiment. They do not make those values explicit for reviews, for the other published alternatives on Facebook, or as a breakdown by sentiment category. The sentiment result that can be stated across all the datasets is the ordering within the base-sized group. The Facebook pair provides a numerical example of that performance difference and should be read at the level of the dataset and metric, rather than as the success rate for any individual category of post.

News topic results

On CTDC and CN, both FERNET systems score above the other base-sized systems on sample-averaged F1. This extends the base-size result to a setting where prediction involves a set of labels and the inputs are news articles. The authors expected an advantage for FERNET-News because its pretraining data were drawn substantially from news and its architecture follows RoBERTa. FERNET-C5 performs comparably well, and on CTDC it places ahead of FERNET-News. The paper gives the direction of this comparison in its results discussion.

FERNET-C5 also finishes ahead of XLM-RoBERTa-large on CTDC, but the authors report that this difference is statistically insignificant. The distinction is important. The reported mean comparison puts FERNET-C5 first in that pairing. The significance qualification limits what can be inferred about the strength and reliability of that ordering. The paper's broader account says the base-sized FERNET systems usually fall slightly below the large multilingual system, while producing broadly comparable results.

One practical reading of the news findings is about coverage of a second style of Czech. The same pretrained C5 weights that supply the strongest base-sized starting point on user sentiment also allow competitive adaptation to edited article text. The downstream learning is performed separately for those uses. The shared element is the C5 starting point, which can be fine-tuned for both. The result thus includes the performance of the news fine-tuning procedure and the relative-score label rule. It is not a test of whether the unlabeled web corpus already supplied the exact categories in either news dataset.

CTDC and CN should also be read on their own terms. CTDC offers a public evaluation with a restricted frequent-label setup and cross-validated scores. CN tests a larger private collection with a separate test set and a broader topic inventory. A favorable base-size ordering on both indicates that the comparison is not confined to one particular inventory or split procedure. The actual per-system news scores are not stated in the results discussion. The supported numerical context is the size and label inventory of each task, while the reported performance comparison gives the ordering and the significance qualification for CTDC.

What the ablations show

A direct comparison of label decision rules

The paper reports no ablation in which the corpus, tokenizer, or objective is changed one at a time with the rest of the pretraining recipe held constant. It does describe a downstream comparison between two ways to assign topic labels, along with a search over fine-tuning settings and comparative analyses of the complete pretrained systems.

The label rule is the clearest comparison of a specific component. Under the simpler rule, each sigmoid score is compared to a fixed cutoff of 0.5. Under the adopted rule, the maximum score for the article establishes the scale and each label's score is judged relative to it. The authors report consistently better results for the relative rule. Because this change is applied to the classifier's output, it addresses how decisions are made from the scores. It does not require a different pretraining corpus or a different representation of the text.

The two rules can behave differently even when the ranking of topics is identical. Imagine that an article has a clear leading topic and the remaining scores are far below it. Expressing each score relative to the leader keeps that gap visible in the decision rule. Imagine instead that the system gives an article low absolute scores but ranks several topics close together. The relative rule can return those topics despite their low absolute scores. A fixed cutoff in the same situation can return an empty set. The comparison consequently tests whether a cutoff tied to the article's own pattern of scores produces a better fit to the benchmark labels.

Both news collections contain articles with at least one assigned topic. Returning at least the strongest topic suits that construction. It only helps sample-averaged F1 when the retained labels overlap sufficiently with the recorded set. Extra labels can also reduce precision. The reported direction indicates that the adopted rule strikes a better balance in the authors' experiments. The paper supplies no numerical comparison for the two settings, so the size of the improvement and the extent to which it varies across datasets cannot be read from that statement.

What the complete-system comparisons reveal

The comparison between FERNET-C5 and FERNET-News gives evidence about the finished training recipes. The two systems share the broad dimensions of a base encoder and receive the same downstream settings within each task. A higher score after fine-tuning then tells the reader which recipe yielded the more effective starting point for that evaluation. This is useful for choosing a pretrained system and for identifying patterns worth explaining. It does not estimate the effect of changing a single pretraining component.

The sentiment pattern is consistent with the authors' account of corpus variety. FERNET-C5 leads on the rating-based review datasets as well as on Facebook, and the latter comparison is the one for which the conclusions give exact scores. The result fits an explanation based on exposure to many kinds of user writing. The authors also see support in the sentiment performance of web-trained XLM-RoBERTa. That support is comparative. There is no analysis of F1 for posts with missing diacritics, for posts with spoken forms, or for otherwise similar posts with and without those features.

The news comparison puts a different expectation under pressure. If correspondence between pretraining genre and evaluation genre dominated all other choices in these recipes, FERNET-News would be expected to have an advantage on news. FERNET-C5's strong performance, including its higher CTDC score, shows that the web-based recipe can compete in that domain. C5 has more text, includes varied websites, and uses a different training setup. A broad corpus can also contain text resembling articles. The evidence leaves room for an advantage from news pretraining under other conditions while showing that genre matching alone does not explain the CTDC ordering.

The comparison with the larger XLM-RoBERTa system addresses a practical question about system choice. FERNET-C5 can reach a similar level on these tasks and has a higher reported CTDC score, with the stated significance caveat. This puts the performance of a base-sized Czech system in perspective. It does not separate parameter count from training languages, source text, or architectural choices. The larger system is a performance reference from another training recipe, and its results show what that reference achieves under the study's downstream evaluation.

What is known about the fine-tuning settings

The authors report that the selected sentiment settings worked consistently well when compared with others they tried. This supports their use of a shared setup for the sentiment comparison. It also clarifies the claim the experiment can make. The leaderboard concerns performance under the authors' selection of learning rate, input limit, batch size, epoch count, and warmup. It does not rank every pretrained system under its independently optimized settings.

Development evaluation also contributes to the comparison. Choosing a version after checking performance at each epoch makes allowances for performance to peak at different points during a run. The selected checkpoint can differ across systems and folds even though the epoch budget is shared. The paper's description provides enough to understand this selection procedure. It does not report the individual development trajectories or the search results needed to attribute the downstream gains to any particular fine-tuning choice.

These analyses operate at different levels. The label-rule comparison shows a benefit from altering prediction decisions. The corpus and architecture comparisons establish relative performance for complete systems. The account of tuning describes how the authors arrived at the framework in which those comparisons take place. Keeping those levels distinct gives the corpus interpretation its proper weight. The paper has direct evidence about which pretrained starting points worked well and more tentative evidence about why their rankings turned out as they did.

Limitations

Limits the authors state

The first explicit limit concerns CN. The authors cannot release this dataset under its license. Researchers can obtain the pretrained FERNET weights, but those weights do not supply the private labeled collection needed to run the CN evaluation on the same articles. The public datasets account for the reproducible part of the comparison that can be reconstructed without access to CN. The private task still contributes a separate empirical result, with external replication constrained by access to the evaluation material.

The authors also state a statistical limit to the CTDC comparison with XLM-RoBERTa-large. FERNET-C5 scores higher, but the difference is statistically insignificant. A single ordering of reported means can be used to describe the outcome. The authors' qualification means the paper does not establish a reliable lead over the large system on that dataset. This is distinct from the broader observation that the base-sized FERNET systems generally reach a similar level and are usually slightly behind the larger alternative.

The task definitions place explicit limits on what is scored. In FCB, the authors exclude the bipolar examples and report a result for the remaining sentiment scheme. In CTDC, they choose the most frequent subset of topics for comparability with previous research. Each score is valid for its specified setup. Extending the conclusion to mixed sentiment or the full original CTDC label set would require evaluations that include those cases.

The authors describe FERNET-C5 as working across the domains they tested. Their broadest conclusions about varied web text are motivated by those domains and the forms of Czech they observe in user writing. The paper tests sentiment and news topic classification, both after fine-tuning. The experiments do not directly assess conversational understanding, recovery of missing diacritics, or any other separate linguistic skill. A system can be useful across all the evaluated corpora without the study establishing general performance across Czech language processing.

Limits visible in the experimental design

The largest interpretive limit is the number of things changed together in pretraining. FERNET-C5 has a larger and more varied source collection and uses different rules for retaining or altering text. Its vocabulary has a different size and is built by a different tokenizer. The systems use different architectures within the BERT and RoBERTa family, and one pretraining setup includes next sentence prediction. Batch sizes, step schedules, masking, and hardware also differ. The common downstream procedure makes the resulting systems comparable for the stated tasks. It cannot recover the effect of an individual pretraining variable from their final scores.

This matters particularly to the claim about everyday Czech. The authors give a concrete linguistic explanation for the sentiment ordering, but the experiments do not quantify the coverage of colloquial forms in each corpus. They also do not compare downstream errors on otherwise similar examples grouped by punctuation, spelling, or register. C5's filters would remove some forms of short or unpunctuated writing, and its broader sources may preserve other relevant patterns. The size of the corpus could contribute independently of its register. The FCB result is consistent with the explanation about varied language and leaves these possibilities unresolved.

The preprocessing choices also make the names of the corpora an incomplete guide to the contrast. The news material includes broadcast transcripts in addition to written articles. The Common Crawl collection can contain news as part of the wider web. Source domains therefore need not be mutually exclusive. The two collections differ in concentration, treatment, and scale. The evidence shows that greater concentration on news did not guarantee the strongest CTDC result under these recipes. It does not measure the benefit of adding or removing news from an otherwise fixed corpus.

The study describes removing repeated lines within C5. It does not report a comparison of the pretraining collections against the downstream test documents. In an experiment using web crawls for pretraining and online writing for classification, those are separate questions. Corpus deduplication reduces repeated material within the pretraining input. An overlap check would determine whether material corresponding to evaluation items appeared there. The paper supplies no result on that question, so the degree of overlap remains unknown.

Uneven class performance is another open issue. F1 records a balance of precision and recall, but the aggregate values alone cannot show which sentiment labels benefited most or which labels were commonly confused. For news, sample-averaged F1 summarizes the quality of per-document label sets. It gives no direct breakdown by topic frequency or by the number of labels an article should receive. A system may achieve a strong average through gains on some parts of a dataset while showing little change on others. The paper's results support the aggregate comparison and leave that distribution of gains unspecified.

The threshold rule also ties the news findings to the evaluated datasets' assumption that a document carries at least one topic. It always returns a strongest label. That design fits the benchmark and helps explain why a fixed absolute cutoff may fare worse. An application where texts can legitimately fall outside all available topics would call for evaluating the behavior of that forced assignment. Such cases are outside the news setup here. The reported comparison also does not establish how well the sigmoid scores represent absolute confidence, since the adopted decision uses their relative values.

Finally, the reported runtimes are linked to specific hardware, software, inputs, and schedules. A month of one training run and two months of another do not furnish a controlled comparison of the computational cost of RoBERTa and BERT. The size grouping in the classification results is better suited to the paper's stated purpose of comparing performance across available pretrained systems. It is still approximate. Vocabulary size affects parameter counts, and using the same maximum number of tokens can expose different lengths of original text when tokenizers segment it differently. These setup choices are part of the practical comparison and limit claims about equal resources.

What came after

Discovery@FI at #SMM4H–HeaRD 2026 cites the Czech transformer comparison in a study of multilingual clinical named entity recognition. The later work identifies its method as an ensemble character classifier. An ensemble combines predictions from multiple classifiers, and the task shifts the unit of prediction from a whole review or article to entities within text. The two studies thus concern different ways of turning language representations into labels, with different inputs and evaluation targets.

The citation establishes a connection to later work on multilingual classification in a clinical setting. The later work's described method is character-based, while the Czech comparison trains sub-word vocabularies and evaluates document-level decisions. The citation record leaves open which system, result, or design choice from the Czech study informed the later experiment. It supplies no later result on the relative merits of Czech news and Common Crawl pretraining.

Cite

Cite as Jan Lehečka and Ján Švec. 2021. Comparison of Czech Transformers on Text Classification Tasks. Lecture notes in computer science.

The paper itself, not this page. BibTeX from the library's record of the work. DOI 10.1007/978-3-030-89579-2_3 · arXiv 2107.10042

@inproceedings{lehecka2021comparison,
  title = {{Comparison of Czech Transformers on Text Classification Tasks}},
  author = {Jan Lehečka and Ján Švec},
  booktitle = {Lecture notes in computer science},
  year = {2021},
  doi = {10.1007/978-3-030-89579-2\_3},
  eprint = {2107.10042},
  archivePrefix = {arXiv},
  url = {https://doi.org/10.1007/978-3-030-89579-2_3}
}

↑ back to top

This page in Markdown https://md.research.elamur.ai/free/en/papers/lehecka-2021-comparison-czech-transformers-text-classification/

References

20 references, from the paper's own bibliography.

  1. Ashutosh Adhikari, Achyudh Ram, Raphael Tang, and Jimmy Lin. DocBERT: BERT for document classification. arXiv preprint arXiv:1904.08398, 2019. OpenAlex ↗ · Scholar ↗
  2. Mikhail Arkhipov, Maria Trofimova, Yurii Kuratov, and Alexey Sorokin. Tuning multilingual transformers for language-specific named entity recognition. In Proceedings of the 7th Workshop on Balto-Slavic Natural Language Processing, pages 89–93, 2019. our card
  3. Alexis Conneau, Kartikay Khandelwal, Naman Goyal, Vishrav Chaudhary, Guillaume Wenzek, Francisco Guzmán, Édouard Grave, Myle Ott, Luke Zettlemoyer, and Veselin Stoyanov. Unsupervised cross-lingual representation learning at scale. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 8440–8451, 2020. our card
  4. Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. BERT: Pre-training of deep bidirectional transformers for language understanding. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pages 4171–4186, Minneapolis, Minnesota, 2019. Association for Computational Linguistics. our card
  5. Ivan Habernal, Tomáš Ptáček, and Josef Steinberger. Sentiment analysis in Czech social media using supervised machine learning. In Proceedings of the 4th workshop on computational approaches to subjectivity, sentiment and social media analysis, pages 65–74, 2013. our card
  6. Pavel Kral and Ladislav Lenc. Czech text document corpus v 2.0. In Nicoletta Calzolari (Conference chair), Khalid Choukri, Christopher Cieri, Thierry Declerck, Sara Goggi, Koiti Hasida, Hitoshi Isahara, Bente Maegaard, Joseph Mariani, Hélène Mazo, Asuncion Moreno, Jan Odijk, Stelios Piperidis, and Takenobu Tokunaga, editors, Proceedings of the Eleventh International Conference on Language Resources and Evaluation (LREC 2018), Paris, France, May 2018. European Language Resources Association (ELRA). OpenAlex ↗ · Scholar ↗
  7. Michal Křen, Václav Cvrček, Tomáš Čapka, Anna Cermáková, Milena Hnátková, Lucie Chlumská, Tomá s Jelínek, Dominika Kováříková, Vladimír Petkevič, Pavel Procházka, Hana Skoumalová, Michal Škrabal, Petr Truneček, Pavel Vondřička, and Adrian Zasina. SYN v4: large corpus of written czech, 2016. LINDAT/CLARIAH-CZ digital library at the Institute of Formal and Applied Linguistics (ÚFAL), Faculty of Mathematics and Physics, Charles University. OpenAlex ↗ · Scholar ↗
  8. Taku Kudo and John Richardson. SentencePiece: A simple and language independent subword tokenizer and detokenizer for neural text processing. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing: System Demonstrations, pages 66–71, Brussels, Belgium, November 2018. Association for Computational Linguistics. our card
  9. Jan Lehečka, Jan Švec, Pavel Ircing, and Luboš Šmídl. Adjusting BERT’s pooling layer for large-scale multi-label text classification. In International Conference on Text, Speech, and Dialogue, pages 214–221. Springer, 2020. OpenAlex ↗ · Scholar ↗
  10. Ladislav Lenc and Pavel Král. Deep neural networks for czech multi-label document classification. In International Conference on Intelligent Text Processing and Computational Linguistics, pages 460–471. Springer, 2016. OpenAlex ↗ · Scholar ↗
  11. Yinhan Liu, Myle Ott, Naman Goyal, Jingfei Du, Mandar Joshi, Danqi Chen, Omer Levy, Mike Lewis, Luke Zettlemoyer, and Veselin Stoyanov. Roberta: A robustly optimized bert pretraining approach. arXiv preprint arXiv:1907.11692, 2019. our card
  12. Martin Majliš. W2C – web to corpus – corpora, 2011. LINDAT/CLARIAH-CZ digital library at the Institute of Formal and Applied Linguistics (ÚFAL), Faculty of Mathematics and Physics, Charles University. OpenAlex ↗ · Scholar ↗
  13. Louis Martin, Benjamin Muller, Pedro Javier Ortiz Suárez, Yoann Dupont, Laurent Romary, Éric de la Clergerie, Djamé Seddah, and Benoît Sagot. CamemBERT: a tasty French language model. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 7203–7219, Online, July 2020. Association for Computational Linguistics. our card
  14. Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J. Liu. Exploring the limits of transfer learning with a unified text-to-text transformer. Journal of Machine Learning Research, 21(140):1–67, 2020. our card
  15. Jakub Sido, Ondřej Pražák, Pavel Přibáň, Jan Pašek, Michal Seják, and Miloslav Konopík. Czert–czech bert-like model for language representation. arXiv preprint arXiv:2103.13031, 2021. our card
  16. Milan Straka, Jakub Náplava, Jana Straková, and David Samuel. Robeczech: Czech roberta, a monolingual contextualized language representation model. arXiv preprint arXiv:2105.11314, 2021. OpenAlex ↗ · Scholar ↗
  17. Chi Sun, Xipeng Qiu, Yige Xu, and Xuanjing Huang. How to fine-tune BERT for text classification? In China National Conference on Chinese Computational Linguistics, pages 194–206. Springer, 2019. our card
  18. Jan Švec, Jan Lehečka, Pavel Ircing, Lucie Skorkovská, Aleš Pražák, Jan Vavruška, Petr Stanislav, and Jan Hoidekr. General framework for mining, processing and storing large amounts of electronic texts for language modeling purposes. Language Resources and Evaluation, 48(2):227–248, 2014. OpenAlex ↗ · Scholar ↗
  19. Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. In Advances in neural information processing systems, pages 5998–6008, 2017. our card
  20. Antti Virtanen, Jenna Kanerva, Rami Ilo, Jouni Luoma, Juhani Luotolahti, Tapio Salakoski, Filip Ginter, and Sampo Pyysalo. Multilingual is not enough: Bert for finnish. arXiv preprint arXiv:1912.07076, 2019. our card