Manuscript Offprint

arXiv:2610.28187

Foreword: Pre-Generation Prediction and Characterisation of LLM Test Failures using the Jacobian Lens

Somin Kim, Robert Feldt, Shin Yoo

A PREPRINT

Somin Kim

KAIST

Republic of Korea

somin.kim@kaist.ac.kr

Robert Feldt

Chalmers University of Technology

Sweden

robert.feldt@chalmers.se

Shin Yoo

KAIST

Republic of Korea

shin.yoo@kaist.ac.kr

October 21, 2026

ABSTRACT

Testing LLM-based software is expensive: each input needs several sampled responses, each judged by a costly oracle. Further, every prompt or model change calls for re-testing. Pre-generation adequacy measures cut this cost by ranking inputs by failure risk based on the model's internal state. However, the state of the art, Clotho, models only passing reference inputs, and its hidden-state representation says nothing about why inputs fail. We present FOREWORD, a framework built on two ideas: learn from both passing and failing references, and represent inputs through the Jacobian lens (J-lens), an interpretability technique that reads intermediate activations out as scores over vocabulary tokens. FOREWORD pairs these representations with two estimators: a sparse logistic-regression probe or dual Gaussian Mixture Models (dual GMMs), which also yield a reference density (to flag inputs the references do not cover) and failing-class components (to group similar failures). On ten tasks and three open-weight LLMs, all four combinations of representations and estimators outperform Clotho on average, both for prediction of failure (ROC-AUC improves by 0.14 on average and by up to 0.31) and test prioritisation (15% more failures among the 100 top-ranked inputs on average, up to 33%). Prioritisation obtained using small models also transfers better to proprietary models (on average 22% and up to 41% more failures in the first quarter of prioritised inputs). Importantly, our qualitative case study shows that FOREWORD supports semantic characterisation of failures by pointing to ambiguities in labels or task specifications. Combined, FOREWORD can support testers for prioritising inputs, checking support for a prediction, and characterising specific failures, all without generating output.

Keywords Test Adequacy, Large Language Model

1 Introduction

Large Language Models (LLMs) now power software in a growing number of domains, from education [Chu et al.(2025)] and health care [Qiu et al.(2024)] to software development itself [Agarwal et al.(2026)]. Such software must be tested thoroughly, but LLM testing is expensive. LLMs can react to the same input differently each time, so a reliable aggregate verdict on one input may take several iterations, each judged by an oracle that is sometimes itself an LLM [Tan et al.(2025)]. Every change to a prompt, model, or configuration can also require testing again. Testers would therefore like to predict which inputs are likely to fail, understand what failing inputs have in common, and assess when such predictions are supported. Shared failure patterns could help guide fixes and help choose tests that cover different kinds of failure. Yet current LLM testing tools give little guidance even on which inputs to run first [Dobslaw et al.(2026)].

Recently, Clotho [Yoon et al.(2026)], a pre-generation test adequacy measure, was proposed to estimate the likelihood of failure before an output is generated. The key insight is that output uncertainty can be approximated from the

FOREWORD : Pre-Generation Prediction and Characterisation of LLM Test Failures using the Jacobian Lens

LLM's internal latent space: if a new input's hidden-state representation is an outlier relative to inputs known to produce correct outputs, it is more likely to fail. Empirical results show that the ranking lets testers execute inputs likely to fail first, without generating any outputs for the remaining ones. However, Clotho neither characterises shared failure patterns nor distinguishes familiar failures from inputs unlike its references.

We present FOREWORD, a framework that extends Clotho in two ways: (1) learning from both passing and failing reference inputs, and (2) representing inputs through readouts from the Jacobian lens (J-lens), a mechanistic interpretability technique [Gurnee et al.(2026)]. Learning from both outcomes allows us to fit a predictor that distinguishes passing from failing inputs. The J-lens expresses intermediate LLM activations as vocabulary-token scores that reveal concepts the model has available for verbalisation. Unlike Clotho's opaque hidden-state vectors, these scores correspond to readable tokens, offering a basis for describing individual inputs and groups of failures.

FOREWORD represents inputs through vocabulary-aligned J-lens Readout Scores (JRS) and supports two failure estimators that learn from both passing and failing reference inputs. The dual Gaussian Mixture Model (GMM) estimator extends Clotho by fitting separate distributions to passing and failing references. Together, the two GMMs yield a failure score, a reference-density signal for flagging weakly supported inputs, and component groups whose token profiles can be inspected separately. Alternatively, a simpler Logistic Regression (LR) estimator can learn the boundary between passing and failing inputs focusing more directly on failure prediction.

Across ten tasks, including two Python program-synthesis benchmarks with executable tests, our evaluation of FOREWORD separates representation choice from estimator choice by pairing both estimators with JRS and Clotho's Last-token Input Hidden States (LIHS). All four configurations improve average ROC-AUC over Clotho; LR performs best overall. J-lens features provide readable token profiles with similar average discrimination to LIHS, although differences vary by task. In our topic-classification case study, component profiles describe separate failure groups, whereas the inspected global LR weight rankings mix several concepts.

Our contributions are as follows:

• FOREWORD, a pre-generation test adequacy framework that learns from passing and failing references using J-lens features, with LR and dual GMMs as complementary estimators.

• An empirical evaluation across ten tasks and six open-weight and three proprietary LLMs, comparing against Clotho and post-generation uncertainty metrics and assessing prediction, prioritisation, reference support, transfer, and cost.

• A qualitative case study examining how J-lens token profiles characterise failure groups, including groups sharing the same label confusion.

The replication package of FOREWORD is publicly available [Anonymous(2026)].

References (15)