这篇论文教你如何用模型检查方法自动验证LLM生成的解释是否可靠,比随机测试发现更多问题。
研究人员提出使用概率模型检查作为测试预言机,对大型语言模型生成的后验解释进行系统性测试。该方法在七个MDP环境中测试了三个开源LLM,一个推理模型通过85%的测试用例,中等规模模型通过70%,而10亿参数模型的表现低于随机基线。测试通过查询分类法结构化输入空间,并根据问题特定的诊断难度分数对测试用例进行优先级排序。
Automated Testing of LLM-Based Post Hoc Explainers Using Model Checking as an Oracle
Large language models (LLMs) are used as post hoc explainers of sequential decision-making policies, producing natural-language explanations of why an action was chosen. However, LLMs often generate plausible but incorrect statements, and no existing approach systematically tests whether such explanations are faithful to the underlying environment. Two classic software testing challenges stand in the way: there is no oracle for the correctness of an explanation, and the test inputs, natural language queries about a policy's behavior, lack the structure needed for systematic test case generation. We address both. Probabilistic model checking provides the test oracle, computing exact reference results against which LLM answers are graded automatically. A taxonomy of post hoc query categories structures the input space around the environment-level facts from which policy explanations are composed; test cases generated from it are prioritized by question-specific diagnostic difficulty scores. Across seven MDP environments, the testing separates three open-weight LLMs: a reasoning model passes 85% of test cases, a mid-size model 70%, and a 1B model falls below the random baseline, while prioritization surfaces significantly harder cases than random selection. Our results indicate how trustworthy LLM-generated explanations are in model-free settings, where the same LLMs are used but no oracle exists to verify them.