Administrator
This teaching view is for the instructor. Enter the administrator password.
Wrong password · Mot de passe incorrect
Cette vue enseignement n'existe qu'en anglais.
The systems behind much of today’s language technology, including almost all machine translation systems and chatbots with which you will interact, are neural networks. The name suggests something brain-like, and the inspiration is real, but loose: there are some similarities between artificial neural networks and natural neural networks like our brain, but this does not go beyond the very basics.
Each unit, called a neuron, is a small mathematical function. It receives numbers from the units connected to it, combines them, and passes a number on. Every connection has a strength, called a weight weightpoids machine learningapprentissage automatique A real number attached to one input of a computing unit, learned during training, that sets how much that input counts towards the unit's output.Nombre réel attaché à une entrée d'une unité de calcul, appris pendant l'entraînement, qui détermine l'importance de cette entrée dans la sortie de l'unité. , and training adjusts those weights, the network’s parameters parameterparamètre de modèle machine learningapprentissage automatique A numerical value learned during a model's training and used in its computations.Valeur numérique apprise pendant l'entraînement d'un modèle et utilisée dans ses calculs. : a stronger connection gives one unit’s output more influence on the next.
The units are organized in layers. An input layer takes in the raw data as numbers; one or more hidden layers transform it, step by step; an output layer produces the answer, for example one value per possible category. When there are many hidden layers, the network is called deep, which is all that the “deep” in deep learning means (LeCun et al., 2015).
Depth is what lets a network build complex patterns out of simple ones. Early layers pick up simple regularities in the raw input; later layers combine those into larger ones. In image recognition, the classic illustration, first edges, then shapes, then faces. For text the same principle applies, with one catch: a network’s input layer takes numbers, so using one for language requires a way to encode language as numbers (see also the Language as numbers module) (voir aussi le module Le langage en nombres).
Worth saying aloud and not projecting: the brain inspiration is real and loose, and each unit is a small mathematical function. Depth is what lets a network build complex patterns out of simple ones: edges, then shapes, then faces for images.
A toy example
Suppose we want a network that tells diamonds, squares and circles apart.Shapes are a toy task, chosen for its simplicity and easy visualization. A real network chooses among far more classes, and its input is rarely anything as tidy as a drawn shape. The loop is the same either way, which is what lets the example be this small. That already fixes the shape of its output layer: one unit per category, one for square, one for circle, one for diamond. Their scores are turned into percentages that add up to 100, so the three answers compete, and raising one lowers the others.
A network answers in probabilities from the start. Untrained, they are essentially random. Given a picture of a diamond and asked what shape it is, the answer might be something like: square 40%, circle 35%, diamond 25%. Early in training they can be confidently wrong instead: square 80%, circle 10%, diamond 10%. The network is then told the right answer, and the predict-compare-adjust loop of supervised learning reappears in its neural form (see also the From rules to machine learning chapter, in the Foundations of AI & NLP module) (voir aussi le chapitre Des règles à l'apprentissage automatique, dans le module Fondements de l'IA et du TAL): the error flows backward through the network, and the connections that pushed toward square are weakened, the ones that pushed toward diamond strengthened.
Millions of small adjustments
Adjustment is not reserved for mistakes. A network nudges its connections on every example, including the ones it already gets right; the nudge simply gets smaller as the prediction moves closer to the label. One example changes little. Millions of examples, each nudging millions of parameters parameterparamètre de modèle machine learningapprentissage automatique A numerical value learned during a model's training and used in its computations.Valeur numérique apprise pendant l'entraînement d'un modèle et utilisée dans ses calculs. , add up to a system whose predictions are sharp. Nothing else in the network changes during training: the architecture, the layers and the connections stay as designed. Learning is entirely a matter of adjusting the strengths.
The difference from a feature-based model
The decisive difference from a feature-based model is what the network learns from. A feature-based model needed a human to decide that suffixes and capitalization matter. A neural network takes raw data (e.g., pixels of an image, or numerical representations of words), and finds its own regularities in it, including ones no human would have thought to specify. The features are learned, and feature engineering disappears. The human work does not disappear with it: choosing and encoding features used to be most of the effort of building a system, and the effort now goes into collecting the data, defining the task and designing the network.
Why it took until the 2010s
Nothing about the idea is new: the underlying design goes back to the perceptron of the 1950s (Rosenblatt, 1958), the first model that could learn its own weights weightpoids machine learningapprentissage automatique A real number attached to one input of a computing unit, learned during training, that sets how much that input counts towards the unit's output.Nombre réel attaché à une entrée d'une unité de calcul, appris pendant l'entraînement, qui détermine l'importance de cette entrée dans la sortie de l'unité. from labelled examples (Goodfellow et al., 2016). In the 2010s, its two main requirements could finally be fulfilled. Learning features from raw data takes far more examples than learning weights for a few hand-picked features, and processing them takes enormous computation. Large collections of digital text and images supplied the first; graphics processors, built to render games, turned out to suit the calculations and supplied the second. With both in place, deep networks moved the state of the art in speech recognition, image recognition and object detection, and in fields as far from language as drug discovery (LeCun et al., 2015).
The second line is the one that connects back to the features chapter: no human decides that suffixes and capitalization matter. The third is the answer to “why now”: two appetites, data and computation, fed at the same time in the 2010s. LeCun et al. (2015) name speech, images and object detection as where it showed first.
With a rule-based system rule-based systemsystème à base de règles AIIA A system whose behaviour is fixed by rules that people wrote, most often of the form "if this condition, then this action", so that every output can be traced to the rule that produced it.Système dont le comportement est fixé par des règles écrites par des personnes, le plus souvent de la forme « si cette condition, alors cette action », de sorte que chaque résultat peut être rapporté à la règle qui l'a produit. you can always find out why an output came out as it did: some rule was triggered, and that rule can be read, disagreed with and changed. In a trained neural network there is nothing to read. Its behaviour is stored as millions of numerical connection weights weightpoids machine learningapprentissage automatique A real number attached to one input of a computing unit, learned during training, that sets how much that input counts towards the unit's output.Nombre réel attaché à une entrée d'une unité de calcul, appris pendant l'entraînement, qui détermine l'importance de cette entrée dans la sortie de l'unité. , learnt from data, and no single one of them means anything on its own. The mathematics of every step is known exactly, but nothing states, in a form a person can check, what the steps do together.
Statistical systems are a sort of middle ground: their rules are learnt from data rather than written by hand, but stay more or less readable (see also the Four paradigms page, in the Foundations of AI & NLP module) (voir aussi la page Quatre paradigmes, dans le module Fondements de l'IA et du TAL). How readable depends on the algorithm: a decision tree, a series of questions that leads to an answer, can be printed and followed, while the weights other algorithms learn cannot be read that way.
People call neural networks black boxes for this reason, and it is a property of the approach rather than a defect to be patched later. The power of the method comes from letting the system find regularities too numerous and too diffuse for anyone to write down; a representation humans could read would be a representation humans could have written.
Four consequences follow for anyone who works with these systems:
- Errors cannot be fixed the way a rule is fixed. There is no line to correct. Improving a network means changing its training data training setjeu de données d'entraînement machine learningapprentissage automatique The portion of a dataset used to train a machine-learning model.Portion d'un jeu de données servant à entraîner un modèle d'apprentissage automatique. , training it further, or changing its architecture and training again, and any of these can shift its behaviour elsewhere in ways nobody chose.
- Behaviour is discovered by testing, not by inspection. The only way to know how a system handles legal text, or Québécois French, is to try it on legal text and Québécois French, which is why evaluation is a professional skill in its own right (see also the Evaluating language technology module) (voir aussi le module L'évaluation des technologies langagières).
- The same input need not give the same output. A classifier is deterministic deterministicdéterministe computinginformatique Describes a process, algorithm, or system that, under the same initial conditions and with the same input, always produces the same output.Se dit d'un processus, d'un algorithme ou d'un système qui, dans les mêmes conditions initiales et avec la même entrée, produit toujours la même sortie. : the same email gives the same verdict every time. A system that generates text often is not, because choosing each next word can involve randomness, and one run then differs from the next. A single trial is evidence about that run, not about the system.
- Confidence is not self-knowledge. A network reports probabilities, and they measure how its training data looked, never how much it “knows” (see also the Reliability of LLM output module) (voir aussi le module Fiabilité des résultats des GML).
Put it to the room: how would you find out whether a system handles Québécois French? The only answer is to try it on Québécois French, which is why evaluation is a professional skill and a whole module here.
One model, many tasks
Every system of the first three paradigms was built for one task: a spam filter sorts email, a tagger labels words with their grammatical class, and the next system means starting again, with new rules, new features or new labelled data. A large language model is a neural network neural network (NN)réseau de neurones (RNA) machine learningapprentissage automatique A machine-learning model composed of interconnected layers of small computational units.Modèle d'apprentissage automatique composé de couches interconnectées de petites unités de calcul. of the kind this chapter describes, trained from examples like the second and third paradigms, except that the examples are plain text and the task is to predict the next word (Jurafsky & Martin, 2026). Nothing in that training names a task, and once trained, the same model translates, summarizes, lists the terms in a text or labels its words, when the request is written to it in a prompt (Brown et al., 2020). Figure 6figure 6 sets the two arrangements side by side.
Decreasing human influence
Each shift took one thing out of the developer’s hands, as the table below sets out, and the last took the largest: the task itself, which passes to the person using the model.
| Shift | No longer specified by the developer | Still specified by people |
|---|---|---|
| Rules to machine learning | the patterns | the task and the features, by the developer, before training |
| Machine learning to deep learning | the features featureattribut machine learningapprentissage automatique A property or representation of an observation that a machine-learning model uses as input when making a prediction.Propriété ou représentation d'une observation qu'un modèle d'apprentissage automatique utilise en entrée pour produire une prédiction. | the task and its data, by the developer, before training |
| Deep learning to large language models | the task | the task, by the person using the model, in a prompt |
A large language model is, technically, deep learning. Four things make it a paradigm of its own all the same, rather than a step inside the third:
- One general system instead of a system per task. The line is not absolute, since a model can be fine-tuned fine-tuningaffinage machine learningapprentissage automatique Further training of a pretrained model on new data to adapt it for a particular task, domain, or intended behaviour.Poursuite de l'entraînement d'un modèle préentraîné sur un jeu de données généralement plus restreint et spécialisé, afin de l'adapter à une tâche ou à un domaine particulier. for one task or one context (see also the Fine-tuning chapter, in the LLM lifecycle module) (voir aussi le chapitre Affinage, dans le module Cycle de vie des GML) and dedicated systems are built on top of models, but its capabilities are far broader than those of any earlier system, and a prompt alone reaches most of them.
- A far simpler interface, so far less specialized users. A prompt is ordinary text rather than a program, so the person who describes the job is often the person who used to be a user of someone else’s system. The line between building a system and using one has moved.
- An even larger appetite for data and computation, in place of explicit knowledge. Each earlier shift already traded knowledge written by people for data; this one trades the task description itself for more text and more computation.
- A blurrier line between natural language processing natural language processing (NLP)traitement automatique de la langue (TAL) NLPTAL An interdisciplinary field that develops and studies computational methods for analyzing, processing, and generating human language.Domaine interdisciplinaire qui développe et étudie des méthodes computationnelles pour analyser, traiter et générer le langage humain. and the rest of AI. The model that labels words or extracts terms is the same one that writes code, describes images and acts on your behalf, and language has become the interface to all of it.
A prompt steers a model without changing it, and within limits (see also the In-context learning chapter, in the LLM lifecycle module) (voir aussi le chapitre Apprentissage en contexte, dans le module Cycle de vie des GML).
Still deep learning
Everything that was true of the third paradigm is still true of the fourth:
- the patterns it learned are spread over billions of numbers nobody can read (see also the black box page, in the Foundations of AI & NLP module) (voir aussi la page La boîte noire, dans le module Fondements de l'IA et du TAL);
- everything it does comes from its training text, with that text’s gaps and leanings (see also the Reliability of LLM output module) (voir aussi le module Fiabilité des résultats des GML);
- the tasks it does well and badly do not follow what a person finds hard, so its abilities have to be tested;
- the dedicated systems have not disappeared: for a task run on whole corpora, fast and the same way every time, a trained tagger or a term extractor is still the usual tool (see also the Comparing term extraction methods page, in the Classical NLP module) (voir aussi la page Comparer les méthodes d'extraction de termes, dans le module TAL classique).
What the last two chapters settled
| The idea | What it gives | What it costs |
|---|---|---|
| A number per word, alphabetically | An identifier | An order and an arithmetic that mean nothing |
| A vector vectorvecteur machine learningapprentissage automatique An ordered list of numbers.Liste ordonnée de nombres. per word | Coordinates in a space, so distances exist | Nothing yet: the space has to be built |
| A one-hot vector | Identity with no false order | Every pair equally distant; 99,999 zeros per word |
What is still missing
- Numbers that say how words relate. So far cat is exactly as far from dog as it is from democracy.
- A representation that stays manageable and still says something. Giving every word its own slot takes tens of thousands of numbers to say one thing, and all but one of them are zero.
- A representation that can change with the sentence. Bank does not mean the same thing in every sentence it appears in, and one fixed set of numbers per word cannot follow that.
This chapter answers the first two. The third takes a chapter of its own (see also the Contextual embeddings chapter, in the Language as numbers module) (voir aussi le chapitre Plongements contextuels, dans le module Le langage en nombres).
Words as coordinates
Suppose you want to place words in a two-dimensional space. You give the horizontal axis one meaning and the vertical axis another, then put each word where it belongs relative to those two meanings. Every word ends up with coordinates, which is to say a vector vectorvecteur machine learningapprentissage automatique An ordered list of numbers.Liste ordonnée de nombres. : here a list of two numbers, one per axis. Those numbers do more than locate the word. They say how it stands on each of the two meanings, and how far it is from every other word in the same space.
Speed and capacity
The idea is worked out for means of transport in Figure 1figure 1. The horizontal axis is passenger capacity and the vertical axis is speed, and most people would agree on roughly where each vehicle goes. A skateboard scores low on both: it does not travel fast and it carries one person. A rocket has maximal speed and more moderate capacity, giving it the vector [0.4, 1.0]. Where a one-hot vector only identified a word, that pair of numbers says something about the thing named, and it fixes how far the rocket stands from every other vehicle in the space.
Placing words this way also makes groups form on their own. Personal transport gathers on the left, public transport on the right, and the rocket sits apart, which is where it belongs. Nobody drew those groups; they follow from the coordinates.
Where the apple goes
So far this looks like a promising way to turn words into lists of numbers that mean something. Then: where would you put an apple in this space? The question makes no sense, because speed and capacity say nothing about an apple.
Two things follow. A space that fits a whole vocabulary needs many more than two dimensions, since it has to suit everything from skateboard to ardour. And once there are hundreds of dimensions and tens of thousands of words, neither the axes nor the positions can be chosen by a person.
Which leaves the question: how can numbers like these be found automatically, for every word in a vocabulary?
Build the transport space with the room before showing it: speed on one axis, capacity on the other, then ask where a skateboard, a bus and a rocket go. The apple is the screen after it, and the question that kills the hand-made version.
Five blanks
Suppose you are given five fragments of text, each with one word missing:
- have a ___ as pet
- pet the ___ of the
- and the ___ purrs loudly
- walk your ___ on a leash
- does the ___ love music
Which words could fill the blank? Cat goes into the first three without any trouble; the leash makes you hesitate. Dog goes into the pet, the petting and the leash, and fails at the purring. The last fragment takes any of them, which is why it tells you so little. So the two words share most of their contexts, and the ones they do not share are exactly the ones you would expect: a cat purrs, a dog is walked.
Now try snake. It fits have a ___ as pet, and after that it gets harder: a snake does not purr, and a snake on a leash is a very big stretch. Snake shares one or two contexts with cat and dog and not the rest. A word like democracy fits none of the five.
Not only whether a word can fill a blank counts, but how often it does. Cat turns up before purrs far more often than after walk your, and a system that counts contexts in a large collection of text sees that difference directly.
What the blanks show
Words with related meanings turn up in similar contexts, and the more two words’ contexts overlap, the closer their meanings tend to be. Linguists formulated this in the 1950s, Joos, Harris and Firth among them (Jurafsky & Martin, 2026), and Firth put it in one sentence: “You shall know a word by the company it keeps” (Firth, 1957).
Why this suits a machine
The idea is useful for a machine because of what it does not require:
- No definitions. Nobody has to say what cat means.
- No labels. Nobody has to mark examples by hand.
- No hand-picked axes. Nobody chooses the dimensions of the space, or where each word goes on them.
It does require text, in quantity. Contexts are observable: any large collection of text shows directly which words surround which. So a system can build a workable stand-in for meaning just by reading enough text.
Run the five blanks out loud and let the room fill them, one word at a time: cat, then dog, then snake, then democracy. Then the figure, then the Firth sentence.
Learning the positions from text
Mikolov et al. (2013a) published word2vec, a pair of architectures that put the distributional hypothesis distributional hypothesishypothèse distributionnelle embeddingsplongements The linguistic hypothesis that patterns of word use provide evidence about meaning: words that occur with similar neighbouring words are likely to have related or similar meanings.Hypothèse linguistique selon laquelle les régularités d'emploi des mots renseignent sur leur sens : les mots qui apparaissent avec des voisins semblables ont vraisemblablement des sens apparentés ou proches. to work at scale. Each word starts with a vector of a few hundred numbers, and those numbers are then adjusted on millions of sentences, nudging words toward each other whenever they occur in similar contexts. Nobody labels anything: the text itself shows which words occur near which, and that serves as the correct answer the training checks against. Jurafsky and Martin (2026) describe this as self-supervised learning self-supervised learningapprentissage autosupervisé machine learningapprentissage automatique A machine-learning approach in which the targets used for training are created automatically from the structure or content of the training data, rather than being supplied as separate human-written labels.Approche d'apprentissage automatique dans laquelle les cibles servant à l'entraînement sont créées automatiquement à partir de la structure ou du contenu des données, plutôt que fournies sous forme d'étiquettes rédigées par des humains. , in which the answers come from the data (see also the training loop: predict, compare, adjust page, in the LLM lifecycle module) (voir aussi la page La boucle d'entraînement : prédire, comparer, ajuster, dans le module Cycle de vie des GML). The method spread because it was efficient: high-quality vectors from 1.6 billion words in under a day, where earlier neural approaches cost far more. Related methods followed, GloVe among them (Pennington et al., 2014), and the family became the standard representation of words. Every word in the vocabulary vocabularyvocabulaire language modelsmodèles de langue The fixed set of tokens that a tokenizer and language model can recognize and represent.Ensemble fixe des jetons qu'un segmenteur et un modèle de langue peuvent reconnaître et représenter. ends up with a vector, and all of them together make one embedding space.
Short, dense, and distances that mean something
Every property of these vectors contrasts with the one-hot representation:
- Short instead of vocabulary-sized. Typically 100 to 300 dimensions rather than one per word.
- Dense instead of sparse. Every position has a value other than zero, where a one-hot vector is almost all zeros.
- Distance means something. Cat and dog end up close, snake farther, democracy elsewhere entirely, because their contexts imposed it during training.
No readable axes
The example with our means of transport showed axes that were interpretable: speed and capacity. The learned dimensions are not. They do not correspond to any nameable property, and looking at one value tells you nothing. In this representation a word’s meaning is the whole pattern of all its values together, and only comparisons between whole vectors are meaningful.
The habit to break: no single dimension stands for anything nameable. Only whole vectors compare. Say it explicitly, because the transport figure has just taught the opposite.
King minus man plus woman
Static word embeddings static word embeddingplongement lexical statique embeddingsplongements A numerical representation that assigns each word type, meaning each distinct word in a vocabulary, a single fixed vector learned from patterns in a corpus.Représentation numérique qui attribue à chaque type de mot, c'est-à-dire à chaque mot distinct d'un vocabulaire, un unique vecteur fixe appris à partir des régularités d'un corpus. like word2vec, one fixed vector per word, let you do arithmetic with words.
When you take the vector for king, subtract the vector for man and add the vector for woman, the point you land on is nearest the word queen (Mikolov et al., 2013b). Nothing in the training aimed at this. It falls out of the geometry: the displacement from man to king encodes something like royalty, and applying that same displacement to woman arrives near queen.
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.
One direction among many
The royalty direction is one of many. Mikolov et al. (2013b) tested the pattern systematically on grammatical relations, a thousand questions each for comparatives (good is to better as rough is to rougher), plurals (year is to years) and verb tense (see is to saw as return is to returned), and found it there too. Encyclopedic relations behave the same way, a country and its capital among them (Jurafsky & Martin, 2026). The axes are still unreadable. The meaning is in the directions between whole vectors, and those can be looked for after the fact.
Carnegie Mellon’s browser demo does exactly that. The three screenshots below were taken from it on 9 September 2026, and the demo can change. They are dense, and a click opens each one larger.
The same arithmetic on stereotypes
The arithmetic works on stereotypes too. In embeddings trained on Google News articles, man is to computer programmer as woman is to homemaker, and occupation words divide along a gender direction the same way king and queen divide along a royalty one (Bolukbasi et al., 2016).
No programmer decided to put woman further from doctor and closer to nurse. The bias comes from the text: the vectors record how the words are used across millions of sentences, and people wrote those sentences. The method is working as designed. The consequences reach everything built on embeddings since (see also the Bias chapter, in the Reliability of LLM output module) (voir aussi le chapitre Biais, dans le module Fiabilité des résultats des GML).
King minus man plus woman
Static word embeddings static word embeddingplongement lexical statique embeddingsplongements A numerical representation that assigns each word type, meaning each distinct word in a vocabulary, a single fixed vector learned from patterns in a corpus.Représentation numérique qui attribue à chaque type de mot, c'est-à-dire à chaque mot distinct d'un vocabulaire, un unique vecteur fixe appris à partir des régularités d'un corpus. like word2vec, one fixed vector per word, let you do arithmetic with words.
When you take the vector for king, subtract the vector for man and add the vector for woman, the point you land on is nearest the word queen (Mikolov et al., 2013b). Nothing in the training aimed at this. It falls out of the geometry: the displacement from man to king encodes something like royalty, and applying that same displacement to woman arrives near queen.
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.
One direction among many
The royalty direction is one of many. Mikolov et al. (2013b) tested the pattern systematically on grammatical relations, a thousand questions each for comparatives (good is to better as rough is to rougher), plurals (year is to years) and verb tense (see is to saw as return is to returned), and found it there too. Encyclopedic relations behave the same way, a country and its capital among them (Jurafsky & Martin, 2026). The axes are still unreadable. The meaning is in the directions between whole vectors, and those can be looked for after the fact.
Carnegie Mellon’s browser demo does exactly that. The three screenshots below were taken from it on 9 September 2026, and the demo can change. They are dense, and a click opens each one larger.
The same arithmetic on stereotypes
The arithmetic works on stereotypes too. In embeddings trained on Google News articles, man is to computer programmer as woman is to homemaker, and occupation words divide along a gender direction the same way king and queen divide along a royalty one (Bolukbasi et al., 2016).
No programmer decided to put woman further from doctor and closer to nurse. The bias comes from the text: the vectors record how the words are used across millions of sentences, and people wrote those sentences. The method is working as designed. The consequences reach everything built on embeddings since (see also the Bias chapter, in the Reliability of LLM output module) (voir aussi le chapitre Biais, dans le module Fiabilité des résultats des GML).
The CMU demo runs in a browser on word2vec and GloVe: try king − man + woman live, then take an analogy from the room’s working languages. Ask for an occupation analogy before showing the Bolukbasi result, so the bias arrives as something the room produced rather than as a warning.
Three limitations
New words get nothing
An embedding model has one vector for each word that occurred in its training text, so a word coined last year, a rare technical term or a typo has no vector and no representation at all. Morphologically rich languages make this worse, since their productive compounds and inflections produce forms no training corpus contains. Modern systems dissolve the problem by working with pieces of words instead (see also the Tokenization chapter, in the Language as numbers module) (voir aussi le chapitre Jetonisation, dans le module Le langage en nombres).
One vector averages every sense
Bank is a financial institution in I deposited money at the bank and a strip of riverside in we picnicked on the river bank. A single vector for bank has to serve both sentences, so it lands somewhere between finance and geography, a compromise that is wrong everywhere. It is not even a fair compromise: the vector is an average over occurrences, so it sits nearest whichever sense is commonest in the training text, and the rarer sense is served worst. Translation feels this early, since choosing between rive and banque is exactly a decision about which sense is active.
Order is invisible
The dog follows Jean and Jean follows the dog contain the same words and do not describe the same walk, so any representation built by combining fixed word vectors struggles to tell them apart. Meaning depends on arrangement, and per-word vectors have nowhere to put arrangement.
Ce que les deux chapitres précédents ont établi
| L’idée | Ce qu’elle apporte | Ce qu’elle coûte |
|---|---|---|
| Un nombre par mot, par ordre alphabétique | Un identifiant | Un ordre et une arithmétique qui ne veulent rien dire |
| Un vecteur vectorvecteur machine learningapprentissage automatique An ordered list of numbers.Liste ordonnée de nombres. par mot | Des coordonnées dans un espace, donc des distances | Rien encore : l’espace reste à construire |
| Un vecteur 1 parmi n | Une identité sans faux ordre | Toutes les paires à égale distance ; 99 999 zéros par mot |
Ce qui manque encore
- Des nombres qui disent comment les mots se rapportent. Jusqu’ici, chat est exactement aussi loin de chien que de démocratie.
- Une représentation qui reste maniable et qui dit quelque chose. Donner à chaque mot sa propre case demande des dizaines de milliers de nombres pour dire une seule chose, et tous sauf un valent zéro.
- Une représentation qui peut changer avec la phrase. Livres ne veut pas dire la même chose dans toutes les phrases où le mot apparaît, et un seul jeu de nombres fixe par mot ne peut pas suivre.
Ce chapitre répond aux deux premiers points. Le troisième demande un chapitre à lui seul (see also the Contextual embeddings chapter, in the Language as numbers module) (voir aussi le chapitre Plongements contextuels, dans le module Le langage en nombres).
Les mots comme coordonnées
Supposons que vous vouliez placer des mots dans un espace à deux dimensions. Vous donnez un sens à l’axe horizontal et un autre à l’axe vertical, puis vous posez chaque mot là où il se situe par rapport à ces deux sens. Chaque mot se retrouve avec des coordonnées, c’est-à-dire un vecteur vectorvecteur machine learningapprentissage automatique An ordered list of numbers.Liste ordonnée de nombres. : ici une liste de deux nombres, un par axe. Ces nombres font plus que localiser le mot. Ils disent comment il se situe sur chacun des deux sens, et à quelle distance il se trouve de tous les autres mots du même espace.
La vitesse et le nombre de passagers
L’idée est développée pour des moyens de transport dans la Figure 1figure 1. L’axe horizontal est le nombre de passagers et l’axe vertical la vitesse, et la plupart des gens s’entendraient sur la place approximative de chaque véhicule. La planche est basse sur les deux : elle ne va pas vite et elle transporte une personne. La fusée a une vitesse maximale et une capacité plus modeste, ce qui lui donne le vecteur [0,4 ; 1,0]. Là où un vecteur 1 parmi n ne faisait qu’identifier un mot, cette paire de nombres dit quelque chose de la chose nommée, et elle fixe la distance entre la fusée et tous les autres véhicules de l’espace.
Placer les mots de cette façon fait aussi apparaître des groupes d’eux-mêmes. Le transport individuel se rassemble à gauche, le transport collectif à droite, et la fusée reste à part, là où elle a sa place. Personne n’a dessiné ces groupes ; ils découlent des coordonnées.
Où placer la pomme
Jusqu’ici, voilà une manière prometteuse de transformer des mots en listes de nombres qui veulent dire quelque chose. Puis : où placeriez-vous une pomme dans cet espace ? La question n’a aucun sens, parce que la vitesse et le nombre de passagers ne disent rien d’une pomme.
Deux conséquences. Un espace qui accueille un vocabulaire entier a besoin de bien plus de deux dimensions, puisqu’il doit convenir à tout, de planche à ardeur. Et dès qu’il y a des centaines de dimensions et des dizaines de milliers de mots, ni les axes ni les positions ne peuvent être choisis par une personne.
Reste la question : comment trouver automatiquement de tels nombres, pour chaque mot d’un vocabulaire ?
Construire l’espace des transports avec le groupe avant de le montrer : la vitesse sur un axe, le nombre de passagers sur l’autre, puis demander où vont une planche, un autobus et une fusée. La pomme arrive à l’écran suivant, avec la question qui tue la version faite à la main.
Cinq trous
Supposons qu’on vous donne cinq fragments de texte, chacun avec un mot manquant :
- adopter un ___
- caresser le ___ du
- et le ___ ronronne fort
- promener son ___ en laisse
- le ___ aime-t-il la musique
Quels mots pourraient remplir le trou ? Chat entre sans peine dans les trois premiers ; la laisse fait hésiter. Chien entre dans l’adoption, la caresse et la laisse, et échoue sur le ronronnement. Le dernier fragment accepte n’importe lequel des trois, et c’est pourquoi il vous apprend si peu. Les deux mots partagent donc la plupart de leurs contextes, et ceux qu’ils ne partagent pas sont exactement ceux qu’on attendrait : un chat ronronne, on promène un chien.
Essayez maintenant serpent. Il va avec adopter un ___, et ensuite, cela se complique : un serpent ne ronronne pas, et un serpent en laisse, c’est vraiment tiré par les cheveux. Serpent partage un ou deux contextes avec chat et chien, et pas le reste. Un mot comme démocratie ne remplit aucun des cinq.
Il ne suffit pas qu’un mot puisse remplir un trou : la fréquence à laquelle il le fait compte aussi. Chat précède ronronne bien plus souvent qu’il ne suit promener son, et un système qui compte les contextes dans un grand ensemble de textes voit cette différence directement.
Ce que montrent les trous
Les mots dont le sens est apparenté apparaissent dans des contextes semblables, et plus les contextes de deux mots se recoupent, plus leurs sens ont tendance à être proches. Des linguistes l’ont formulé dans les années 1950, Joos, Harris et Firth parmi eux (Jurafsky et Martin, 2026), et Firth l’a résumé en une phrase : « You shall know a word by the company it keeps » (Firth, 1957).
Pourquoi cela convient à une machine
L’idée est utile à une machine par ce qu’elle n’exige pas :
- Aucune définition. Personne n’a à dire ce que chat veut dire.
- Aucune annotation. Personne n’a à marquer des exemples à la main.
- Aucun axe choisi à la main. Personne ne choisit les dimensions de l’espace, ni la place de chaque mot sur celles-ci.
Il faut en revanche du texte, en quantité. Les contextes sont observables : n’importe quel grand ensemble de textes montre directement quels mots entourent quels autres. Un système peut donc se construire un substitut utilisable du sens simplement en lisant assez de texte.
Lire les cinq trous à voix haute et laisser le groupe les remplir, un mot à la fois : chat, puis chien, puis serpent, puis démocratie. Ensuite la figure, puis la phrase de Firth.
Apprendre les positions à partir des textes
Mikolov et al. (2013a) publient word2vec, une paire d’architectures qui mettent l’hypothèse distributionnelle distributional hypothesishypothèse distributionnelle embeddingsplongements The linguistic hypothesis that patterns of word use provide evidence about meaning: words that occur with similar neighbouring words are likely to have related or similar meanings.Hypothèse linguistique selon laquelle les régularités d'emploi des mots renseignent sur leur sens : les mots qui apparaissent avec des voisins semblables ont vraisemblablement des sens apparentés ou proches. au travail à grande échelle. Chaque mot part d’un vecteur de quelques centaines de nombres, et ces nombres sont ensuite ajustés sur des millions de phrases, rapprochant les mots chaque fois qu’ils apparaissent dans des contextes semblables. Personne n’annote rien : le texte montre lui-même quels mots apparaissent près de quels autres, et cette information sert de bonne réponse à l’entraînement. Jurafsky et Martin (2026) y voient de l’apprentissage autosupervisé self-supervised learningapprentissage autosupervisé machine learningapprentissage automatique A machine-learning approach in which the targets used for training are created automatically from the structure or content of the training data, rather than being supplied as separate human-written labels.Approche d'apprentissage automatique dans laquelle les cibles servant à l'entraînement sont créées automatiquement à partir de la structure ou du contenu des données, plutôt que fournies sous forme d'étiquettes rédigées par des humains. , où les réponses viennent des données elles-mêmes (see also the training loop: predict, compare, adjust page, in the LLM lifecycle module) (voir aussi la page La boucle d'entraînement : prédire, comparer, ajuster, dans le module Cycle de vie des GML). La méthode s’est répandue parce qu’elle était efficace : des vecteurs de qualité obtenus à partir de 1,6 milliard de mots en moins d’une journée, là où les approches neuronales antérieures coûtaient bien davantage. D’autres méthodes ont suivi, dont GloVe (Pennington et al., 2014), et cette famille est devenue la représentation standard des mots. Chaque mot du vocabulaire vocabularyvocabulaire language modelsmodèles de langue The fixed set of tokens that a tokenizer and language model can recognize and represent.Ensemble fixe des jetons qu'un segmenteur et un modèle de langue peuvent reconnaître et représenter. se retrouve avec un vecteur, et tous ensemble forment un espace de plongement.
Court, dense, et des distances qui veulent dire quelque chose
Chaque propriété de ces vecteurs contraste avec la représentation 1 parmi n :
- Court plutôt que long comme le vocabulaire. Typiquement de 100 à 300 dimensions, plutôt qu’une par mot.
- Dense plutôt que creux. Chaque position contient une valeur non nulle, là où un vecteur 1 parmi n est presque entièrement fait de zéros.
- La distance veut dire quelque chose. Chat et chien se retrouvent proches, serpent plus loin, démocratie tout à fait ailleurs, parce que leurs contextes l’ont imposé pendant l’entraînement.
Des axes illisibles
L’exemple des moyens de transport montrait des axes interprétables : la vitesse et le nombre de passagers. Les dimensions apprises ne le sont pas. Elles ne correspondent à aucune propriété nommable, et regarder une seule valeur ne dit rien. Dans cette représentation, le sens d’un mot est le motif complet de toutes ses valeurs prises ensemble, et seules les comparaisons entre vecteurs entiers ont un sens.
L’habitude à casser : aucune dimension ne représente quoi que ce soit de nommable. Seuls des vecteurs entiers se comparent. Le dire explicitement, parce que la figure des transports vient d’enseigner le contraire.
Roi moins homme plus femme
Les plongements lexicaux statiques static word embeddingplongement lexical statique embeddingsplongements A numerical representation that assigns each word type, meaning each distinct word in a vocabulary, a single fixed vector learned from patterns in a corpus.Représentation numérique qui attribue à chaque type de mot, c'est-à-dire à chaque mot distinct d'un vocabulaire, un unique vecteur fixe appris à partir des régularités d'un corpus. comme word2vec, un vecteur fixe par mot, permettent de faire de l’arithmétique avec des mots.
Quand on prend le vecteur de roi, qu’on en soustrait le vecteur de homme et qu’on y ajoute le vecteur de femme, le point où l’on arrive a pour plus proche voisin le mot reine (Mikolov et al., 2013b). Rien dans l’entraînement ne visait ce résultat. Il découle de la géométrie : le déplacement de homme vers roi encode quelque chose comme la royauté, et appliquer ce même déplacement à femme arrive près de reine.
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.
Une direction parmi bien d’autres
La direction de la royauté est l’une parmi bien d’autres. Mikolov et al. (2013b) ont testé ce motif de façon systématique sur des relations grammaticales, mille questions chacune pour les comparatifs (good est à better ce que rough est à rougher), les pluriels (year est à years) et le temps des verbes (see est à saw ce que return est à returned), et il s’est confirmé. Les relations encyclopédiques se comportent de la même manière, dont celle d’un pays et de sa capitale (Jurafsky et Martin, 2026). Les axes restent illisibles. Le sens est dans les directions entre vecteurs entiers, et celles-ci peuvent se chercher après coup.
La démonstration en ligne de Carnegie Mellon fait exactement cela. Les trois captures ci-dessous en viennent, prises le 9 septembre 2026, et la démonstration peut changer. Elles sont denses ; un clic ouvre chacune en plus grand.
La même arithmétique sur les stéréotypes
L’arithmétique fonctionne aussi sur les stéréotypes. Dans des plongements entraînés sur des articles de Google News, man est à computer programmer ce que woman est à homemaker, et les noms de métiers se répartissent selon une direction de genre exactement comme roi et reine se répartissent selon une direction de royauté (Bolukbasi et al., 2016).
Aucun programmeur n’a décidé d’éloigner woman de doctor et de la rapprocher de nurse. Le biais vient des textes : les vecteurs enregistrent la manière dont les mots sont employés à travers des millions de phrases, et ce sont des personnes qui ont écrit ces phrases. La méthode fonctionne comme prévu. Les conséquences touchent tout ce qui a été construit sur des plongements depuis (see also the Bias chapter, in the Reliability of LLM output module) (voir aussi le chapitre Biais, dans le module Fiabilité des résultats des GML).
Roi moins homme plus femme
Les plongements lexicaux statiques static word embeddingplongement lexical statique embeddingsplongements A numerical representation that assigns each word type, meaning each distinct word in a vocabulary, a single fixed vector learned from patterns in a corpus.Représentation numérique qui attribue à chaque type de mot, c'est-à-dire à chaque mot distinct d'un vocabulaire, un unique vecteur fixe appris à partir des régularités d'un corpus. comme word2vec, un vecteur fixe par mot, permettent de faire de l’arithmétique avec des mots.
Quand on prend le vecteur de roi, qu’on en soustrait le vecteur de homme et qu’on y ajoute le vecteur de femme, le point où l’on arrive a pour plus proche voisin le mot reine (Mikolov et al., 2013b). Rien dans l’entraînement ne visait ce résultat. Il découle de la géométrie : le déplacement de homme vers roi encode quelque chose comme la royauté, et appliquer ce même déplacement à femme arrive près de reine.
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.
Une direction parmi bien d’autres
La direction de la royauté est l’une parmi bien d’autres. Mikolov et al. (2013b) ont testé ce motif de façon systématique sur des relations grammaticales, mille questions chacune pour les comparatifs (good est à better ce que rough est à rougher), les pluriels (year est à years) et le temps des verbes (see est à saw ce que return est à returned), et il s’est confirmé. Les relations encyclopédiques se comportent de la même manière, dont celle d’un pays et de sa capitale (Jurafsky et Martin, 2026). Les axes restent illisibles. Le sens est dans les directions entre vecteurs entiers, et celles-ci peuvent se chercher après coup.
La démonstration en ligne de Carnegie Mellon fait exactement cela. Les trois captures ci-dessous en viennent, prises le 9 septembre 2026, et la démonstration peut changer. Elles sont denses ; un clic ouvre chacune en plus grand.
La même arithmétique sur les stéréotypes
L’arithmétique fonctionne aussi sur les stéréotypes. Dans des plongements entraînés sur des articles de Google News, man est à computer programmer ce que woman est à homemaker, et les noms de métiers se répartissent selon une direction de genre exactement comme roi et reine se répartissent selon une direction de royauté (Bolukbasi et al., 2016).
Aucun programmeur n’a décidé d’éloigner woman de doctor et de la rapprocher de nurse. Le biais vient des textes : les vecteurs enregistrent la manière dont les mots sont employés à travers des millions de phrases, et ce sont des personnes qui ont écrit ces phrases. La méthode fonctionne comme prévu. Les conséquences touchent tout ce qui a été construit sur des plongements depuis (see also the Bias chapter, in the Reliability of LLM output module) (voir aussi le chapitre Biais, dans le module Fiabilité des résultats des GML).
La démonstration de CMU tourne dans un navigateur sur word2vec et GloVe : essayer roi − homme + femme en direct, puis prendre une analogie dans les langues de travail du groupe. Demander une analogie de métiers avant de montrer le résultat de Bolukbasi, pour que le biais arrive comme quelque chose que le groupe a produit et non comme un avertissement.
Trois limites
Les mots nouveaux n’obtiennent rien
Un modèle de plongements a un vecteur pour chaque mot rencontré à l’entraînement : un mot forgé l’an dernier, un terme technique rare ou une coquille n’a donc aucun vecteur et aucune représentation. Les langues à morphologie riche aggravent la situation, puisque leurs composés et leurs flexions productives produisent des formes qu’aucune base d’apprentissage ne contient. Les systèmes modernes dissolvent le problème en travaillant sur des morceaux de mots (see also the Tokenization chapter, in the Language as numbers module) (voir aussi le chapitre Jetonisation, dans le module Le langage en nombres).
Un seul vecteur fait la moyenne de tous les sens
Livres désigne une monnaie dans j’ai changé mille livres et des ouvrages dans j’ai emprunté trois livres. Un vecteur unique pour livres doit servir aux deux phrases : il atterrit donc quelque part entre la finance et la lecture, un compromis qui a tort partout. Ce n’est même pas un compromis équitable : le vecteur est une moyenne sur les occurrences, il se place donc au plus près du sens le plus fréquent dans les textes d’entraînement, et c’est le sens le plus rare qui est le plus mal servi. La traduction s’en aperçoit tôt, puisque choisir entre pounds et books est exactement une décision sur le sens actif.
L’ordre est invisible
Jean suit le chien et le chien suit Jean contiennent les mêmes mots et ne décrivent pas la même promenade ; toute représentation construite en combinant des vecteurs de mots fixes a donc du mal à les distinguer. Le sens dépend de l’agencement, et des vecteurs par mot n’ont nulle part où mettre l’agencement.
Three sentences, one word
Take three sentences with bank in them:
- I deposited money at the bank.
- We picnicked on the river bank.
- The plane will bank left.
You would translate the word three different ways: banque, rive, virer. A fixed embedding gives all three the same vector.
A vector per occurrence
A contextual embedding sides with the translator. Instead of storing one finished vector per word, the model computes a vector for each occurrence, at the moment of use, from the whole sentence around it:
- the bank beside deposited and money comes out near the vocabulary of finance;
- the one beside river and picnicked, near geography;
- the one after will, in verb territory.
Same word, three vectors, each shaped by its company. Models that work this way arrived in the late 2010s, and ELMo was the landmark (Peters et al., 2018).
This is also where the material stops being machine learning machine learning (ML)apprentissage automatique machine learningapprentissage automatique An approach to artificial intelligence in which a model is trained on data or experience so that its adjustable parameters come to reflect patterns relevant to a task.Approche de l'intelligence artificielle dans laquelle un modèle est entraîné sur des données ou sur l'expérience, de sorte que ses paramètres ajustables en viennent à refléter des régularités pertinentes pour une tâche. in general and becomes deep learning deep learning (DL)apprentissage profond machine learningapprentissage automatique An approach to machine learning based on neural networks with many successive layers of computing units.Approche de l'apprentissage automatique fondée sur des réseaux de neurones comportant de nombreuses couches successives d'unités de calcul. . Word2vec kept its model deliberately simple, which let it train on billions of words (Mikolov et al., 2013a). Computing a vector for every occurrence takes many layers instead, and ELMo’s paper says so in its title, Deep contextualized word representations.
What happens to polysemy
Nobody lists the senses of bank or writes a rule to pick one. The senses simply stop being merged, because there is no single vector left for them to be merged into.
One consequence is easy to miss. A word no longer has “its vector”, the kind you could print in a table. It has a vector in each sentence, so the question “what does the model think bank means?” only has answers of the form “here, in this sentence”. Word meaning in isolation, the thing a dictionary records, has quietly left the system.
Three sentences on the board first: I deposited money at the bank, we picnicked on the river bank, the plane will bank left. Ask for the French of each. Then the figure: the room has already done what the model does.
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.
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. 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.
Every layer of the model therefore draws on both sides at once. The architecture underneath makes that possible (see also the Attention & transformers chapter, in the Language as numbers module) (voir aussi le chapitre Attention et transformeurs, dans le module Le langage en nombres).
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.
- Computation. A fresh vector per occurrence, from the whole sentence, costs far more than looking up a stored one, so these models need serious hardware.
- Inspection. A static embedding table could at least be examined word by word. Contextual representations exist only inside a running model, one more step away from anything a person can read (see also the From neural networks to large language models chapter, in the Foundations of AI & NLP module) (voir aussi le chapitre Des réseaux de neurones aux grands modèles de langue, dans le module Fondements de l'IA et du TAL).
The field judged the accuracy worth both.
The generator screen is the hinge to séance 3: a generator only ever sees what came before, which is why it commits to words it cannot revise. Worth naming now, so that behaviour is expected rather than surprising when the chatbots arrive.
What pretraining leaves you with
Pretraining leaves you with a model that turns any sentence into contextual embeddings contextual embeddingplongement contextuel embeddingsplongements A numerical representation generated for a particular occurrence of a token by taking account of the other tokens available to the model.Représentation numérique générée pour une occurrence particulière d'un jeton en tenant compte des autres jetons accessibles au modèle. . It knows a great deal about the language it read and nothing about any particular task, which makes it worth keeping: one expensive training run, then many uses.
Two ways to use it
Its embeddings can be taken as they are and fed into a model of your own, which is how ELMo was used. Or the whole model can be kept and fine-tuned: a small output layer is added and trained on labelled examples for one task, so that what the model learned about language carries over to it (Devlin et al., 2019) (see also the Fine-tuning chapter, in the LLM lifecycle module) (voir aussi le chapitre Affinage, dans le module Cycle de vie des GML). Sentiment analysis, named-entity recognition and question answering were all built that way, and the task-specific training is small beside the pretraining.
That recipe still applies to a model like BERT. For large generative models, much of what once took a fine-tuned model of its own is now done by putting examples in the prompt promptrequête promptingrequêtes Input given to a generative AI system to specify a task, provide context, or otherwise guide its output.Entrée fournie à un système d'IA générative pour préciser une tâche, donner du contexte ou orienter la sortie. instead (Brown et al., 2020) (see also the In-context learning chapter, in the LLM lifecycle module) (voir aussi le chapitre Apprentissage en contexte, dans le module Cycle de vie des GML).
Two routes off one model: its embeddings as features, or the model itself fine-tuned. Say which one BERT made standard, and that the pretraining is the expensive half.
Trois phrases, un seul mot
Prenons trois phrases contenant bank :
- I deposited money at the bank.
- We picnicked on the river bank.
- The plane will bank left.
Vous traduiriez le mot de trois façons différentes : banque, rive, virer. Un plongement fixe donne le même vecteur aux trois.
Un vecteur par occurrence
Un plongement contextuel donne raison à la traductrice ou au traducteur. Au lieu de conserver un vecteur tout fait par mot, le modèle calcule un vecteur pour chaque occurrence, au moment de l’usage, à partir de toute la phrase qui l’entoure :
- le bank voisin de deposited et de money ressort près du vocabulaire de la finance ;
- celui qui voisine avec river et picnicked, près de la géographie ;
- celui qui suit will, du côté des verbes.
Même mot, trois vecteurs, chacun façonné par sa compagnie. Les modèles qui fonctionnent ainsi arrivent à la fin des années 2010, et ELMo en est le jalon (Peters et al., 2018).
C’est aussi ici que la matière cesse d’être de l’apprentissage automatique machine learning (ML)apprentissage automatique machine learningapprentissage automatique An approach to artificial intelligence in which a model is trained on data or experience so that its adjustable parameters come to reflect patterns relevant to a task.Approche de l'intelligence artificielle dans laquelle un modèle est entraîné sur des données ou sur l'expérience, de sorte que ses paramètres ajustables en viennent à refléter des régularités pertinentes pour une tâche. en général pour devenir de l’apprentissage profond deep learning (DL)apprentissage profond machine learningapprentissage automatique An approach to machine learning based on neural networks with many successive layers of computing units.Approche de l'apprentissage automatique fondée sur des réseaux de neurones comportant de nombreuses couches successives d'unités de calcul. . Word2vec gardait son modèle délibérément simple, ce qui lui a permis de s’entraîner sur des milliards de mots (Mikolov et al., 2013a). Calculer un vecteur pour chaque occurrence demande au contraire de nombreuses couches, et l’article d’ELMo le dit dans son titre, Deep contextualized word representations.
Ce que devient la polysémie
Personne ne dresse la liste des sens de bank ni n’écrit de règle pour en choisir un. Les sens cessent simplement d’être fusionnés, parce qu’il ne reste aucun vecteur unique dans lequel les fusionner.
Une conséquence passe facilement inaperçue. Un mot n’a plus « son vecteur », celui qu’on pourrait imprimer dans un tableau. Il a un vecteur dans chaque phrase, si bien que la question « que pense le modèle du sens de bank ? » n’admet que des réponses de la forme « ici, dans cette phrase ». Le sens d’un mot hors contexte, ce que consigne un dictionnaire, a discrètement quitté le système.
Trois phrases au tableau d’abord : I deposited money at the bank, we picnicked on the river bank, the plane will bank left. Demander la traduction française de chacune. Puis la figure : le groupe vient de faire ce que fait le modèle.
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.
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. 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.
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, in the Language as numbers module) (voir aussi le chapitre Attention et transformeurs, dans le module Le langage en nombres).
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 calcul. Un vecteur neuf par occurrence, à partir de toute la phrase, coûte bien plus cher que d’en consulter un déjà rangé : ces modèles exigent donc du matériel sérieux.
- L’inspection. Une table de plongements statiques pouvait au moins s’examiner mot à mot. Les représentations contextuelles n’existent qu’à l’intérieur d’un modèle en train de tourner, un cran plus loin encore de ce qu’une personne peut lire (see also the From neural networks to large language models chapter, in the Foundations of AI & NLP module) (voir aussi le chapitre Des réseaux de neurones aux grands modèles de langue, dans le module Fondements de l'IA et du TAL).
Le domaine a jugé que la précision valait les deux.
L’écran sur le générateur est la charnière vers la séance 3 : un générateur ne voit jamais que ce qui précède, et c’est pourquoi il s’engage sur des mots qu’il ne peut pas réviser. Cela vaut la peine de le nommer maintenant, pour que ce comportement soit attendu plutôt que surprenant quand les agents conversationnels arriveront.
Ce que laisse le préentraînement
Le préentraînement pre-trainingpréentraînement language modelsmodèles de langue An initial stage in which a model learns general patterns and reusable representations from a large dataset, often through self-supervised learning, before any later adaptation for particular tasks or uses.Étape initiale au cours de laquelle un modèle apprend des régularités générales et des représentations réutilisables à partir d'un grand jeu de données, souvent par apprentissage autosupervisé, avant toute adaptation ultérieure à des tâches ou à des usages particuliers. laisse un modèle qui transforme n’importe quelle phrase en plongements contextuels contextual embeddingplongement contextuel embeddingsplongements A numerical representation generated for a particular occurrence of a token by taking account of the other tokens available to the model.Représentation numérique générée pour une occurrence particulière d'un jeton en tenant compte des autres jetons accessibles au modèle. . Il en sait beaucoup sur la langue qu’il a lue et rien sur une tâche particulière, ce qui le rend précieux : un entraînement coûteux, puis de nombreux usages.
Deux façons de s’en servir
Ses plongements peuvent être pris tels quels et fournis à un modèle à vous, comme ELMo était utilisé. Ou le modèle entier peut être conservé et affiné (fine-tuning, aussi appelé réglage fin) : on y ajoute une petite couche de sortie, entraînée sur des exemples annotés pour une seule tâche, de sorte que ce que le modèle a appris de la langue lui profite (Devlin et al., 2019) (see also the Fine-tuning chapter, in the LLM lifecycle module) (voir aussi le chapitre Affinage, dans le module Cycle de vie des GML). L’analyse de sentiments, la reconnaissance d’entités nommées named entity recognition (NER)reconnaissance d'entités nommées (REN) NLPTAL The task of finding the spans of a text that are proper names, and labelling the category, most often a person, a location or an organization.Tâche qui consiste à repérer dans un texte les segments qui sont des noms propres, et à en étiqueter la catégorie, le plus souvent une personne, un lieu ou une organisation. et la réponse aux questions ont toutes été construites ainsi, et l’entraînement propre à la tâche est petit à côté du préentraînement.
Cette recette s’applique toujours à un modèle comme BERT. Pour les grands modèles génératifs, une bonne part de ce qui demandait autrefois un modèle affiné à part se fait maintenant en mettant des exemples dans la requête promptrequête promptingrequêtes Input given to a generative AI system to specify a task, provide context, or otherwise guide its output.Entrée fournie à un système d'IA générative pour préciser une tâche, donner du contexte ou orienter la sortie. (Brown et al., 2020) (see also the In-context learning chapter, in the LLM lifecycle module) (voir aussi le chapitre Apprentissage en contexte, dans le module Cycle de vie des GML).
Deux voies à partir d’un seul modèle : ses plongements comme traits, ou le modèle lui-même affiné. Dire laquelle BERT a rendue standard, et que le préentraînement est la moitié coûteuse.