Skip to Content
ElectronicsElectronics
  • Article
  • Open Access

11 August 2026

24 Pages

A Privacy-Preserving Middleware Architecture for Detecting Prompt Injection and Sensitive Data Exposure in Large-Language-Model Interactions

and
Computer Science Research Centre, UWECyber, School of Computing and Creative Technologies, University of the West of England, Frenchay, Bristol BS16 1QY, UK
*
Author to whom correspondence should be addressed.

Abstract

The deployment of large language models (LLMs) in real-world applications introduces a compounding security problem: detecting adversarial inputs such as prompt injection and jailbreak-driven data leakage while simultaneously preventing the detection mechanism itself from becoming a source of data exposure. Existing approaches address either detection effectiveness or privacy preservation, but rarely both in a unified, deployable architecture. This paper proposes and evaluates a privacy-preserving hybrid middleware architecture that enforces a local trust boundary as its primary design constraint. The architecture combines deterministic rule-based screening, a fine-tuned small language model (SLM) operating entirely within the local processing environment, and a sensitivity-aware routing mechanism that invokes external LLM reasoning only for prompts all local components have assessed as non-sensitive. Evaluation on a 120-prompt benchmark spanning benign, jailbreak, and sensitive categories (including 20 hard negatives constructed to be lexically adjacent to genuine secrets) shows that the routed architecture attains 95.83% accuracy with complete recall, retaining 95% of sensitive prompts within the local boundary, at the cost of a 12.5% false-positive rate. Comparison against two published detectors reveals a systematic asymmetry: an injection-specific classifier reaches 82.5% recall on jailbreak prompts but 25% on sensitive ones, while a content-safety model inverts that profile, confirming empirically that the two risks are addressed separately by current tooling. The framework is model-agnostic, requires no retraining of the underlying LLM, and is compatible with black-box API deployments. The evaluation dataset and fine-tuned model are released publicly.

1. Introduction

The widespread integration of large language models into customer-facing and enterprise applications has created a security environment with no precedent in traditional software engineering. Unlike conventional systems, LLMs operate on natural-language instructions, making them susceptible to adversarial manipulation through carefully crafted prompts rather than memory corruption or authentication exploits [1,2]. This shift exposes organizations to two compounding risks: prompt injection attacks that subvert model behavior, and the unintended disclosure of sensitive information through jailbreak-driven data leakage [3,4].
What the existing literature has not sufficiently addressed is a second-order privacy risk that arises when deploying detection itself. Many detection mechanisms route user prompts to external LLM-based moderation systems or cloud classifiers. When those prompts contain credentials, personal identifiers, or confidential business data, the act of detecting a threat can itself constitute a data exposure incident. Prompts sent to third-party inference infrastructure may be retained for model training, logged by providers, or subject to jurisdictional data access obligations [5,6]. Organizations deploying LLM assistants in sensitive domains such as legal, financial, or healthcare contexts face a fundamental constraint: detection systems must preserve data confidentiality to the same degree as the underlying application, yet no current single-layer detection approach adequately meets this requirement.
This paper addresses this constraint by introducing a middleware architecture that treats privacy preservation as a primary design principle rather than an auxiliary feature. Central to the design is a sensitivity-aware routing mechanism enforcing a strict categorical policy: any prompt that contains, or may contain, sensitive data is confined to processing within the local trust boundary. The external LLM is invoked only in the complementary case: when every local component has assessed the prompt as non-sensitive, and when the additional contextual reasoning would materially improve the verdict. Sensitivity therefore withholds external routing; it never triggers it.
Research Question: Can a privacy-preserving hybrid middleware architecture simultaneously satisfy practical deployment constraints and provide effective detection of prompt injection attacks and sensitive data exposure in LLM systems, without transmitting confidential data to external inference infrastructure?
The work reported here contributes on four fronts. Architecturally, it shows what changes when a local trust boundary is treated as a hard constraint rather than a configuration option: every component must justify its placement against that boundary, and the routing logic, not a post-hoc filter, becomes the mechanism that enforces it. Empirically, it places three heterogeneous detection strategies, deterministic pattern matching, a locally fine-tuned SLM, and external LLM reasoning, inside a single evaluation frame, so that accuracy, latency, and privacy exposure can be reasoned about together rather than one at a time. Practically, it quantifies what privacy costs: the latency gap between local and external inference is not an incidental measurement but the price of keeping confidential prompts inside the boundary. Finally, both the evaluation dataset [7] and the fine-tuned classifier [8] have been released so that others can reproduce, criticize, and extend the results.
The remainder of this paper is organized as follows. Section 2 reviews prompt injection detection, operational guardrails, and privacy risks in LLM deployments, and positions the proposed architecture against them. Section 3 defines the security and privacy threat models that motivate the design. Section 4 presents the architecture, its components, the sensitivity routing mechanism, and the fine-tuning and evaluation methodology. Section 5 reports detection performance, latency, and the privacy properties of each configuration. Section 6 discusses the privacy–performance trade-off and the limitations of the current evaluation, and Section 7 concludes.

3. Threat Model

3.1. System Context

The system under consideration is a deployed LLM-based application accessed through a client interface. A middleware layer sits between the client and the LLM provider, intercepting user prompts and model outputs for security analysis. The middleware operates as a monitoring and incident response layer; it does not modify the LLM itself and requires no changes to vendor infrastructure.

3.2. Security Threat Model

Adversaries are assumed to submit arbitrary prompts with one or more of the following objectives: overriding system instructions, extracting sensitive data from the model’s context or training, inducing policy-violating outputs via jailbreak techniques, or obfuscating malicious intent through paraphrasing and indirect framing [2,11]. The attacker interacts only through the standard user interface; they do not have access to model weights, middleware configuration, or internal system state.

3.3. Privacy Threat Model

In addition to the standard adversarial threat model, this work defines an explicit privacy threat model for the detection layer itself. The following threat scenarios motivate the architecture:
  • T1: Credential exposure via external routing. A user submits a prompt containing an API key, database connection string, or authentication token. If this prompt is forwarded to an external LLM classifier, the credential is transmitted to third-party infrastructure where it may be logged or retained.
  • T2: PII transmission during detection. A prompt contains email addresses, national identifiers, or financial data. Routing to an external service for classification constitutes processing under GDPR Article 4(2) and may engage data minimization obligations.
  • T3: Training data contamination. External LLM providers may retain prompts for model improvement. Sensitive business or personal data submitted during detection could be incorporated into future model training, constituting an uncontrolled data disclosure.
  • T4: Inference-time memorization exploitation. If a detection mechanism routes prompts to an externally hosted model that has memorized sensitive data from prior interactions, the response itself may constitute a privacy breach.
These threats are not addressed by any of the detection approaches reviewed in Section 2. They motivate the hard constraint in the proposed architecture: no prompt that may contain sensitive data is transmitted beyond the local trust boundary.

3.4. Defender Constraints

The defensive system operates under the following practical constraints: real-time or near real-time response; limited local computational resources; compatibility with black-box LLM providers; avoidance of excessive false positives that degrade user experience; and alignment with data protection obligations under UK GDPR.

4. Materials and Methods

4.1. Design Principles

The architecture is governed by three ordered design principles, derived from the threat model in Section 3: (1) privacy as constraint, not feature: the local trust boundary is non-negotiable, and any prompt assessed as sensitive is processed locally regardless of the potential detection quality benefit of external routing; (2) staged analysis with early termination: processing proceeds through increasingly expensive detection layers, terminating as early as the available signal permits a confident decision, which controls both latency and the number of prompts that reach external services; and (3) monitoring-first enforcement: the system prioritizes detection, logging, and user notification over blocking, with hard blocking reserved for content indicating imminent physical harm, consistent with established AI safety practice [23].

4.2. High-Level Architecture

Figure 1 illustrates the proposed architecture. The middleware controller receives all user prompts before they reach the LLM and orchestrates the detection pipeline. The pipeline enforces the local trust boundary: all prompts are first screened by the rule-based engine and SLM classifier. Only if a prompt is assessed as non-sensitive does the sensitivity routing mechanism permit forwarding to the external LLM reasoning layer.
Figure 1. Middleware-based detection architecture for prompt injection and sensitive data exposure in LLM interactions. The detection pipeline comprises Tokenization and Pattern Matching, an SLM classifier, and an LLM reasoning layer, feeding into the Hybrid Verdict Engine. The middleware acts as an intrusion detection layer: non-blocking warnings are issued for detected threats; hard blocking is reserved for content indicating potential physical harm or self-harm.

4.3. Trust Boundary Analysis

Table 2 formalizes which components operate within the local trust boundary and the privacy rationale for each placement decision. This analysis is the primary mechanism by which privacy-by-design is operationalized in the architecture [22].
Table 2. Component placement relative to the local trust boundary.

4.4. Architecture Components

Middleware Controller. The controller orchestrates data flow and enforces the sensitivity-aware routing policy. It receives the raw prompt, initiates the detection pipeline, aggregates detection signals, and produces the final verdict. It is the only component with visibility across the full pipeline.
Tokenization and Pattern-Matching Module. Provides deterministic, low-latency first-stage screening using structured regular expression patterns targeting PII (email, phone, national identifiers, financial account numbers), authentication material (API keys, tokens, connection strings), and known jailbreak syntactic signatures. This layer achieves sub-millisecond latency and zero false positives on structured data. Financial identifiers are validated using Luhn checksums, and entropy thresholds are applied for high-entropy string detection (tokens, keys).
Heuristic Detection Engine. Applies behavioral indicators targeting semantic-level adversarial patterns: instruction override language, role-play framing, meta-prompting, context-shifting prefixes (“for research”, “in a hypothetical”), and multi-stage manipulation sequences. Outputs a heuristic confidence score, not a binary decision, allowing downstream aggregation.
SLM Classifier. A fine-tuned 0.6 B-parameter transformer (detailed in Section 4.7) deployed locally for semantic classification into three categories: benign, sensitive, and jailbreak. Its output governs the routing decision rather than the final verdict: the classifier determines whether a prompt may cross the trust boundary, and the verdict is then computed from the components available on the resulting path (Section 4.8). This placement is deliberate. Sensitivity assessment must occur locally by definition, since routing the assessment itself to an external service would defeat its purpose, whereas verdict quality can draw on external reasoning once the boundary decision has been made. The SLM is accordingly the primary control point for the architecture’s privacy property: in the evaluation reported in Section 5.4, it triggered local retention for 58 of the 70 prompts kept inside the boundary, against 12 for pattern matching.
Sensitivity Routing Mechanism. The routing mechanism aggregates outputs from the pattern matching, heuristic, and SLM components to make a binary decision: does this prompt contain, or possibly contain, sensitive data? If yes, processing is restricted to local components, and the external LLM reasoning layer is not invoked. This mechanism implements threat scenarios T1–T4 from Section 3.3 as hard architectural constraints. The routing decision is conservative by design: uncertainty defaults to local processing. A prompt is permitted to reach the external LLM layer only when all three local components assess it as non-sensitive.
External LLM Reasoning Layer. Provides advanced contextual analysis for prompts that have cleared the sensitivity gate. Capable of identifying complex multi-step manipulation strategies and subtle jailbreak attempts that evade pattern-based detection. Conditionally invoked to limit both privacy exposure and computational cost.
The external model is google/gemini-3-flash-preview, accessed through the OpenRouter gateway. It is queried with temperature 0.3 and a 200-token output limit; top_p is not set in the request and therefore takes the provider-side default. The system prompt is reproduced verbatim in Appendix A. A second user-turn message supplies the prompt under analysis together with the indicators raised by the heuristic engine, so that the external model receives the local evidence rather than the raw prompt alone.
The response is parsed as JSON and the confidence field is taken as L in Equation (1); the Boolean fields determine which threat conditions the external layer reports. A response that fails to parse is treated as a null result, and the verdict falls back to the locally derived signals.
Hybrid Verdict Engine. Aggregates the signals available on the path a prompt has taken into a final classification. The weighted scoring model (Section 4.8) combines the heuristic confidence with the external LLM confidence where the routing gate has permitted the external call. The SLM confidence is not an input to this score; its role is confined to the gate, as described above. Produces one of four operational tiers, named here as they are named in the implementation: benign, concerning, security_attack, and critical_harm.
Two distinct taxonomies operate in this system and are easily confused, so the relationship is stated explicitly. The SLM performs content classification over three classes: {benign, sensitive, jailbreak}, which are also the class labels of the datasets. The verdict engine performs action classification over four tiers: {benign, concerning, security_attack, critical_harm}, because the system must decide what to do as well as what it is looking at. The mapping is not one-to-one: concerning and security_attack both arise from content the SLM would label sensitive or jailbreak, distinguished by which pattern-matching conditions were raised, while critical_harm additionally requires the numeric confidence threshold described in Section 4.8. Throughout this paper, “benign”, “sensitive”, and “jailbreak” denote dataset classes and are used in all reported metrics; the typewriter names denote runtime verdict tiers and appear only where system behavior is described.
Logging and User Notification Module. Records all detection events, triggered rules, confidence scores, routing decisions, and actions with timestamped metadata. Supports auditability and incident response. Non-blocking warnings are issued for the concerning and security_attack tiers. Hard blocking, the only case where the prompt does not reach the LLM, is reserved for critical_harm.

4.5. Detection Pipeline Workflow

Figure 2 shows the detection pipeline for a representative example: a prompt containing a PostgreSQL connection string, which is flagged at the pattern-matching stage and routed entirely through local processing.
Figure 2. Detection pipeline workflow for a prompt containing a database credential (postgresql://admin:MyPassword123!@prod-db.company.com:5432/users_db). After middleware interception, the prompt is tokenized, pattern-matched, and assessed by the heuristic engine and SLM classifier. The sensitive data gate routes the prompt to local processing only; the external LLM reasoning layer is not invoked. The classification outcome and system action (Allow|Warn|Strong Warn|Block) are determined by the Hybrid Verdict Engine.

4.6. Alignment with Data Protection Obligations

The architecture is designed to support three data protection obligations, though whether any given deployment satisfies them depends on implementation detail, provider contracts, retention practice, jurisdiction, and organizational governance that lie outside the scope of an architectural proposal.
With respect to UK GDPR Article 5(1)(c) (data minimization), the sensitivity routing mechanism is intended to limit what is transmitted beyond the local boundary: external LLM invocation is withheld whenever sensitive content is detected or cannot be confidently excluded. With respect to Article 25 (data protection by design and default), privacy safeguards are embedded in the architectural routing logic rather than applied as post-processing controls, which operationalizes Cavoukian’s privacy-by-design principle of end-to-end security [22]. With respect to Article 32 (security of processing), the logging module provides structured auditability and supports incident response, which contributes to (but does not by itself constitute) the appropriate technical measures the Article requires.

4.7. SLM Fine-Tuning

The SLM component is built on Narasimha-0.6B (sarthakrastogi/narasimha-b-0.6b), a 0.6 B-parameter decoder-only transformer released as part of the Rival prompt-attack detection toolkit [24]. The checkpoint derives from the Qwen3 family [25]: 28 layers, hidden size 1024, 16 attention heads over 8 key–value heads under grouped-query attention, and a 151,936-token tied embedding matrix that alone accounts for 26% of the model’s 596,049,920 parameters. It should be noted that this checkpoint has itself already been tuned for adversarial prompt classification; it is, therefore, a domain-adapted starting point rather than a general-purpose base model, and the fine-tuning reported here constitutes further specialization rather than adaptation from scratch. Selection criteria were: (1) sufficient contextual capability for semantic classification of adversarial prompts; (2) inference feasibility without GPU acceleration, supporting local deployment; and (3) a small enough parameter count to meet real-time latency requirements on consumer hardware.
Parameter-efficient fine-tuning was implemented using Low-Rank Adaptation (LoRA) [26] through the PEFT library. This approach introduces trainable low-rank matrices into selected transformer layers while keeping the base model parameters frozen. Full fine-tuning was avoided to minimize computational resource requirements and to preserve the stability and generalization capabilities of the pre-trained base model.
Table 3 reports the complete configuration. Adaptation was confined to the four attention projections; the feed-forward blocks, which constitute 264,241,152 parameters or 44% of the model, were left frozen. This yields 4,587,520 trainable parameters, 0.77% of the total. Restricting adaptation to attention keeps the adapter small enough to distribute independently of the base weights, at the cost of leaving the feed-forward representations unchanged; extending adaptation to the feed-forward projections is a natural direction for improving local classification capacity without increasing inference cost at deployment time.
Table 3. LoRA fine-tuning configuration. Architecture and adapter values are taken from the released checkpoint’s config.json and adapter_config.json; parameter counts are derived from those configurations. Entries marked † were not set explicitly and take the Hugging Face TrainingArguments default.
Training ran for two epochs over the 700-prompt training partition at a learning rate of 5 × 10 − 5 , with a per-device batch size of 1 and gradient accumulation over 8 steps, giving an effective batch size of 8 and 175 optimizer steps in total. Mixed-precision fp16 was enabled. Validation loss was computed at the end of each epoch on the held-out validation partition; best-checkpoint selection was not enabled, so the released adapter is the checkpoint from the final epoch rather than the best-scoring one. The comparatively small number of optimizer steps reflects both the corpus size and the fact that the base checkpoint had already been adapted to adversarial prompt classification, so this stage constitutes further specialization rather than adaptation from scratch.
The model was fine-tuned using a generative classification format. Each training instance followed the template: “Classify the following prompt into one of the categories: benign, sensitive, jailbreak. Prompt: [user prompt]. Classification:”. The first generated token following “Classification:” was parsed as the predicted label. This format preserves compatibility with the text-generation architecture, avoids adding a classification head, and supports future expansion to multi-label reasoning without architectural modification.

4.8. Verdict Aggregation

The gate and the verdict draw on different signals. The gate is determined locally, from the pattern-matching result and the SLM classification; the verdict score is computed from the heuristic confidence and, where the gate has permitted an external call, the external model’s confidence. The SLM therefore contributes to the routing decision but not to the score.
Let H ∈ [ 0 , 1 ] denote the heuristic engine confidence and L ∈ [ 0 , 1 ] the external LLM confidence. Where the external layer has been invoked, the two are combined linearly:
C = 0.40 H + 0.60 L
The weighting reflects an engineering judgment that the external model contributes better semantic interpretation than fixed heuristic patterns, while the heuristic term preserves a deterministic and interpretable contribution. It was selected a priori and was not empirically tuned: no ablation or parameter sweep was conducted, and the values are not presented as optimal. Section 6.6 notes sensitivity analysis over this weighting as future work.
The verdict is then assigned by a rule cascade rather than by a set of score thresholds. Three tiers are determined by Boolean outcomes from the pattern-matching stage (whether harmful content, a bypass attempt, or a structured attack signature was found), and are evaluated in that order. A single numeric cutoff is applied: a prompt is escalated to the highest tier, critical_harm, only when harmful content is detected and  C ≥ 0.70 . The resulting tiers are benign, concerning, security_attack, and critical_harm.
Only critical_harm results in the prompt being blocked. The remaining tiers produce non-blocking warnings, consistent with the monitoring-first principle in Section 4.

4.9. Dataset Construction

A custom evaluation dataset was constructed and released publicly [7]. The dataset comprises three categories: benign (ordinary queries, coding requests, and conversational prompts), sensitive (inputs containing structured PII, credentials, or configuration secrets), and jailbreak (prompts designed for instruction overriding, role-play manipulation, or policy evasion). Both manually curated samples and synthetically generated variations were incorporated to enhance linguistic diversity and robustness.
The corpus was partitioned into training, validation, and held-out test subsets as shown in Table 4. Validation and test partitions are class-balanced at 50 prompts per class.
Table 4. Training corpus composition by partition and class. The evaluation reported in Section 5 uses the separately constructed 120-prompt comparison set, not the test partition below.
Two distinct evaluations are reported in this paper and should not be conflated. The held-out test partition above is drawn from the same templated corpus as the training data and is used only for internal validation during fine-tuning. All results in Section 5 use the independently constructed 120-prompt comparison set described below, which shares no generation template with the training corpus and whose benign class is drawn from an entirely different distribution.

4.10. Evaluation Setup

Fine-tuning and inference evaluation were carried out on separate machines, and the two are reported separately below because conflating them would misattribute the latency results.
Training environment. Fine-tuning was conducted in a Google Colaboratory free-tier session using Hugging Face Transformers (≥4.35.0) and PyTorch (≥2.0.0) with LoRA via PEFT 0.18.0 [27]. The session was allocated an NVIDIA T4 (16 GB), as recorded in Table 3; free-tier allocation is not guaranteed to a fixed accelerator, so this device applies to the reported run rather than to the platform in general. Training used fp16 mixed precision, which is the appropriate choice for this accelerator: the T4 is a Turing-generation device without hardware bfloat16 support. The bfloat16 value recorded in the base checkpoint’s configuration is that checkpoint’s storage dtype and does not describe the present training run. This environment is relevant to reproducibility of the fine-tuning procedure only. It has no bearing on the latency figures in Section 5, which were measured on the local inference machine described below.
Inference environment. All latency and detection-performance figures reported in Section 5 were measured on a KVM-virtualized VPS instance running Ubuntu 25.04 (kernel 6.14.0-37-generic), provisioned with 6 vCPUs (AMD EPYC-Milan Processor, as presented by the hypervisor) and 11 GiB of RAM. No GPU was available in this environment; all local inference, the rule-based engine, the SLM classifier, and the DeBERTa-v3 baseline, ran on CPU only, consistent with the CPU-only latency figures reported in Section 5.5. Because the instance is virtualized, the reported vCPU count reflects the hypervisor’s allocation rather than dedicated physical cores; this is a boundary condition on the absolute latency figures rather than a source of inconsistency between configurations, since all six configurations in Table 5 were measured on this same instance under the same conditions.
Table 5. Detection performance on the 120-prompt evaluation set. CI is a bootstrap 95% interval on accuracy over 1000 resamples. FPR = FP/(FP + TN); FNR = FN/(FN + TP). Latency is mean per prompt; the two remote services were accessed through the OpenRouter gateway, and their figures include network round-trip time. N/A: the routed configuration’s end-to-end latency is not directly measured; it is reported by path in Section 5.5.
Use of generative AI. In the preparation of this manuscript, no generative artificial intelligence was used to generate the reported experimental results, datasets, or model training; large language models were evaluated strictly as a subject of study (one of the three compared detection approaches), not as a tool used to produce the findings.

5. Results

All results are computed on the 120-prompt evaluation set described in Section 4.9: 40 benign, 40 jailbreak, and 40 sensitive prompts. The benign class is further divided into 20 general assistant queries and 20 hard negatives: prompts that are lexically or semantically adjacent to the sensitive class without being sensitive, such as requests to write a scanner for leaked tokens, questions about credential formats, or examples using placeholder values. Metrics are reported for the binary task of separating attack and sensitive prompts from benign ones unless stated otherwise.

5.1. Standalone Detection Performance

Table 5 reports all six configurations, and Figure 3 presents the same results with per-configuration confusion matrices. Accuracy is accompanied by a bootstrap 95% confidence interval over 1000 resamples, which is necessary at this sample size to avoid over-reading differences of a few percentage points.
Figure 3. Detection accuracy, F1, precision, recall, and confusion matrix for each of the six configurations evaluated on the 120-prompt set. The Gemini 3 Flash panel is shaded green to indicate the top-performing standalone configuration. The routed hybrid (lower right) records zero false negatives across all 80 attack and sensitive prompts, at the cost of five false positives. Latency for the routed configuration is derived from component measurements; see Section 5.5.
The external LLM attains the highest standalone accuracy, with a single false negative and no false positives. The rule-based engine achieves high precision but detects only 11 of 80 attack and sensitive prompts. The locally fine-tuned SLM occupies an intermediate position, recovering the majority of what the rule engine misses while remaining inside the trust boundary. The confidence intervals overlap substantially for the two published baselines, so their ordering relative to one another should not be over-interpreted; the separation between the external LLM and everything else is the only gap the sample size clearly supports.

5.2. Per-Category Performance

Aggregate figures conceal the finding that most directly concerns this paper’s motivation. Table 6 decomposes detection by prompt category.
Table 6. Detection rate by category. Benign specificity is the proportion of benign prompts correctly not flagged; jailbreak and sensitive columns report recall within each class ( n = 40 each).
The two published baselines fail in opposite directions, and the pattern is systematic rather than incidental. DeBERTa-v3-prompt-injection, trained specifically for injection detection, attains 82.5% recall on jailbreak prompts but only 25% on sensitive ones. Llama Guard, a content-safety classifier, inverts this: 27.5% on jailbreak against 55% on sensitive. Neither exceeds 55% on the class it was not designed for.
This is direct empirical support for the research gap identified in Section 2. The claim that prompt injection detection and sensitive data protection are treated as separate problems was argued there from the literature; it is visible here in the behavior of the tools themselves. A deployment relying on either baseline alone would be substantially exposed to one of the two OWASP risks this work addresses.

5.3. False Positives on Hard Negatives

Table 7 separates false positives on general benign prompts from those on hard negatives.
Table 7. False positives by benign subtype ( n = 20 each). General prompts are ordinary assistant requests; hard negatives are benign prompts lexically adjacent to the sensitive class.
Every approach except the external LLM performs worse on hard negatives than on general prompts, and for four of the six the entire false-positive burden falls there. Had the evaluation used only unrelated benign text, five of the six configurations would have reported a false-positive rate at or near zero, and the reported precision figures would have carried no information about deployment behavior.
The failures are interpretable. DeBERTa flags a request for a placeholder .env file, a question about what an OpenSSH key header means, and a masked card example: surface patterns without intent. The SLM flags a request to write a regex matching GitHub tokens and a request for a log scrubber that removes passwords: prompts whose subject matter is credentials but whose purpose is protective. Only the external LLM separates subject from intent across all 20.

5.4. The Routed Architecture

The results above characterize components in isolation. The architecture’s central claim, however, concerns their composition under the routing constraint. The sensitivity gate was applied to the per-component decisions recorded during evaluation: a prompt is retained locally when either the pattern-matching layer fires or the SLM classifies it as an attack, and is forwarded to the external layer otherwise. Because each component is deterministic given its input, this reconstruction yields the verdicts a live routed pipeline produces. End-to-end latency is the one quantity it cannot recover, and is therefore not reported.
Three observations follow.
First, the routed architecture eliminates false negatives: all 80 attack and sensitive prompts are flagged, against a single miss for the external LLM alone and 15 for the SLM alone. The mechanism is straightforward: the gate is disjunctive, so a prompt is retained and flagged whenever any local component fires, and prompts that clear the gate still receive external analysis. The upper confidence bound of 4.6% reflects the sample size rather than measured error.
Second, the privacy constraint is enforced but not perfectly. Two of forty sensitive prompts were routed externally, a 5.0% leakage rate with an upper bound of 16.5%. Both failures are of one kind: Attached salary sheet includes all employees and bonus values for 2025 and Confidential legal settlement estimate is 18.5 million USD. Neither contains a structured secret for the pattern layer to match, and the SLM classified both as benign. They are sensitive by virtue of business context, not surface form. This identifies a specific and addressable weakness: the gate detects sensitivity through structural signatures and a classifier trained predominantly on structured secrets, and unstructured confidential content falls outside both. It is not a marginal case but a coherent category, and closing it is the most direct route to strengthening the architecture.
Third, the constraint carries a cost. The routed architecture’s false-positive rate is 12.5%, against 0% for the external LLM, because a conservative disjunctive gate flags anything any local component finds suspicious, including four hard negatives. This is the trade the architecture makes explicit: complete recall and containment of 95% of sensitive prompts, in exchange for a false-positive rate an order of magnitude above what unrestricted external analysis achieves. Under the monitoring-first policy of Section 4, where non-harm verdicts produce warnings rather than blocks, that trade is defensible; under a blocking policy it would not be.
Table 8 summarizes these routing statistics.
Table 8. Routing behavior of the proposed architecture on the 120-prompt evaluation set. Intervals are Wilson 95% confidence intervals; N/A marks descriptive counts for which no interval was computed.

5.5. Latency

Component latencies were measured per prompt. The rule-based engine runs at 0.1 ms and is effectively free. The local SLM required 3193.7 ms on CPU-only hardware. The remote services were faster despite being substantially larger, 1150.9 ms for Gemini 3 Flash and 369.5 ms for Llama Guard 4, because they execute on dedicated inference infrastructure; both figures include OpenRouter gateway and network round-trip time. DeBERTa-v3, a 184 M-parameter encoder requiring a single forward pass, ran locally in 146.7 ms.
End-to-end latency for the routed architecture depends on the path a prompt takes, and the two paths must be reported separately because the gate withholds the external call for a majority of prompts:
The comparison in the last two rows is worth stating explicitly, because it runs against the framing used earlier in this paper. Routing was introduced as a privacy control whose cost is latency. On this evaluation, it is not a cost at all: because 58.3% of prompts never reach the external service, mean end-to-end latency is 671.4 ms lower than a configuration that calls out on every prompt (a 15.5% reduction), together with a 58.3% reduction in external API calls and their associated cost. The gate withholds work as well as data.
The dominant term in every path is the local SLM at 3193.7 ms. That figure is not an inherent property of local execution: DeBERTa-v3 ran on the same machine in 146.7 ms, over 20 times faster, because it is an encoder evaluated in a single forward pass rather than an autoregressive decoder generating tokens. Local inference within a real-time budget is therefore achievable; it requires a different local architecture, not different hardware. This is the single most consequential direction for improving the deployability of the proposed system.

6. Discussion

6.1. Complementary Failure Modes and Complete Recall

The routed architecture detected all 80 attack and sensitive prompts, against a single miss for the external LLM alone and 15 for the local SLM alone. That the composition outperforms its strongest component is not an averaging effect, and the mechanism is worth setting out precisely.
On the sensitive class, the local classifier and the external model fail on disjoint prompts. The SLM misclassified two: Attached salary sheet includes all employees and bonus values for 2025 and Confidential legal settlement estimate is 18.5 million USD. The external model misclassified one: Medical record: patient P-83921 diagnosed with hypertension. The intersection of these sets is empty. Under the routing policy, the two prompts the SLM misses are precisely the ones it does not flag, so they clear the gate and reach the external model, which classifies both correctly; the prompt the external model misses is retained locally because the SLM flags it, so the external verdict is never consulted. Neither component exceeds 97.5% recall on this class alone, and their composition reaches 100%.
This is a stronger justification for a hybrid than the usual appeal to defense in depth. The two components fail differently because they detect differently: the local classifier was tuned on structured secrets and responds to their surface regularities, while the external model reasons about context and disposition. A medical record identifier is structurally distinctive but contextually innocuous; a salary sheet reference is contextually confidential but structurally featureless. Each component fails on the category the other is built for.
The same composition operates on the jailbreak class by a different route. The gate retains 27 of 40 jailbreak prompts locally, almost entirely on the SLM signal, and forwards the remaining 13 to the external model, whose recall on this class is complete. Routed recall is therefore 100% without either component achieving it alone.
The generality of this result should not be overstated. It rests on three prompts in a 40-item class, and a different sample would very plausibly produce some overlap. What the evaluation supports is the weaker and still useful claim that the failure modes are of different kinds, structural versus contextual, which is a property of how the components work rather than of which prompts happened to be sampled.

6.2. Privacy Without a Latency Penalty

This paper introduced the routing mechanism as a privacy control and framed its cost in latency: local inference is slower, and that slowness is the price of confidentiality. The measurements do not support that framing, and the correction is worth stating plainly rather than quietly.
Because the gate withholds the external call for 58.3% of prompts, mean end-to-end latency under routing is 3673.3 ms against 4344.7 ms for a configuration that calls out on every prompt: 671.4 ms lower, a 15.5% reduction, together with a 58.3% reduction in external API calls and their associated cost. Routing does not trade latency for privacy. It reduces both external exposure and external work, because the same test that decides whether data may leave also decides whether a network round trip is necessary at all.
This does not make the architecture fast. Every path is dominated by the local SLM at 3193.7 ms, which is far outside an interactive budget. However, the correct attribution matters: that cost belongs to the choice of local model, not to the routing policy. DeBERTa-v3 ran on the same hardware in 146.7 ms, over 20 times faster, because it is an encoder evaluated in a single forward pass rather than a decoder generating tokens autoregressively. Substituting an encoder-based local classifier would plausibly bring end-to-end latency close to the external model’s, while strengthening rather than weakening the privacy property. This is the most consequential single change available to the design.

6.3. Division of Labor Among Local Components

The two local components contribute unequally, and the pattern is not the one the architecture description anticipated.
Pattern matching triggered the gate on 12 of 70 locally retained prompts; the SLM accounted for the remaining 58. As a standalone detector, the rule engine reached 13.75% recall, detecting 20% of sensitive prompts and 7.5% of jailbreak prompts. It missed AWS access keys, Slack webhook URLs, OpenSSH private-key headers, MongoDB connection strings, and several token formats. Its precision, at 91.67%, is not the perfect figure an earlier and less demanding evaluation produced: one hard negative, a question about whether a placeholder connection string is safe to commit, matched the password_in_url rule.
The honest characterization is therefore narrower than “fast, high-precision first-stage filter”. The rule engine is a low-cost detector for a specific and incomplete set of credential formats, valuable at 0.1 ms because it is nearly free rather than because it carries much of the load. Expanding its pattern coverage is a cheap improvement with no latency consequence.
The SLM’s profile is more interesting. It reached 95% recall on sensitive prompts but only 67.5% on jailbreak, a substantial asymmetry, and plausibly a consequence of a training corpus dominated by structured-secret templates. In most detection settings, that would be a deficiency. In this architecture, it is close to the right shape. The gate’s function is to identify prompts that must not leave the local boundary, and jailbreak prompts are not confidential: forwarding one to an external service discloses nothing. The component’s weakness falls in the class where local handling is unnecessary, and its strength in the class where local handling is the entire point.

6.4. Existing Detectors Address One Risk or the Other

Section 2 argued from the literature that prompt injection detection and sensitive data protection are pursued as separate problems. The baseline results make that visible in the tools themselves.
DeBERTa-v3-prompt-injection reached 82.5% recall on jailbreak prompts and 25% on sensitive ones. Llama Guard 4 inverted the profile: 27.5% on jailbreak and 55% on sensitive. Each performs respectably on the risk it was built for and poorly on the other, and neither exceeds 55% outside its domain. Both are competent systems used as designed; the gap is in what they were designed to cover.
For a deployment, this is the practical consequence: adopting either alone leaves substantial exposure on one of the two highest-priority risks in the OWASP LLM Top 10 [3], and the exposure is not apparent from a headline accuracy figure computed over a mixed corpus. Reporting detection performance per risk category, rather than in aggregate, should be standard practice in this area.

6.5. What Hard Negatives Revealed

Twenty of the forty benign prompts were constructed to be lexically adjacent to genuine secrets: requests to build leak scanners, questions about credential formats, masked and placeholder values. Every configuration except the external LLM performed worse on these than on ordinary benign prompts, and for four of six the entire false-positive burden fell there.
The failures are legible rather than random. DeBERTa flagged a placeholder .env example, a question about what an OpenSSH key header signifies, and a masked card number: surface pattern without regard to purpose. The SLM flagged a request to write a regex matching GitHub tokens and a request for a log scrubber that strips passwords from logs: prompts whose subject is credentials but whose intent is protective. Only the external model separated subject from intent across all 20.
The methodological point generalizes beyond this system. An evaluation whose negative class consists of unrelated text cannot measure false-positive behavior, because no credential detector misfires on a recipe. Had this evaluation used only general benign prompts, five of six configurations would have reported false-positive rates at or near zero, and the precision figures would have carried no information about deployment. Security-adjacent benign prompts are common in the environments this middleware targets, and a detector that flags them is one that will be disabled.

6.6. Limitations

Six limitations qualify these results.
Sample size. The evaluation set contains 120 prompts, 40 per class. Bootstrap confidence intervals on accuracy span roughly 8 to 17 percentage points depending on the configuration, and the intervals for the two published baselines overlap substantially, so their ordering relative to one another is not established. Only the separation between the external model and the remaining standalone configurations is clearly supported.
Routing derived rather than executed. The instrumented run evaluated all components on every prompt and aggregated by majority vote; it did not exercise the gate. The routed results reported in Section 5.4 were obtained by applying the gate to the per-component decisions recorded in that run. Because each component is deterministic given its input, the reconstructed verdicts are those a live routed pipeline produces. End-to-end latency is the one quantity this cannot recover, and the figures in Table 9 are accordingly sums of measured component latencies rather than measured path latencies. A live routed run is required to report path latency directly, including any overhead the gate itself introduces.
Table 9. End-to-end latency of the routed architecture by path. Local and external path costs are the sums of the component measurements along each path; the mean is weighted by the observed routing distribution.
Residual data egress. Two of forty sensitive prompts were routed externally, a 5.0% leakage rate with a 95% upper bound of 16.5%. The architecture reduces exposure substantially but does not eliminate it, and no claim of guaranteed containment is made. Both failures share a structure: confidential content carrying no structural signature, which neither the pattern layer nor a classifier trained predominantly on structured secrets detects. This is a coherent category rather than an assortment of edge cases, and it defines the most direct route to improving the gate.
False-positive cost. The routed configuration’s false-positive rate is 12.5%, against 0% for unrestricted external analysis. A conservative disjunctive gate flags whatever any local component finds suspicious. Under the monitoring-first policy adopted here, where non-harm verdicts produce warnings rather than blocks, this is tolerable; under a blocking policy it would not be, and the architecture should not be deployed in blocking mode on these numbers.
Non-adversarial evaluation. Attack prompts were not constructed with knowledge of the detection components. The results characterize performance against representative attacks, not against an adversary adapting to this specific defense. The jailbreak prompts in particular are single-turn and overt; indirect injection, multi-turn manipulation, and encoding-based obfuscation are unrepresented.
Single measurement run. Component latencies come from one execution, and the external services were accessed through a gateway whose round-trip time varies. The latency figures should be read as indicative of magnitude rather than as precise measurements.

6.7. Deployment Considerations

The architecture requires no access to model internals and integrates with black-box API providers, which is its principal practical advantage over attention-based and weight-access approaches. The TypeScript (5.9.3) implementation supports deployment as a browser extension or as a server-side proxy.
Three findings bear directly on deployment. First, the local classifier dominates latency, and an encoder-based classifier would plausibly reduce end-to-end cost by an order of magnitude at equal or better accuracy; this is the first change to make before any production use. Second, routing reduces external API volume by 58.3%, so the privacy control also lowers operating cost, which matters when external inference is billed per call. Third, the 12.5% false-positive rate concentrated on security-adjacent benign prompts means the monitoring-first policy is not merely a safety preference but a functional requirement: in environments where developers routinely ask about credential handling, a blocking configuration on these numbers would obstruct legitimate work often enough to be switched off.

7. Conclusions

This paper proposed and evaluated a privacy-preserving middleware architecture for detecting prompt injection and sensitive data exposure in deployed LLM systems. Its defining feature is the treatment of a local trust boundary as a hard architectural constraint: a sensitivity-aware gate determines whether a prompt may be forwarded to external inference infrastructure, and that determination is made on locally derived signals alone.
Evaluated on a 120-prompt benchmark spanning benign, jailbreak, and sensitive categories, the routed architecture achieved 95.83% accuracy with complete recall over all 80 attack and sensitive prompts, retaining 95% of sensitive prompts within the local boundary. Complete recall arises from a specific property rather than from redundancy: the local classifier and the external model fail on disjoint prompts, because one responds to structural regularities in secrets and the other reasons about context. Neither exceeds 97.5% recall on the sensitive class alone.
Three findings qualify or extend the original design rationale. Routing was framed as a privacy control whose cost is latency; in fact, it reduces mean end-to-end latency by 15.5% and external API calls by 58.3%, because the test that decides whether data may leave also decides whether a network call is needed. The dominant latency cost belongs to the local decoder-based classifier, not to the routing policy: an encoder baseline ran on the same hardware more than 20 times faster, indicating that local inference within an interactive budget is a matter of local architecture rather than hardware. In addition, the two published detectors evaluated as baselines fail in opposite directions: 82.5% against 25% for an injection-specific classifier across jailbreak and sensitive prompts, and 27.5% against 55% for a content-safety model, giving direct empirical support to the claim that these two risks are addressed separately by current tooling.
The architecture does not eliminate exposure. Two of forty sensitive prompts were routed externally, both carrying confidential business content with no structural signature that either local component detects. Its false-positive rate of 12.5%, concentrated on security-adjacent benign prompts, is an order of magnitude above unrestricted external analysis and constrains the system to monitoring rather than blocking deployment.
Future work follows from these limitations in a defined order. Replacing the local decoder with an encoder-based classifier addresses the latency cost directly. Extending the gate to recognize contextually rather than structurally sensitive content addresses the residual egress. Adversarial evaluation against evasion-aware prompts, and a live routed run reporting measured path latency, are both required before deployment claims can be made with confidence. The evaluation set, training corpus, and fine-tuned model are released publicly to support replication and extension.

Author Contributions

Conceptualization, A.A.H. and A.A.; methodology, A.A.H. and A.A.; software, A.A.H.; validation, A.A.H.; formal analysis, A.A.H. and A.A.; investigation, A.A.H.; resources, A.A.H. and A.A.; data curation, A.A.H.; writing: original draft preparation, A.A.H.; writing: review and editing, A.A.H. and A.A.; visualization, A.A.H.; supervision, A.A.; project administration, A.A.H. and A.A. All authors have read and agreed to the published version of the manuscript.

Funding

This research received no external funding.

Institutional Review Board Statement

Not applicable. The study did not involve human participants, animal subjects, or the collection of personally identifiable data from real users. All evaluation data were synthetically generated; ethical approval for the underlying project was granted by the University of the West of England in accordance with institutional research ethics procedures.

Data Availability Statement

Two datasets are released. The evaluation set used for all results reported in Section 5 (120 prompts across benign, jailbreak, and sensitive classes, with the benign class subdivided into general and hard-negative prompts) is available at https://huggingface.co/datasets/v1adam/Comparison_Dataset (accessed on 27 July 2026). The training corpus used to fine-tune the SLM is available at https://huggingface.co/datasets/v1adam/Prompt_Injection_and_Sensitive_Data_exposure_detection (accessed on 27 July 2026). The two were constructed independently: no prompt in the evaluation set shares a generation template with the training corpus. The fine-tuned model is available at https://huggingface.co/v1adam/slm-threat-detection-v1 (accessed on 27 July 2026).

Acknowledgments

The authors acknowledge the support of the Department of Computer Science and Creative Technologies, University of the West of England, Bristol.

Conflicts of Interest

The authors declare no conflicts of interest.

Appendix A. External Reasoning Layer System Prompt

The external model is queried with the system prompt shown in Figure A1, reproduced exactly as it appears in the implementation. A second user-turn message supplies the prompt under analysis together with the indicators raised by the heuristic engine.
Figure A1. System prompt supplied to the external reasoning layer, reproduced verbatim from the implementation.

Appendix B. Representative Evaluation Prompts

Reviewers requested that the evaluation prompts be visible in the manuscript. The complete 120-prompt set is published at https://huggingface.co/datasets/v1adam/Comparison_Dataset (accessed on 27 July 2026); Table A1 gives representative examples from each class. All credentials, identifiers, and personal details are synthetic: no value corresponds to a real account, person, key, or record.
The final two sensitive examples are the prompts discussed in Section 5.4: the medical record is the one the external model misclassified but the local classifier caught, and the salary sheet is one of the two the local classifier missed and which the gate therefore forwarded externally. Together they illustrate the complementary failure modes on which the routed architecture’s complete recall depends.
Table A1. Representative prompts from each class of the evaluation set. Hard negatives are benign prompts constructed to be lexically adjacent to the sensitive class.

References

  1. Perez, F.; Ribeiro, I. Ignore previous prompt: Attack techniques for language models. In Proceedings of the NeurIPS 2022 ML Safety Workshop, New Orleans, LA, USA, 2 December 2022. [Google Scholar]
  2. Greshake, K.; Abdelnabi, S.; Mishra, S.; Endres, C.; Holz, T.; Fritz, M. Not what you’ve signed up for: Compromising real-world LLM-integrated applications with indirect prompt injection. In Proceedings of the 16th ACM Workshop on Artificial Intelligence and Security, Copenhagen, Denmark, 30 November 2023; ACM Digital Library: New York, NY, USA, 2023; pp. 79–90. [Google Scholar]
  3. OWASP. OWASP Top 10 for Large Language Model Applications. Open Worldwide Application Security Project. 2024. Available online: https://owasp.org/www-project-top-10-for-large-language-model-applications/ (accessed on 26 February 2026).
  4. Wei, A.; Haghtalab, N.; Steinhardt, J. Jailbroken: How does LLM safety training fail? In Proceedings of the Advances in Neural Information Processing Systems 36 NeurIPS 2023, New Orleans, LA, USA, 10–16 December 2023. [Google Scholar]
  5. Carlini, N.; Tramèr, F.; Wallace, E.; Jagielski, M.; Herbert-Voss, A.; Lee, K.; Roberts, A.; Brown, T.; Song, D.; Erlingsson, U.; et al. Extracting training data from large language models. In Proceedings of the 30th USENIX Security Symposium, Vancouver, BC, Canada, 11–13 August 2021; USENIX: Berkeley, CA, USA, 2021; pp. 2633–2650. [Google Scholar]
  6. Shokri, R.; Shmatikov, V. Privacy-preserving deep learning. In Proceedings of the 22nd ACM SIGSAC Conference on Computer and Communications Security, Denver, CO, USA, 12–16 October 2015; ACM Digital Library: New York, NY, USA, 2015; pp. 1310–1321. [Google Scholar]
  7. Ait Hsine, A. Prompt Injection and Sensitive Data Exposure Detection Dataset. Hugging Face. 2026. Available online: https://huggingface.co/datasets/v1adam/Prompt_injection_and_Sensitive_Data_exposure_detection (accessed on 27 July 2026).
  8. Ait Hsine, A. slm-threat-detection-v1: Fine-Tuned Narasimha-0.6B for Prompt Injection Detection. Hugging Face. 2026. Available online: https://huggingface.co/v1adam/slm-threat-detection-v1 (accessed on 27 July 2026).
  9. Brown, T.; Mann, B.; Ryder, N.; Subbiah, M.; Kaplan, J.D.; Dhariwal, P.; Neelakantan, A.; Shyam, P.; Sastry, G.; Askell, A.; et al. Language models are few-shot learners. Adv. Neural Inf. Process. Syst. 2020, 33, 1877–1901. [Google Scholar]
  10. Bommasani, R.; Hudson, D.A.; Adeli, E.; Altman, R.; Arora, S.; von Arx, S.; Bernstein, M.S.; Bohg, J.; Bosselut, A.; Brunskill, E.; et al. On the Opportunities and Risks of Foundation Models. arXiv 2021, arXiv:2108.07258. [Google Scholar]
  11. Brundage, M.; Avin, S.; Clark, J.; Toner, H.; Eckersley, P.; Garfinkel, B.; Dafoe, A.; Scharre, P.; Zeitzoff, T.; Filar, B.; et al. The Malicious Use of Artificial Intelligence: Forecasting, Prevention, and Mitigation. arXiv 2018, arXiv:1802.07228. [Google Scholar]
  12. Jacob, D.; Alzahrani, H.; Zhanhao, H.; Piet, J.; Wagner, D. PromptShield: Deployable detection for prompt injection attacks. In Proceedings of the Fifteenth ACM Conference on Data and Application Security and Privacy (CODASPY ’25), Pittsburgh, PA, USA, 4–6 June 2025. [Google Scholar]
  13. Hung, K.H.; Ko, C.Y.; Rawat, A.; Chung, I.H.; Hsu, W.H.; Chen, P.Y. Attention tracker: Detecting prompt injection attacks in LLMs. In Proceedings of the Findings of the Association for Computational Linguistics: NAACL 2025, Albuquerque, NM, USA, 29 April 2025; Association for Computational Linguistics: Stroudsburg, PA, USA, 2025; pp. 2309–2322. [Google Scholar]
  14. Ji, Y.; Li, R.; Mao, B. Detection method for prompt injection by integrating pre-trained model and heuristic feature engineering. In Knowledge Science, Engineering and Management (KSEM 2025); Lecture Notes in Computer Science; Springer: Singapore, 2025; Volume 15924, pp. 69–82. [Google Scholar]
  15. Inan, H.; Upasani, K.; Chi, J.; Rungta, R.; Iyer, K.; Mao, Y.; Tontchev, M.; Hu, Q.; Fuller, B.; Testuggine, D.; et al. Llama Guard: LLM-Based Input-Output Safeguard for Human-AI Conversations. arXiv 2023, arXiv:2312.06674. [Google Scholar]
  16. Rebedea, T.; Dinu, R.; Sreedhar, M.; Parisien, C.; Cohen, J. NeMo Guardrails: A toolkit for controllable and safe LLM applications with programmable rails. In Proceedings of the 2023 Conference on Empirical Methods in Natural Language Processing: System Demonstrations, Singapore, 6–10 December 2023. [Google Scholar]
  17. Microsoft. Prompt Shields in Azure AI Content Safety. Microsoft Learn Documentation. 2024. Available online: https://learn.microsoft.com/en-us/azure/ai-services/content-safety/concepts/jailbreak-detection (accessed on 26 July 2026).
  18. Wang, Y.; Cao, Y.; Ren, Y.; Fang, F.; Lin, Z.; Fang, B. PIG: Privacy Jailbreak Attack on LLMs via Gradient-Based Iterative In-Context Optimization. arXiv 2025, arXiv:2505.09921. [Google Scholar]
  19. Kuo, M.; Zhang, J.; Zhang, J.; Tang, M.; DiValentin, L.; Ding, A.; Sun, J.; Chen, W.; Hass, A.; Chen, T.; et al. Proactive Privacy Amnesia for Large Language Models: Safeguarding PII with Negligible Impact on Model Utility. arXiv 2025, arXiv:2502.17591. [Google Scholar]
  20. UK GDPR. UK General Data Protection Regulation; The Stationery Office: London, UK, 2018. Available online: https://www.legislation.gov.uk/eur/2016/679/contents (accessed on 26 February 2026).
  21. National Institute of Standards and Technology. NIST Special Publication 800-53 Rev. 5: Security and Privacy Controls for Information Systems and Organizations; NIST: Gaithersburg, MD, USA, 2020.
  22. Cavoukian, A. Privacy by Design: The 7 Foundational Principles; Information and Privacy Commissioner of Ontario: Toronto, ON, Canada, 2011. [Google Scholar]
  23. Weidinger, L.; Uesato, J.; Rauh, M.; Griffin, C.; Huang, P.-S.; Mellor, J.; Glaese, A.; Cheng, M.; Balle, B.; Kasirzadeh, A.; et al. Taxonomy of risks posed by language models. In Proceedings of the 2022 ACM Conference on Fairness, Accountability, and Transparency (FAccT ’22), Seoul, Republic of Korea, 21–24 June 2022; ACM Digital Library: New York, NY, USA, 2022; pp. 214–229. [Google Scholar]
  24. Rastogi, S. Rival: Prompt Attack Detection Models. GitHub Repository. 2025. Available online: https://github.com/sarthakrastogi/rival (accessed on 26 July 2026).
  25. Qwen Team. Qwen3 Technical Report. arXiv 2025, arXiv:2505.09388. [Google Scholar]
  26. Hu, E.J.; Shen, Y.; Wallis, P.; Allen-Zhu, Z.; Li, Y.; Wang, S.; Wang, L.; Chen, W. LoRA: Low-Rank Adaptation of Large Language Models. arXiv 2021, arXiv:2106.09685. [Google Scholar]
  27. Hugging Face. Transformers: State-of-the-Art Machine Learning for PyTorch, TensorFlow, and JAX. 2024. Available online: https://huggingface.co/docs/transformers (accessed on 26 February 2026).
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Article Metrics

Citations

Article Access Statistics

Multiple requests from the same IP address are counted as one view.