Shadowing-Übung: Encoder-Only Transformers (like BERT) for RAG, Clearly Explained!!! - Englisch Sprechen Lernen mit Video

Übungsmodus wählen

Jeder Modus öffnet einen Übungsraum im Vollbild.

172 Sätze
Wenn Sätze zu kurz oder zu lang sind, klicke auf Edit, um sie anzupassen.
1
Encoder -only transformers can cluster things and classify things that's cool.
2
StatQuest.
3
Hello, I'm Josh Starmer and welcome to StatQuest.
4
Today we're going to talk about encoder -only transformers and they're going to be clearly explained.
5
This StatQuest is brought to you by the letters A, B, and C.
6
A always, B, B, C curious always be curious.
7
Note, this stat quest assumes that you are already familiar with the main ideas of how neural networks work.
8
If not, check out the quest.
9
Also note, this stat quest focuses on the main ideas of how encoder -only transformers work
10
and what we can do with them.
11
That said, if you want to see the nitty -gritty details, check out these fine quests.
12
Okay,
13
way back in 2017 the first transformer ever made had one part called an encoder and a second part called a decoder.
14
And the encoder and the decoder were connected to each other so they could work together.
15
This first transformer was based on something called a seek -to -seek or an encoder -decoder model.
16
Encoder -decoder models were designed to translate text in one language, like English, into another language, like Spanish.
17
For example, Squatch might say, Pizza is great!
18
And the encoder would crunch a lot of numbers to encode the input, and the decoder would crunch a lot of numbers,
19
including the output from the encoder, and, ultimately, decode those numbers into a translation.
20
La pizza es magnifico.
21
Bam!
22
However, it wasn't long after this first encoder -decoder transform was published
23
that people realized that both parts could work just fine on their own.
24
It turned out that we could generate text, including translations of text, with just a decoder.
25
And these models, which formed the basis for ChatGPT, were named decoder -only transformers.
26
Likewise, models based entirely on the encoder started to be very useful on their own.
27
And these models, which formed the basis for BERT and many other models, were named encoder -only transformers.
28
However, over the years, the models based on decoder -only transformers kind of stole the show.
29
Pretty much everyone has used, or at least heard of, ChatGPT or Gemini or any of the other countless decoder -only transformers out there.
30
And I've heard some super smart people, who keep up with AI and everything, ask me if people still used encoder -only transformers.
31
So, in this stat quest, I want to dive deep into encoder -only transformers so we can understand their significant, but understated, power.
32
And that means starting with a deep dive into the first thing a transformer does, which is create word embeddings.
33
Word embedding converts words, bits of words, and symbols, collectively called tokens, into numbers.
34
We need to convert tokens into numbers because transformers are a type of neural network and neural networks only operate on numbers.
35
One super easy way to convert words into numbers is to just assign each word to a random number.
36
For example, if Squatch just ate a delicious pizza, they might say, Pizza is great!
37
And we could assign a random number to each word.
38
Now, if Norm came along and said, Pizza is awesome!
39
Then we could reuse the random numbers that we already assigned to pizza and is, and assign a new random number to awesome.
40
In theory, this is fine.
41
But it means that even though great and awesome mean similar things and are used in similar ways,
42
they have very different numbers associated with them.
43
And that means the neural network will probably need a lot more complexity
44
and training because learning how to correctly process the word great won't help the neural network correctly use the word awesome.
45
So it would be nice if similar words that are used in similar ways could be given similar numbers.
46
So that learning how to use one word will help learn how to use the other at the same time.
47
And because the same words can be used in different contexts, or made plural, or used in some other way,
48
it might be nice to assign each word more than one number, so that the neural network can more easily adjust to different contexts.
49
For example, the word great can be used in a positive way, like, pizza is great.
50
And it can also be used in a sarcastic negative way, like, my cell phone's broken.
51
Great.
52
And it would be nice if we had one number that could keep track of the positive ways that great is used,
53
and a different number to keep track of the negative ways.
54
Hey Josh, deciding what words are similar and are used in similar contexts sounds like a lot of work.
55
And using more than one number per word to account for different contexts sounds like even more work.
56
Don't worry Squatch, the good news is
57
that we can get a relatively simple neural network to do all of the work for us.
58
For example, let's imagine we have two phrases.
59
Pizza is great and pizza is awesome.
60
The first thing we do is create inputs to a relatively simple neural network for each unique word.
61
Then we create an output for each word.
62
Then we connect all of the inputs to at least one activation function.
63
And in this example, we'll connect the inputs to two activation functions.
64
The number of activation functions determines how many numbers we will use to represent each word.
65
In this case, since we have two activation functions, we'll end up with two numbers or word embeddings representing each word.
66
Then we add weights to the connections from the inputs to the activation functions.
67
These weights are initialized with random numbers, so right now they're not very useful.
68
But the plan is to train them and thus change them using this data.
69
Lastly, we connect the activation functions to the outputs with some boring details that we don't need to worry about right now.
70
Because we have one word embedding for each word going to the activation function on the top,
71
and one word embedding for each word going to the activation function on the bottom,
72
we can plot each word on a graph that has the top word embeddings on the x -axis
73
and the bottom word embeddings on the y -axis.
74
For example, the word pizza goes here because its top word embedding is negative 0 .11,
75
and its bottom word embedding is 0 .10.
76
Likewise, the word is goes here, great goes here, and awesome goes here.
77
Now, with this graph, we see that the words great
78
and awesome are currently no more similar to each other than they are to any of the other words.
79
However, because both words appear in the same context in the training data, we hope that training the network will make their word embeddings more similar.
80
The idea is that we want each word in the training data to predict the next word.
81
For example, we want the first word in each sentence, pizza, to predict the word that comes after it, is.
82
And we want the word IS to predict the words that come after it, GREAT and AWESOME.
83
So, in order to see which word the network predicts should come after PIZZA, we put a 1 in the input for PIZZA,
84
and we put 0s in all of the other inputs.
85
Then we do the math with the randomly initialized parameters, and we end up predicting GREAT,
86
because it has the largest output value, 0 .45.
87
Thus, with the randomly initialized parameters, the network does not correctly predict IS, the word that comes after PIZZA.
88
However, after we train the model, we end up with these new word embeddings.
89
And PIZZA correctly predicts IS and is correctly predicts great and awesome.
90
Now when we graph the words with the new word embeddings, great and awesome cluster together.
91
This result is great and awesome because great and awesome are similar words used in similar contexts,
92
and they ended up with similar word embeddings.
93
So far, we've seen the simplest way to create word embeddings.
94
We used a simple network that we trained to predict the word that comes after the input.
95
However, just predicting the next word doesn't give us a lot of context to determine the optimal word embeddings.
96
In contrast, if we had a more complicated training data set, then we would have more inputs and outputs for our neural network.
97
And we could connect everything like we did before.
98
But now, because we have more inputs and outputs, and longer sentences in the training data,
99
we can add more context to the training process.
100
For example, we can use the pizza came out to predict the next word of.
101
In other words, instead of just using one word to predict the next, we can use the preceding four words to predict the next.
102
Increasing the context can help create better word embedding values.
103
But I want to point out that the way we are doing things right now ignores word order.
104
And because we are not currently keeping track of word order, any jumble is just as good as anything else.
105
In other words, the pizza came out of would give us the same inputs an output, as the jumbled up phrase,
106
pizza out came the of.
107
So it would be nice if there were some way to create word embedding values that also took word order into account.
108
And that leads us to the part of a transformer that comes after the initial word embedding layer, called positional encoding.
109
Positional encoding helps keep track of word order.
110
For example, if Norm said, Squatch eats pizza, then Squatch might say, yum.
111
In contrast, if Norm said, pizza eats Squatch, then Squatch might say, yikes.
112
So these two phrases, Squatch eats pizza and pizza eats squash use the exact same words but have very different meanings.
113
So, keeping track of word order is super important.
114
There are a bunch of ways to implement positional encoding, but these details are out of the scope of this quest.
115
Anyway, now we know that positional encoding helps keep track of word order.
116
However, it would be great if there was also a way to keep track of the relationships among words.
117
For example, if the input sentence was this, The pizza came out of the oven and it tasted good.
118
Then this word, it, could refer to pizza or potentially it could refer to the word oven.
119
Josh, I've heard of good tasting pizza but never a good tasting oven.
120
I know, Squatch, that's why it's important that the transformer correctly associates the word it with pizza.
121
And that leads us to the part of a transformer that comes after positional encoding, called attention.
122
And, specifically, in an encoder -only transformer, it's called self -attention.
123
Attention helps keep track of the relationships among words.
124
Going back to our example about pizza coming out of an oven, attention can help correctly associate the word it with the word pizza.
125
Note, there are different types of attention, but encoder -only transformers only use self -attention, so we'll focus on that.
126
In general terms, self -attention works by seeing how similar each word is to all of the other words in the sentence, including itself.
127
For example, self -attention calculates the similarity between the first word,
128
the, and all of the other words in the sentence, including itself.
129
And self -attention calculates these similarities for every word in the sentence.
130
Once the similarities are calculated, they are used to determine how the transformer encodes each word. For example,
131
if you looked at a lot of sentences about pizza and the word it was more commonly associated with pizza than oven,
132
then the similarity score for pizza will cause
133
it to have a larger impact on how the word it is encoded by the transformer.
134
Bam.
135
Now that we understand the ideas behind self -attention,
136
we understand the ideas behind the three fundamental building blocks that make up an encoder -only transformer.
137
Word embedding converts the input into numbers, positional encoding helps keep track of word order,
138
and self -attention helps establish relationships among words.
139
Combining all three layers creates a new kind of embedding for each token that takes position and relationships among words into account.
140
And this new type of embedding is sometimes called context -aware embedding or contextualized embedding.
141
Because context -aware embeddings include information about the position of each word as well as the relationships among the words,
142
Context -aware embeddings can help cluster similar sentences or even similar documents.
143
Bam!
144
To summarize, encoder -only transformers like BERT that only use self -attention can create context -aware embeddings.
145
And just like plain old word embeddings can help cluster similar words that are used in similar ways,
146
Context -aware embeddings can help cluster similar sentences or similar documents.
147
Note, the ability to cluster similar sentences in documents is the foundation for something called Retrieval Augmented Generation, or RAG.
148
RAG works by breaking a document into blocks of text
149
and then using an encoder -only transformer to create context -aware embeddings for each one.
150
Then, when someone gives an AI a prompt like, what is pizza?
151
RAG generates embeddings for what is pizza and finds the chunks of text that are the most similar.
152
Double bam!
153
Now that we understand the main ideas behind encoder -only transformers and context -aware embeddings,
154
let's talk about another cool thing we can do with them.
155
One thing that we can do is use the context -aware embeddings as inputs to a normal neural network
156
that classifies the sentiment of the input.
157
For example, we might want to see if people are posting positive or negative sentiments about pizza on LinkedIn.
158
And the context -aware embeddings are great inputs for a neural network that can do that type of classification.
159
Alternatively, we could use the context -aware embeddings as variables in a logistic regression model that does classification.
160
Anyway, even though decoder -only transformers like ChatGPT get all the hype, the context -aware embeddings
161
that encoder -only transformers create can be used in a wide variety of settings to do very cool things triple bam.
162
Now it's time for some shameless self -promotion.
163
If you want to review statistics and machine learning offline, check out the StatQuest PDF study guides and my books,
164
the StatQuest Illustrated Guide to Machine Learning, and the StatQuest Illustrated Guide to Neural Networks and AI at StatQuest .org.
165
There's something for everyone.
166
Hooray!
167
We've made it to the end of another exciting StatQuest.
168
If you like this StatQuest and want to see more, please subscribe.
169
And if you want to support StatQuest, consider contributing to my Patreon campaign, becoming a channel member, buying one or two of my original songs,
170
or a t -shirt, or a hoodie, or just donate.
171
The links are in the description below.
172
All right, until next time, quest on!

App herunterladen

Alles, was du zum fließenden Sprechen brauchst

KI-AussprachebewertungJeder Satz bewertet
IPA-TrainingJeden Laut meistern
WortschatzBaue deinen Wortschatz auf
VokabelspielSpielend lernen

Gleicher Kanal

FOR YOU

Empfohlenes Video

Wortschatz und Sprechhinweise zu dieser Lektion

Diese Sprechübung basiert auf dem Video „Encoder-Only Transformers (like BERT) for RAG, Clearly Explained!!!“. Diese Wörter kommen am häufigsten vor: word, embedding, pizza, transformer, encoder. Dieses Video enthält 172 Sätze und 2494 Wörter zum Nachsprechen. Der gesprochene Teil dauert 18:50. Der Sprecher spricht gleichmäßig mit etwa 132 Wörtern pro Minute – ein angenehmes Tempo fürs Shadowing. Nur 80 % der Wörter gehören zu den 3.000 häufigsten im Englischen, der Wortschatz ist also anspruchsvoll.

Wichtiger Wortschatz in diesem Video

15 lernenswerte Wörter aus dem Video, mit Aussprache und Bedeutung:

WortAusspracheBedeutung
pizza Substantiv/ˈpi.tsə/Pizza
predict Verb/pɹɪˈdɪkt/prophezeien
neural Adjektiv/ˈnʊɹəl/neural
activation Substantiv/ˌæktəˈveɪʃən/Aktivierung, Aktivieren
output Substantiv/ˈaʊtpʊt/Output
quest Substantiv/kwɛst/Suche, Queste
cluster Substantiv/ˈklʌstɚ/Anhäufung, Büschel
connect Verb/kəˈnɛkt/verbinden
oven Substantiv/ˈʌ.vn̩/Backofen, Backrohr
assign Verb/əˈsaɪn/zuweisen, zuteilen
associate Substantiv/əˈsoʊʃi.ət/Weggefährte
convert Verb/kənˈvɝt/konvertieren, umwandeln
similarity Substantiv/ˌsɪm.ɪˈlæɹ.ɪ.ti/Ähnlichkeit
phrase Substantiv/ˈfɹeɪ̯z/Redewendung, Phrase
graph Substantiv/ɡɹæf/Graph, Funktionsgraph

Phrasal Verbs, die du hören wirst

WortAusspracheBedeutung
check out Verbüberprüfen
come along Verbmitgehen
end up Verbsich herausstellen, am Ende irgendwo / etwas sein
keep up with Verbmithalten, mit etwas Schritt halten
make up Verb/ˌmeɪk ˈʌp/wiedergutmachen, kompensieren
point out Verbhinweisen
turn out Verbsich herausstellen als/dass, sich erweisen als

Grammatik in diesem Video

Die Strukturen, die der Sprecher am häufigsten verwendet, mit den genauen Worten aus dem Video:

StrukturIm Video
Passiv be + Partizip Perfekt – wichtig ist, was geschieht, nicht wer es tutbe clearly explained · is brought · were connected
Present Perfect have/has + Partizip Perfekt – eine vergangene Handlung, die jetzt noch wichtig isthas used · I've heard · we've seen

Aussprache, auf die du achten solltest

Der Sprecher verwendet 16 Kurzformen und abgeschwächte Formen, zum Beispiel we'll, don't, I've. Sprich sie in der kurzen Form, so wie du sie hörst.

  • Die Laute „sh“ und „zh“: activation /ˌæktəˈveɪʃən/, associate /əˈsoʊʃi.ət/, contrast /kənˈt(ʃ)ɹæst/, translation /tɹænzˈleɪʃən/, classification /ˌklæsɪfɪˈkeɪʃən/
  • Lange Wörter – auf die Betonung achten: activation /ˌæktəˈveɪʃən/, associate /əˈsoʊʃi.ət/, similarity /ˌsɪm.ɪˈlæɹ.ɪ.ti/, classification /ˌklæsɪfɪˈkeɪʃən/, parameter /pəˈɹæm.ə.tɚ/

Laute, die Deutschsprachigen schwerfallen:

  • /w/ — mit runden Lippen, nicht wie das deutsche „w“ (/v/): quest /kwɛst/, likewise /ˈlaɪkˌwaɪz/, squash /skwɔʃ/
  • Stimmhafter Auslaut — /b/, /d/, /g/, /z/, /v/ am Wortende nicht verhärten: phrase /ˈfɹeɪ̯z/, dive /daɪv/, likewise /ˈlaɪkˌwaɪz/, complicated /ˈkɑm.plɪˌkeɪ.tɪd/, subscribe /səbˈskɹaɪb/
  • /æ/ — offener als „ä“: activation /ˌæktəˈveɪʃən/, similarity /ˌsɪm.ɪˈlæɹ.ɪ.ti/, graph /ɡɹæf/, stat /stæt/, calculate /ˈkælkjʊleɪt/

So übst du mit diesem Video

  1. Höre dir das ganze Video einmal an, ohne zu sprechen, und notiere die Wörter, die du nicht kennst.
  2. Sprich Satz für Satz in normaler Geschwindigkeit nach und wiederhole jeden, bis dein Rhythmus zum Sprecher passt.
  3. Nimm dich auf und vergleiche mit dem Original; achte dabei auf Wörter wie pizza, predict, neural.

Was ist die Shadowing-Technik?

Shadowing ist eine wissenschaftlich fundierte Sprachlerntechnik, die ursprünglich für die professionelle Dolmetscherausbildung entwickelt und durch den Polyglotten Dr. Alexander Arguelles populär gemacht wurde. Die Methode ist einfach aber wirkungsvoll: Du hörst englisches Audio von Muttersprachlern und wiederholst es sofort laut — wie ein Schatten, der dem Sprecher mit nur 1–2 Sekunden Verzögerung folgt. Anders als passives Hören oder Grammatikübungen zwingt Shadowing dein Gehirn und deine Mundmuskulatur, gleichzeitig echte Sprachmuster zu verarbeiten und zu reproduzieren. Studien zeigen, dass es Aussprachegenauigkeit, Intonation, Rhythmus, verbundene Sprache, Hörverständnis und Sprechflüssigkeit signifikant verbessert — was es zu einer der effektivsten Methoden für die IELTS Speaking-Vorbereitung und reale englische Kommunikation macht.

Shadowing-Technik: die vollständige Schritt-für-Schritt-Anleitung lesen →