Back to tree

🔄 编码器解码器:一个读懂,一个写出🔄 Encoder-Decoder: One Reads, One Writes

上一片给每个词发了一张“座位号”,顺序问题解决了。这一片看整台翻译机怎么干活:它由两位搭档组成,一位读懂整句,一位逐词写出。 Last leaf gave every word a seat number, so order was settled. Now watch the whole translation machine at work. It is really two partners: one reads the sentence in, one writes it out word by word.

第 1 步:编码器,一口气读完整句Step 1: The encoder reads the whole sentence at once

先看负责“读”的这一半——整句是怎么被读进去的?Start with the reading half — how does a whole sentence get read in?

编码器读书、解码器吐卡:一个读懂,一个写出
编码器像一位速读高手。拿到“你好,世界”这排词(每张都带着座位号),它不逐字慢慢啃,而是一口气全读完,又快又能并行。成果是一份浓缩的理解,装进一条向量。向量里没有具体的字,只有“这句在说什么”。 The encoder is a speed-reader. Given the row of words “hello, world!” (each wearing a seat number), it does not chew through them one by one — it reads the whole row at once, so it is fast and parallel. The result is not a pile of loose words but one concentrated understanding, packed into a vector. The vector holds no actual words — only what the sentence means.

手里有了这份“理解”,接下来怎么写出英文?With that understanding in hand, how does the English come out?

第 2 步:解码器,逐词往外写Step 2: The decoder writes it out word by word

翻译流水线:中文句 → 编码器 → 理解卡 → 解码器 → 英文句
解码器像一位小心写字的作家。它拿着那份理解,先写出 hello。写完回头看一眼已写的词,再写下 world,再写下 !。每写一个词,它都参考两样东西:整句的理解,加上已经写出的内容。 The decoder is a careful writer. Holding that understanding, it writes the first word, “hello”. Then it glances back at what it has already written, and writes “world”, then “!”. For every word it consults two things: the meaning of the whole sentence, plus what has been written so far.

这“一读一写”的分工,现实中都用在哪?Where does this read-write division of labour show up in real life?

第 3 步:真实场景,翻译和摘要Step 3: In the wild — translation and summaries

解码器写一个词,回头看一眼已写的
最典型的就是翻译:中文进去,英文出来,中间那份理解就是两种语言之间的桥。摘要也一样:长文读进去,短文写出来。写代码、配字幕也靠这对搭档——凡是从一段内容生出另一段,几乎都是它俩在干活。 Translation is the classic job: Chinese goes in, English comes out, and the meaning in the middle is the bridge between the two languages. Summarising works the same way: a long text goes in, a short text comes out. Writing code, captioning videos — any task that turns one passage into another usually has this pair on the job.

🎮 你来当翻译机(1 分钟)🎮 Your turn: be the machine (1 minute)

道理讲完了。先点点看编码器怎么把整句读进去、吐出理解卡;再从词库挑卡片,按顺序拼出英文译文。Theory done. Click through the encoder reading the sentence and popping a meaning card; then pick word cards and build the English translation in order.

一句话记住它:编码器把整句读成一份理解,解码器拿着这份理解逐词写出结果。 Remember it in one line: the encoder reads the whole sentence into one understanding; the decoder turns that understanding back into words, one at a time.
编码器:一口气读完整句,可以并行,产出一份“理解”向量Encoder: reads the whole sentence at once, in parallel, producing one understanding vector 解码器:拿着理解逐词往外写,写一个词回头看一眼已写的Decoder: writes word by word, glancing back at what is already written 翻译是典型用途:两种语言之间,靠中间那份“理解”搭桥Translation is the classic use — the meaning in the middle bridges two languages

← 浏览全部 302 个知识点← Browse all 302 topics

内容参考 OpenStax 等公开教材,多来源核对 · AI 生成、人工审核 · 发现错误欢迎指正,帮这片叶子长得更好。 Based on OpenStax and other open textbooks, cross-checked across sources · AI-generated, human-reviewed · Spotted a mistake? Tell us — help this leaf grow.