BadSKP: Backdoor Attacks on Knowledge Graph-Enhanced LLMs with Soft Prompts

Xiaoting Lyu, Yufei Han, Hangwei Qian, Haoyuan Yu, Xiang Ao, Bin Wang, Chenxu Wang, Xiaobo Ma, Wei Wang · 2026

Read BadSKP: Backdoor Attacks on Knowledge Graph-Enhanced LLMs with Soft Prompts by Xiaoting Lyu, Yufei Han, Hangwei Qian, Haoyuan Yu, Xiang Ao, Bin Wang, Chenxu Wang, Xiaobo Ma, Wei Wang (2026) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2605-11996.txt.

Introduction

Xiaoting Lyu and eight colleagues expose a backdoor risk in knowledge-graph-enhanced language models that use soft prompts. Text-channel attacks fail against these systems because graph-derived prompts anchor generation toward query-consistent semantics. Their BadSKP attack instead manipulates graph-level representations through multi-stage optimization, steering the induced soft prompt toward adversarial semantics. Across two models and four datasets it achieved high attack success under frozen and trojaned settings, even under perplexity defenses.

Catalog record

CREATORXiaoting Lyu, Yufei Han, Hangwei Qian, Haoyuan Yu, Xiang Ao, Bin Wang, Chenxu Wang, Xiaobo Ma, Wei Wang
YEAR2026
COLLECTIONPAPERS
FORMATTXT
FILE SIZE60712
LICENSEhttp://creativecommons.org/licenses/by/4.0/
RIGHTSCC BY
SOURCEarXiv

Source: https://arxiv.org/abs/2605.11996

Browse the full library · About the Tower of Babel

Full text

The opening of the work, from the library's hosted text:

BadSKP: Backdoor Attacks on Knowledge Graph-Enhanced LLMs with Soft Prompts Xiaoting Lyu, Yufei Han, Hangwei Qian, Haoyuan Yu, Xiang Ao, Bin Wang, Chenxu Wang, Xiaobo Ma, Wei Wang Abstract Recent knowledge graph (KG)-enhanced large language models (LLMs) move beyond purely textual knowledge augmentation by encoding retrieved subgraphs into continuous soft prompts via graph neural networks, introducing a graph-conditioned channel that operates alongside the standard text interface. However, existing backdoor attacks are largely designed for the textual channel, and their effectiveness against this dual-channel architecture remains unclear. We show that this architecture creates a robustness gap: text-channel backdoor attacks that readily compromise textual KG prompting systems become largely ineffective against soft-prompt-based counterparts. We interpret this gap through semantic anchoring , whereby graph-derived soft prompts bias the generation-driving hidden state toward query-consistent semantics and suppress surface-level malicious instructions. Because this anchoring effect is itself induced by the graph channel, an attacker who manipulates graph-level representations can in turn redirect it toward adversarial semantics. To demonstrate this risk, we propose BadSKP , a backdoor attack that targets the graph-to-prompt interface through a multi-stage optimization strategy: it constructs adversarial target embeddings, optimizes poisoned node embeddings to steer the induced soft prompt, and approximates the optimized representations with fluent adversarial node attributes. Experiments on two soft-prompt KG-enhanced LLMs across four datasets show that BadSKP achieves high attack success under both frozen and trojaned settings, while text-only attacks remain unreliable even under perplexity-based defenses. I Introduction Knowledge graph-enhanced large language models (KG-enhanced LLMs) extend standard LLMs with external structured knowledge to improve factual grounding and support knowledge-intensive reasoning [ 15 , 11 , 18 , 21 , 25 , 10 , 20 , 33 , 36 , 26 ] . Recent systems increasingly move beyond purely textual knowledge augmentation by introducing graph-derived continuous soft prompts alongside textual inputs, creating a dual-channel architecture in which both the text interface and a graph-conditioned prompt channel shape generation. Fig. 1: KG prompt designs for KG-enhanced LLM QA system. As illustrated in Figure 1 , integrating KGs into the LLM inference pipeline typically follows two distinct paradigms. Discrete textual KG prompting linearizes the retrieved subgraph into natural-language descriptions and appends them to the input query as additional context [ 25 , 33 , 17 , 20 , 26 ] . In contrast, continuous soft KG prompting encodes the retrieved subgraph with a graph neural network and projects the resulting embedding into the LLM embedding space as a soft prompt [ 10 , 36 , 22 ] . Importantly, the soft KG prompt is jointly processed with the token embeddings of the textualized subgraph and the user query, enabling generation to be shaped by both natural-language context and graph-conditioned continuous representations. Fig. 2: Overview of BadSKP . In the frozen setting, BadSKP executes Steps 1–3, whereas in the trojaned setting it performs all 4 steps. While external knowledge improves factual grounding, it also exposes KG-enhanced LLMs to knowledge poisoning risks. Recent backdoor attacks on Retrieval-Augmented Generation (RAG) systems [ 51 , 29 ] show that attackers can poison external databases so that trigger-related queries retrieve malicious context and activate attacker-specified outputs, while benign queries remain unaffected. However, these attacks are primarily designed for the textual channel, and whether they remain effective in KG-enhanced LLMs with additional soft KG prompts remains poorly understood. To bridge this gap, we examine the security of both KG prompting paradigms under poisoned external KGs and reveal a clear robustness gap. Textual KG prompting methods, such as StructGPT [ 17 ] , RoG [ 25 ] , and ToG [ 33 ] , are highly vulnerable to text-level poisoning, where malicious instructions embedded in node attributes can directly hijack generation. In contrast, soft-prompt-based systems, including G-Retriever [ 10 ] and GNP [ 36 ] , remain markedly more resistant even when the retrieved subgraph contains adversarial textual content. To better understand this behavior, we interpret the robustness gap through semantic anchoring , a mechanistic view in which graph-derived soft prompts bias the generation-driving hidden state toward query-consistent semantics and reduce the influence of surface-level malicious instructions. However, this apparent resilience does not eliminate the attack surface. Because the anchoring effect is itself induced by the graph channel, an attacker who can manipulate graph-level representations may redirect the anchor toward adversarial semantics. This makes the graph-to-prompt interface a critical security boundary in soft-prompt-based KG-enhanced LLMs. Our work. Motivated by this observation, we propose BadSKP , a targeted backdoor attack that exploits the graph-to-prompt interface in KG-enhanced LLMs with soft KG prompts. Unlike existing backdoor attacks on continuous prompts or GNNs, which target either the prompt interface or the graph encoder in isolation, BadSKP jointly perturbs graph structure and node attributes to steer the induced soft prompt toward attacker-specified semantics and hijack the fused latent representation. This requires navigating the discrete-to-continuous mapping at the graph-to-prompt interface while overcoming the gradient attenuation induced by graph aggregation. To address these challenges, BadSKP adopts a multi-stage optimization strategy (Figure 2 ): (1) Target embedding construction , which encodes attacker-specified behavior in the LLM latent space using auxiliary samples; (2) Node-level embedding optimization , which optimizes the embeddings of poisoned nodes to steer the generation-driving hidden state toward the target; (3) Input-space approximation , which translates the optimized embeddings into fluent adversarial node attributes; and (4) Persistence optimization (trojaned setting only), which aligns backdoor and main-task gradients so that the backdoor survives the downstream clean fine-tuning of the soft KG prompt module. We evaluate BadSKP on two representative soft-prompt KG-enhanced LLMs across four datasets. The results show that BadSKP consistently achieves strong attack effectiveness under both frozen and trojaned settings, while attacks confined to the textual channel remain largely ineffective in this architecture. Moreover, BadSKP continues to achieve non-trivial attack success under perplexity-based detection defenses, suggesting that defenses focused solely on surface-level textual anomalies are insufficient for protecting soft-prompt KG systems. This contrast indicates that the primary vulnerability in such systems lies not only in the textual channel, but also in the graph-induced soft-prompt pathway introduced by continuous knowledge injection. Contributions. Our main contributions are as follows: • We reveal a clear robustness gap between textual and soft KG prompting under poisoned external KGs, and introduce semantic anchoring , a mechanistic interpretation of how graph-derived soft prompts bias generation toward query-consistent semantics. • We propose BadSKP , a backdoor attack targeting the graph-to-prompt interface in KG-enhanced LLMs, which jointly perturbs graph structure and node attributes through a multi-stage optimization strategy. • Experiments across four datasets show that BadSKP remains effective under both frozen and trojaned settings, even against perplexity-based detection defenses. II Related Work II-A KG-enhanced LLMs for QA Tasks Knowledge graphs provide structured relational knowledge that complements the parametric memory of LLMs and are widely used to improve question answering performance. Existing approaches for KG-enhanced QA mainly follow two paradigms. Textual KG prompting linearizes retrieved triples or subgraphs into natural-language context appended to the query, enabling reasoning over explicit KG evidence [ 17 , 33 , 25 , 28 , 26 , 32 ] . In contrast, soft KG prompting encodes retrieved subgraphs into continuous embeddings via GNNs and injects them into LLMs as soft KG prompts [ 10 , 36 ,

Read the complete text