一句话:提出并实现基于强化学习的 Java 运行时验证工具 Valg,通过减少冗余监控大幅降低开销。
运行时验证(RV)通过动态监控方法调用等事件序列是否违反形式规约来发现缺陷,但监控开销高。先前工作发现 99.87% 的被监控轨迹是冗余的。本文提出 Valg,将基于强化学习(RL)的技术实现于 Java,以减少冗余监控。相比原型,Valg 增加逐规约超参数、RL 轨迹保存、离线超参数调优和性能优化,并集成 JavaMOP 与 TraceMOP,修复一个长期规约缺陷。在 56 个开源项目上,调参后的 Valg 相对原型在 JavaMOP 和 TraceMOP 上分别最高加速 4.2 倍和 1.9 倍,唯一轨迹保留率最高提升 94.5 个百分点,离线调参比在线调参快数个数量级。
Runtime Verification (RV) dynamically monitors whether traces—sequences of program events like method calls—violate formal specifications. RV helped find many bugs, but it incurs high runtime overheads. Prior work showed that 99.87% of monitored traces are redundant: they are identical to the other 0.13%. So, we recently proposed a new technique based on reinforcement learning (RL) to speed up RV by reducing redundant monitoring. This paper presents Valg, a tool that implements the technique for Java. Compared to our previous prototype, Valg adds (i) per-spec hyperparameters, (ii) RL trajectory saving, (iii) offline hyperparameter tuning, and (iv) performance optimizations. We also integrate Valg with the main development branch of JavaMOP and TraceMOP, two state-of-the-art RV tools, and fix a long-standing specification bug. On 56 open-source projects, Valg with tuned hyperparameters is up to 4.2x and 1.9x faster than our prototype when applied to JavaMOP and TraceMOP, respectively, and improves unique trace preservation by up to 94.5pp. Valg’s offline hyperparameter tuning is orders of magnitude faster than our prototype’s online tuning, and our optimizations make JavaMOP, TraceMOP, and Valg faster. Valg is open-sourced at: https://github.com/SoftEngResearch/tracemop, and a video demo can be found at: https://youtu.be/_QCyHaa_ICc.