Elamur Research

PTT5: Pretraining and validating the T5 model on Brazilian Portuguese data

Paper · 2020 · Diedre Santos do Carmo, Marcos Piau, Israel Campiotti et al.

Summary

A system can learn from a great deal of text and still have relatively little experience with the language in which it will be used. Carmo and colleagues investigate that problem for T5, a system that can take text as input and produce text in response. They start from the existing T5 weights and continue training on BrWac, a large collection of Brazilian Portuguese webpages. They also test a separate change in how the system reads text. Alongside versions that retain T5’s original vocabulary of word pieces, they train versions that use a vocabulary learned from Portuguese Wikipedia. The resulting family is called PTT5.

The authors evaluate the adaptation on tasks that ask for different kinds of answers. In ASSIN 2, a pair of sentences can receive a score for semantic similarity or a decision about whether one sentence implies the other. In HAREM, the task is to find expressions such as people’s names, locations, and dates and assign them categories. That last task uses generated text. PTT5 produces a version of the input with labels inserted, and the evaluation procedure maps those labels back onto the words. The main sentence-pair experiments instead use prediction layers attached to the part of T5 that reads the input. Named entity recognition

Continuing pretraining on Portuguese improved on the original T5 starting point in both ASSIN 2 tasks and in the HAREM comparison. The Portuguese vocabulary further helped in ASSIN 2 and brought a smaller gain in entity recognition. PTT5 Base was competitive with BERTimbau on ASSIN 2 and achieved the best test mean squared error for similarity in the paper’s comparison. BERTimbau Large still led the overall ASSIN 2 comparison, and Portuguese BERT held a small advantage on MiniHAREM. Within PTT5, the larger variant also had mixed results. It reached the lowest entailment loss on the validation split, while PTT5 Base had the stronger reported test correlation for similarity.

The authors also ask how much of T5 needs to change during Portuguese pretraining. Updating only the vocabulary embeddings reduced the time per epoch for the base and large variants and produced similarity results that looked comparable on the ASSIN 2 validation split. Updating all weights gave much better results on the test split in that comparison. Together, the experiments make a case for testing the pretraining corpus, the vocabulary, and the task output separately. They also show why a promising validation curve can be an incomplete guide to which version transfers best.

Deep dive: PTT5: Pretraining and validating the T5 model on Brazilian Portuguese data

PTT5 adapts T5 to Brazilian Portuguese and tests how Portuguese pretraining and vocabulary affect sentence comparison and entity recognition. · about 33 minutes to read

The problem and its context

Bringing pretraining to Portuguese

In the research context the authors describe, progress in natural language processing drew heavily on resources in languages other than Portuguese. Pretraining offered a way to use a different kind of resource from the examples ordinarily needed to teach a task. A collection of Portuguese sentences could support learning before anyone supplied a similarity score, judged whether one sentence followed from another, or marked the names in a document. The later task could then start from parameters already exposed to the language.

This division of labor matters because the resources serve different purposes. A web corpus supplies many examples of Portuguese in use. An entailment dataset supplies judgments about selected pairs of sentences, and a named entity dataset supplies annotations of selected passages. The webpages can support an exercise in reconstructing text. The annotated datasets tell the system which distinctions it must make and give researchers a way to check its answers. Both stages contribute to what the final task system learns. Language models & pretraining

The authors situate PTT5 in a line of work on training for a particular language. They describe earlier studies in which pretraining on a single target language worked well for tasks in that language, including studies comparing such systems with alternatives trained on multilingual collections. The particularly relevant precedent was Portuguese BERT. Earlier work had already used Portuguese pretraining to improve task performance, and BERTimbau used the same BrWac corpus that PTT5 would use. The authors therefore had an existing Portuguese corpus and a strong comparison from another architecture.

The question was whether the same direction made sense for T5. The existing T5 checkpoint, a saved set of learned parameters, gave the authors a way to begin from a system with prior training. They could expose it to Brazilian Portuguese and see how its later task performance changed. They could also retain the original checkpoint for a direct comparison. In that comparison, both versions receive Portuguese examples during fine-tuning, the stage in which labeled examples teach the particular task. The difference of interest is the Portuguese training that one version receives before it sees those task labels.

Even with that distinction, the intervention covers more than one possible change. Text from a different corpus changes what the system reads. A different vocabulary changes the units in which it reads that text. A different choice about which parameters can update changes where adaptation can take place. The authors vary these choices because a favorable result for a fully adapted system would give limited information about which parts of the process mattered.

Why start with T5?

The paper’s reason for choosing T5 is its ability to produce a sequence of text. An ordinary prediction layer can return a class or a score. The text output interface can express those answers too, and it can support outputs whose length and content depend on the input. The paper points to translation, abstractive question answering, and summarization as motivations. An abstractive answer or summary can be phrased anew, so the ability to generate text is directly relevant to those tasks. Machine translation · Question answering · Text summarization

T5 has a part that reads an input sequence, called the encoder, and a part that produces an output sequence, called the decoder. An encoder takes the pieces of the input and forms a representation of them in context. The decoder can use that representation to generate an answer. The two parts consequently offer different ways to get a result. A researcher can take the encoder’s representation and use a task-specific prediction layer, or ask the decoder to express the result as a sequence. Transformer and attention

PTT5’s evaluation gives both interfaces a role. A sentence-pair score has a predetermined range, and entailment has fixed answer categories. These are natural settings in which to compare string generation with a prediction layer. A passage can contain multiple named entities, with boundaries and types that vary from sentence to sentence. HAREM gives the authors an opportunity to encode that structured information in generated text. Translation and summarization explain the architectural motivation, while the benchmarks address the specific Portuguese tasks chosen for the study. Text generation

There is also a distinction between the language of a pretraining corpus and the languages represented when a vocabulary is learned. The paper describes original T5 pretraining in the HAREM comparison as English pretraining. It describes the construction of the original vocabulary separately, using webpages in English, German, French, and Romanian. The original vocabulary is therefore the shared point of comparison throughout PTT5’s experiments. A version can use that vocabulary while receiving a substantial additional period of training on Portuguese text.

Why the pieces of words matter

A vocabulary in this setting is the inventory of units into which text can be divided. A unit may be a word or part of one. Those units form a sequence that the system can process, and each unit has an associated representation among the learned parameters. How a word divides can therefore affect both how many positions it uses in the sequence and which learned representations contribute to its treatment. The paper investigates that design choice by training a Portuguese inventory with the same capacity as the original one. Subword tokenization

A vocabulary adapted to Portuguese has an intuitive appeal when the system will spend its time reading Portuguese. There is also a reason to keep the original one. The starting checkpoint has learned to use the entries in that inventory, and keeping it allows those entries to keep their established meanings. Introducing a new inventory asks the continued training stage to accommodate a changed mapping between pieces of text and vocabulary entries. The experiment thus puts a potential linguistic advantage alongside the practical advantage of continuity with the checkpoint.

That tension gives the study a rationale beyond building another Portuguese system. An adaptation can be harder to train under the pretraining objective and still provide a better starting point for a supervised task. Similarly, a version that changes only a small part of the checkpoint can be attractive on training cost even if the full update transfers better. The paper brings these possibilities into the same study by recording pretraining behavior and then evaluating the resulting checkpoints on labeled Portuguese tasks.

The method, step by step

From Brazilian Portuguese web text to task predictions

The steps in order.

From Brazilian Portuguese web text to task predictionsStep 1: Repair encoding in BrWac text1. Repair encoding in BrWac textStep 2: Pack sentences into training examples2. Pack sentences into training examplesStep 3: Apply the original or Portuguese vocabulary3. Apply the original or Portuguese vocabularyStep 4: Mask input pieces and reconstruct the text4. Mask input pieces and reconstruct the textStep 5: Update all weights or vocabulary embeddings5. Update all weights or vocabulary embeddingsStep 6: Adapt checkpoints using labeled Portuguese examples6. Adapt checkpoints using labeled Portuguese examplesStep 7: Score predictions on held-out data7. Score predictions on held-out data

Preparing the web text

The authors use BrWac for the stage that teaches T5 from unlabeled Portuguese. BrWac was assembled from a crawl of more than 60 million webpages. Quality filtering retained 3.5 million pages, yielding a corpus described as containing 2.7 billion tokens. These are statistics for the corpus, before the authors’ preparation of the particular examples that enter PTT5 pretraining. They indicate the size of the resource from which the reconstruction exercises are made.

The first practical issue is deciding where each example ends. The authors join adjacent sentences within a limit of 512 words. When a sentence would push the current example over the limit, it goes into the following example. A sentence that by itself exceeds 512 words is handled separately, with its text cut at that limit. Packing this way typically preserves complete sentences, including when several short ones share an example. An exceptionally long sentence follows the truncation rule.

For this operation, a word is counted with Python’s split function. The authors also use ftfy to repair encoding problems. The prepared text occupies 15.6 GB, and the paper reports a mean of 360 words per document after preprocessing. Those word counts describe the prepared text before it is represented as sub-word units. A word that divides into several pieces will occupy several positions when it reaches T5, which is why the packing limit and the eventual sequence limit are separate parts of the procedure. Tokenization

This distinction becomes important when reading the reported settings. The sentence-packing procedure decides which stretches of natural text form an example. The later tokenization procedure determines how many positions the example occupies. A passage that fits the word-level budget can still require truncation at the token level. Conversely, an example that ends early because the next sentence would overflow can receive padding when represented for training. The authors apply the same preparation before passing examples to either vocabulary.

Building a Portuguese vocabulary

The original T5 vocabulary was made with SentencePiece from Common Crawl text in English, German, French, and Romanian. The authors retain SentencePiece for their Portuguese alternative. Its input is a random selection of 2 million sentences from Portuguese Wikipedia. This makes Wikipedia the source of the inventory of word pieces, while BrWac supplies the text on which the parameters are subsequently trained. Those are distinct uses of Portuguese text.

The vocabulary is learned with the Unigram approach identified in the paper, and its size is set in advance to 32,000 wordpieces. The resulting inventory provides entries from which a sentence can be represented as a sequence of pieces. A trained inventory can determine the divisions for words and parts of words across new inputs, including those encountered in BrWac and in the supervised tasks. The Portuguese vocabulary is a change in that inventory, with the same entry count as the original.

The authors preserve the control tokens for padding, ending a sequence, and indicating an unknown item. These serve specific roles independent of the ordinary pieces used to represent words. Padding fills out shorter sequences to the required length. The end-of-sequence token identifies a boundary. The unknown token supplies a designated representation for material that requires it. Keeping these controls and the vocabulary size allowed the authors to continue from the original checkpoints with the same overall T5 architecture.

That compatibility concerns the dimensions and interface of the checkpoint. When a vocabulary entry refers to a different piece of text, the system may still need to learn a different use for it. This is the reason the original and Portuguese vocabularies constitute an informative comparison even though they have the same size. The study holds the count of available entries fixed while varying the inventory and the text used to learn it.

Continuing pretraining by reconstructing text

The authors start each pretraining run from the corresponding original T5 checkpoint. BrWac then provides examples for denoising, an exercise in which a clean sequence supplies both the material to corrupt and the answer to recover. The input is a version with tokens hidden, and the training target is the original token sequence. In the paper’s illustrative Portuguese sentence, words such as belo, aprendermos, and maravilhoso stand in positions that a mask has hidden. The actual exercise hides tokens, which can be pieces of words.

The training setting assigns a 15% corruption rate to the input tokens, following the original T5 experiment the authors adopt. The encoder reads the altered sequence, and the output is trained against the clean sequence. This task can be repeated over web text without collecting task labels. The unaltered sequence already specifies the expected answer. The surrounding text gives the system information it can use when forming predictions for what it should produce.

The pretraining objective is cross-entropy. It gives the system a lower loss when it assigns greater probability to the expected tokens. Adafactor performs the parameter updates, and the learning rate stays at 0.003. The authors use the official T5 implementation in TensorFlow and run pretraining on Google Cloud TPU v3-8 hardware. The reported runs last four epochs, where an epoch is a pass through the pretraining data. The authors made their implementation and trained checkpoints available.

For both the input and the reconstruction target, the sequence limit is 512 tokens. The training procedure truncates a longer sequence and pads a shorter one. At this stage the word pieces count as tokens, so the two vocabularies can break up the same stretch of text differently within the common limit. The reported method controls the maximum number of positions. How much original text those positions cover can depend on the resulting segmentation.

The main choice about parameter updates is whether everything can adapt. In the whole-system runs, all the weights are trainable, including the vocabulary embeddings. An embedding is a learned numerical representation associated with a token. In the restricted runs, the authors update these vocabulary representations and hold the remaining weights fixed during pretraining. The rest of T5 still participates in reading and reconstructing the text. Its weights stay at their starting values during that stage, so only the embeddings can change in response to the Portuguese reconstruction exercise.

This gives the authors several comparisons within a common setup. For a given size and update strategy, they can retain the original vocabulary or introduce the Portuguese one. For a given vocabulary, they can permit either a full update or an embedding-only update. Each adapted checkpoint then becomes a candidate starting point for the supervised task. The distinction between these stages matters. An embedding-only run describes the scope of unsupervised adaptation, and the resulting checkpoint still goes through the paper’s task training procedure.

Preparing sentence pairs for ASSIN 2

ASSIN 2 uses pairs of short Portuguese sentences. The similarity task asks for a number from 1 to 5 that represents how close the sentences are in meaning. The entailment task asks whether the relevant implication holds between them. Its categories are entail and none. A pair expressing related subject matter can receive a similarity judgment even where the implication decision requires a different sort of reasoning. The dataset consequently gives the authors both a numerical prediction problem and a classification problem. Text classification

Both tasks pass the pair to T5 in the following template.

ASSIN sentence1: [S1] [eos] sentence2: [S2] [eos]

ASSIN is the literal task marker. sentence1: and sentence2: are the literal labels that introduce the first and second sentences. [S1] and [S2] stand for the respective sentence strings, and each [eos] denotes the end-of-sequence token used at that boundary. The template supplies an ordered pair, which is important for a task that asks about implication between the sentences.

For similarity, the first output strategy asks the decoder to write a literal score as text. The authors cap this generation at 5 tokens and convert the resulting string to a floating-point number. The written score thus passes through two representations on the way to evaluation. It is a sequence of tokens for T5 and a numeric value for the scoring procedure. The sequence approach follows the regression strategy the authors attribute to the original T5 work. Regression here means predicting a quantity on a scale.

The other similarity strategy reads the encoder’s final hidden state. That state contains a representation at each input position. In the paper, a linear layer with sigmoid activation takes the mean of those representations across the sequence as its input. The linear layer combines the representation into a scalar, and the sigmoid puts that scalar on a scale from which the authors can obtain a prediction in the required score range. They apply the following rescaling.

4y + 1

y is the scalar returned by the sigmoid. 4 sets the width of the rescaled interval, + denotes addition, and 1 shifts its lower boundary to the bottom of the ASSIN 2 scale. The full expression is the predicted similarity score. The paper uses mean squared error for similarity. It squares the error between the predicted score and the reference score for each example, then averages those errors. Larger misses therefore count more strongly than smaller ones.

For entailment, the authors attach a linear layer to the encoder’s final hidden state. The output layer has two neurons corresponding to the two judgment categories. A softmax converts the outputs into probabilities for the categories, and cross-entropy penalizes low probability assigned to the correct judgment. The entailment method specifies RAdam for fine-tuning. In the main ASSIN 2 comparisons the authors use the linear-layer approach, following their separate experiment with generation.

The paper’s description of pooling is explicit for similarity, where the average extends over the sequence length. Its description of entailment specifies the final encoder state, the linear layer, and the softmax. Those details establish the contrast between a numerical similarity prediction and an entailment classification. They also identify where task-specific computation begins in each case, without requiring the decoder to produce the final answer in the main comparisons.

Representing HAREM annotations as text

For HAREM, the authors make a text generation task out of entity recognition. An entity is a stretch of text with an annotated category, such as a person, a location, or a date. The system has to identify where that stretch occurs and assign a type. A multiword name counts as a single entity when its words form one annotated span. The authors give T5 a sentence and ask it to produce the sentence with category markers that indicate those spans. Linguistic annotation

The recognition input uses this format.

Recognize Entities: [S] [eos]

Recognize Entities: is the literal task prompt. [S] stands for the sentence string, and [eos] marks its end. The target places a label after an entity. The paper illustrates this with an English sentence in which John is followed by a person label and New York by a location label. The intervening words belong to the outside category. In the actual benchmark, the text is Portuguese and the targets use natural-language entity labels. The authors give Organização as an example.

This representation lets the same sequence-to-sequence architecture produce both the text and its annotations. During training, the authors minimize cross-entropy over the target tokens and use AdamW. A correct target includes the expected words and the labels at their expected positions. Since the answer is generated, a prediction can also contain a word-level change that has nothing to do with choosing an entity category. The evaluation procedure must account for the relationship between the generated string and the passage that was originally annotated.

Before fine-tuning, the authors preprocess First HAREM and MiniHAREM with code from the Portuguese BERT work. In the conditions using the original T5 vocabulary, they replace accented characters with unaccented counterparts, such as replacing ã with a. Inputs longer than 512 tokens are handled with a sliding window and a stride of 256 tokens. The window creates shorter segments, and the stride specifies how far its start advances before the next segment.

At validation, the decoder uses beam search with width 5. Beam search builds candidate outputs incrementally, keeping a limited set of candidates available as generation proceeds. The generated output is then converted to BIO labels so it can be compared with the annotations in a conventional sequence-labeling format. A B label marks the start of an entity, an I label marks a word inside the entity after its start, and O marks a word outside an entity. The category is included where it applies. For the example in the paper, John begins a person span, New begins a location span, and York continues that location span. The format makes the link from generated text back to word positions explicit.

Experiments and results

What the pretraining runs measured

The authors first compare the checkpoints as they learn the reconstruction objective on BrWac. Their training curves track cross-entropy, so the direct measurement is how well each run predicts the target tokens under its own vocabulary. They report runs for different T5 sizes, vocabularies, and scopes of parameter updating. Each reported configuration of size, batch size, and update strategy includes a version with each vocabulary. A batch is the set of examples used in calculating a training update.

Larger variants reached lower pretraining loss. For a given size, the authors observed higher loss with the Portuguese vocabulary, including high loss early in training. They suggest that the initialization helps explain the pattern. The original weights came from training with the original vocabulary, and the Portuguese inventory gives the system a new set of token meanings to accommodate. That explanation is a hypothesis about the training curves. The actual observation is the difference in loss trajectories between the vocabulary conditions.

The pretraining experiment also measures time per epoch. For the base and large variants, an epoch took roughly 20% less time when updates were limited to vocabulary embeddings than when all weights could change. That comparison is about the cost of a training pass on the authors’ setup. Whether the less expensive checkpoint serves equally well as a starting point for a later task is evaluated separately.

The loss curves and the training-time comparison answer different questions about the same intervention. A curve records how the reconstruction predictions develop. Timing records the cost of carrying out the update strategy. Both matter when a checkpoint must be trained and evaluated, and the downstream experiment adds the evidence about what was gained for Portuguese tasks.

Similarity and entailment on ASSIN 2

ASSIN 2 assigns 6500 sentence pairs to training, 500 to validation, and 2448 to testing. The training pairs are used to adapt the checkpoint to the target. Validation gives the authors a split on which to follow loss and choose training settings. The test split is scored with the official ASSIN 2 evaluation code. It supplies the comparison with other systems and is particularly important when similar validation scores conceal differences in test performance.

The usual learning rate for these experiments is 0.0001. Batch sizes are 32 for small, 2 for base, and 1 for large, with the authors attributing the small batches for the larger variants to GPU memory limits. Inspection of the tokenized training and validation pairs led them to use a sequence length of 128. The reported plots run for at most 50 epochs. The patience setting is 5 epochs for similarity and 10 epochs for entailment. Patience specifies how long training can wait for further improvement on its monitoring criterion.

The evaluation compares checkpoints of original T5 after task training with adapted PTT5 checkpoints after task training. The authors also compare against BERTimbau, mBERT, and leading official ASSIN 2 submissions. BERTimbau gives them another Portuguese system exposed to BrWac, while mBERT represents multilingual BERT pretraining. The shared-task submissions broaden the comparison to approaches already evaluated in that setting. Each baseline provides a different reference point for judging how competitive Portuguese adaptation of T5 was.

For similarity, mean squared error measures numerical distance from the reference scores. Pearson correlation measures how strongly predicted and reference scores vary together in a linear relationship. A system can track variation across the pairs and still have errors in where it places them on the score scale. Reporting both metrics allows each property to influence the comparison. The paper discusses accuracy for the entailment output-strategy analysis and cross-entropy for entailment validation. Accuracy counts correct category decisions, while cross-entropy also responds to how much probability the classifier assigns to the expected category.

On the test split, PTT5 improved consistently over original T5 on the similarity and entailment tasks. The custom Portuguese vocabulary also improved the ASSIN 2 results in the authors’ comparisons. PTT5 Base reached the best test MSE in the comparison, which the authors suggest may be related to the use of MSE as the training objective. They describe Base as competitive with BERTimbau overall and report that it performed better than PTT5 Large. BERTimbau Large gave the strongest overall results in the comparison, and the authors place PTT5 ahead of the leading shared-task submissions they discuss.

The numerical validation minima put the distinction between tasks into focus. PTT5 Base with the Portuguese vocabulary attained an MSE of 0.0387 on the ASSIN 2 similarity validation split. PTT5 Large with the Portuguese vocabulary attained a cross-entropy of 0.1420 on the ASSIN 2 entailment validation split. Each was the best reported value for its respective task and loss. These measurements use different objectives and are meaningful within their own comparisons. The paper also reports that Large achieved lower test Pearson correlation for similarity than Base. That correlation is a comparison within the similarity task, separate from Large’s validation advantage on entailment.

The results support the authors’ original premise in a specific sense. They show that continuing to learn from unlabeled Portuguese helps when T5 is then trained on labeled sentence pairs from ASSIN 2. Improvements against original T5 are the most direct evidence on that question. The BERTimbau comparison addresses competitiveness among approaches with different architectures and training choices. PTT5 Base’s test MSE and BERTimbau Large’s broader lead can both hold because the comparison includes multiple predictions and evaluation criteria.

Entity recognition on MiniHAREM

HAREM gives the authors a different evaluation design. First HAREM supplies the material for training and validation. It contains 129 documents, with 4151 annotated entities in the selective scenario and 5017 in the total scenario. The authors reserve 7 percent of the documents for validation and train on the remainder. They use MiniHAREM in full as the test split. It contains 128 documents and has its own counts for the two annotation scenarios.

The selective scenario covers 5 classes. These are the labels for people, organizations, locations, values, and dates. The total scenario covers 10 classes and gives a larger set of annotated entities within the same collection. The authors use the selective setting for their experiments. The following counts describe the scope of the MiniHAREM benchmark under the two settings.

Annotated entities in the two MiniHAREM test scenarios

The selective scenario evaluated by PTT5 covers fewer annotated entities than the total scenario.

Annotated entities in the two MiniHAREM test scenariosTotal scenario: 3642Total scenario3642Selective scenario used for PTT5 (this paper): 3018Selective scenario used for PTT5 (thispaper)3018
The numbers
System or settingannotated entities
Total scenario3642
Selective scenario used for PTT5 (this paper)3018

Here, a higher count means broader annotation coverage. The count identifies what is included in the evaluation, independently of how accurately any system recognizes the entities. All of the paper’s conclusions from the MiniHAREM performance comparison concern the starred setting. In particular, the five classes outside that setting are outside the entity recognition experiment’s scope.

The recognition comparison includes original T5 Base, PTT5 Base with the original vocabulary, and PTT5 Base with the Portuguese vocabulary. Computation costs led the authors to use base checkpoints for this task. Memory allowed batches of 2. They accumulated gradients over 4 steps to reach an effective batch size of 8. Gradient accumulation combines the learning signals from successive batches before an update. AdamW uses a learning rate of 0.0002, with no initial warmup or later adjustment schedule.

The paper evaluates the outputs after converting the generated strings into BIO labels. Portuguese pretraining improved the result relative to original T5. Using the Portuguese vocabulary gave a further small improvement over the original vocabulary within PTT5. The Portuguese BERT approach still performed slightly better in the reported comparison. The authors’ analysis by entity category identifies Value as the main source of degraded performance. It localizes much of the difficulty to one of the classes included in the selective setting.

This experiment also demonstrates the use of generated answers that originally motivated the choice of T5. The final prediction has to identify which words belong together and which label to assign, even when several different entities appear in a passage. A generated string can express those choices through the placement of tags. The final score consequently reflects both language adaptation and the ability of this particular output procedure to turn generated text into aligned labels.

What the ablations show

Changing the form of the ASSIN 2 answer

The output-strategy experiment asks whether the answer is easier to learn as text or as the output of a prediction layer. Both choices use the original T5 weights and vocabulary in the comparison, and the paper examines small and base starting checkpoints. For similarity, the comparison follows validation loss. For entailment, it examines validation accuracy in the described generation comparison. The experiment focuses on how the two forms train under a common starting point.

The two forms place different demands on the system. With generation, it must learn a string that can be read as the intended answer. A similarity score originates as tokens and is converted to a number. With the similarity prediction layer, the encoder representation is projected directly to a scalar on the desired scale. Entailment presents a related distinction. Its output can be represented in text, or the encoder can support a probability distribution over the decision categories. The authors find faster convergence and higher stability with the linear-layer approach and choose it for the subsequent ASSIN 2 comparisons.

This choice helps interpret the paper’s strongest sentence-pair results. The experiments evaluate the transfer of T5’s encoder representations under a task-specific layer. HAREM exercises a different part of the design by using the decoder for generation. The output ablation gives a reason for that division of work. The simple fixed outputs of ASSIN 2 can use direct task predictors, while the entity experiment tests a sequence whose structure depends on the input.

The output curves support a claim about the observed training behavior on ASSIN 2 from the selected original checkpoints. They leave open the outcome of the same head comparison starting from every Portuguese checkpoint. The paper adopts a common output method for its main experiments after this preliminary comparison. That choice makes the later comparisons easier to interpret as differences in the starting weights and vocabulary.

Holding vocabulary size fixed while changing the pieces

The vocabulary ablation compares PTT5 checkpoints of the same size with the original vocabulary and the custom Portuguese inventory. The paper inspects small, base, and large validation curves for both similarity and entailment. With the Portuguese vocabulary, the ASSIN 2 runs generally reach better results and converge more favorably. The authors also observe faster convergence during fine-tuning for larger variants. Here, convergence concerns how training reaches a stable or favorable region of the monitored loss.

There is a productive tension between those curves and the curves from BrWac. Portuguese pieces yielded higher pretraining loss at a given size, while the corresponding checkpoints performed better when adapted to ASSIN 2. The pretraining task predicts the pieces defined by the chosen vocabulary. The supervised task predicts a score or an entailment decision. Changing the pieces changes the stream of items whose probabilities contribute to pretraining loss. The validation comparisons on ASSIN 2 put both vocabularies under a common task objective and show their practical value there.

The authors attribute the early difficulty with the Portuguese vocabulary, as a hypothesis, to the original checkpoint’s experience with its existing token inventory. Keeping the original inventory carries forward a familiar interpretation of those entries. The Portuguese inventory can benefit task training after the system has had time to adapt to it through reconstruction. The full set of results is consistent with that account. The paper measures the overall effect of the new vocabulary on the tasks and leaves the contribution of particular pieces or words open.

The MiniHAREM comparison adds a second type of evidence about the vocabulary. The Portuguese version also improves on the adapted version with the original vocabulary there, although the reported gain is slight. In that experiment the input preparation includes accent replacement for the original-vocabulary conditions. The observed gain therefore belongs to the complete variants as evaluated, including their treatment of accents. The paper establishes the direction of the comparison while leaving the independent contributions of vocabulary and accent handling unresolved.

Varying the amount of adaptation

The embedding-only experiment asks whether a relatively economical update can capture enough of the benefit of BrWac. A run with frozen internal weights can still learn how to represent the vocabulary. A full update gives the internal weights a chance to change along with those representations. At pretraining time, the restricted strategy offers the measured savings in time per epoch for the base and large sizes.

The ASSIN 2 similarity experiments make that efficiency result conditional on how the resulting checkpoint is used. Embedding-only pretraining and whole-system pretraining gave similar validation performance in the comparison the authors discuss. On the test split, however, the checkpoint pretrained with all weights performed far better. This is direct evidence about the tested adaptation strategies on that split. It shows why validation results alone gave an incomplete picture of the tradeoff.

The authors point to the validation set’s 500 examples and to scores already close to the top of the metric scale as possible explanations. They note validation Pearson correlations close to 1. With results crowded near the top, validation performance gave them little room to distinguish the variants. They therefore call for testing on other tasks before judging whether embedding-only pretraining is a viable economy. The result makes the split central to the interpretation, because the apparent cost and quality tradeoff changes when the test measurements are considered.

There is also a difference between assigning the learning signal to embeddings alone and requiring the adapted system to rely on that one change forever. The experiment limits which parameters receive the pretraining updates. The checkpoints subsequently participate in task training. Its outcome concerns which form of unsupervised Portuguese adaptation supplied the stronger starting point in the reported test, given the rest of the pipeline. It does not require a claim that the embedding-only checkpoint learned nothing useful from the corpus.

Looking at size and additional training settings

The paper presents additional similarity experiments that vary learning rate, batch handling, and the amount of pretraining. The supplementary comparison covers checkpoints with the Portuguese vocabulary and examines accumulating learning signals across batches. For the PTT5 Large configuration called out in the corresponding caption, the pretraining batch size is 128. This is the number for the BrWac pretraining batch in that configuration, distinct from the usual task batch size for Large on ASSIN 2.

The validation results for the main configurations give different answers depending on the task. Base with the Portuguese vocabulary leads in validation MSE for similarity, and Large with that vocabulary leads in validation cross-entropy for entailment. The paper also observes that larger variants can converge faster while fine-tuning. These results concern distinct qualities of a training run. Early progress in validation loss, the best validation objective value, and the eventual test ranking each capture a different part of what happened.

The comparison between Base and Large is consequently more informative than a single ranking by size. Larger variants had an advantage on pretraining loss, and Large supplied the lowest entailment validation loss. Base was stronger on the reported test correlation for similarity and had the top test MSE. The usual fine-tuning batch sizes also differ by size. These are results for complete training configurations under the authors’ resource constraints. They establish that the larger configuration’s advantages were specific to some measurements.

The additional experiments also clarify the role of the validation split in hyper-parameter decisions. A learning rate or batch setting can influence training, while a validation set with crowded scores can make that influence difficult to use for selection. The authors’ discussion gives particular weight to the contrast between the validation and test results for full and restricted updates. That contrast supports their argument about selection more directly than a general claim that any individual hyper-parameter caused the test outcome.

Limitations

Limits identified by the authors

The authors question how well the ASSIN 2 validation split serves to choose a checkpoint. They cite its small size and high metrics across configurations, including Pearson correlations close to the upper end of the scale. The full-update and embedding-only comparison is their concrete example. Validation suggests comparable outcomes, and testing separates the methods much more clearly. The authors treat the reasons for that separation as likely explanations and say that the economical adaptation strategy needs evidence from other tasks.

Hardware capacity also limits the range of comparisons. The authors report that GPU memory constrained batches for the larger ASSIN 2 variants. For HAREM, computation costs restricted the T5 comparisons to base checkpoints, and batch accumulation was used to manage the small batches that fit. This defines the scope of their size conclusions. ASSIN 2 supplies some evidence across sizes, whereas the entity recognition result applies to the evaluated base variants.

For HAREM, the authors flag a vulnerability in their generated-output procedure. A generated word can be inserted, or an expected input word can be omitted. Either can disturb the correspondence between positions in the output and positions in the reference annotation. A predicted entity category can therefore be evaluated through an alignment problem introduced elsewhere in the sentence. The authors identify this as a drawback of the format and find that much of the observed degradation is associated with Value entities.

The authors also set their claims about overall competitiveness against BERTimbau Large. PTT5 outperformed the original T5 checkpoints and surpassed the leading ASSIN 2 submissions discussed in the paper. BERTimbau Large still had the stronger overall ASSIN 2 result, and Portuguese BERT led by a small amount in the HAREM comparison. These outcomes define the benchmark context of the contribution. The advance is clearest for the adaptation of T5 itself.

Limits of the comparisons

The task coverage is specific. The paper tests semantic similarity, entailment, and entity recognition under the training and evaluation choices described above. Translation, abstractive question answering, and summarization explain the interest in T5’s generative interface. The effect of the same adaptation on the quality of those outputs remains an open question. HAREM establishes that the system can use generation to express a particular annotation structure in a Portuguese benchmark.

The target of adaptation is also specific. The authors train on Brazilian Portuguese web text, learn an inventory from Portuguese Wikipedia, and evaluate with ASSIN 2 and HAREM. The results directly concern that combination. How the checkpoints would behave in other Portuguese varieties, in domains with substantially different words or writing conventions, or with other kinds of annotations requires evidence from those settings. A language-specific gain in this design is reason to examine those cases, while their outcomes remain unknown.

The original T5 baseline makes it possible to measure the practical value of additional training on BrWac. The intervention combines additional updates with exposure to that corpus. A matched continuation on a different text collection would address how much of the improvement depends on corpus language as distinct from the extra training. The paper’s baseline supports the result it reports about the usefulness of its Portuguese adaptation. It leaves this finer causal division unresolved.

The vocabulary comparison holds inventory size fixed, which is helpful for interpreting the change. It also changes which sub-word pieces are available, how text divides into those pieces, and how the new entries relate to the starting weights. In the HAREM conditions there is a further difference in accent preprocessing. The observed performance belongs to the resulting configurations. Individual effects such as the contribution of diacritics or the behavior of particular sub-words would take more targeted comparisons to measure.

Similarly, the higher reconstruction loss with the Portuguese inventory has a limited meaning across inventories. Tokens represented by one vocabulary need not correspond one for one to the tokens represented by the other. Loss describes predictions of the targets used in each run. A shared downstream task permits a more direct comparison of how useful the resulting checkpoints are for that task. The paper’s finding that the Portuguese vocabulary helps ASSIN 2 rests on those downstream comparisons as well as the analysis of training curves.

MiniHAREM measures only the selective entity scenario in this study. Its result summarizes performance across the classes retained there. The class analysis narrows attention to Value, but the causes of the difficulty remain open. A generated label could be wrong, a span boundary could differ, or an insertion or omission could affect alignment. These possibilities have different implications for improving the method. The reported class result identifies where the performance problem concentrates, and the discussion of alignment describes one way the output procedure can contribute error.

Finally, the results are most precise when stated by task, split, and metric. The lowest similarity validation MSE, lowest entailment validation cross-entropy, and best similarity test MSE refer to different comparisons. The ranking can change between tasks and between validation and test even within the same family. The paper documents improvements across the chosen Portuguese tasks and gives useful evidence about the proposed vocabulary and update strategies. The scope of each claim follows the conditions under which the accompanying measurement was made.

What came after

Text-to-text pretraining across languages

Later work citing PTT5 returns to the allocation of pretraining across languages from several directions. mT5 takes the text-to-text approach to a massively multilingual setting. Its connection is clearest at the level of the shared interface and the range of languages for pretraining. PTT5 starts with T5 and adapts it to a particular language, then compares task performance before and after that adaptation. The scope named by mT5 concerns a broadly multilingual system. This places the language-specific strategy alongside a different design question about sharing text-to-text pretraining across languages. mT5

Work on transfer learning for Polish stays closer to the scale of PTT5’s question. It evaluates transfer learning for one language with a text-to-text system. The common issue is how the capabilities acquired during training carry into evaluation for the target language. The change from Portuguese to Polish matters because the available text, the words and pieces that represent it, and the downstream evaluation can all be specific to the language. The later study establishes a parallel setting for asking the transfer question. Evaluation of Transfer Learning for Polish with a Text-to-Text Model

FineWeb2 moves the language question upstream to the processing of pretraining data. Its stated scope is adapting a shared processing pipeline across languages. PTT5’s own method illustrates the significance of this stage through its use of a filtered web corpus, encoding repair, sentence packing, and a distinct source of vocabulary training text. FineWeb2 addresses data processing as a research problem across languages, broadening the setting in which the preparation of pretraining text is the object of study. FineWeb2

GlórIA keeps the focus on Portuguese and situates it in the development of an open generative large language system. The connection is to PTT5’s motivation for starting from an architecture that can produce text. PTT5 used that capability to express named entity annotations in its evaluation. GlórIA’s stated subject continues the development of generative capabilities for Portuguese at the level of the system itself. GlórIA

New questions about Portuguese evaluation

The later HAREM audit returns to PTT5’s named entity benchmark and makes reproducibility and reassessment its focus. PTT5’s protocol illustrates some of the choices such an audit makes relevant. An experiment selects an annotation scenario, partitions the First HAREM documents, and tests on MiniHAREM. A generator also needs a procedure for converting output into labels aligned with the text. The audit shares PTT5’s benchmark and shifts the research question toward how Portuguese entity recognition results can be checked and reassessed. Twenty Years of HAREM

RelEx-PT adds a Portuguese dataset for sentence-level relation extraction. That task asks which relationship a sentence expresses, extending the kinds of structured information for which Portuguese evaluation data are available. PTT5’s HAREM experiment concerns where an entity appears and which category belongs to it. The relation extraction dataset concerns a different annotation target within Portuguese text. This is a connection through the development of resources for evaluating Portuguese information extraction. RelEx-PT

A study of proficiency-controlled simplification in European Portuguese examines prompting for a different use of generated text. Its stated task is to produce a simpler formulation conditioned on a reader’s proficiency level. The connection to PTT5 is the ability to generate a variable-length textual answer, with changes in both Portuguese variety and evaluation goal. PTT5’s HAREM decoder produces a labeled rendering of an input sentence. In simplification, the requested output is a reformulation with a specified reading demand. The later study applies the generative interface to that distinct question. Proficiency-Controlled Text Simplification in European Portuguese

Cite

Cite as Diedre Santos do Carmo, Marcos Piau, Israel Campiotti, Rodrigo Frassetto Nogueira and Roberto Lotufo. 2020. PTT5: Pretraining and validating the T5 model on Brazilian Portuguese data. arXiv (Cornell University).

The paper itself, not this page. BibTeX from the library's record of the work. DOI 10.48550/arxiv.2008.09144 · arXiv 2008.09144

@misc{carmo2020ptt5,
  title = {{PTT5: Pretraining and validating the T5 model on Brazilian Portuguese data}},
  author = {Diedre Santos do Carmo, Marcos Piau, Israel Campiotti, Rodrigo Frassetto Nogueira and Roberto Lotufo},
  year = {2020},
  doi = {10.48550/arxiv.2008.09144},
  eprint = {2008.09144},
  archivePrefix = {arXiv},
  url = {https://doi.org/10.48550/arxiv.2008.09144}
}

↑ back to top

This page in Markdown https://md.research.elamur.ai/free/en/papers/carmo-2020-ptt5-pretraining-validating-t5-model/

References

26 references, from the paper's own bibliography.

  1. Fady Baly, Hazem Hajj, et al. Arabert: Transformer-based model for arabic language understanding. In Proceedings of the 4th Workshop on Open-Source Arabic Corpora and Processing Tools, with a Shared Task on Offensive Language Detection, pages 9–15, 2020. our card
  2. José Cañete, Gabriel Chaperon, Rodrigo Fuentes, and Jorge Pérez. Spanish pre-trained bert model and evaluation data. In to appear in PML4DC at ICLR 2020, 2020. OpenAlex ↗ · Scholar ↗
  3. Pieter Delobelle, Thomas Winters, and Bettina Berendt. RobBERT: a Dutch RoBERTa-based Language Model. arXiv preprint arXiv:2001.06286, 2020. our card
  4. Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. Bert: Pre-training of deep bidirectional transformers for language understanding. arXiv preprint arXiv:1810.04805, 2018. our card
  5. Evandro Fonseca and João Paulo Reis Alvarenga. Wide and deep transformers applied to semantic relatedness and textual entailment. In Oliveira et al. [ASSIN2], pages 68–76. OpenAlex ↗ · Scholar ↗
  6. Taku Kudo. Subword regularization: Improving neural network translation models with multiple subword candidates. arXiv preprint arXiv:1804.10959, 2018. our card
  7. Taku Kudo and John Richardson. Sentencepiece: A simple and language independent subword tokenizer and detokenizer for neural text processing. arXiv preprint arXiv:1808.06226, 2018. our card
  8. Yuri Kuratov and Mikhail Arkhipov. Adaptation of deep bidirectional multilingual transformers for russian language. arXiv preprint arXiv:1905.07213, 2019. OpenAlex ↗ · Scholar ↗
  9. Liyuan Liu, Haoming Jiang, Pengcheng He, Weizhu Chen, Xiaodong Liu, Jianfeng Gao, and Jiawei Han. On the variance of the adaptive learning rate and beyond. arXiv preprint arXiv:1908.03265, 2019. OpenAlex ↗ · Scholar ↗
  10. 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
  11. Ilya Loshchilov and Frank Hutter. Decoupled weight decay regularization, 2017. our card
  12. Louis Martin, Benjamin Muller, Pedro Javier Ortiz Suárez, Yoann Dupont, Laurent Romary, Éric Villemonte de la Clergerie, Djamé Seddah, and Benoît Sagot. Camembert: a tasty french language model. arXiv preprint arXiv:1911.03894, 2019. our card
  13. Dat Quoc Nguyen and Anh Tuan Nguyen. Phobert: Pre-trained language models for vietnamese. arXiv preprint arXiv:2003.00744, 2020. our card
  14. Hugo Gonçalo Oliveira, Livy Real, and Erick Fonseca, editors. Proceedings of the ASSIN 2 Shared Task: Evaluating Semantic Textual Similarity and Textual Entailment in Portuguese, Extended Semantic Web Conference, number 2583 in CEUR Workshop Proceedings, 2020. OpenAlex ↗ · Scholar ↗
  15. Marco Polignano, Pierpaolo Basile, Marco de Gemmis, Giovanni Semeraro, and Valerio Basile. AlBERTo: Italian BERT Language Understanding Model for NLP Challenging Tasks Based on Tweets. In Proceedings of the Sixth Italian Conference on Computational Linguistics (CLiC-it 2019), volume 2481. CEUR, 2019. our card
  16. 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. arXiv preprint arXiv:1910.10683, 2019. our card
  17. Livy Real, Erick Fonseca, and Hugo Gonçalo Oliveira. The assin 2 shared task: a quick overview. In International Conference on Computational Processing of the Portuguese Language, pages 406–412. Springer, 2020. OpenAlex ↗ · Scholar ↗
  18. Ruan Rodrigues, Jéssica da Silva, Pedro Castro, Nadia Felix, and Anderson Soares. Multilingual transformer ensembles for portuguese natural language tasks. In Oliveira et al. [ASSIN2], pages 27–38. OpenAlex ↗ · Scholar ↗
  19. Rui Rodrigues, Paula Couto, and Irene Rodrigues. Ipr: The semantic textual similarity and recognizing textual entailment systems. In Oliveira et al. [ASSIN2], pages 39–47. OpenAlex ↗ · Scholar ↗
  20. Diana Santos, Nuno Seco, Nuno Cardoso, and Rui Vilela. HAREM: An advanced NER evaluation contest for Portuguese. In Proceedings of the Fifth International Conference on Language Resources and Evaluation (LREC'06), Genoa, Italy, May 2006. European Language Resources Association (ELRA). OpenAlex ↗ · Scholar ↗
  21. Noam Shazeer and Mitchell Stern. Adafactor: Adaptive learning rates with sublinear memory cost. arXiv preprint arXiv:1804.04235, 2018. OpenAlex ↗ · Scholar ↗
  22. Fábio Souza, Rodrigo Nogueira, and Roberto Lotufo. Portuguese named entity recognition using bert-crf. arXiv preprint arXiv:1909.10649, 2019. OpenAlex ↗ · Scholar ↗
  23. Robyn Speer. ftfy. Zenodo, 2019. Version 5.5. OpenAlex ↗ · Scholar ↗
  24. 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
  25. Wietse de Vries, Andreas van Cranenburgh, Arianna Bisazza, Tommaso Caselli, Gertjan van Noord, and Malvina Nissim. BERTje: A Dutch BERT Model. arXiv preprint arXiv:1912.09582, December 2019. our card
  26. Jorge A Wagner Filho, Rodrigo Wilkens, Marco Idiart, and Aline Villavicencio. The brwac corpus: A new open resource for brazilian portuguese. In Proceedings of the Eleventh International Conference on Language Resources and Evaluation (LREC 2018), 2018. our card