T-RAG: End-to-End Table Question Answering via Retrieval-Augmented Generation阅读笔记

论文发表:2022 arXiv
论文地址:https://arxiv.org/abs/2203.16714

摘要

现有的大多数端到端表格问答(Table QA)模型由两阶段框架组成:

1)检索器从语料库中选择相关的表格候选者

2)阅读器从语料库中定位正确的答案。

本文引入了T-RAG,这是一种端到端的Table QA模型,其中非参数密集向量索引与BART(一种参数序列到序列模型)联合微调以生成答案令牌。对于任何自然语言问题,T-RAG利用统一的管道自动搜索表格语料库,直接从表格单元格中定位正确答案。

一. 介绍

表格数据来源

回答开放式文档中表格问题的难点

回答这些表格的QA任务难:缺乏模式信息

表格QA任务的实现

表格QA任务分为两步:

1)找到相关表

(Cafarella et al., 2008, 2009; Zhang
and Balog, 2018a; Shraga et al., 2020a,b),

  • Shuo Zhang and K. Balog. 2018a. Ad hoc table re-
    trieval using semantic similarity. Proceedings ofthe
    2018 World Wide Web Conference.
  • Roee Shraga, Haggai Roitman, Guy Feigenblat, and
    Mustafa Canim. 2020a. Ad hoc table retrieval using
    intrinsic and extrinsic similarities. In Proceedings of
    The Web Conference 2020, pages 2479–2485.
  • Roee Shraga, Haggai Roitman, Guy Feigenblat, and
    Mustafa Cannim. 2020b. Web table retrieval using
    multimodal deep learning. In Proceedings of the
    43rd International ACM SIGIR Conference on Re-
    search and Development in Information Retrieval,
    SIGIR ’20, page 1399–1408, New York, NY, USA.
    Association for Computing Machinery.

2)基于这些表的查询

(Yu et al., 2018; Herzig et al., 2020;
Yin et al., 2020; Glass et al., 2020

一些现有的表格问答系统

DTR

  • Jonathan Herzig, Thomas Müller, Syrine Krichene, and
    Julian Martin Eisenschlos. 2021. Open domain ques-
    tion answering over tables via dense retrieval. arXiv
    preprint arXiv:2103.12011.

CLTR

  • Feifei Pan, Mustafa Canim, Michael Glass, Alfio
    Gliozzo, and Peter Fox. 2021. CLTR: An end-to-
    end, transformer-based system for cell-level table re-
    trieval and table question answering. In Proceed-
    ings of the 59th Annual Meeting of the Association
    for Computational Linguistics and the 11th Interna-
    tional Joint Conference on Natural Language Pro-
    cessing: System Demonstrations, pages 202–209,
    Online. Association for Computational Linguistics.

他们的共同实现方法

两步管道组成,检索器生成一组候选表,阅读器回答这些表上的问题。

问题:两个组件独自训练-> 错误传播

RAG和密集检索的不足

密集检索和检索增强生成(RAG)在开放域表QA中取得了巨大的成功,但是文献中没有一个研究利用非参数记忆模型沿着参数记忆模型来进行开放域表QA任务。

TRAG

TRAG单一的训练过程取代两步框架→ 不会有错误的传播

密集通道检索(DPR)

联合训练DPR组件与基于BART的Seq 2Seq模型。

二. 相关工作

1. 表检索

传统模型

表检索传统的表检索模型通常将表连接到文档中,而忽略底层的表格结构

新的方法

新的方法来检索具有表、查询和表-查询对的一组特征的表。

Zhang and Balog, 2018b; Sun et al., 2019;
Bhagavatula et al., 2013; Shraga et al., 2020a).
Zhang and Balog (2018b

使用语义相似性来构建具有各种特征的ad-hoc表检索模型。

自然语言排序模型

A neural ranking model is in-
troduced in Shraga et al. (2020b),

表被定义为多模态对象,门控多模态单元用于学习查询表对的表示

Kpstic等人 2021 使用密集向量嵌入来提高双向和三向编码器在检索表格和文本时的性能。

2. 表格QA

大多数早期的Table QA解决方案都是完全监督的模型专注于将自然语言问题转换为SQL格式,并使用SQL格式的问题来查询给定的表

文本上的开放域QA通常利用多个知识来源

Oguz等人(2021)提出了一种模型,可以将结构化,非结构化和半结构化知识转换为开放领域QA的文本

转向利用外部知识提高表格QA效果

  • Jiménez-Ruiz等人(2020)首先提出了表数据与知识图匹配(SemTab)的语义网挑战,以鼓励此类解决方案用于表理解和表QA。

基于变换器的弱监督解决方案已被提出用于表QA。

分为两类:(1)基于逻辑形式的解决方案,如TABERT(Yin et al.,2020)模型,其被训练以捕获自然语言句子以及表格数据的表示;(2)应答单元预测解决方案,诸如TAPAS(Herzig等人,2020)和RCI(Glass等人,2020)模型。当前最先进的RCI模型利用基于transformer的框架。RCI模型不是直接为任何给定的问题-表格对检索表格单元格,而是独立地识别最相关的列和行,并将交叉表格单元格定位为最终答案。

3. 端到端的表格QA

Sun et al.(2016)发布了第一个端到端表格单元格搜索框架。这项工作利用了单元格之间的语义关系,并将查询映射到具有关系链的表单元格。

DTR模型(Herzig等人,2021)解决了端到端的表QA问题与表检索器和基于TAPAS的阅读器模型

后来,CLTR模型(Pan等人,2021)引入了类似的两步解决方案,使用BM 25作为检索器。该模型对BM 25结果重新排序,并使用RCI分数定位表格单元格。

最近,Chen et al.(2021)提出了一个新的任务,用于自由文本和表格的QA,并提供了一个解决方案,包括具有早期融合技术的检索器和跨块阅读器。

Wenhu Chen, Ming-Wei Chang, Eva Schlinger,
William Yang Wang, and William W. Cohen. 2021.
Open question answering over tables and text. In
International Conference on Learning Representa-
tions.

此外,还发布了开放域OTT-QA基准测试,以评估文本和表格上的端到端QA模型。

三. 使用T-RAG实现端到端的表格QAG

在这里插入图片描述

1)对问题“谁是Ikar的编辑?”使用查询编码器并预处理表,如T1和T2,从表语料库中进行编码

2)编码后的表稍后被索引到近似最近邻(ANN)数据结构中以供查询

3)编码后的问题在输入到基于BART的生成器进行答案预测之前被附加到每个表中。

DPR和RAG组件在没有明确考虑表级基础事实的情况下联合训练。

一步式的端到端表格QA任务:

给定一个包含表格ti的大型语料库C和任何自然语言问题qi,我们训练一个模型,直接从表格单元格生成qi的答案,而不需要任何中间步骤。

1. 设置步骤

在训练之前进行表格预处理。我们将表ti处理成一种结构表示格式

(1)列标题被附加在单元格值之前,由特殊符号“|“;

(2)分隔符“*”被附加到每一行的末尾;

(3)对于具有诸如标题之类的附加信息的表,我们将它们附加在表的前面

表被分割成512个令牌的长度用于训练。对于每个问题,我们从语料库C中检索硬否定,并将它们用作额外的否定样本来增强T-RAG训练。

2. 软硬负样本

hard negative mining
总结:让网络把
没有学好,学错的地方再学一遍

深度学习结果分析常用的思路。名为hard negative mining。

该思路源自于在faster rcnn和SSD中训练的方法。

由于一个图片中的gt_truth比较少,所以会到导致正样本会比较少,很有可能会出现正负样本不均衡的状态,所以运用了hard negative mining这个方法来帮助我们训练。

hard negative mining顾名思义:negative,即负样本,其次是hard,说明是困难样本,也就是说在对负样本分类时候,loss比较大(label与prediction相差较大)的那些样本,也可以说是容易将负样本看成正样本的那些样本。

hard negative mining就是多找一些hard negative加入负样本集,进行训练,这样会比easy negative组成的负样本集效果更好。

hard negative mining思路在目标检测中的训练过程,简单来说有以下三个步骤
1、目标检测中如何根据有标签的数据划分正负训练集
用带标签的图像随机生成图像块,iou大于某一个阈值的图像块做为正样本,否则为负样本。但一般负样本远远多于正样本,为避免训练出来的模型会偏向预测为负例,需要保持样本均衡,所以初始负样本训练集需要选择负样本集的子集,一般正:负=1:3。
2、有了正负训练集就可以训练神经网络了。经过训练后,就可以用这个训练出的模型预测其余的负样本了(就是没有加入训练集的那些负样本)。模型在预测一张图像块后会给出其属于正负的概率,在这里设置一个阈值,预测为正的概率大于这个阈值,就可以把这个图像块加入复样本训练集了【需要再训练的】
3.正样本训练集不变,负样本训练集除了初始的那些,还有新加入的。拿着这个新的训练集,就可以开始新的一轮训练了。(这里运用了解决样本不平衡欠采样的方法之一)
跳到第二步(这个过程是重复的)

其实这个思路也会用在其它地方,主要是对分析结果后对数据的处理,比如说分类网络,将hard sample 补充到数据集里,将检测错误的重新标注一下,重新丢进网络当中,简单来说就是让网络没有学好,学错的地方再学一遍
https://zhuanlan.zhihu.com/p/57440670

首席按使用BM25来找到最可能的表候选集,再从中利用Hard negative训练

本文如何使用Hard negative:

  • 从表池中,我们丢弃地面真值表。排名靠前的非正表被用作硬否定候选。在训练过程中,我们利用软硬否定机制,而不是使用前1个否定表,我们从前k个否定表中随机选择硬否定。

3. RAG

为了实现RAG所做的工作:

联合训练了一个基于DPR的检索器和一个基于BART的生成器

基于关键字的搜索引擎Anserini在C中索引表

https://github.com/castorini/anserini

以使用BM 25收集硬负训练样本

实现方法

编码:用BERT-BASE对问题、groundTruth和硬否定表进行编码。

预测:T-RAG采用答案级的基础事实,并使用Seq 2Seq生成器BART-LARGE模型进行答案预测。

查询:先前编码的表用开源FAISS(约翰逊等人,2017)库中的ANN数据结构进行查询

编码的问题连接到每个顶部检索表,并用作生成答案的提示。

四. 实验

在两个开放域基准测试NQ-TABLES和E2E_WTQ上验证了T-RAG。

NQTABLES是Natural Questions数据集的表子集,具有从英文维基百科文章中提取的表格语料库和{q,T,a}格式的样本,其中q,T和a分别表示问题,地面真值表和答案。

E2E_WTQ包含WikiTableQuestions的查找子集(Pasupat和Liang,2015)。虽然NQ-TABLES中的大量表格是转置的信息框表格,但E2E_WTQ只包含格式良好但更复杂的表格。数据统计见表1。

### Retrieval-Augmented Generation in Knowledge-Intensive NLP Tasks Implementation and Best Practices The method of retrieval-augmented generation (RAG) for knowledge-intensive natural language processing tasks aims to combine the strengths of dense vector representations with sparse exact match methods, thereby improving model performance on tasks that require access to external information not present during training[^1]. This approach ensures models can retrieve relevant documents or passages from a large corpus at inference time and generate responses conditioned on this retrieved context. #### Key Components of RAG Framework A typical implementation involves two main components: 1. **Retriever**: A component responsible for fetching potentially useful pieces of text based on input queries. 2. **Generator**: An encoder-decoder architecture like BART or T5 which generates outputs given both the query and retrieved contexts as inputs. This dual-stage process allows systems to leverage vast amounts of unstructured data without needing explicit retraining when new facts become available. #### Practical Steps for Implementing RAG Models To effectively implement such an architecture, one should consider several factors including but not limited to choosing appropriate pre-trained retrievers and generators fine-tuned specifically towards question answering or similar objectives where factual accuracy is paramount. Additionally, integrating these modules into existing pipelines requires careful consideration regarding latency constraints versus quality trade-offs especially under real-time applications scenarios. For instance, here's how you might set up a simple pipeline using Hugging Face Transformers library: ```python from transformers import RagTokenizer, RagTokenForGeneration tokenizer = RagTokenizer.from_pretrained("facebook/rag-token-nq") model = RagTokenForGeneration.from_pretrained("facebook/rag-token-nq") def rag_pipeline(question): inputs = tokenizer([question], return_tensors="pt", truncation=True) generated_ids = model.generate(input_ids=inputs["input_ids"]) output = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0] return output ``` In practice, tuning hyperparameters associated with each stage separately could lead to better overall results compared to treating them monolithically due to their distinct roles within the system design. #### Best Practices When Working With RAG Systems When deploying RAG-based solutions, adhering to certain guidelines helps maximize effectiveness while minimizing potential pitfalls: - Ensure high-quality indexing over document collections used by the retriever part since poor recall directly impacts downstream generations negatively. - Regularly update underlying corpora so they remain current; stale resources may propagate outdated information through synthetic texts produced thereafter. - Monitor closely any changes made either upstream (e.g., modifications affecting source material accessibility) or inside your own infrastructure because alterations elsewhere often necessitate corresponding adjustments locally too. By following these recommendations alongside leveraging state-of-the-art techniques provided via frameworks like those mentioned earlier, developers stand well positioned to build robust conversational agents capable of delivering accurate answers across diverse domains requiring specialized domain expertise beyond what general-purpose pretrained models alone offer today. --related questions-- 1. How does multi-task learning compare against single-task approaches concerning adaptability? 2. What are some challenges faced when implementing keyword-based point cloud completion algorithms? 3. Can prompt engineering significantly influence outcomes in few-shot learning settings? 4. Are there specific industries benefiting most prominently from advancements in knowledge-intensive NLP technologies?
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值