LLM Jailbreak Detection Using Token Probability Shifts

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Large Language Models (LLMs) are vulnerable to 'jailbreak' attacks where attackers manipulate prompts to bypass safety measures, leading to the generation of malicious or illegal content, which can compromise user safety and system integrity.

Innovation Solution

A method is employed to detect jailbreak attempts by analyzing shifts in probability-based metrics, such as perplexity, across tokens in input or output data to identify sudden changes indicative of malicious content, using a sliding window approach to assess the probability of each token given its context.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Adaptability or versatility

If LLMs are trained on large diverse datasets to improve versatility and capability, then the model can perform a wide range of tasks, but the model becomes vulnerable to jailbreak attacks that exploit the training data to generate malicious content

Engineering Contradiction:
Improvetask capabilityVSAvoidjailbreak vulnerability
Core Design Contradiction:
Adaptability or versatilityVSObject-affected harmful factors

Solution Approach 1:

The system performs preliminary detection of jailbreak attempts by analyzing probability-based metrics (perplexity, entropy) of tokens before the LLM generates malicious content. This early detection allows the system to prevent harmful output without requiring the model to be retrained, thus maintaining versatility while addressing security vulnerabilities.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

An intermediary detection layer is introduced between the LLM and the output. This layer analyzes the probability metrics of tokens and acts as a gatekeeper, blocking potentially malicious content while allowing legitimate tasks to proceed. This mediator approach preserves the model's capabilities while filtering harmful outputs.

Inventive Principle:
Principle #24Intermediary (Mediator)

2Object-affected harmful factors

If safety measures are added to moderate generated content, then harmful output is reduced, but the system complexity increases

Engineering Contradiction:
Improvemalicious content generationVSAvoidsystem complexity
Core Design Contradiction:
Object-affected harmful factorsVSDevice complexity

Solution Approach 1:

The LLM itself is used to calculate the probability-based metrics (perplexity, entropy) of its own output tokens. This self-service approach eliminates the need for separate complex analysis systems, as the model leverages its own internal probability distributions to detect anomalies, thereby reducing overall system complexity while maintaining safety.

Inventive Principle:
Principle #25Self-service

Solution Approach 2:

The system changes the parameter space by analyzing probability metrics (perplexity, entropy) of tokens rather than using complex content analysis. This parameter-based approach simplifies the detection mechanism compared to traditional content filtering, reducing system complexity while effectively identifying malicious content through statistical anomalies.

Inventive Principle:
Principle #35Parameter changes

3Measurement precision

If probability-based metrics are calculated for each token to detect jailbreak attempts, then detection accuracy improves, but computational cost increases

Engineering Contradiction:
Improvejailbreak detection accuracyVSAvoidcomputational cost
Core Design Contradiction:
Measurement precisionVSUse of energy by moving object

Solution Approach 1:

The system calculates probability-based metrics for all tokens (excessive action) to ensure comprehensive detection coverage. While this increases computational cost, the use of efficient probability calculations and the model's own internal mechanisms keeps the overhead manageable, achieving high detection accuracy without proportionally high computational expense.

Inventive Principle:
Principle #16Partial or excessive action

Data Source

PatentUS12468785B2Detecting jailbreak attempts on generative models
Publication Date: 2025.11.11 MICROSOFT TECHNOLOGY LICENSING LLC
  • US12468785B2 patent drawing
  • US12468785B2 patent drawing
  • US12468785B2 patent drawing

AI summary

A computer-implemented method is provided that detects jailbreak attempts against generative models, which may involve a shift between benign and malicious content. The method includes determining a probability-based metric for each of a plurality of tokens in a target text using a language model, the probability-based metric being based on a probability at least one preceding token. The probability-based metrics are processed to identify a subset of the plurality of tokens having a change in the probability-based metric with respect to others of the plurality of the tokens not within the subset of the plurality of tokens. A jailbreak attempt in the target text is detected in response to identifying the change in the probability-based metric in the subset of the plurality of tokens.