GeekCoding101 make your way to geek

Attention Is All You Need: Key Terms in English & Chinese

A glossary of Transformer terms from "Attention Is All You Need" (Q/K/V, multi-head attention, positional encoding, BLEU) with Chinese translations.

7 min read
Terms
On this pageHow to use this glossary

This page lists the key terms from “Attention Is All You Need” (Vaswani et al.), the paper that introduced the Transformer. Each term comes with its Chinese translation and a one-line explanation. The terms are grouped the way you meet them in the paper: architecture, attention, the building blocks around attention, training, and evaluation. A short section at the end covers the older models the paper compares against.

GeekCoding101 · Dec 28, 2024 · Topics: attention-is-all-you-need, machine-learning, transformer

attention is all you need term

How to use this glossary

  • Keep it open next to the paper. The sections follow the paper’s order: Model Architecture, then Training, then Results.
  • If you’re reading a Chinese translation or explanation of the paper, use the middle column to map terms back to the original English.
  • Where a term has an external link, it points to a longer explainer.

Architecture: the big pieces

English TermChinese TranslationExplanationLink
TransformerTransformer(变换器)The model the paper introduces. It is an encoder–decoder built from attention and feed-forward layers, with no recurrence or convolution.
Sequence Transduction序列转换Turning one sequence into another, such as a sentence in one language into its translation. This is the task family the paper targets.
Encoder编码器The stack that reads the input sequence and turns it into a sequence of context-aware representations.
Decoder解码器The stack that generates the output sequence one token at a time. It uses the encoder’s output and the tokens it has already produced.
Encoder–Decoder Architecture编码器-解码器架构The overall design: one stack reads the input and another writes the output.
Layer / Stack层 / 堆叠The encoder and decoder are each made of identical layers stacked on top of each other.
Token词元 / 标记One unit of text the model processes, such as a word or a subword piece.
Embedding嵌入A learned vector that represents a token. Embeddings are the model’s actual input.
Auto-regressive自回归Generating output step by step, where each new token depends on the tokens before it. The decoder works this way.

Attention: the core idea

English TermChinese TranslationExplanationLink
Attention Mechanism注意力机制Measures how much each element of a sequence should draw on every other element, then mixes their information by those weights.Attention Mechanism Explained
Query, Key, Value (Q, K, V)查询、键、值Three learned projections of each token. A query is compared with keys to get weights, and the weights are applied to the values.
Scaled Dot-Product Attention缩放点积注意力The paper’s attention function. It takes dot products of queries and keys, divides by √dₖ, applies softmax, and uses the result to weight the values.
SoftmaxSoftmax(归一化指数函数)Turns raw scores into weights that are positive and sum to 1.
Self-Attention自注意力Attention where queries, keys and values all come from the same sequence. Each token looks at the other tokens in its own sequence.
Masked Self-Attention掩码自注意力Self-attention in the decoder that blocks each position from seeing later positions, so the model can’t peek at future tokens.
Encoder–Decoder Attention (Cross-Attention)编码器-解码器注意力(交叉注意力)Attention in the decoder where queries come from the decoder and keys and values come from the encoder’s output.
Multi-Head Attention多头注意力Runs several attention operations (“heads”) in parallel, each on its own learned projection of Q, K and V. The results are then concatenated and projected again.
Attention Head注意力头One of the parallel attention operations inside multi-head attention.

The formula behind scaled dot-product attention, as written in the paper:

Attention(Q, K, V) = softmax( Q·Kᵀ / √d_k ) · V

Dividing by √dₖ (the square root of the key dimension) keeps the dot products from growing so large that softmax saturates and gradients become very small.

Building blocks around attention

English TermChinese TranslationExplanationLink
Positional Encoding位置编码Attention alone ignores word order, so position information is added to the embeddings. The paper uses fixed sine and cosine functions of different frequencies.
Sinusoidal Encoding正弦位置编码The specific sine/cosine scheme the paper uses for positional encoding.
Position-wise Feed-Forward Network (FFN)逐位置前馈神经网络Two linear layers with a ReLU in between, applied to each position separately and identically.Feed-Forward Networks in NLP
Residual Connection残差连接Adds a sub-layer’s input to its output, giving gradients a shortcut path through deep stacks.
Layer Normalization层归一化Normalizes the values within each token’s vector to stabilize training. Applied together with the residual connection around each sub-layer.Layer Normalization Details
Linear Projection线性投影A learned matrix multiplication. It is used to create Q, K and V, and to combine the outputs of the attention heads.

Training terms

English TermChinese TranslationExplanationLink
Parallelization并行化Performing many computations at the same time. Because the Transformer has no recurrence, it can process all positions of a sequence in parallel during training.
Byte-Pair Encoding (BPE)字节对编码A subword tokenization method that splits text into frequent character sequences.
Adam OptimizerAdam 优化器The gradient-based optimizer used to train the model.
Learning-Rate Warmup学习率预热Raising the learning rate gradually at the start of training before letting it decay.
Dropout随机失活(Dropout)Randomly zeroing some activations during training to reduce overfitting.
Label Smoothing标签平滑Softening the one-hot training targets so the model is less overconfident.

Evaluation terms

English TermChinese TranslationExplanationLink
BLEU (Bilingual Evaluation Understudy)双语评估替补(BLEU)A metric that scores machine translations by their n-gram overlap with reference translations.Understanding BLEU
Beam Search束搜索A decoding strategy that keeps several candidate outputs at each step instead of only the single most likely one.
Machine Translation机器翻译Automatically translating text between languages. This is the main task the paper evaluates on.

The models the Transformer replaced

The paper compares the Transformer against these two families of sequence models. They are worth knowing because the paper’s argument is that attention alone can do their job.

English TermChinese TranslationExplanationLink
Recurrent Neural Network (RNN)循环神经网络Processes a sequence one step at a time and carries a hidden state forward, which makes training hard to parallelize.RNN Basics
Long Short-Term Memory (LSTM)长短期记忆网络A type of RNN with gates that help it keep information over longer sequences.
Convolutional Neural Network (CNN)卷积神经网络Uses convolutions to extract features from local windows of the input.CNN Overview

FAQ

What does “Attention Is All You Need” mean? The title is the paper’s claim: a sequence model can be built from attention layers plus simple feed-forward layers, with no recurrence (RNNs) and no convolutions (CNNs).

What are Query, Key and Value in simple terms? Each token produces three vectors. Its query asks “what am I looking for?”, every token’s key answers “what do I contain?”, and the value is the information that gets passed along. Query–key similarity decides how much of each value a token takes in.

What is the difference between self-attention and multi-head attention? Self-attention is the operation: a sequence attending to itself. Multi-head attention runs that operation several times in parallel with different learned projections, so each head can focus on different relationships. The heads’ results are then combined.

Why does the Transformer need positional encoding? Attention treats its input as a set, so it has no built-in notion of order. Positional encoding adds a position signal to each embedding so the model can tell “dog bites man” from “man bites dog.”

How do you say “self-attention” and “multi-head attention” in Chinese? Self-attention is 自注意力 and multi-head attention is 多头注意力. Masked self-attention is 掩码自注意力.


Questions about a term, or one you’d like added? Leave a comment below or use the contact page.

Thanks for reading my blog post! Feel free to check out my other posts or contact me via the social links in the footer.

Keep reading

All posts