LeCov: Multi-level Testing Criteria for Large Language Models
Xuan Xie, Jiayang Song, Yuheng Huang, Da Song, Fuyuan Zhang, Felix Juefei-Xu, Lei Ma
TL;DR
LeCov introduces a formal, multi-level testing framework for LLMs that targets three internal components—attention, feed-forward neurons, and uncertainty—and defines nine criteria across attention-wise, neuron-wise, and uncertainty-wise coverage. The criteria are applied to test prioritization and coverage-guided testing, demonstrated on three open-source models and four datasets, showing improvements in both prioritization accuracy and defect detection. Key contributions include the design of $k$-multisection attention and uncertainty coverages, time-aware neuron criteria, and a mutation-driven CGT pipeline. The findings suggest that internal-structure-aware testing can substantially enhance LLM trustworthiness assessments and guide practical testing workflows.
Abstract
Large Language Models (LLMs) are widely used in many different domains, but because of their limited interpretability, there are questions about how trustworthy they are in various perspectives, e.g., truthfulness and toxicity. Recent research has started developing testing methods for LLMs, aiming to uncover untrustworthy issues, i.e., defects, before deployment. However, systematic and formalized testing criteria are lacking, which hinders a comprehensive assessment of the extent and adequacy of testing exploration. To mitigate this threat, we propose a set of multi-level testing criteria, LeCov, for LLMs. The criteria consider three crucial LLM internal components, i.e., the attention mechanism, feed-forward neurons, and uncertainty, and contain nine types of testing criteria in total. We apply the criteria in two scenarios: test prioritization and coverage-guided testing. The experiment evaluation, on three models and four datasets, demonstrates the usefulness and effectiveness of LeCov.
