Secure Prompt System Using Special Token IDs for Language Models

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing language model systems lack effective security measures to differentiate between system instructions and external data, making them vulnerable to malicious attacks that exploit this lack of separation.

Innovation Solution

The implementation of a secure prompt system that uses updatable random strings in prompt templates, synchronized with a tokenizer, to securely separate system instructions from user inputs by mapping random strings to special token IDs, thereby preventing malicious manipulation.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Reliability

If detailed and complex system instructions are provided to language models to prevent attacks, then the system attempts to improve security, but language models fundamentally cannot distinguish between system instructions and outside data

Engineering Contradiction:
ImprovesecurityVSAvoidsystem instructions complexity
Core Design Contradiction:
ReliabilityVSDevice complexity

Solution Approach 1:

The system separates system instructions from user data by embedding a unique training string as a delimiter within the prompt. This segmentation allows the language model to clearly distinguish between instructions it should follow and user input it should process, resolving the fundamental inability to differentiate between the two.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

A training string acts as an intermediary element that the language model learns to recognize as a boundary marker. This intermediary enables the model to understand where system instructions end and user data begins, without requiring complex instruction structures.

Inventive Principle:
Principle #24Intermediary (Mediator)

2Reliability

If random strings are used to represent system instructions, then the system attempts to prevent attacks, but language models have difficulty detecting exactly matching strings and malicious users can input their own random strings to fool the model

Engineering Contradiction:
ImprovesecurityVSAvoidstring matching accuracy
Core Design Contradiction:
ReliabilityVSMeasurement precision

Solution Approach 1:

The system performs preliminary training of the language model on a specific training string before deployment. This preliminary action ensures the model learns to precisely recognize and respond to the exact training string delimiter, preventing malicious users from fooling the system with similar but different strings.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The system changes the parameter of the training string from a simple random string to a specially designed sequence that includes both the training string and associated instructions. This parameter change enhances the model's ability to detect and respond to the delimiter accurately.

Inventive Principle:
Principle #35Parameter changes

3Reliability

If long and complex random strings are used to prevent guessing, then security is improved, but language models are weaker at matching them and more resources are required for retraining

Engineering Contradiction:
ImprovesecurityVSAvoidtraining efficiency
Core Design Contradiction:
ReliabilityVSProductivity

Solution Approach 1:

Instead of using long and complex random strings that are difficult for models to match, the system uses a copied, standardized training string that the model learns during training. This approach maintains security while significantly improving matching efficiency and reducing retraining resources.

Inventive Principle:
Principle #26Copying

4Device complexity

If system instructions and outside data are provided on the same channel, then the system structure is simpler, but they become difficult to differentiate by language models making them vulnerable to attacks

Engineering Contradiction:
Improvesystem structureVSAvoidsecurity
Core Design Contradiction:
Device complexityVSReliability

Solution Approach 1:

The system extracts the boundary-detection function from the complex instruction-following capability of the language model. By using a trained delimiter string, the boundary detection is handled through pattern recognition rather than requiring the model to inherently understand instruction versus data boundaries.

Inventive Principle:
Principle #2Taking out (Extraction)

Data Source

PatentUS20250131261A1Using special tokens for secure prompt template input to language models
Publication Date: 2025.04.24 NVIDIA CORP
  • US20250131261A1 patent drawing
  • US20250131261A1 patent drawing
  • US20250131261A1 patent drawing

AI summary

Systems and methods provide for a prompt template to include private random strings that are used by a language model to reference specific tokens on which the language model has been trained. A number of random strings may be generated and inserted into a prompt template and assigned special token identifiers (IDs) in a tokenizer. The text data from the prompt template are tokenized to convert the random strings to the assigned special token IDs which are sent to the language model for inferencing. Based on the provided special token IDs, the language model may reference special tokens learned from training and then generates an inference. The random strings remain hidden during their lifetime and may be updated on-demand to ensure security.