We introduce Modelizer - a novel framework that, given a black-box program, learns a _model from its input/output behavior_ using _neural machine translation_. The resulting model _mocks_ the original program: Given an input, the model predicts the output that would have been produced by the program. However, the model is also _reversible_ - that is, the model can predict the input that would have produced a given output. Finally, the model is _differentiable_ and can be efficiently restricted to predict only a certain aspect of the program behavior. Modelizer uses _grammars_ to synthesize inputs and to parse the resulting outputs, allowing it to learn sequence-to-sequence associations between token streams. Other than input and output grammars, Modelizer only requires the ability to execute the program. The resulting models are _small_, requiring fewer than 6.3 million parameters for languages such as Markdown or HTML; and they are _accurate_, achieving up to 95.4% accuracy and a BLEU score of 0.98 with standard error 0.04 in mocking real-world applications. We foresee several _applications_ of these models, especially as the output of the program can be any aspect of program behavior. Besides mocking and predicting program behavior, the model can also synthesize inputs that are likely to produce a particular behavior, such as failures or coverage.
翻译:我们提出Modelizer——一种新颖的框架,该框架在给定黑盒程序的情况下,利用神经机器翻译技术从其输入/输出行为中学习模型。所得模型能够模拟原始程序:给定输入时,模型可预测程序原本会产生的输出。同时该模型具有可逆性,即能够预测会产生特定输出的对应输入。此外,模型具备可微分特性,并可被高效约束为仅预测程序行为的特定方面。Modelizer通过语法规则合成输入并解析相应输出,从而学习令牌流之间的序列到序列映射关系。除输入与输出语法外,Modelizer仅需具备执行目标程序的能力。所生成的模型规模紧凑,对于Markdown或HTML等语言仅需少于630万个参数;同时具有高准确性,在模拟实际应用时可达95.4%的准确率,BLEU分数达0.98(标准误差0.04)。我们预见此类模型具有多重应用价值,特别是由于程序输出可表征程序行为的任意维度。除模拟与预测程序行为外,该模型还能合成可能引发特定行为(如故障或覆盖率)的输入。