跳到主要内容

先剪枝(把无关的轮次整个删掉),再排序,还要划重点 — DHS-ConvQA(攻关二)

这一章讲三件事: 「无关历史有多伤」的一次定量实验;三层过滤怎么协同;每层各值几分。 它接住第 06 章留下的尾巴——单点故障的剪枝,这一章把它变成了带冗余的三层。

1. 先看现象:塞进 11 个无关轮,分数掉 15 分

第 06 章说过「无关历史是噪声」。这个说法在这一章被做成了定量实验,值得先看,因为它给全书定了一个量级。

实验做法:模型本来只喂「选出的相关轮」;现在故意往里掺负样本——同一话题、但来自其他文章的问题,它们意思上很像真历史,模型很难靠表面字样认出来1。结果:

掺入负样本数01357911
F167.567.064.362.560.754.652.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:

#问答
Q1Jal 是谁创立的?—— Goher Mumtaz 和 Atif Aslam
Q2Atif 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. 三层各值几分:消融实验

这一节是本章的硬证据:把三层逐个拆掉,看分数掉多少。

配置F1HEQ-QHEQ-D
去掉剪枝64.362.96.6
去掉重排67.363.66.9
去掉词级标注65.762.06.5
完整版67.565.37.5

读法:去掉剪枝掉得最多(−3.2)——噪声是主要矛盾;去掉重排掉得最少(−0.2)——有了干净的轮子和重点标注,座次只是锦上添花7。原书自己的解读一致:不剪枝则所有轮都进输入,噪声直接拖垮;而重排在「已剪枝+已划重点」的前提下影响最小8

跟四个对手正面对比,DHS-ConvQA 全部占优9:

模型流水线版DHS-ConvQA 版
BERT-HAE(第 04 章花招二)62.363.1
BERT-HAM(软选择代表)63.465.4
BERT-CoQAC(拿两串数算夹角来选轮,作者此前工作)63.164.4
CONVSR(第 06 章主角)66.167.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. 可带走的

  1. 噪声的价目表:11 个无关轮 ≈ −15 F1;话题转移/回归类问题对噪声最敏感;
  2. 硬选择管资格、软选择管座次,叠用比单用强——消融给出的次序是「剪枝 > 划重点 > 重排」;
  3. 注意力重排的实用红利:权重最高的轮紧挨当前问题放——位置本身就是一种信号;
  4. 词级 0/1 标注是「划重点」的工程化:给含糊问题标出缺失信息的所在;
  5. CONVSR 和 DHS-ConvQA 是叠加关系:实体线索+三层过滤,66.1→67.5;
  6. 级联误差是乘法:第一级剪枝准 50%,末级答案只剩 65%——流水线设计永远先看第一级;
  7. 动态选历史胜过改写问题——这是作者的原话结论,也是 06/07 两章共同的落点15

7. 原文地图

主题原书章原文位置
噪声命题、全塞历史之害Ch4text/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 对话Ch4text/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 定义Ch4text/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」)
静态/动态、硬/软、组合Ch4text/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、补全后的问句Ch4text/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.3Ch4text/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」)
高权重轮挨着问题、词级标注层Ch4text/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 打标Ch4text/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 参数Ch4text/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」)
四个对手模型Ch4text/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」)
主结果表Ch4text/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」)
消融表与解读Ch4text/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」)
负样本实验与解读Ch4text/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」)
剪枝传播表与级联Ch4text/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」)
「选历史胜过改写」结论Ch4text/17-ch04-chapter-4-dynamic-history-selection-for-conversa.txt:28(搜「better than rewriting」)

Footnotes

  1. 出处:「CHAPTER 4: Dynamic History Selection for Conversational Question Answering」第 421 段(text/17-ch04-chapter-4-dynamic-history-selection-for-conversa.txt:421,搜「negative samples are the questions」)。负样本=同主题、不同文章的问题,与真历史语义相近。

  2. 出处:「CHAPTER 4: Dynamic History Selection for Conversational Question Answering」Table 4.4(text/17-ch04-chapter-4-dynamic-history-selection-for-conversa.txt:55,搜「Topic Shift」)。11 个负样本时 F1 52.4(第 418 段,搜「11NS」);澄清型最扛噪的解读在第 426 段(搜「least impacted」)。

  3. 出处:「CHAPTER 4: Dynamic History Selection for Conversational Question Answering」Table 4.1(text/17-ch04-chapter-4-dynamic-history-selection-for-conversa.txt:78,搜「Jal-The band」)。Q2 话题转移、Q3 回归、Q4/Q5 为下钻的说明在第 55–58 段。

  4. 出处:「CHAPTER 4: Dynamic History Selection for Conversational Question Answering」第 259–260 段(text/17-ch04-chapter-4-dynamic-history-selection-for-conversa.txt:62,搜「missing information」)。原文:标「1」的词充当含糊问题的缺失信息,帮模型看清当前问题。

  5. 出处:「CHAPTER 4: Dynamic History Selection for Conversational Question Answering」第 133 段(text/17-ch04-chapter-4-dynamic-history-selection-for-conversa.txt:133,搜「Hard history selection」)与第 135 段(搜「question-aware」)。

  6. 出处:「CHAPTER 4: Dynamic History Selection for Conversational Question Answering」第 139 段(text/17-ch04-chapter-4-dynamic-history-selection-for-conversa.txt:139,搜「combination of the two」)。

  7. 出处:「CHAPTER 4: Dynamic History Selection for Conversational Question Answering」Table 4.3(text/17-ch04-chapter-4-dynamic-history-selection-for-conversa.txt:385,搜「w/o」)。四行数字如正文表;完整版 67.5 在第 390 段(搜「complete setup」)。

  8. 出处:「CHAPTER 4: Dynamic History Selection for Conversational Question Answering」第 402 段(text/17-ch04-chapter-4-dynamic-history-selection-for-conversa.txt:402,搜「greater decline」)与第 405 段(搜「the least」)。原文:去掉剪枝掉分最多,因所有轮进入输入带噪声;去掉重排影响最小。

  9. 出处:「CHAPTER 4: Dynamic History Selection for Conversational Question Answering」Table 4.2(text/17-ch04-chapter-4-dynamic-history-selection-for-conversa.txt:345,搜「62.3」)。四个对手的介绍在第 316–336 段;「选历史胜过改写」的结论在第 71 段(搜「better results than rewriting」)。

  10. 出处:「CHAPTER 4: Dynamic History Selection for Conversational Question Answering」Table 4.5(text/17-ch04-chapter-4-dynamic-history-selection-for-conversa.txt:440,搜「Binary-term」)。三行数字如正文表;「第一模块越好、答案预测越准」的解读在第 433–436 段(搜「direct effect」)。

  11. 出处:「CHAPTER 4: Dynamic History Selection for Conversational Question Answering」第 438 段(text/17-ch04-chapter-4-dynamic-history-selection-for-conversa.txt:438,搜「high chances of error」)。原文:每级输出是下一级输入,存在级联误差的高风险。

  12. 出处:「CHAPTER 4: Dynamic History Selection for Conversational Question Answering」第 283 段(text/17-ch04-chapter-4-dynamic-history-selection-for-conversa.txt:283,搜「31K pairs」)。验证集 3K、测试 5K 同段。

  13. 出处:「CHAPTER 4: Dynamic History Selection for Conversational Question Answering」第 291–295 段(text/17-ch04-chapter-4-dynamic-history-selection-for-conversa.txt:292,搜「hyperparameters were used」)。batch 4(第 293 段)、学习率 0.00005 与权重衰减 0.01(第 294 段)。

  14. 出处:「CHAPTER 4: Dynamic History Selection for Conversational Question Answering」第 298–301 段(text/17-ch04-chapter-4-dynamic-history-selection-for-conversa.txt:298,搜「2e-5」)。答案 40/问题 64 在第 300 段(搜「maximum answer length」)。

  15. 出处:「CHAPTER 4: Dynamic History Selection for Conversational Question Answering」第 28 段(text/17-ch04-chapter-4-dynamic-history-selection-for-conversa.txt:28,搜「better than rewriting」)。