Active Testing of Large Language Model via Multi-Stage Sampling

Yuheng Huang, Jiayang Song, Qiang Hu, Felix Juefei-Xu, Lei Ma · DOI

Introduction

Evaluating Large Language Models (LLMs) has become a significant bottleneck in AI development. As models scale to billions of parameters and tackle increasingly diverse tasks, the cost and time required for thorough evaluation—often involving human labeling or expensive API calls—grow exponentially. While "active testing" offers a potential solution by sampling a subset of data, traditional methods often fail to account for the unique characteristics of LLMs, such as their autoregressive nature and multi-task capabilities.

The AcTracer Framework

AcTracer is an unsupervised, plug-and-play framework designed to estimate LLM performance with high accuracy using a minimal labeling budget. It operates through a three-stage process that leverages the model's internal states and output confidence.

Overview of the AcTracer multi-stage sampling framework, illustrating the partitioning and sampling stages.

1. Internal State-Driven Partitioning (CluSearch)

Instead of relying on raw text, AcTracer analyzes the model's neuron activations (hidden states) from a middle layer. These states are grouped using CluSearch, an automated clustering algorithm that identifies similar test cases based on the model's internal representation.

Pseudocode for the CluSearch algorithm used for adaptive sampling and elbow-point detection.

2. Inter-cluster Sampling

To optimize the labeling budget, AcTracer employs a Monte Carlo Upper Confidence Bound (MC-UCB) strategy. This approach prioritizes clusters with high performance variance, ensuring that labeling efforts are focused on areas where the model's behavior is most inconsistent.

3. Intra-cluster Sampling

Within a selected cluster, the framework identifies representative data points by analyzing output confidence distributions. By using a "dip test" to detect multimodality and applying appropriate distance metrics (Wasserstein or Kolmogorov-Smirnov), AcTracer selects points that best characterize the cluster's overall performance.

Experimental Evaluation

The authors validated AcTracer across seven diverse datasets, including TriviaQA (common knowledge), GSM8K (mathematical reasoning), AGIEval (problem solving), and HumanEval (code generation). The framework was tested on five prominent models: Llama-2, Llama-3, Code Llama, Qwen2.5, and Phi-4.

AcTracer demonstrated superior performance, achieving state-of-the-art results in 26 out of 32 experimental settings. Notably, on Llama-3 (NQ-open), it improved estimation accuracy by 37.18% compared to the strongest baseline.

Key Insights

  • Middle Layer Representations: The study found that middle layers (e.g., Layer 16 in a 32-layer model) are more indicative of task-specific behavior than the final layer. Relying on the last layer resulted in an average accuracy drop of over 21%.
  • Entropy-Guided Confidence: Simple averaging of token-level confidence scores is often ineffective. AcTracer uses an entropy-guided method to aggregate these scores into a single, informative metric for each task.
  • Unsupervised Efficiency: The framework operates without labeled training data or prior knowledge of the model's training history, making it highly versatile for "black-box" evaluations.

Conclusion and Future Work

AcTracer provides a robust and efficient solution for LLM evaluation, significantly reducing the need for exhaustive labeling. While it shows slight limitations in specialized areas like "truthfulness," its ability to maintain accuracy even on small datasets makes it a valuable tool for researchers. Future work may explore dynamic stopping criteria and the integration of historical performance data to further refine the sampling process.

Summary updated

BibTeX
@article{huang2025active,
  author = {Yuheng Huang and Jiayang Song and Qiang Hu and Felix Juefei-Xu and Lei Ma},
  title = {{Active Testing of Large Language Model via Multi-Stage Sampling}},
  journal = {ACM Transactions on Software Engineering and Methodology},
  year = {2025},
  doi = {10.1145/3744340},
}
Figure