arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2604.06559cs.SEcs.LG
收藏

ExplainFuzz: 基于概率电路的可解释且受约束的测试生成

ExplainFuzz: Explainable and Constraint-Conditioned Test Generation with Probabilistic Circuits

UCLA(加州大学洛杉矶分校);KU Leuven(鲁汶大学)

Annaëlle Baiget, Jaron Maene, Seongmin Lee, Benjie Wang, Guy Van den Broeck, Miryung Kim

AI总结:

ExplainFuzz利用概率电路学习并查询基于语法规则的测试输入的结构分布,通过条件化能力整合测试约束,提升生成输入的现实性和多样性,显著提高缺陷触发率。

摘要:

理解并解释生成测试输入的结构对于有效的软件测试和调试至关重要。现有方法,包括基于语法规则的模糊测试器、概率上下文无关文法(pCFGs)和大型语言模型(LLMs),存在关键局限。它们经常生成不规范的输入,无法反映真实的数据分布,难以捕捉上下文敏感的概率依赖关系,并缺乏可解释性。我们介绍了ExplainFuzz,一个利用概率电路(PCs)学习和查询基于语法规则的测试输入结构分布的测试生成框架。从上下文无关文法(CFG)开始,ExplainFuzz编译一个语法规则感知的PC并将其训练于现有输入上。新输入通过采样生成。ExplainFuzz利用PC的条件化能力整合测试特定约束(例如,查询必须包含GROUP BY),使受约束的概率采样生成满足语法规则和用户提供的约束的输入。我们的结果表明,ExplainFuzz提高了生成输入的连贯性和现实性,相比pCFGs、语法规则无关的PCs和LLMs显著降低了困惑度。通过利用其原生的条件化能力,ExplainFuzz显著增强了满足用户提供的约束的输入的多样性。与语法规则感知的突变模糊测试相比,ExplainFuzz在SQL中将缺陷触发率从35%提高到63%,在XML中从10%提高到100%。这些结果展示了学习输入分布相对于突变模糊测试的能力,后者通常局限于探索种子输入的局部邻域。这些能力突显了概率电路作为语法感知、可控测试生成基础的潜力,能够捕捉上下文敏感的概率依赖关系。

英文摘要:

Understanding and explaining the structure of generated test inputs is essential for effective software testing and debugging. Existing approaches--including grammar-based fuzzers, probabilistic Context-Free Grammars (pCFGs), and Large Language Models (LLMs)--suffer from critical limitations. They frequently produce ill-formed inputs that fail to reflect realistic data distributions, struggle to capture context-sensitive probabilistic dependencies, and lack explainability. We introduce ExplainFuzz, a test generation framework that leverages Probabilistic Circuits (PCs) to learn and query structured distributions over grammar-based test inputs interpretably and controllably. Starting from a Context-Free Grammar (CFG), ExplainFuzz compiles a grammar-aware PC and trains it on existing inputs. New inputs are then generated via sampling. ExplainFuzz utilizes the conditioning capability of PCs to incorporate test-specific constraints (e.g., a query must have GROUP BY), enabling constrained probabilistic sampling to generate inputs satisfying grammar and user-provided constraints. Our results show that ExplainFuzz improves the coherence and realism of generated inputs, achieving significant perplexity reduction compared to pCFGs, grammar-unaware PCs, and LLMs. By leveraging its native conditioning capability, ExplainFuzz significantly enhances the diversity of inputs that satisfy a user-provided constraint. Compared to grammar-aware mutational fuzzing, ExplainFuzz increases bug-triggering rates from 35% to 63% in SQL and from 10% to 100% in XML. These results demonstrate the power of a learned input distribution over mutational fuzzing, which is often limited to exploring the local neighborhood of seed inputs. These capabilities highlight the potential of PCs to serve as a foundation for grammar-aware, controllable test generation that captures context-sensitive, probabilistic dependencies.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑