Page 268 - 《软件学报》2025年第5期
P. 268
2168 软件学报 2025 年第 36 卷第 5 期
contrast (MGCC) for our generator. The main purpose of this approach is to enhance the representation distances between supporting and
distracting cell sentences, thereby helping the generator differentiate between them. Specifically, this contrast mechanism is composed of
coarse-grained cell semantic contrasts and fine-grained constituent element contrasts, including contrasts in row names, column names, and
cell values. The experimental results validate that the proposed MGCC approach enables the generator to achieve better performance than
the benchmark model on the FinQA and MultiHiertt numerical reasoning datasets. On the FinQA dataset, it leads to an improvement of up
to 3.38% in answer accuracy. Notably, on the more challenging hierarchical table dataset MultiHiertt, it yields a 7.8% increase in the
accuracy of the generator. Compared with GPT-3 combined with chain of chain of thought (CoT), MGCC results in respective
improvements of 5.44% and 1.69% on the FinQA and MultiHiertt datasets. The subsequent analytical experiments further verify that the
multi-granularity cell semantic contrast approach contributes to the model’s improved differentiation between supporting and distracting cell
sentences.
Key words: table and text learning; numerical question-answering model; multi-granularity contrastive learning
问答模型在文本和知识图谱等领域已取得显著成功 [1−4] . 然而, 在现实场景中, 存在大量文本和表格混合的文
档, 如何设计问答模型解决基于文本和表格的数值推理问题, 在很多领域有着广泛的实际需求 [5,6] . 如图 1 所示, 基
于文本和表格数值问答是指模型在给定的文本和表格下进行数值推理, 生成一个计算程序 (program), 并将计算程
序结果作为问题答案. 由于表格数据的复杂性以及文本与表格数据之间的异构特性, 这些因素给当前的问答模型
带来了新的挑战, 并吸引了越来越多的关注 [5−9] .
Column headers
2009 2010 2011 2012 2013
Masco $128.21 $120.32 $102.45 $165.80 $229.59
S&P 500 $125.92 $144.58 $147.60 $171.04 $225.85
Row headers industrials $120.19 $151.89 $150.97 $173.87 $243.73 Cell values
index
S&P 500
index
… … … … … …
p
图 1 基于文本和表格数值推理问答任务示例
使用预训练语言模型在文本上进行数值推理已经取得了显著进展 [10−15] , 这表明了预训练语言模型在数值推理
上的潜力. 结合表格特点及充分利用预训练语言模型的这种优势, 当前工作主要通过固定模板将表格线性化为表
格文本, 然后设计基于预训练语言模型的问答模型在文本上进行数值推理 [5−9] , 图 2 展示了整个解决问题过程. 具
体而言, 一些工作表明表格单元格语义主要由单元格数值及其对应的行名、列名这 3 个元素构成 [16] . 因此当前工
作通过由这三者构成的固定模板将表格单元格转化为反映其语义的单元格句子, 进一步可以将整个表格线性化为
多个句子构成的表格文本, 图 3 展示了线性化表格过程. 最终, 表格文本和非结构化文本作为回答问题的输入. 但
这些输入包含很多无关信息, 且长度超过预训练语言模型的最大输入长度限制. 因此, 一个检索器先被用于从表格
文本和非结构化文本中检索相关句子, 然后一个生成器根据检索句子回答问题.
然而, 通过模板“The [row header] of [column header] is [cell value]”转化的这些单元格句子的语义差异很小. 这