[{"data":1,"prerenderedAt":433},["ShallowReactive",2],{"content-query-wGjGW0dlQC":3},{"_path":4,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":8,"description":9,"date":10,"cover":11,"type":12,"category":13,"body":14,"_type":427,"_id":428,"_source":429,"_file":430,"_stem":431,"_extension":432},"/technology-blogs/zh/654","zh",false,"","TPRR：“会思考”的多跳问答检索","MindSpore原创多跳问答检索模型TPRR","2021-07-19","https://obs-mindspore-file.obs.cn-north-4.myhuaweicloud.com/file/2021/07/19/fbd778ca796c46838c6ce78d61a07ead.png","technology-blogs","大V博文",{"type":15,"children":16,"toc":424},"root",[17,25,39,44,56,64,69,74,82,87,94,99,125,133,143,151,160,168,173,178,183,188,200,207,212,219,224,236,243,248,256,261,268,273,278,283,290,295,300,307,312,320,325,332,337,342,349,354,361,366,371,379,394,409,414,419],{"type":18,"tag":19,"props":20,"children":22},"element","h1",{"id":21},"tprr会思考的多跳问答检索",[23],{"type":24,"value":8},"text",{"type":18,"tag":26,"props":27,"children":28},"p",{},[29,31],{"type":24,"value":30},"转载地址：",{"type":18,"tag":32,"props":33,"children":37},"a",{"href":34,"rel":35},"https://zhuanlan.zhihu.com/p/390212829",[36],"nofollow",[38],{"type":24,"value":34},{"type":18,"tag":26,"props":40,"children":41},{},[42],{"type":24,"value":43},"作者：于璠",{"type":18,"tag":26,"props":45,"children":46},{},[47,49,54],{"type":24,"value":48},"本篇主要介绍",{"type":18,"tag":50,"props":51,"children":52},"strong",{},[53],{"type":24,"value":9},{"type":24,"value":55},"，分享团队在复杂的开放域问答工作上的一些探索。十分欢迎各位一起探讨更多NLP任务场景的挑战和趋势。",{"type":18,"tag":26,"props":57,"children":58},{},[59],{"type":18,"tag":50,"props":60,"children":61},{},[62],{"type":24,"value":63},"·背景",{"type":18,"tag":26,"props":65,"children":66},{},[67],{"type":24,"value":68},"自然语言处理中，问答（QA）一直是十分热门的领域，旨在希望AI想人类一样“具有推理能力”，能够根据已有知识自动回答提出的问题。与传统的信息检索相比，QA研究如何处理以自然语言的形式提出的问题，而不是一些查询语言。",{"type":18,"tag":26,"props":70,"children":71},{},[72],{"type":24,"value":73},"在传统的抽取式简单问答中（如SQuAD）中，很多问题的答案只需要从原文中抽取与问题相关的一个句子就能回答。而在复杂的多跳问答中，系统需要通过收集多篇文档并通过推理才能回答一个问题。比如“where did Algeria qualify for the first time into the round of 16?”。如图1所示，仅依赖单个wiki的文档只能得到Algeria第一次进世界杯16强是在2014年。因此系统还需要2014 FIFA World Cup的wiki文档，通过多跳推理融合两个文档信息从而预测出正确答案“Brazil”。",{"type":18,"tag":26,"props":75,"children":76},{},[77],{"type":18,"tag":78,"props":79,"children":81},"img",{"alt":7,"src":80},"https://pic3.zhimg.com/80/v2-80ceeb0d20c7339ec8ad6b9671976eb6_720w.jpeg",[],{"type":18,"tag":26,"props":83,"children":84},{},[85],{"type":24,"value":86},"图1 Algeria at the FIFA World Cup词条",{"type":18,"tag":26,"props":88,"children":89},{},[90],{"type":18,"tag":78,"props":91,"children":93},{"alt":7,"src":92},"https://pic3.zhimg.com/80/v2-ea6b875a24a8835d2f87892df9bdc7ee_720w.jpg",[],{"type":18,"tag":26,"props":95,"children":96},{},[97],{"type":24,"value":98},"图2 2014 FIFA World Cup词条",{"type":18,"tag":26,"props":100,"children":101},{},[102,104,109,111,116,118,123],{"type":24,"value":103},"针对上述复杂的多跳问答场景，华为泊松实验室和MindSpore团队联合提出了一种解决开放域多跳问题的通用模型TPRR（Thinking Path Re-Ranker）。TPRR基于全路径建模和动态负样本构建并经过EPR（External Path Reranker）模块细粒度精排从而大幅提升系统多跳问答的的能力。自2021年1月，TPRR在国际权威多跳问答榜单",{"type":18,"tag":50,"props":105,"children":106},{},[107],{"type":24,"value":108},"HotpotQA Fullwiki Setting",{"type":24,"value":110},"评测中荣登榜首。相关论文已被",{"type":18,"tag":50,"props":112,"children":113},{},[114],{"type":24,"value":115},"SIGIR2021",{"type":24,"value":117},"录用，推理代码已基于",{"type":18,"tag":50,"props":119,"children":120},{},[121],{"type":24,"value":122},"MindSpore开源发布",{"type":24,"value":124},"，欢迎大家使用。",{"type":18,"tag":26,"props":126,"children":127},{},[128],{"type":18,"tag":50,"props":129,"children":130},{},[131],{"type":24,"value":132},"论文链接：",{"type":18,"tag":26,"props":134,"children":135},{},[136],{"type":18,"tag":32,"props":137,"children":140},{"href":138,"rel":139},"https://link.zhihu.com/?target=http%3A//playbigdata.ruc.edu.cn/dou/publication/2021_SIGIR_Ranker.pdf",[36],[141],{"type":24,"value":142},"http://playbigdata.ruc.edu.cn/dou/publication/2021_SIGIR_Ranker.pdf",{"type":18,"tag":26,"props":144,"children":145},{},[146],{"type":18,"tag":50,"props":147,"children":148},{},[149],{"type":24,"value":150},"代码链接：",{"type":18,"tag":26,"props":152,"children":153},{},[154],{"type":18,"tag":32,"props":155,"children":158},{"href":156,"rel":157},"https://gitee.com/mindspore/mindspore/tree/master",[36],[159],{"type":24,"value":156},{"type":18,"tag":26,"props":161,"children":162},{},[163],{"type":18,"tag":50,"props":164,"children":165},{},[166],{"type":24,"value":167},"·问题定义",{"type":18,"tag":26,"props":169,"children":170},{},[171],{"type":24,"value":172},"解决复杂问答问题的流程主要包括：",{"type":18,"tag":26,"props":174,"children":175},{},[176],{"type":24,"value":177},"1、 **多轮信息检索器（retriever）**根据问题从海量文档中检索出相关的线索文档候选集",{"type":18,"tag":26,"props":179,"children":180},{},[181],{"type":24,"value":182},"2、 **重排器（reranker）**对于候选线索文档进行精排，选出最佳的线索文档序列",{"type":18,"tag":26,"props":184,"children":185},{},[186],{"type":24,"value":187},"3、 **阅读器（reader）**从最佳线索文档多个句子中解析出答案span",{"type":18,"tag":26,"props":189,"children":190},{},[191,193,198],{"type":24,"value":192},"以二跳问答举例。如图3所示，最右的概率表示已知问题q，选取一跳文档 的概率d_i^1，是一跳文档检索的建模目标。中间的概率表示已知问题q和一跳文档d_i^1，选取二跳文档d_j^2的概率。在先前ICLR工作[1]中，二跳文档检索建模时是基于greedy search的思想，仅使用p(d_j^2 |q,d_i^1 )作为建模目标，即只优化",{"type":18,"tag":50,"props":194,"children":195},{},[196],{"type":24,"value":197},"当前的文档检索",{"type":24,"value":199},"。",{"type":18,"tag":26,"props":201,"children":202},{},[203],{"type":18,"tag":78,"props":204,"children":206},{"alt":7,"src":205},"https://pic1.zhimg.com/80/v2-9b2e153adba75a5233617dcb69eae27c_720w.jpg",[],{"type":18,"tag":26,"props":208,"children":209},{},[210],{"type":24,"value":211},"图3二跳路径概率公式",{"type":18,"tag":26,"props":213,"children":214},{},[215],{"type":18,"tag":78,"props":216,"children":218},{"alt":7,"src":217},"https://pic3.zhimg.com/80/v2-e0a0328d638a01434c3b9832061e39de_720w.jpeg",[],{"type":18,"tag":26,"props":220,"children":221},{},[222],{"type":24,"value":223},"图4 全局路径概率公式",{"type":18,"tag":26,"props":225,"children":226},{},[227,229,234],{"type":24,"value":228},"这种优化过程是次优的，因此TPRR采用全局路径建模的方式，进行多跳文档检索建模时，用“全局”的视角每次对于",{"type":18,"tag":50,"props":230,"children":231},{},[232],{"type":24,"value":233},"当前的路径检索",{"type":24,"value":235},"进行建模。从理论上分析，如图4在第n跳检索建模的过程中，引入前n-1跳的概率，则可以根据当前跳的监督信号，在梯度反传过程中对于模型先前的检索进行监督“微调”，加大了对于正确文档检索的监督信号。结果如图5呈现，全局路径建模端到端的多轮检索效果更佳。",{"type":18,"tag":26,"props":237,"children":238},{},[239],{"type":18,"tag":78,"props":240,"children":242},{"alt":7,"src":241},"https://pic1.zhimg.com/80/v2-adc72539259d2cbf0cdfd19920f6f528_720w.jpg",[],{"type":18,"tag":26,"props":244,"children":245},{},[246],{"type":24,"value":247},"图5 全局路径建模消融结果",{"type":18,"tag":26,"props":249,"children":250},{},[251],{"type":18,"tag":50,"props":252,"children":253},{},[254],{"type":24,"value":255},"·动态负样本训练方式",{"type":18,"tag":26,"props":257,"children":258},{},[259],{"type":24,"value":260},"在多跳检索的训练中，每一跳路径的优化目标如图6所示。通过rank loss计算，希望在所有训练路径排序中，最大化当前正确路径(d^1,…,d^(t-1),d_c^t)概率。在检索模型的训练中，负样本的选取十分重要。微软先前的工作[2]指出，“容易”的负样本训练loss越小，梯度越小，对于训练收敛的帮助也很小。检索模型的训练收敛十分依赖于负样本的“信息量”，即难易程度。",{"type":18,"tag":26,"props":262,"children":263},{},[264],{"type":18,"tag":78,"props":265,"children":267},{"alt":7,"src":266},"https://pic2.zhimg.com/80/v2-a0fac4a8260f30e32e6fdc4d2d536499_720w.jpeg",[],{"type":18,"tag":26,"props":269,"children":270},{},[271],{"type":24,"value":272},"图6 检索优化目标",{"type":18,"tag":26,"props":274,"children":275},{},[276],{"type":24,"value":277},"借鉴上述思想，TPRR设计了一种动态的负样本训练方式用来模拟人的学习思考过程，举个例子，在小学阶段，我们入门一些简单的加减法。到了中学阶段，学习一些函数和方程的思想。到了大学阶段，随着知识量的累积开始学习微积分等更难的数学课程。因此，我们在检索模型的训练过程中不断增加训练负样本的“难度”，从而使得模型学习过程更加“自然”。利用topk算子如图7，在_t_跳路径建模时，所有负样本输入_M_中只选择得分topk的输入进行反传。",{"type":18,"tag":26,"props":279,"children":280},{},[281],{"type":24,"value":282},"在训练初期，模型检索能力较弱的时候，模型对于样本打分不能很好区分正负样本。此时，选取的_k_个负样本是比较“容易”的，训练检索模型对于一般样本的区分能力。随着训练步数的增加，模型检索能力变强，选取的_k_个负样本是“困难”的，此时“容易”的负样本训练对于模型的检索能力已经很少有提升。因此利用topk的选取负样本策略，模型的学习任务随着模型能力增强变得更加困难，模拟人的学习过程。",{"type":18,"tag":26,"props":284,"children":285},{},[286],{"type":18,"tag":78,"props":287,"children":289},{"alt":7,"src":288},"https://pic1.zhimg.com/80/v2-42742cecbcbc8d864760c0380ac615e4_720w.jpg",[],{"type":18,"tag":26,"props":291,"children":292},{},[293],{"type":24,"value":294},"图7 topk选择负样本",{"type":18,"tag":26,"props":296,"children":297},{},[298],{"type":24,"value":299},"最终结果如图8，动态负样本的训练方式大大提升了模型的检索能力。",{"type":18,"tag":26,"props":301,"children":302},{},[303],{"type":18,"tag":78,"props":304,"children":306},{"alt":7,"src":305},"https://pic3.zhimg.com/80/v2-efcf04ba182094f75e1613f8defbda5a_720w.jpg",[],{"type":18,"tag":26,"props":308,"children":309},{},[310],{"type":24,"value":311},"图8 动态负样本消融结果",{"type":18,"tag":26,"props":313,"children":314},{},[315],{"type":18,"tag":50,"props":316,"children":317},{},[318],{"type":24,"value":319},"·细粒度精排",{"type":18,"tag":26,"props":321,"children":322},{},[323],{"type":24,"value":324},"通过上述的初步检索过程，从500w的wiki文档中筛选出top8的相关文档序列。TPRR使用了更细粒度的文档划分和多任务预测筛选最佳线索文档。在精排过程中，将相关文档拆分为标题、句子、段落的不同粒度构造相关的输入。同时在最终任务中，同时进行路径预测、检索段落预测、检索句子预测三个不同粒度的任务。如图9，额外的精排过程带来了巨大的top1检索准确率收益。",{"type":18,"tag":26,"props":326,"children":327},{},[328],{"type":18,"tag":78,"props":329,"children":331},{"alt":7,"src":330},"https://pic4.zhimg.com/80/v2-df1532e086eed08e24842f4e0ae7e5af_720w.jpg",[],{"type":18,"tag":26,"props":333,"children":334},{},[335],{"type":24,"value":336},"图9 精排消融结果",{"type":18,"tag":26,"props":338,"children":339},{},[340],{"type":24,"value":341},"在多跳问答权威benchmark Hotpot QA中，多项创新技术的引入带来了巨大收益，如图10、图11，TPRR在答案、线索和联合准确率指标上均超越SOTA模型，在Fullwiki setting中名列榜首。",{"type":18,"tag":26,"props":343,"children":344},{},[345],{"type":18,"tag":78,"props":346,"children":348},{"alt":7,"src":347},"https://pic3.zhimg.com/80/v2-288fb95bd50639bf7091fe97855edb56_720w.jpg",[],{"type":18,"tag":26,"props":350,"children":351},{},[352],{"type":24,"value":353},"图10 Hotpot QA实验结果",{"type":18,"tag":26,"props":355,"children":356},{},[357],{"type":18,"tag":78,"props":358,"children":360},{"alt":7,"src":359},"https://pic3.zhimg.com/80/v2-d339e26a6ede3633c7570fb3f0f4ac76_720w.jpg",[],{"type":18,"tag":26,"props":362,"children":363},{},[364],{"type":24,"value":365},"图11 Hotpot QA榜单",{"type":18,"tag":26,"props":367,"children":368},{},[369],{"type":24,"value":370},"对于TPRR的介绍就到这里啦，欢迎大家多多讨论，批评指正。",{"type":18,"tag":26,"props":372,"children":373},{},[374],{"type":18,"tag":50,"props":375,"children":376},{},[377],{"type":24,"value":378},"最后给MindSpore打个广告，期待大家多多参与使用",{"type":18,"tag":26,"props":380,"children":381},{},[382],{"type":18,"tag":50,"props":383,"children":384},{},[385,387],{"type":24,"value":386},"MindSpore官网：",{"type":18,"tag":32,"props":388,"children":391},{"href":389,"rel":390},"https://link.zhihu.com/?target=https%3A//www.mindspore.cn/",[36],[392],{"type":24,"value":393},"https://www.mindspore.cn/",{"type":18,"tag":26,"props":395,"children":396},{},[397],{"type":18,"tag":50,"props":398,"children":399},{},[400,402],{"type":24,"value":401},"MindSpore论坛：",{"type":18,"tag":32,"props":403,"children":406},{"href":404,"rel":405},"https://link.zhihu.com/?target=https%3A//bbs.huaweicloud.com/forum/forum-1076-1.html",[36],[407],{"type":24,"value":408},"https://bbs.huaweicloud.com/forum/forum-1076-1.html",{"type":18,"tag":26,"props":410,"children":411},{},[412],{"type":24,"value":413},"参考文献：",{"type":18,"tag":26,"props":415,"children":416},{},[417],{"type":24,"value":418},"[1] Asai A, Hashimoto K, Hajishirzi H, et al. Learning to retrieve reasoning paths over wikipedia graph for question answering[J]. arXiv preprint arXiv:1911.10470, 2019.",{"type":18,"tag":26,"props":420,"children":421},{},[422],{"type":24,"value":423},"[2] Xiong L, Xiong C, Li Y, et al. Approximate nearest neighbor negative contrastive learning for dense text retrieval[J]. arXiv preprint arXiv:2007.00808, 2020.",{"title":7,"searchDepth":425,"depth":425,"links":426},4,[],"markdown","content:technology-blogs:zh:654.md","content","technology-blogs/zh/654.md","technology-blogs/zh/654","md",1776506139251]