先剪枝(把无关的轮次整个删掉),再排序,还要划重点 — DHS-ConvQA(攻关二)
这一章讲三件事: 「无关历史有多伤」的一次定量实验;三层过滤怎么协同;每层各值几分。 它接住第 06 章留下的尾巴——单点故障的剪枝,这一章把它变成了带冗余的三层。
1. 先看现象:塞进 11 个无关轮,分数掉 15 分
第 06 章说过「无关历史是噪声」。这个说法在这一章被做成了定量实验,值得先看,因为它给全书定了一个量级。
实验做法:模型本来只喂「选出的相关轮」;现在故意往里掺负样本——同一话题、但来自其他文章的问题,它们意思上很像真历史,模型很难靠表面字样认出来1。结果:
| 掺入负样本数 | 0 | 1 | 3 | 5 | 7 | 9 | 11 |
|---|---|---|---|---|---|---|---|
| F1 | 67.5 | 67.0 | 64.3 | 62.5 | 60.7 | 54.6 | 52.4 |
11 个负样本,F1 掉了 15 分——大约每多两个无关轮,掉 3 分。更细的发现按问题类型分:澄清型问题最扛噪(F1 只从 90.9 缓降到 83.8),话题转移(85.4→63.0)和话题回归(82.2→62.1)受伤最重2——道理不奇怪:转移和回归恰恰要靠「选对历史」才能答,历史一脏就没救。
这就把第 04 章的问题升级成定量命题:历史选择不是锦上添花,是性能杠杆。 DHS-ConvQA(Dynamic History Selection in ConvQA)就是作者对此的完整答卷。
2. 走查:「它是什么时候发行的?」怎么被接住
主走查。 原书自己的例子是一段关于巴基斯坦乐队 Jal 的对话3:
| # | 问答 |
|---|---|
| Q1 | Jal 是谁创立的?—— Goher Mumtaz 和 Atif Aslam |
| Q2 | Atif Aslam 出生在哪里?—— Wazirabad(话题转移:聊到了歌手个人) |
| Q3 | 乐队是哪年创立的?—— 2002(话题回归) |
| Q4 | 他们的第一张专辑是什么?—— Aadat |
| Q5 | 它是什么时候发行的? |
Q5 的「它」= Q4 的「第一张专辑」。逐层走一遍 DHS-ConvQA 的四步:
① 实体生成(BART + 远距监督,同第 06 章)
给每一轮历史生成 CE/QE:
Q4 → CE = band(乐队) QE = album(专辑)
直觉:含糊的追问是对话流的延续,从上一轮拿信息填空最稳
② 剪枝(硬选择)
逐轮与当前问题比对实体:
Q2(Atif Aslam 出生)与 Q5 无共享实体 → 剪掉
Q4(第一张专辑)与 Q5 共享实体 → 保留
「把歌手出生地混进 Q5」正是原书点名的噪声案例
③ 注意力重排(软选择)
保留的轮各过一个单层前馈网络打权重,softmax 归一:
w(Q4) ≈ 0.83 w(Q1) ≈ 0.62 (权重为演示编)
按权重排队,权重最高的轮紧挨着当前问题摆放
——离问题越近的位置,编码器看它看得越清
④ 词级二分类(划重点)
RoBERTa 编码后,顶层给每个词打 0/1:
「band」「album」相关的词 → 1;其余 → 0
标 1 的词 = 给含糊问题的「缺失信息提示」
结果:模型实际看到的输入 ≈
文章 + [Q4(重排后紧邻)+ 标记过的重点词] + 「它是什么时候发行的?」
答案:「2002 年后的 2004 年」所在 span —— Aadat 的发行时间
图说:③④ 的具体权重与 0/1 标记为演示编;四步的顺序与机制按原书。
第 ④ 步值得单独看一眼:它和第 06 章的 CE/QE 是一脉的——CE/QE 是「补哪两个实体」的粗粒度答案,词级标注是「句子里哪些字最重要」的细粒度答案。原书的说法是:标 1 的词充当含糊问题的「缺失信息」线索,帮模型看清当前问题在问什么4。
3. 硬和软为什么要组合
这一节回答:第 04 章明明说硬/软是两条路,为什么这里要叠着用?
先把概念分清(第 04 章的术语,这里正式安家):硬选择挑「哪些轮有资格进输入」——进不了的就是进不了;软选择不淘汰,只给所有轮加权,让重要的轮在表示里占比更大、位置更近5。两者其实管两件事:硬选择管资格,软选择管座次。单独用任何一个都有缺口——只硬:剪错的轮永久丢失;只软:噪声轮还在场,只是声音小。
DHS-ConvQA 的裁决是叠起来:先硬后软6。代价是流水线更长,收益见消融实验(下一节)。
4. 三层各值几分:消融实验
这一节是本章的硬证据:把三层逐个拆掉,看分数掉多少。
| 配置 | F1 | HEQ-Q | HEQ-D |
|---|---|---|---|
| 去掉剪枝 | 64.3 | 62.9 | 6.6 |
| 去掉重排 | 67.3 | 63.6 | 6.9 |
| 去掉词级标注 | 65.7 | 62.0 | 6.5 |
| 完整版 | 67.5 | 65.3 | 7.5 |
读法:去掉剪枝掉得最多(−3.2)——噪声是主要矛盾;去掉重排掉得最少(−0.2)——有了干净的轮子和重点标注,座次只是锦上添花7。原书 自己的解读一致:不剪枝则所有轮都进输入,噪声直接拖垮;而重排在「已剪枝+已划重点」的前提下影响最小8。
跟四个对手正面对比,DHS-ConvQA 全部占优9:
| 模型 | 流水线版 | DHS-ConvQA 版 |
|---|---|---|
| BERT-HAE(第 04 章花招二) | 62.3 | 63.1 |
| BERT-HAM(软选择代表) | 63.4 | 65.4 |
| BERT-CoQAC(拿两串数算夹角来选轮,作者此前工作) | 63.1 | 64.4 |
| CONVSR(第 06 章主角) | 66.1 | 67.5 |
注意最后一行:上一章的 CONVSR 也可以被这套三层过滤再抬一分——两个模型不是替代关系,是叠加关系。
5. 证据之外的冷水和配置
这一节交代这套方案的代价与工程参数,不粉饰。
冷水一:流水线误差传播仍在,而且是乘法。 剪枝的准确程度直接决定下游所有环节的上限10:
| 剪枝准确率 | 重排 | 词级标注 | 最终答案 |
|---|---|---|---|
| 100% | 100% | 92% | 90% |
| 70% | 95% | 86% | 80% |
| 50% | 89% | 70% | 65% |
剪枝掉一半,最终答案掉 25 分——每级输出是下级输入,错误沿途累积11。这比第 06 章的「单点故障」诊断更细:三层过滤缓解了单点,但没有取消级联。
冷水二:负样本实验只做了「问题」形态的噪声。 真实对话里的噪声还包括答非所问的答案、循环重复的话题,这些未验证。
配置备查(读者复现或对照自家系统用):QR 流水线对照版用约 3.1 万对 CANARD 改写训练12;实体生成的 BART 用 batch 4、学习率 0.00005、权重衰减 0.01、早停13;词级标注的 RoBERTa 学习率在 2e-5/3e-5/3e-6 里选,dropout(训练时随机屏蔽一部分计算件、防死记硬背的旋钮)设 0.1–0.4,答案最长 40 词、问题最长 64 词14。
6. 可带走的
- 噪声的价目表:11 个无关轮 ≈ −15 F1;话题转移/回归类问题对噪声最敏感;
- 硬选择管资格、软选择管座次,叠用比单用强——消融给出的次序是「剪枝 > 划重点 > 重排」;
- 注意力重排的实用红利:权重最高的轮紧挨当前问题放——位置本身就是一种信号;
- 词级 0/1 标注是「划重点」的工程化:给含糊问题标出缺失信息的所在;
- CONVSR 和 DHS-ConvQA 是叠加关系:实体线索+三层过滤,66.1→67.5;
- 级联误差是乘法:第一级剪枝准 50%,末级答案只剩 65%——流水线设计永远先看第一级;
- 动态选历史胜过改写问题——这是作者的原话结论,也是 06/07 两章共同的落点15。
7. 原文地图
| 主题 | 原书章 | 原文位置 |
|---|---|---|
| 噪声命题、全塞历史之害 | Ch4 | text/17-ch04-chapter-4-dynamic-history-selection-for-conversa.txt:11(搜「brings noise to the」) · text/17-ch04-chapter-4-dynamic-history-selection-for-conversa.txt:46(搜「entire conversational history」) |
| 紧邻 k 轮的失效、Jal 对话 | Ch4 | text/17-ch04-chapter-4-dynamic-history-selection-for-conversa.txt:52(搜「prepending k immediate turns」) · text/17-ch04-chapter-4-dynamic-history-selection-for-conversa.txt:78(搜「Jal-The band」) · text/17-ch04-chapter-4-dynamic-history-selection-for-conversa.txt:88(搜「When was it released」) |
| 「歌手问题混进来」的噪声案例、CE/QE 定义 | Ch4 | text/17-ch04-chapter-4-dynamic-history-selection-for-conversa.txt:57(搜「which inquires about」) · text/17-ch04-chapter-4-dynamic-history-selection-for-conversa.txt:92(搜「entity targeted in the」) |
| 静态/动态、硬/软、组合 | Ch4 | text/17-ch04-chapter-4-dynamic-history-selection-for-conversa.txt:130(搜「static and dynamic」) · text/17-ch04-chapter-4-dynamic-history-selection-for-conversa.txt:133(搜「Hard history selection」) · text/17-ch04-chapter-4-dynamic-history-selection-for-conversa.txt:139(搜「combination of the two」) |
| CE=band/QE=album、补全后的问句 | Ch4 | text/17-ch04-chapter-4-dynamic-history-selection-for-conversa.txt:223(搜「context entity of Q4」) · text/17-ch04-chapter-4-dynamic-history-selection-for-conversa.txt:226(搜「album released」) |
| 剪枝、注意力模块、公式 4.2/4.3 | Ch4 | text/17-ch04-chapter-4-dynamic-history-selection-for-conversa.txt:231(搜「prune all the history turns」) · text/17-ch04-chapter-4-dynamic-history-selection-for-conversa.txt:236(搜「single-layer feed-forward network」) · text/17-ch04-chapter-4-dynamic-history-selection-for-conversa.txt:235(搜「attention weight」) |
| 高权重轮挨着问题、词级标注层 | Ch4 | text/17-ch04-chapter-4-dynamic-history-selection-for-conversa.txt:252(搜「highest weight is added next」) · text/17-ch04-chapter-4-dynamic-history-selection-for-conversa.txt:255(搜「term classification layer」) · text/17-ch04-chapter-4-dynamic-history-selection-for-conversa.txt:260(搜「missing information」) |
| 远距监督训练、1/0 打标 | Ch4 | text/17-ch04-chapter-4-dynamic-history-selection-for-conversa.txt:269(搜「distantly supervised labeling」) · text/17-ch04-chapter-4-dynamic-history-selection-for-conversa.txt:277(搜「tagged as 1」) |
| 配置:31K、bart-base 参数、RoBERTa 参数 | Ch4 | text/17-ch04-chapter-4-dynamic-history-selection-for-conversa.txt:283(搜「31K pairs」) · text/17-ch04-chapter-4-dynamic-history-selection-for-conversa.txt:293(搜「batch size of 4」) · text/17-ch04-chapter-4-dynamic-history-selection-for-conversa.txt:298(搜「2e-5」) · text/17-ch04-chapter-4-dynamic-history-selection-for-conversa.txt:300(搜「maximum answer length」) |
| 四个对手模型 | Ch4 | text/17-ch04-chapter-4-dynamic-history-selection-for-conversa.txt:323(搜「BERT-based history answer」) · text/17-ch04-chapter-4-dynamic-history-selection-for-conversa.txt:330(搜「BERT-CoQAC」) · text/17-ch04-chapter-4-dynamic-history-selection-for-conversa.txt:334(搜「CONVSR」) |
| 主结果表 | Ch4 | text/17-ch04-chapter-4-dynamic-history-selection-for-conversa.txt:345(搜「62.3」) · text/17-ch04-chapter-4-dynamic-history-selection-for-conversa.txt:358(搜「67.5」) |
| 消融表与解读 | Ch4 | text/17-ch04-chapter-4-dynamic-history-selection-for-conversa.txt:385(搜「w/o pruning」) · text/17-ch04-chapter-4-dynamic-history-selection-for-conversa.txt:402(搜「greater decline」) · text/17-ch04-chapter-4-dynamic-history-selection-for-conversa.txt:405(搜「the least」) |
| 负样本实验与解读 | Ch4 | text/17-ch04-chapter-4-dynamic-history-selection-for-conversa.txt:421(搜「negative samples are the questions」) · text/17-ch04-chapter-4-dynamic-history-selection-for-conversa.txt:418(搜 「11NS」) · text/17-ch04-chapter-4-dynamic-history-selection-for-conversa.txt:427(搜「least impacted」) |
| 剪枝传播表与级联 | Ch4 | text/17-ch04-chapter-4-dynamic-history-selection-for-conversa.txt:440(搜「Binary-term」) · text/17-ch04-chapter-4-dynamic-history-selection-for-conversa.txt:438(搜「high chances of error」) |
| 「选历史胜过改写」结论 | Ch4 | text/17-ch04-chapter-4-dynamic-history-selection-for-conversa.txt:28(搜「better than rewriting」) |