LLM Prompt Segmentation for Prompt Injection Detection

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Large language models (LLMs) are vulnerable to prompt injection attacks, where malicious users bypass instructions by phrasing queries in various ways, making it challenging to detect such attacks automatically due to the vast number of queries and diverse phrasing possibilities, and human review is infeasible.

Innovation Solution

Implement an LLM firewall with a malicious prompt detector that segments user prompts into vectors, scores them against stored vectors, and sets a prompt injection signal based on similarity scores to block malicious prompts.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Reliability

If instructions are added to the LLM to self-control which questions to answer, then security against malicious queries is improved, but vulnerability to prompt injection attacks increases

Engineering Contradiction:
Improvesecurity against malicious queriesVSAvoidprompt injection attacks
Core Design Contradiction:
ReliabilityVSObject-affected harmful factors

Solution Approach 1:

The patent introduces an intermediary malicious prompt detector between the user prompt and the LLM. This detector segments the user prompt into multiple segments, encodes each segment into a vector, compares the vectors against a database of malicious prompt vectors, and determines whether to block the prompt before it reaches the LLM. This intermediary layer prevents prompt injection attacks from bypassing the LLM's self-control instructions.

Inventive Principle:
Principle #24Intermediary (Mediator)

2Measurement precision

If human review of individual user queries is performed, then detection accuracy of prompt injection attacks is improved, but productivity decreases

Engineering Contradiction:
Improvedetection accuracy of prompt injection attacksVSAvoidquery processing capacity
Core Design Contradiction:
Measurement precisionVSProductivity

Solution Approach 1:

The patent replaces the mechanical system of human review with an automated malicious prompt detector that uses vector encoding and comparison. The detector segments user prompts, encodes each segment into a vector representation, compares these vectors against a database of malicious prompt vectors using cosine similarity, and automatically blocks malicious prompts. This substitution maintains high detection accuracy while enabling the system to process large volumes of queries without human intervention.

Inventive Principle:
Principle #28Mechanics substitution (Replace mechanical system)

3Device complexity

If prompt injection detection is performed using traditional methods, then implementation simplicity is improved, but detection capability against diverse attack phrases decreases

Engineering Contradiction:
Improvedetection system simplicityVSAvoiddetection capability against diverse attack phrases
Core Design Contradiction:
Device complexityVSAdaptability or versatility

Solution Approach 1:

The patent transforms the detection approach by changing the parameter representation from raw text to vector embeddings. Each prompt segment is encoded into a vector that captures its semantic meaning, and the system compares these vectors against a database of malicious prompt vectors. This parameter transformation enables the system to detect diverse attack phrases including those with different wording, spelling variations, and obfuscation techniques, while maintaining a relatively simple implementation through the use of pre-trained encoding models and cosine similarity comparison.

Inventive Principle:
Principle #35Parameter changes

Data Source

PatentUS20250371133A1Malicious prompt detection for large language models
Publication Date: 2025.12.04 INTUIT INC
  • US20250371133A1 patent drawing
  • US20250371133A1 patent drawing
  • US20250371133A1 patent drawing

AI summary

A method includes receiving, at a server from a user device, a user prompt to a large language model (LLM). The user prompt is segmented to generate a set of user segments. An encoding model generates the set of user segments into a set of user vectors. The method further includes scoring each user vector of the set of user vectors based on a comparison between the user vector and a set of stored vectors in a vector store to generate a set of user vector scores, detecting whether the user prompt is malicious according to the set of user vector scores, and setting a prompt injection signal based on whether the user prompt is detected as malicious according to the set of user vector scores.