Reading in both directionsLire dans les deux sens

TRA6008 S2 · in classS2 · en classe

Before or after

Where does the word that settles the ambiguity sit? Sometimes before the ambiguous word: in fishing from the bank is prohibited, fishing has settled the sense by the time bank arrives. Sometimes after it: in the bank issued new regulations, the deciding word only comes once bank has been read.

Two sentences with their words in chips. In 'fishing from the bank is prohibited', an arc runs from fishing forward to bank, and a reader going left to right already has it. In 'the bank issued new regulations', an arc runs from issued back to bank, which a reader going left to right reaches too late and revises.
Figure 3. The word that settles an ambiguity comes before it in one sentence and after it in the other. A model reading strictly left to right has only half of that context.

Reading both ways

ELMo already used both sides, but shallowly: one model read the sentence left to right, a second read it right to left, and their outputs were joined at the end, so the two directions were never combined during training (Devlin et al., 2019).

BERT is the model that put the two together.ELMo and BERT set a fashion, and the acronyms that followed were bent to land on Sesame Street characters: ERNIE, Grover, Big Bird.

Training a language model normally means predicting the next word, and that forces a single direction: a model allowed to see what follows would simply be handed the answer. BERT changes the exercise. It hides about 15 per cent of the tokens token²jeton textuel² language modelsmodèles de langue A unit of text that a language model processes or generates.Unité de texte qu'un modèle de langue traite ou génère. Un jeton peut correspondre à un mot entier, à une partie de mot, à un signe de ponctuation ou à une séquence plus petite de caractères ou d'octets. in a text and trains the model to restore each one from everything around it, on both sides (Devlin et al., 2019). Nothing is being generated here, so nothing is spoiled by reading ahead.

A sentence as word chips, we sat on the blank and watched the river, with the fifth chip empty and outlined in dashes. Below it a band stands for the model, containing one small circle per word of the sentence. Lines run from every chip, on both sides of the gap, into the filled circle under the gap, and an arrow runs from that circle down to the word bank.
Figure 4. Every token of the sentence, on both sides of the gap, feeds the position where the word is missing, and the model restores it from all of them.

Every layer of the model therefore draws on both sides at once. The architecture underneath makes that possible (see also the Attention & transformers chapter) (voir aussi le chapitre Attention et transformeurs).

BERT reported new best results on eleven language-processing tasks, and this methodology became the standard: pretrain one model on raw text, then fine-tune it for each task. For translation, where the whole source text is there before any output is produced, reading it in both directions is the natural design.

What it costs

Two things.

The field judged the accuracy worth both.

Written in English. The French version was automatically generated and I have not revised it. Rédigé en anglais. La version française a été générée automatiquement et je ne l'ai pas révisée. Updated 4 October 2026

Avant ou après

Où se trouve le mot qui lève l’ambiguïté ? Parfois avant le mot ambigu : dans fishing from the bank is prohibited, fishing a déjà fixé le sens quand bank arrive. Parfois après lui : dans the bank issued new regulations, le mot décisif ne vient qu’une fois bank lu.

Deux phrases dont les mots sont en jetons. Dans « fishing from the bank is prohibited », un arc va de fishing vers bank, et une lecture de gauche à droite l'a déjà. Dans « the bank issued new regulations », un arc revient de issued vers bank, qu'une lecture de gauche à droite rencontre trop tard et doit réviser.
Figure 3. Le mot qui lève une ambiguïté vient avant elle dans une phrase et après elle dans l'autre. Un modèle qui lit strictement de gauche à droite n'a que la moitié de ce contexte.

Lire dans les deux sens

ELMo utilisait déjà les deux côtés, mais superficiellement : un modèle lisait la phrase de gauche à droite, un second la lisait de droite à gauche, et leurs sorties étaient réunies à la fin, si bien que les deux sens ne se rencontraient jamais pendant l’entraînement (Devlin et al., 2019).

BERT est le modèle qui a réuni les deux.ELMo et BERT ont lancé une mode, et les acronymes qui ont suivi ont été tordus pour tomber sur des personnages de Sesame Street : ERNIE, Grover, Big Bird.

Entraîner un modèle de langue veut normalement dire prédire le mot suivant, et cela impose un sens unique : un modèle autorisé à voir ce qui suit se verrait simplement donner la réponse. BERT change l’exercice. Il masque environ 15 % des jetons token²jeton textuel² language modelsmodèles de langue A unit of text that a language model processes or generates.Unité de texte qu'un modèle de langue traite ou génère. Un jeton peut correspondre à un mot entier, à une partie de mot, à un signe de ponctuation ou à une séquence plus petite de caractères ou d'octets. d’un texte et entraîne le modèle à rétablir chacun d’eux à partir de tout ce qui l’entoure, des deux côtés (Devlin et al., 2019). Rien n’est produit ici, donc rien n’est gâché si le modèle lit plus loin.

Une phrase en jetons, we sat on the trou and watched the river, dont le cinquième jeton est vide et cerné de pointillés. Sous elle, une bande représente le modèle et contient un petit cercle par mot de la phrase. Des traits partent de chaque jeton, des deux côtés du trou, vers le cercle plein situé sous le trou, et une flèche descend de ce cercle vers le mot bank.
Figure 4. Chaque jeton de la phrase, des deux côtés du trou, alimente la position où le mot manque, et le modèle le rétablit à partir de tous.

Chaque couche du modèle puise donc des deux côtés à la fois. L’architecture sous-jacente rend cela possible (see also the Attention & transformers chapter) (voir aussi le chapitre Attention et transformeurs).

BERT a établi de nouveaux records sur onze tâches de traitement de la langue, et cette méthodologie est devenue la norme : préentraîner un modèle sur du texte brut, puis l’affiner pour chaque tâche. En traduction, où tout le texte de départ est là avant qu’aucune sortie ne soit produite, le lire dans les deux sens est la conception naturelle.

Ce que cela coûte

Deux choses.

Le domaine a jugé que la précision valait les deux.

Written in English. The French version was automatically generated and I have not revised it. Rédigé en anglais. La version française a été générée automatiquement et je ne l'ai pas révisée. Mise à jour 2 octobre 2026

Sources

  • Devlin, J., Chang, M.-W., Lee, K., & Toutanova, K. (2019). BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding. 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). https://doi.org/10.18653/v1/N19-1423
  • Peters, M. E., Neumann, M., Iyyer, M., Gardner, M., Clark, C., Lee, K., et al. (2018). Deep Contextualized Word Representations. Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long Papers). https://doi.org/10.18653/v1/N18-1202

Sources

  • Devlin, J., Chang, M.-W., Lee, K., & Toutanova, K. (2019). BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding. 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). https://doi.org/10.18653/v1/N19-1423
  • Peters, M. E., Neumann, M., Iyyer, M., Gardner, M., Clark, C., Lee, K., et al. (2018). Deep Contextualized Word Representations. Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long Papers). https://doi.org/10.18653/v1/N18-1202

Spotted an error? Une erreur ?

Language, content, a broken link: e-mail me what you saw and I will fix it. Langue, contenu, lien brisé : écrivez-moi ce que vous avez vu et je corrige.

ayla.rigouts.terryn@umontreal.ca

Please mention the page: Mentionnez la page :