Encoders and decodersEncodeurs et décodeurs

TRA6008 S2 · in classS2 · en classe

Two halves, one translation

Being a translation model, the 2017 transformer transformertransformeur deep learningapprentissage profond A neural-network architecture for processing sequences, such as text.Architecture de réseau de neurones pour le traitement des séquences, comme le texte. has to do two different things: read a source text, and produce a target text. It does them in two halves (Vaswani et al., 2017).

  • The encoder takes the source and turns it into contextual representations, all words at the same time.
  • The decoder writes the target one word at a time, and at each word it looks in two directions: back over what it has already written, and across at the encoder’s representations of the source.

Click the drawing, or a line below, to build it up stage by stage. Cliquez sur le dessin, ou sur une ligne ci-dessous, pour le construire étape par étape.

Figure 6. Simplified schematic of an encoder-decoder mechanism, illustrated with a translation task.

Figure 6figure 6 follows one sentence through both halves, le chien suit Jean becoming the dog follows Jean, caught at the moment the decoder produces follows. Training is over by then, so the figure shows one pass through a finished model (see also the Attention page) (voir aussi la page L'attention). Training a translation model in the first place is a subject of its own (see also the What machine translation is chapter, in the Machine translation module) (voir aussi le chapitre Qu'est-ce que la traduction automatique, dans le module Traduction automatique).

Direction belongs to the attention, not to the turning of words into vectors and back.

Encoder, decoder, or both?

Both halves are made of the same attention layers, so a model can keep one or keep both. The choice follows from the shape of the task: what goes in, and what has to come out.

The line is not a wall. A decoder-only model translates perfectly well when the source and its translation are given to it as one running text, which happens whenever a translation is asked of a chatbot (see also the Machine translation module) (voir aussi le module Traduction automatique).

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 9 September 2026

Deux moitiés, une traduction

Étant un modèle de traduction, le transformeur transformertransformeur deep learningapprentissage profond A neural-network architecture for processing sequences, such as text.Architecture de réseau de neurones pour le traitement des séquences, comme le texte. de 2017 doit faire deux choses différentes : lire un texte de départ et produire un texte d’arrivée. Il les confie à deux moitiés (Vaswani et al., 2017).

  • L’encodeur prend le texte de départ et le transforme en représentations contextuelles, tous les mots en même temps.
  • Le décodeur écrit le texte d’arrivée un mot à la fois, et à chaque mot il regarde dans deux directions : en arrière sur ce qu’il a déjà écrit, et de l’autre côté vers les représentations du texte de départ produites par l’encodeur.

Click the drawing, or a line below, to build it up stage by stage. Cliquez sur le dessin, ou sur une ligne ci-dessous, pour le construire étape par étape.

Figure 6. Schéma simplifié d'un mécanisme encodeur-décodeur, illustré par une tâche de traduction.

La Figure 6figure 6 suit une phrase à travers les deux moitiés, le chien suit Jean devenant the dog follows Jean, saisie au moment où le décodeur produit follows. L’entraînement est terminé à ce stade : la figure montre donc un seul passage dans un modèle achevé (see also the Attention page) (voir aussi la page L'attention). L’entraînement d’un modèle de traduction est un sujet à part entière (see also the What machine translation is chapter, in the Machine translation module) (voir aussi le chapitre Qu'est-ce que la traduction automatique, dans le module Traduction automatique).

La direction appartient à l’attention, non au passage des mots aux vecteurs et des vecteurs aux mots.

Encodeur, décodeur ou les deux ?

Les deux moitiés sont faites des mêmes couches d’attention : un modèle peut donc n’en garder qu’une, ou garder les deux. Le choix découle de la forme de la tâche : ce qui entre, et ce qui doit sortir.

La frontière n’est pas un mur. Un modèle à décodeur seul traduit très bien quand le texte de départ et sa traduction lui sont donnés comme un seul texte courant, ce qui arrive chaque fois qu’on demande une traduction à un agent conversationnel (see also the Machine translation module) (voir aussi le module Traduction automatique).

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 10 septembre 2026

Sources

Sources

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 :