Day 28 · 语言学

从规则到统计

手写语法输掉的原因不是规则写错了,是规则这种东西里没有「多半」这一栏
2026-09-24
1954 年那台机器只有 250 个词、6 条语法规则,演示完媒体就说翻译问题三五年内解决。真正把它推动起来的办法 1990 年前后才出现,而那办法在当年看来近乎耍赖:它不试图弄懂句子的意思,只数哪些词总是一起出现。六十年换过两次思路,每次换掉的都不是「更懂语言」,是承认自己不懂。

你大概遇到过这种事:一段机器译文读起来完全通顺,你却总觉得哪里不对;回头一对原文,它把一个「不」字的位置悄悄挪了。顺,而且错——这是今天的机器翻译特有的失败方式。

六十年前它不这么失败——那时译文又生硬又错,错在哪一眼看得见。中间这段很少被讲成一个连贯的故事:一批人花三十年手写语法规则,输给了一批不看语法、只数数的人;而那批数数的人后来又被一个读不懂意思的评分脚本推着跑了十五年。

// 01

「盒子在笔里」——幼儿园孩子都不会误解的一句话,规则永远算不对

先看那台机器有多小。1954 年 1 月 7 日,乔治城大学和 IBM 在纽约公开演示:六十多句俄语自动译成英语,词表 250 个词,语法规则 6 条。报道铺天盖地,当时的普遍预期是三五年内这件事就做完了。

接下来三十年,写规则的人遇到的真实困境不是词不够,是每加一条新规则都要跟已经写好的那些打架——你为「пол 在这个上下文里译成 floor 不译成 sex」加一条,它就在另外二十个句子里生效了,而那二十句原本是对的。规则表越长,改一处的代价越大。

1960 年,全世界第一个全职做机器翻译的研究者巴希勒尔(Yehoshua Bar-Hillel)把这件事顶到了墙上。他给了一小段话:Little John was looking for his toy box. Finally he found it. The box was in the pen.(小约翰在找他的玩具盒,终于找到了,盒子在 pen 里。)英语 pen 有两个意思:钢笔,和小孩玩的围栏。选哪个靠的不是语法也不是词典,是你知道钢笔比玩具盒小、围栏比玩具盒大。他的结论很硬:要做全自动的高质量翻译,机器不光要有词典,还得先有一部百科全书——而这在他看来纯属幻想。

还有一层更日常的麻烦:两门语言在句子层面就对不齐。英语 She swam across the river,「怎么动」(游)在动词里,「往哪动」交给 across 这个小词;西班牙语惯常说 Cruzó el río nadando,字面「她横渡了那条河、游着」——「往哪动」进了动词,「怎么动」被挤成一个分词。语言学家塔尔米(Leonard Talmy)把这两种打包方式分成两类。这是倾向不是铁律,西班牙语某些场合也走得通英语那种说法——倾向比铁律更难办:你得手写改写规则,还得手写它什么时候不适用。

1966 年,美国一个评估委员会发布了后来简称 ALPAC 的报告。结论不是「这条路错了」,是「现在不值这个钱」:机器译完还得请人从头返工,算下来不比直接请人翻便宜。报告原话是,我们没有可用的机器翻译,也看不到近期会有。经费断了将近二十年。

EN On 7 January 1954, Georgetown and IBM publicly demonstrated automatic Russian-to-English translation of sixty-odd sentences, using a 250-word vocabulary and six grammar rules; the press concluded translation would be solved in three to five years. The rule-writers' real problem over the next thirty years was not vocabulary but interaction: every rule added to disambiguate one context silently fired in twenty others that had been correct. In 1960 Yehoshua Bar-Hillel, the first full-time machine-translation researcher, drove this home with a short passage — "Little John was looking for his toy box. Finally he found it. The box was in the pen." Choosing "playpen" over "writing pen" requires knowing the relative sizes of pens, boxes and enclosures; a machine, he argued, would need not a dictionary but an encyclopedia, a requirement he called utterly chimerical. A second, more everyday difficulty is that sentences do not line up. English "She swam across the river" puts manner in the verb and path in a satellite; the habitual Spanish is "Cruzó el río nadando", literally "she crossed the river swimming", with path in the verb and manner pushed into a gerund. Talmy sorted languages into these two packaging strategies — a tendency, not a law, since Spanish permits the other pattern in some contexts, which for a rule writer is worse news than a law would be. The 1966 ALPAC report concluded not that the approach was wrong but that it was not worth the money: post-editing machine output cost more than translating from scratch, and there was "no immediate or predictable prospect of useful machine translation." United States funding stopped for roughly two decades.

// 02

加拿大国会的会议记录,把翻译变成了一道数数题

1990 年前后,IBM 沃森研究中心一组人换了个问题:不问「这句英语是什么意思」,只问在所有法语句子里哪一句最可能是它的译文。意思那一层被绕开了,留下的是一道可以数出来的题。

数什么?数一批已经配好对的句子。加拿大国会的会议记录按法律必须英法双语同时出版,逐句对应,量还特别大:后来常用的那份语料有 3,603,971 对句子,两边各接近一亿个词。这不是谁为研究准备的,是一个国家的双语制度顺手攒下来的。

对齐长什么样,拿一对最普通的句子就看得见。英语 I do not speak French,法语 Je ne parle pas français。三个词规规矩矩对上,麻烦在另外两个:英语一个 not 对上 ne 和 pas 两个词,中间还隔着动词;英语的 do 什么也不对应。规则派得为这两件事各写一条规则;统计派什么也不写——看过几十万个带 not 的句子,法语那边 ne 和 pas 同时出现的次数高得不像话,这条对应自己就浮出来。为了把「一个词对两个词」记进账,那组模型给每个词配了个数叫「生育率」——不是语言学概念,是为了让数数进行下去临时造的记账项。

I do not speak French Je ne parle pas français 对不上任何词 一个词对上两个,中间还隔着动词 这两处正是手写规则最贵、而数数最便宜的地方
连线是词与词的对应。青蓝线规规矩矩,琥珀线是麻烦:一个词分成两处,还有一个词凭空消失。

这个转向后来被浓缩成一句流传极广的俏皮话:每开掉一个语言学家,系统的识别率就上升一点。说这话的是语音识别那边的耶利内克(Frederick Jelinek),他本人对措辞有异议,考据几十年也没定下确切版本。那句话最容易被读歪的地方是:被换掉的不是语言学知识,是「由人手写下来的确定性」。统计系统照样要对齐、要切词,只是这些判断从「某人认为应该这样」变成了「在这批数据里出现过多少次」。它也并没有赢得很快——整个九十年代到两千年代,Systran 这类规则系统在一些语言对上长期有竞争力。

EN Around 1990 a group at IBM's Watson Research Center changed the question. Instead of asking what an English sentence means, they asked which French sentence is most likely to be its translation — a question you can answer by counting. What they counted was pre-aligned text: the Canadian Hansard, which by law publishes parliamentary proceedings in English and French sentence by sentence. The commonly used version holds 3,603,971 sentence pairs, close to a hundred million words on each side, assembled not for research but as a by-product of a national bilingual policy. The alignment problem is visible in one ordinary pair: "I do not speak French" and "Je ne parle pas français". Three words map cleanly, but English "not" corresponds to two French words, "ne" and "pas", with the verb sitting between them, and English "do" corresponds to nothing at all. A rule writer must handle each case explicitly; a counting system needs only to notice that "ne" and "pas" co-occur implausibly often whenever "not" appears. To book-keep one-to-many mappings, the IBM models gave each word a "fertility" — how many words it produces on the other side — not a concept borrowed from linguistics but an accounting device invented to keep the counting going. The shift is often summarised by Frederick Jelinek's quip that firing a linguist improves the system, a remark whose exact wording he himself disputed and which scholars have never pinned down. What it obscures is that the knowledge was not removed: alignment, segmentation and morphology still had to be handled, but the judgements moved from "someone decided this" to "this occurred so many times". Nor did statistics win quickly — rule-based systems such as Systran stayed competitive on some language pairs throughout the 1990s and 2000s, and hybrid systems later bolted statistical post-editing onto rule-based output.

// 03

一个读不懂意思的评分脚本,比任何一条规则都更改变了这个领域

2002 年,IBM 另一组人提出一个打分办法叫 BLEU,做法粗暴得近乎可笑:把机器译文和几份人工参考译文放在一起,数连续词串的重合率——有多少单词、两词组合、三词组合是参考译文里也有的;再加一条惩罚,防止系统靠输出很短的句子骗分。它完全不懂意思,但一秒钟就能跑完。

后果比它本身重要得多。在此之前评一次质量要请人读几天;之后改一个参数,半分钟就知道好没好。一个领域跑多快,不取决于点子多不多,取决于验证一个点子要等多久——这个脚本把等待从几天压到几十秒,于是十五年里所有人都在同一个坡上爬。

代价也很快现形。2006 年有人专门去查这个分数靠不靠谱:BLEU 涨了不等于真变好,真变好了也不一定 BLEU 涨。他们给的对照很说明问题——规则系统 Systran 的 BLEU 偏低,请人评忠实度和流利度却不落下风,因为它选的词跟参考译文不一样、意思是对的,而分数只认字面重合。后来反复被验证的还有一条:译文质量越高,分数和人的判断相关得越松。它擅长认出很差的译文,认不出很好的译文。

2014 年起神经网络进场,2016 年 9 月谷歌把线上的短语统计系统整个换掉(当时中译英每天约一千八百万次)。修好的部分是真的:句子读起来顺了,长距离的语序问题——比如动词在德语从句里要跑到最后——大面积缓解了。

没修好的有三件。一是低资源:这套办法吃成对的句子,而约七千门语言里绝大多数没有这种材料,2022 年一个覆盖 200 门语言的模型就算里程碑了。二是幻觉:2018 年有人把 dog 连打十几遍、指定按毛利语译成英语,出来一段世界末日预言——那些语言的平行文本很大一部分是圣经译本,而输入是噪声时模型仍被训练成「必须输出像人话的东西」,于是它就编一段。三是两边语法的缝:土耳其语第三人称只有一个 o,不分他她,译成英语却必须选,系统长期把 o bir doktor 译成 he is a doctor、o bir hemşire 译成 she is a nurse——原文没有这个信息,目标语言强制要填,系统只能按语料里的多数猜。规则系统坏掉时吐的是看得出来的乱码,神经系统坏掉时吐的是很顺的假话。开头那种「顺而错」,根源在这里。

所以手写语法为什么输了?不是因为语法是错的。规则能说清「这样说合法」,说不清「多半是这个意思」——规则表里没有「多半」这一栏,而翻译每一步要的正是这一栏。巴希勒尔那句话今天多半能译对,不是因为机器有了百科全书,是因为它见过足够多「盒子」和「围栏」同时出现的场合。这算不算懂要看标准:要一部可查、可问、可纠错的世界知识,它没有;要在这句话上给出跟懂的人一样的输出,它做到了。

EN In 2002 a group at IBM proposed BLEU, a scoring method that is almost comically blunt: count how many word sequences in a machine translation also occur in several human reference translations, with a penalty to stop systems scoring well by staying short. It understands nothing, and it runs in a second. That mattered more than the metric itself. Evaluating a system had meant days of human reading; now a parameter change could be judged in half a minute. How fast a field moves depends less on its supply of ideas than on how long verifying one takes, and for fifteen years everyone climbed the same hill. The cost surfaced quickly. Callison-Burch, Osborne and Koehn (2006) showed that a BLEU gain is neither necessary nor sufficient for a real improvement, with a telling case: the rule-based Systran scored low on BLEU while holding its own on human ratings of adequacy and fluency, because it chose different words that meant the same thing. A repeatedly confirmed pattern is that the correlation with human judgement weakens as translation quality rises — the metric is good at spotting bad output, poor at ranking good output. Neural systems arrived from 2014, and in September 2016 Google replaced its phrase-based production system outright, at the time about eighteen million Chinese-to-English translations a day. Fluency and long-distance reordering genuinely improved. Two things did not. Parallel sentences are what the method eats, and most of the world's roughly seven thousand languages have almost none; a 2022 model covering two hundred languages counted as a milestone. And a new failure mode appeared: in 2018 people typed the word "dog" a dozen times, asked for Maori-to-English, and received an apocalyptic prophecy, because much of the available parallel text for such languages is scripture and the model is trained to emit something human-sounding whatever comes in. A rule-based system breaks into visible gibberish; a neural one breaks into fluent falsehood. A further class of error leaks from the gap between two grammars. Turkish has a single third-person pronoun, "o", with no gender; English forces a choice. Systems long rendered "o bir doktor" as "he is a doctor" and "o bir hemşire" as "she is a nurse" — not simply a biased model, but a slot the source language never filled and the target language demands, filled by whatever the corpus majority was. Google began returning both readings for such sentences in late 2018. So why did hand-written grammars lose? Not because grammar is wrong. A rule states what is permissible; it cannot state what is probable, and translation needs the second at every step. Bar-Hillel's sentence is mostly handled correctly today, not because a machine acquired an encyclopedia but because it has seen enough contexts where boxes and enclosures co-occur.

🎒 场景 · BigCat

  1. ① 投资与仓位:你给自己定过规则——「跌到 -20% 就减半」「连续三根周线破位就清掉」。执行两年,每碰到一次不该触发的情况就补一条例外,现在这张表自相矛盾,真到了当口还是靠临场感觉。这正是「盒子在笔里」那节的困境:规则表里没有「多半」这一栏,每个例外只能变成一条新规则,而新规则会在你没看的地方生效。可改的动作:把每条规则改写成一句可数的话——「过去这条件出现过几次,之后 60 天里怎么样了」;样本凑不满 10 次的降级成提醒,不许自动执行。
  2. ② 跨语言工作与生活:你把一段中文消息丢进翻译器发给外国同事,译文流畅得挑不出毛病,对方回过来却答非所问。「读不懂意思的评分脚本」那节的机制说明这不是运气差:神经翻译把流畅和正确解耦了,而流畅恰好是你唯一能用来判断对错的线索。回译也没用,它会用同样的猜测把错误抹平。可改的动作:发之前把关键那句里的代词换成具体名词、把省略的主语补回去再翻——代词和省略正是中文默认省掉、英文强制要填的格子,也就是系统只能靠猜的地方。验收数对方反问「你是说 X 还是 Y」的次数。

🌀 越界 · 跨学科的联想

深入思考

如果当年经费没断,规则派再写三十年,能写成吗?

巴希勒尔的论证不依赖算力:这类判断需要世界知识,而世界知识没法穷举成规则,纯规则那条路多半还是卡在同一处。但有个反例值得记住——领域极窄、句式极固定的场合,比如天气预报,规则系统当年就做到了可用,加拿大的英法天气预报翻译系统跑了很多年。条件是那个世界小到可以被写完。

「不理解意思也能译对」,说明意思不重要吗?

更稳妥的读法是:意思仍然在起作用,只是被藏进了别人的行为里。那三百多万对句子是人译的,每一对都过了一遍理解。统计系统吃的是别人理解的结果——这也解释了它为什么在没人译过的领域上立刻变差。

一门语言缺少平行语料,是它的问题吗?

不是。平行语料多,通常意味着那门语言背后有行政、宗教或商业上的翻译需求,跟语言本身的结构和表达力无关。加拿大国会记录是一部双语法律的副产品。把「机器译得好不好」读成「这门语言怎么样」,是把制度史误读成了语言事实。

延伸阅读