[论文解读] Leveraging Grammar and Reinforcement Learning for Neural Program Synthesis
本文将强化学习与监督训练以及基于语法的裁剪相结合,以生成符合给定 IO 规范的句法有效程序,从而提高数据效率并处理神经程序合成中的程序别名问题。
Program synthesis is the task of automatically generating a program consistent with a specification. Recent years have seen proposal of a number of neural approaches for program synthesis, many of which adopt a sequence generation paradigm similar to neural machine translation, in which sequence-to-sequence models are trained to maximize the likelihood of known reference programs. While achieving impressive results, this strategy has two key limitations. First, it ignores Program Aliasing: the fact that many different programs may satisfy a given specification (especially with incomplete specifications such as a few input-output examples). By maximizing the likelihood of only a single reference program, it penalizes many semantically correct programs, which can adversely affect the synthesizer performance. Second, this strategy overlooks the fact that programs have a strict syntax that can be efficiently checked. To address the first limitation, we perform reinforcement learning on top of a supervised model with an objective that explicitly maximizes the likelihood of generating semantically correct programs. For addressing the second limitation, we introduce a training procedure that directly maximizes the probability of generating syntactically correct programs that fulfill the specification. We show that our contributions lead to improved accuracy of the models, especially in cases where the training data is limited.
研究动机与目标
- 通过优化为任意与语义等价的程序来解决程序别名问题,而不仅仅是单个参考程序。
- 利用程序语法来裁剪搜索空间并强制语法正确性。
- 在没有正式语法时,学习语法以实现能力。
- 在有限训练数据下对 Karel DSL 演示该方法以展示数据效率。
提出的方法
- 使用一个基于序列的 LSTM 模型,条件化输入输出对的嵌入,每个 IO 对一个解码器,并对解码器进行最大池化以预测下一个标记。
- 将程序表示为来自 DSL 字母表的标记序列,并以监督最大似然(MLE)作为基线进行训练。
- 引入强化学习,针对正确性对 IO 示例给出奖励 R(lambda),并通过采样(REINFORCE)近似目标。
- 通过基于束搜索的采样进行训练对齐测试时的解码(BS(p_theta, S))。
- 可选地加入语法检查器以通过对解码器输出的掩码对前缀进行裁剪(stx conditioning)。
- 提出一个学习的语法检查器 g_phi,通过将其输出加入解码器来惩罚句法不可读的标记(联合架构)。
实验结果
研究问题
- RQ1强化学习是否可以直接优化生成任意与 IO 规范一致的程序,而不仅仅是一个 Ground-truth 程序?
- RQ2显式的语法感知裁剪是否能改善生成的句法有效且正确的程序?
- RQ3在没有显式文法可用时,联合学习语法如何影响性能?
- RQ4在 Karel DSL 中使用有限训练数据时,该方法是否具有数据效率?
主要发现
- 针对正确性进行的强化学习在 top-1 泛化方面优于纯监督训练,尤其是在较大训练集时。
- 与训练对齐的基于束搜索采样(RL_beam 变体)比标准 RL 或 MLE 能获得更好的泛化性和正确程序的多样性。
- 促进多样性的目标(RL_beam_div、RL_beam_div_opt)降低冗余并提高前几项预测的相对准确性。
- 使用语法检查器(手写或学习的)来裁剪搜索空间带来性能提升,在数据有限时学习型语法表现良好。
- 在数据有限的情况下,RL 方法的增益更显著,表明程序合成的数据效率有所提高。
更好的研究,从现在开始
从论文设计到论文写作,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。