一句话:提出 InfeRE 范式,将自然语言到正则表达式的生成分解为逐步推理链,并用自洽解码集成多模型输出以提升鲁棒性。
从自然语言描述自动生成正则表达式(NL2RE)是新兴研究方向。已有工作把正则表达式视为线性 token 序列,通过神经语言模型单次自回归生成最终表达式,忽略了最终结果背后的逐步文本匹配过程,从而限制了生成效果与可解释性。本文提出 InfeRE 范式,将正则表达式生成分解为逐步推理链,逐步推断文本匹配行为并据此构造表达式,同时引入自洽解码机制,对来自不同模型采样的多个输出进行集成以增强鲁棒性。作者在公开数据集 NL-RX-Turk 与 KB13 上评估 InfeRE,并与当前最优方法及流行的树结构生成方法 TRANX 比较。实验表明 InfeRE 显著优于此前基线,在两个数据集上的 DFA@5 准确率分别提升 16.3% 和 14.7%。
Automatically generating regular expressions (abbrev. regexes) from natural language description (NL2RE) has been an emerging research area. Prior studies treat regex as a linear sequence of tokens and generate the final expressions autoregressively in a single pass. They did not take into account the step-by-step internal text-matching processes behind the final results. This significantly hinders the efficacy and interpretability of regex generation by neural language models. In this paper, we propose a new paradigm called InfeRE, which decomposes the generation of regexes into chains of step-bystep inference. To enhance the robustness, we introduce a self-consistency decoding mechanism that ensembles multiple outputs sampled from different models. We evaluate InfeRE on two publicly available datasets, NL-RX-Turk and KB13, and compare the results with state-of-the-art approaches and the popular tree-based generation approach TRANX. Experimental results show that InfeRE substantially outperforms previous baselines, yielding 16.3% and 14.7% improvement in DFA@5 accuracy on two datasets, respectively.