When working to understand usage of a data format, examples of the data format are often more representative than the format's specification. For example, two different applications might use very different JSON representations, or two PDF-writing applications might make use of very different areas of the PDF specification to realize the same rendered content. The complexity arising from these distinct origins can lead to large, difficult-to-understand attack surfaces, presenting a security concern when considering both exfiltration and data schizophrenia. Grammar inference can aid in describing the practical language generator behind examples of a data format. However, most grammar inference research focuses on natural language, not data formats, and fails to support crucial features such as type recursion. We propose a novel set of mechanisms for grammar inference, RL-GRIT, and apply them to understanding de facto data formats. After reviewing existing grammar inference solutions, it was determined that a new, more flexible scaffold could be found in Reinforcement Learning (RL). Within this work, we lay out the many algorithmic changes required to adapt RL from its traditional, sequential-time environment to the highly interdependent environment of parsing. The result is an algorithm which can demonstrably learn recursive control structures in simple data formats, and can extract meaningful structure from fragments of the PDF format. Whereas prior work in grammar inference focused on either regular languages or constituency parsing, we show that RL can be used to surpass the expressiveness of both classes, and offers a clear path to learning context-sensitive languages. The proposed algorithm can serve as a building block for understanding the ecosystems of de facto data formats.
翻译:当努力理解数据格式的使用情况时,数据格式的例子往往比格式的规格更具有代表性。例如,两种不同的应用程序可能使用非常不同的 JSON 表达方式,或者两个PDF写字应用程序可能使用PDF规格非常不同的领域来实现相同的内容。这些不同来源产生的复杂性可能导致大、难于理解的攻击表面,在考虑现有语法推理和数据分裂性时,这带来了一种安全关切。格拉姆玛推理可以帮助描述数据格式示例背后的实际语言生成者。然而,大多数语法推理研究可能使用非常不同的 JSON 表达方式,而不是数据格式,可能无法支持诸如重现类型等关键特征。我们提出了一套用于语法推理推理的新型机制,RL-GRIT,并应用这些机制来理解事实上的数据格式。在审查现有的语法推理学解决方案之后,确定在加强学习(RL)中可以找到新的、更灵活的缩缩略图。在这项工作中,我们展示了从常规的逻辑变法结构中所需的许多变法变法结构,从传统的变法结构中可以显示一种直线性的数据格式,从传统的顺序结构,也可以在不断的顺序结构结构中学习一种对立式结构中,可以显示一种直变的变法结构,从传统的变的变式结构,在前的变法结构中可以显示的顺序结构中学习一种对立。