Plato’s Form: Toward Backdoor Defense-as-a-Service for LLMs with Prototype Representations Chen Chen, Yuchen Sun, Jiaxin Gao, Yanwen Jia, Xueluan Gong, Qian Wang, Kwok-Yan Lam Abstract Large language models (LLMs) are increasingly deployed in security-sensitive applications, yet remain vulnerable to backdoor attacks. However, existing backdoor defenses are difficult to operationalize for Backdoor Defense-as-a-Service (BDaaS), as they require unrealistic side information (e.g., downstream clean data, known triggers/targets, or task domain specifics), and lack reusable, scalable purification across diverse backdoored models. In this paper, we present ProtoPurify , a backdoor purification framework via parameter edits under minimal assumptions. ProtoPurify first builds a backdoor vector pool from clean and backdoored model pairs, aggregates vectors into candidate prototypes, and selects the most aligned candidate for the target model via similarity matching. ProtoPurify then identifies a boundary layer through layer-wise prototype alignment and performs targeted purification by suppressing prototype-aligned components in the affected layers, achieving fine-grained mitigation with minimal impact on benign utility. Designed as a BDaaS-ready primitive, ProtoPurify supports reusability , customizability , interpretability , and runtime efficiency . Experiments across various LLMs on both classification and generation tasks show that ProtoPurify consistently outperforms 6 representative defenses against 6 diverse attacks, including single-trigger, multi-trigger, and triggerless backdoor settings. ProtoPurify reduces ASR to below 10%, and even as low as 1.6% in some cases, while incurring less than a 3% drop in clean utility. ProtoPurify further demonstrates robustness against adaptive backdoor variants and stability on non-backdoored models. † † In Plato’s philosophy, a Form is an idealized concept that captures the common structure shared by many imperfect real-world examples. 1 Introduction Large Language Models (LLMs), such as GPT-5 and Llama 3, have advanced rapidly and achieved state-of-the-art performance across a wide range of natural language processing (NLP) tasks [ 2 , 53 ] . Their remarkable generalization capability has driven widespread adoption across diverse industries, including finance, education, and healthcare, where they are broadly deployed to automate workflows and enhance user experiences [ 38 ] . Despite these successes, LLMs remain susceptible to a variety of security threats, among which backdoor attacks pose a particularly severe risk. Backdoor attacks aim to implant malicious functionalities into the model, where an adversary may poison the training data or manipulate the model weights such that the model performs normally on benign inputs but produces predefined malicious outputs when exposed to a secret trigger [ 5 , 55 ] . Detecting and mitigating such attacks is highly challenging, as triggers can take arbitrary forms, e.g., specific text strings, syntactic patterns, or visual signals, and are typically unknown to the defender. The vast scale and complex parameterization of LLMs further obscure backdoor behaviors within high-dimensional latent spaces [ 6 , 46 ] . Figure 1: Cosine similarities among backdoor vectors (B vs B) and between backdoor and clean vectors (B vs C). The backdoor vectors are extracted from 5 trigger types and 4 different attacks. Table 1: A comparison of studies on backdoor defense approaches. Purification method Agnosticism † Backdoor Defense-as-a-Service (BDaaS) Target dataset Target output Target domain Reusability ∗ Customizability § Interpretability ‡ Runtime efficiency ¶ Fine-tuning [ 37 ] ✗ (F) ✓ ✗ Fine-pruning [ 31 ] ✗ (F) ✓ ✗ BadAct [ 51 ] ✗ (P) ✓ ✗ W2SDefense [ 57 ] ✗ (F) ✓ ✗ LETHE [ 4 ] ✗ (F) ✓ ✗ Obliviate [ 23 ] ✗ (F) ✓ ✗ PURE [ 58 ] ✗ (P) ✓ ✗ BTU [ 22 ] ✗ (F&P) ✓ ✗ ROME [ 32 ] ✗ (E) ✓ ✗ NAD [ 29 ] ✗ (P) ✓ ✗ SANDE [ 26 ] ✓ ✗ ✗ BEEAR [ 52 ] ✓ ✗ ✗ LMsanitator [ 42 ] ✓ ✓ ✗ CROW [ 34 ] ✓ ✓ ✓ ProtoPurify ✓ ✓ ✓ • \dagger Agnosticism : Whether the threat model lacks specific knowledge. Target dataset: downstream clean data (used for F = Finetuning, P = Probing, E = Editing). Target output: the compromised output features, such as toxicity or sentiment bias. Target domain: downstream task domain, i.e., classification or generation. • \ast Reusability: How auxiliary modules or purified models can be reused for other backdoored models. = cannot reuse; = requires adaptation; = can reuse. • \mathsection Customizability: How the purification can be tailored to known types of attacks or tasks for better performance. = not customizable; = customizable. • \ddagger Interpretability: How the purification method can reveal the mechanisms of backdoor behaviors. = cannot reveal; = partially reveal; = fully reveal. • \lx@paragraphsign Runtime efficiency: How the purification method affects the per-model runtime efficiency. = needs per-model gradient-based training/optimization (e.g., fine-tuning, unlearning, distillation, or other optimization); = training-free, purification via one-shot editing/pruning or a few forward-pass computations. These threats motivate a managed backdoor defense service for LLMs ( Backdoor Defense-as-a-Service , BDaaS), where model owners submit potentially compromised models for post-hoc mitigation prior to deployment. This service-oriented setting aligns with emerging commercial GenAI security offerings that provide centralized model risk assessment, red-teaming, and safety scanning as a productized workflow (e.g., TrojAI Detect 1 1 1 https://troj.ai/products/detect , and CalypsoAI 2 2 2 https://calypsoai.com/inference-platform/ ). However, directly deploying existing defenses in such a high-throughput service still faces substantial limitations, as summarized in Table 1 . First , many approaches rely on strong assumptions. For instance, some assume access to a representative clean target dataset for the model’s downstream tasks, or prior knowledge of the specific target outputs (e.g., toxic or biased responses) activated by backdoor triggers. Others require information about the target task domain where the model is intended to operate (e.g., classification or generation). These assumptions are often unrealistic, as LLMs are typically designed for general-purpose applications, and such information is either unavailable or sensitive, particularly for BDaaS. Second , most existing defenses are designed to purify each compromised model independently, with no mechanism to transfer insights or components from previous efforts. This limits efficiency and scalability for service-level purification. We therefore identify four desiderata for practical backdoor purification from the literature [ 25 ] , which existing methods rarely satisfy: Reusability , enabling defensive modules to be leveraged across diverse backdoors; Customizability , permitting targeted adaptation when partial information about the backdoor is available; Interpretability , providing transparency into how backdoors are identified or mitigated; and Runtime efficiency , ensuring minimal per-model runtime overhead. In this work, we propose ProtoPurify , a novel backdoor mitigation method that operates under minimal assumptions about the data and downstream tasks, while inherently supporting the four key desiderata. ProtoPurify is motivated by the observation that different backdoor attacks often induce correlated parameter shifts (Figure 1 ), implying a shared malicious backdoor “prototype”. ProtoPurify aims to identify and exploit this prototype for cross-data and cross-task backdoor mitigation. To this end, ProtoPurify is designed to address the following challenges: C1. How to effectively capture backdoor behaviors in LLMs’ parameter space? To capture backdoor behaviors in the parameter space, we adopt a weight-difference formulation that removes task-specific learning signals from malicious updates. Specifically, we simulate diverse backdoor scenarios by training paired models from the same base model under identical optimization settings: one exposed to a backdoor attack and the other trained on clean data only. We obtain a backdoor vector by computing the difference between the parameters of these two models. Applying this process across multiple datasets and attack strategies yields a collection of vectors that encode diverse backdoor behaviors. C2. How to build a backdoor prototype vector based on the backdoor vectors? Given the collection of backdoor vectors extracted from diverse simulated attacks, we aim to distill their shared malicious features into multiple prototype representations. To this end, we construct backdoor vectors using aggregation operations, such as Arithmetic Mean (AM) or Principal Component Analysis (PCA). These backdoor prototype vectors are designed to serve as a transferable and compact representation of backdoor features. For a target backdoored model, we then identify the most appropriate prototype via similarity matching and use it as the basis for model purification. C3. How to detect the layers that encode backdoors? We observe that overly aggressive purification can lead to a noticeable degradation in model utility. To mitigate this issue, we introduce a candidate layer detection mechanism. We first decompose both the target backdoor model’s weight update and the identified prototype vector by layers, and compute alignment scores using cosine similarity. Empirically, we find these scores are relatively stable in lower layers but exhibit a pronounced increase at deeper layers. Based on this observation, we define a boundary layer using both Magnitude Significance and Increment Significance criteria. This boundary partitions the model into protected lower layers and candidate upper layers for purification. C4. How to purify the target backdoor model based on the prototype vector? For each weight matrix in the target backdoor model, we obtain its update vector and decompose it into a set of independent components via matrix decomposition. By measuring the projection of each component to the prototype vector, we can identify those that are strongly associated with backdoor behavior. We then introduce a purification strength that suppresses prototype-aligned components through calibrated scaling. This design enables a controllable trade-off between the strength of the purification and its impact on model utility. Compared with 6 state-of-the-art baseline defenses, ProtoPurify consistently achieves a superior mitigation-utility trade-off across diverse models, tasks, and backdoor settings. ProtoPurify reduces ASR from nearly 100% to below 10% while preserving high CDA on both classification and generation tasks. Extensive evaluation on 6 representative backdoor attacks demonstrates that ProtoPurify is effective under single-trigger, multi-trigger, and triggerless settings. Moreover, ProtoPurify remains robust against defense-aware adaptive adversaries and stable on non-backdoored models. To conclude, we make the following contributions: • We propose ProtoPurify , a prototype-based backdoor purification method toward Backdoor Defense-as-a-Service. It operates under minimal assumptions about triggers, training data, or downstream tasks, and is explicitly designed to satisfy reusability , customizability , interpretability , and runtime efficiency for high-throughput deployment. • We develop an end-to-end weight-space purification pipeline that includes backdoor vector extraction via paired model simulation, prototype construction through aggregation, boundary layer detection using layer-wise alignment analysis, and controllable model purification by suppressing prototype-aligned components. • Extensive experiments on various LLMs across both classification and generation tasks show that ProtoPurify consistently outperforms 6 representative defenses, achieving a superior mitigation-utility trade-off across single-trigger, multi-trigger, and triggerless backdoors. ProtoPurify is also robust to adaptive backdoor attacks and stable on non-backdoored models. 2 Background 2.1 Large Language Models (LLMs) Large Language Models (LLMs) are deep learning models designed to process and generate human-like text. Built on the Transformer architecture, they leverage self-attention mechanisms to capture complex dependencies within sequences. Prominent examples like GPT-3, GPT-4, and LLaMA have shown exceptional performance in tasks such as text generation, translation, and dialogue systems. The training of LLMs typically involves two stages: pre-training and fine-tuning. During pre-training, the model learns a general representation of language by predicting the next token in a sequence using causal language modeling, where the objective is: L_{\text{causal}}=-\sum_{i=1}^{N}\log P(x_{i}\mid x_{