- Updated: June 14, 2026
- 8 min read
Let Relations Speak: An End-to-End LLM‑GNN Soft Prompt Framework for Fraud Detection
Direct Answer
The paper introduces LGSPF (LLM‑GNN Soft Prompt Framework), an end‑to‑end architecture that fuses Large Language Models (LLMs) with Graph Neural Networks (GNNs) through learnable soft prompts, eliminating the need for handcrafted textual attributes in fraud‑detection graphs. By aligning semantic understanding from LLMs with multi‑relational graph structures, LGSPF delivers state‑of‑the‑art detection performance while preserving interpretability of fraudulent behavior.
Background: Why This Problem Is Hard
Fraud detection in financial services, e‑commerce, and online platforms is fundamentally a graph problem: entities (accounts, devices, IPs) interact via edges that encode transactions, logins, or referrals. Traditional machine‑learning pipelines rely on two pillars:
- Rich textual attributes (e.g., user‑generated comments, email bodies) that LLMs can ingest directly.
- Hand‑engineered graph features (e.g., PageRank, node degree) that GNNs consume.
In many real‑world fraud scenarios, textual data is sparse or deliberately obfuscated, leaving only structural signals. Existing hybrid approaches attempt to “textualize” the graph—converting adjacency lists into sentences and feeding them to an LLM via hard prompts. This process suffers from two critical drawbacks:
- Feature distortion: Hard prompts impose a rigid lexical template that cannot faithfully preserve edge semantics, especially when multiple relation types (e.g., “purchased”, “shared”, “referred”) coexist.
- Scalability bottleneck: Generating long textual sequences for large graphs inflates token counts, exceeding LLM context windows and increasing inference latency.
Moreover, fraud detection graphs are often multi‑relational. A single node may simultaneously belong to a payment network, a device fingerprint network, and a social‑influence network. Capturing the deep semantic interplay among these heterogeneous edges exceeds the expressive capacity of current GNN‑only or LLM‑only solutions.
What the Researchers Propose
LGSPF tackles the above challenges by introducing a soft‑prompt bridge that learns a continuous embedding space shared between an LLM and a parallel GNN encoder. The framework consists of three core agents:
- Soft Prompt Generator: A trainable matrix of token embeddings that replaces hand‑crafted textual prompts. It directly encodes graph topology and relation types into the LLM’s input space.
- Graph Neural Network Encoder: A multi‑relational GNN (e.g., RGCN or Relational Graph Attention Network) that processes the raw graph and emits graph tokens—compact vector representations for each node and edge.
- Large Language Model Decoder: A pre‑trained LLM (such as Llama‑2 or GPT‑4) that consumes the soft prompts and graph tokens, producing fraud‑risk scores and natural‑language explanations.
The key insight is that the soft prompt learns to translate structural cues into a semantic language that the LLM already understands, while the GNN supplies fine‑grained relational context. End‑to‑end back‑propagation aligns the two modalities, ensuring that the LLM’s attention heads focus on the most suspicious sub‑graphs without any explicit textual supervision.
How It Works in Practice
Conceptual Workflow
- Graph Ingestion: Raw transaction logs are transformed into a multi‑relational graph
G = (V, E, R), whereVare entities,Eare edges, andRdenotes relation types (e.g., “payment”, “device‑share”). - GNN Tokenization: The GNN encoder computes node embeddings
h_vand edge embeddingsh_e. These embeddings are quantized into a fixed‑size token vocabulary, yielding a sequenceT_G = [t_1, …, t_n]. - Soft Prompt Construction: A learnable prompt matrix
P ∈ ℝ^{k×d}(wherekis prompt length anddis embedding dimension) is concatenated withT_Gto form the final LLM inputI = [P; T_G]. - LLM Reasoning: The LLM processes
I, attending to both prompt tokens and graph tokens. Its output head predicts a fraud probability for each target node and optionally generates a textual rationale. - Joint Optimization: A combined loss (cross‑entropy for classification + language modeling loss for explanations) back‑propagates through the LLM, soft prompt, and GNN, synchronizing semantic and structural learning.
Interaction Between Components
The soft prompt acts as a semantic adaptor. During early training epochs, the prompt learns to map high‑frequency relational patterns (e.g., “multiple accounts sharing the same device”) into token embeddings that trigger the LLM’s fraud‑related attention patterns. As training progresses, the GNN refines its embeddings based on the LLM’s feedback, creating a feedback loop that sharpens both structural discrimination and natural‑language interpretability.
What Sets LGSPF Apart
- No reliance on raw text: The framework works even when textual fields are missing or encrypted.
- Multi‑relational awareness: By feeding relation‑specific edge embeddings into the prompt, LGSPF preserves the semantics of each edge type.
- End‑to‑end differentiability: Soft prompts are fully trainable, unlike static hard prompts that cannot adapt to new fraud patterns.
- Explainability by design: The LLM’s language generation head produces human‑readable explanations aligned with the underlying graph evidence.
Evaluation & Results
Benchmarks and Scenarios
The authors evaluated LGSPF on three publicly available fraud‑detection datasets:
- PaySim – a synthetic mobile payment graph with 6 relation types.
- Alibaba Large‑Scale Transaction Graph – real‑world e‑commerce transactions featuring device‑sharing and referral edges.
- Twitter Botnet Graph – a social‑network graph where bots coordinate via retweet and mention relations.
Each dataset was split into 70 % training, 15 % validation, and 15 % test. The evaluation measured:
- Area Under the ROC Curve (AUC) for fraud classification.
- Precision‑Recall (PR) gain to capture performance on highly imbalanced data.
- Human‑rated explanation quality (via a Likert‑scale survey of domain experts).
Key Findings
Across all benchmarks, LGSPF consistently outperformed three baselines:
- Pure GNN (RGCN) without any language component.
- Hard‑prompt LLM‑GNN hybrid (textualization of graph).
- LLM‑only approach using manually crafted textual features.
Notable results include:
- PaySim: LGSPF achieved an AUC of 0.96, a 4.2 % lift over the best baseline.
- Alibaba: PR‑gain improved from 0.31 (baseline) to 0.44, indicating better detection of rare fraud cases.
- Twitter Botnet: Expert reviewers rated LGSPF’s explanations 1.8 points higher on average (scale 1‑5) than those generated by the hard‑prompt method.
These outcomes demonstrate that the soft‑prompt bridge not only boosts detection accuracy but also yields more trustworthy, human‑readable rationales—critical for compliance and audit trails.
Why This Matters for AI Systems and Agents
For practitioners building AI‑driven security stacks, LGSPF offers several practical advantages:
- Plug‑and‑play integration: The framework can wrap around any pre‑trained LLM and any multi‑relational GNN, reducing engineering overhead.
- Reduced data preparation cost: Organizations no longer need to engineer extensive textual features or perform costly graph‑to‑text conversions.
- Real‑time inference: Soft prompts are fixed‑size token sequences, keeping LLM context windows small and enabling low‑latency scoring in production pipelines.
- Compliance‑ready explanations: Generated rationales can be logged for regulatory reporting, satisfying GDPR, AML, and other audit requirements.
These capabilities align directly with the needs of modern AI agents that must reason over relational data while remaining transparent. For example, an Enterprise AI platform by UBOS could embed LGSPF as a micro‑service, allowing fraud‑detection agents to request both a risk score and an explanatory paragraph in a single API call.
Moreover, the soft‑prompt paradigm can be extended beyond fraud detection to any domain where graphs dominate but text is scarce—supply‑chain risk, network intrusion detection, or even knowledge‑graph‑based recommendation engines.
What Comes Next
Current Limitations
While LGSPF sets a new benchmark, the authors acknowledge several open challenges:
- Scalability to billions of nodes: The GNN encoder still requires GPU memory proportional to the graph size; distributed training strategies are needed for truly massive networks.
- Prompt length trade‑off: Longer soft prompts capture richer structure but increase LLM compute; adaptive prompt sizing remains an open research question.
- Domain adaptation: Transferability of a trained LGSPF model across industries (e.g., from finance to gaming) has not been fully explored.
Future Research Directions
Potential avenues to extend the framework include:
- Hierarchical prompting: Introducing multi‑level soft prompts that first summarize local neighborhoods before feeding a global context to the LLM.
- Contrastive pre‑training: Leveraging self‑supervised graph contrastive objectives to bootstrap the GNN encoder before joint fine‑tuning.
- Multi‑modal fusion: Adding sparse textual cues (e.g., user‑provided notes) when available, allowing the model to blend text and structure seamlessly.
Practical Next Steps for Teams
Organizations interested in adopting LGSPF can start by prototyping within the Workflow automation studio, which offers drag‑and‑drop pipelines for graph ingestion, GNN training, and LLM inference. Early pilots can focus on high‑value fraud hotspots where textual data is minimal but relational signals are strong.
For startups seeking a rapid proof‑of‑concept, the UBOS for startups program provides cloud credits and expert consulting to accelerate model deployment.
Finally, developers can explore the UBOS templates for quick start, which include a pre‑configured LGSPF container image compatible with popular LLM APIs (OpenAI, Anthropic, etc.).
References
For a complete technical description, see the original arXiv paper. Additional resources on LLM‑GNN integration and soft prompting are available in the broader AI research literature.
Call to Action
Ready to bring next‑generation fraud detection to your organization? Explore the UBOS homepage for a full suite of AI tools, or contact our solutions team to schedule a demo of LGSPF in action.
Andrii Bidochko
CTO UBOS
Andrii Bidochko is an AI entrepreneur and researcher focused on AI agents, reinforcement learning, and autonomous systems. He writes about the technologies shaping the future of machine intelligence, from frontier models and agent architectures to real-world AI applications.