arXiv:2608.26423cs.LGAug 2026

Manuscript Offprint

arXiv:2608.26423

The Latent Diagnostic Taxonomy: A Framework for Constructing Classifiers and Diagnosing Their Decisions, Applied to Prompt Injection Detection

Jaturong Kongmanee, Smile Thanapattheerakul

Abstract

This paper proposes a framework for constructing a classifier as a safeguard layer, and for developing a complementary diagnostic that identifies which of the classifier's confident decisions can be trusted. This framework, the Latent Diagnostic Taxonomy, consists of (i) constructing a dimensionality-optimized classifier, in which the embedding dimensionality is empirically selected via cross-validated performance rather than fixed a priori, (ii) locating a relatively small set of latent support vectors ( ≈29%\approx 29\% of total training examples) representing influential prompts for identifying tokens that alter the classifier's predicted labels, and (iii) utilizing such tokens and their associated attack magnitudes for constructing a diagnostic taxonomy. This diagnostic taxonomy provides an end-to-end guideline for flagging prompts that require different treatments: rely Safely on the classifier's decision; flag Heuristic Bias and Heuristic Override cases; route Insufficient Context cases for further human/safety review. Applying the framework to a classifier trained on a public prompt injection dataset, we find that a substantial fraction of its confident decisions ( ≈77%\approx 77\%) are not robust to removing a single token, and that this brittleness separates into two distinct failure patterns: a confidence calibration failure and a genuinely exploitable shortcut. For each zone of the taxonomy, we also recommend strategies for remediating diagnosed prompts. We illustrate the framework as a series of steps, demonstrating how each step operates.

Keywords: Prompt Injection, LLM Guardrails, LLM security, Support Vector Machines, Token-Level Robustness Diagnosis, Feature Attribution

1 Introduction

Large language models (LLMs), when deployed as agents, are capable of carrying out multi-step tasks (e.g., navigating web pages (Shen et al., 2024) and identifying zero-day vulnerabilities (Carlini et al., 2026)). This capability is enabled by harnessing and scaffolding LLMs with essential contextual data. Retrieved and returned data, however, can contain hidden adversarial instructions that, when incorporated into the LLM's context window, can cause prompt injection attacks in which adversarial prompts subvert the system designer's intent. (Toyer et al., 2024; Liu et al., 2024).

Prompt injection attacks can, for example, turn an LLM-powered chatbot into a phishing agent (Greshake et al., 2023) and leak system prompts exposing proprietary business logic and operational rules (Liu et al., 2023). The leaked system prompts can be used as templates for attackers to craft malicious prompts that LLMs are likely to comply with (Zhang et al., 2025), to perform malicious actions such as generating offensive content (Shao et al., 2025) and leaking sensitive data (Agarwal et al., 2024; Alizadeh et al., 2025). As we

©2026 J. Kongmanee and S. Thanapattheerakul.

License: CC-BY-NC-ND 4.0, see https://creativecommons.org/licenses/by-nc-nd/4.0/.

expect adversaries to continue developing new attacks, we aim to develop a framework for constructing a guardrail classifier that can be continuously trained and get updated more easily and rapidly to identify and alert such attacks, thereby, when our safeguard is in use, increasing the computational effort and resources for adversaries developing new attacks that evade detection.

Given the real-world situation we face and our practical constraints, we are concerned with developing a specialized classifier as a safeguard layer, and analyzing the failed cases of the classifier to develop security defenses for LLMs. The combination of the two approaches' strengths aims to enhance our process of developing methods for detecting prompt injection. This ongoing process comprises constructing a dimensionality-optimized classifier, in which cross-validated performance determines the embedding dimensionality (Section 2.1), locating a set of influential prompts to identify attack tokens that can alter the classifier's decision boundary (Section 2.2), and utilizing such attack tokens to construct a diagnostic taxonomy providing an end-to-end guideline for flagging diagnosed prompts (Section 2.3). Section 3 demonstrates how the latent diagnostic taxonomy applies to prompt injection vulnerability.