Transformer 架构 · 拖一枚 token 穿过整台机器Transformer Architecture · Drag One Token Through the Whole Machine
token → embedding → N × Transformer block → final norm → logits
Transformer 架构(Transformer Architecture)以注意力和前馈 block
为核心,可并行处理序列表示。这里把 S3 的零件装回整机:拖动 token
逐站走,点任一模块暂停核对“看谁、改什么、输出到哪”。The Transformer architecture centers on attention and feed-forward blocks that process sequence representations
in parallel. This page reassembles the S3 parts: drag a token through every station, or pause any module to
inspect what it reads, changes, and outputs.
01 · 零件终于装回整机01 · Put the parts back into the machine
一枚 token
从编号变成“下一个词”的分数,中间到底经过哪些站?每站改了什么?A token ID becomes scores for the next token. Which stations does it cross, and what changes at each
one?
T→Σ
02拖 token 走全程;点模块随时暂停巡检Drag the Token End to End; Pause Any Module to Inspect
S3 全系列总装S3 full assembly
当前站Current station
INPUT
token 编号token ID
表示形状Representation shape
1
离散编号discrete ID
累计 blockBlocks traversed
0 / 4
每层重复同一组零件same parts repeat per layer
红色 token
是“当前这个位置的表示”,不是原始文字永远不变地穿过机器。进入 embedding
后,它一直是被各模块更新的向量。The red token represents the current position's evolving representation. It is not unchanged text moving
through the machine; after embedding, it is a vector updated by each module.
03从输入到输出的 4 个总成Four Assemblies from Input to Output
encode · mix · transform · score
ASSEMBLY 01
Token 与 embeddingToken and embedding
离散编号查表变成模型可计算的向量表示。A discrete ID looks up a vector the model can process.
ASSEMBLY 02
注意力子层Attention sublayer
各位置按允许范围互看并汇总上下文。Positions gather context from other allowed positions.
ASSEMBLY 03
FFN 与稳态结构FFN and stabilizers
逐位置变换,残差保留信息,LayerNorm 稳尺度。Per-position transforms, residual preservation, and scale stabilization.
ASSEMBLY 04
输出分数Output scores
最终表示投影成词表 logits,供解码步骤选择。The final representation projects to vocabulary logits for decoding.
04最小机制:跨位置汇总与逐位置变换交替堆叠Minimal Mechanism: Alternate Cross-Position Gathering and Per-Position Transformation
层数滑块改变 N。它不会添加新种类零件,只会把 S3-14 装好的 block
重复更多次。The layer slider changes N. It adds no new part type; it repeats the block assembled in S3-14 more
times.
表示序列Represent sequencetoken ID → 向量token ID → vector
重复 blockRepeat blocks互看、加工、保留、稳住gather, transform, preserve, stabilize
投影到词表Project to vocabulary每个候选 token 得到 logiteach candidate gets a logit
05边界实验:让 token 绕过所有 block 直达 logitsBoundary Test: Bypass Every Block and Jump to Logits
主动制造失败Create a failure
形状能接上,不代表上下文已经形成Compatible shape does not mean context was built
把 embedding 输出直接投到
logits。向量维度可以设计成可投影,但它从未经过注意力,无法把周围 token
的信息装进当前表示。Project the embedding directly to logits. Dimensions may still fit, but without attention the current
representation never gathers surrounding context.
尚未执行。当前路径经过全部 block。Not run yet. The current path crosses every block.
✗ Transformer 就是注意力。A Transformer is just attention.
→ ✓ 整机还包含 embedding、FFN、残差、归一化与输出投影。The machine also includes embeddings, FFN, residual paths, normalization, and output
projection.
✗ token 原文不变地穿过所有层。Raw token text passes unchanged through every layer.
→ ✓ 穿过各层的是持续更新的向量表示。An evolving vector representation moves through the layers.
✗ 层数越多必然越好。More layers are always better.
→ ✓ 深度增加容量与成本,效果必须实测。Depth raises capacity and cost; results must be measured.
06 · 一句话带走06 · One line to keep
Transformer 把 token 变成向量,让注意力与 FFN block 反复更新表示,最后投影成
logits;拖 token、点模块、改层数即可把整条链逐站验清。A Transformer turns tokens into vectors, repeatedly updates them with attention and FFN blocks, then
projects them to logits. Drag, pause, and change depth to verify the entire chain.