Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Principle:Liu00222 Open Prompt Injection Input Preprocessing

From Leeroopedia
Revision as of 17:58, 16 February 2026 by Admin (talk | contribs) (Auto-imported from principles/Liu00222_Open_Prompt_Injection_Input_Preprocessing.md)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Knowledge Sources
Domains NLP, Preprocessing, Data_Cleaning
Last Updated 2026-02-14 15:00 GMT

Overview

A text normalization technique that standardizes input data by removing task-specific prefixes and normalizing formatting before feeding it to a detection model.

Description

Input Preprocessing in the context of injection detection normalizes raw data prompts to reduce noise that could confuse the detection model. This includes removing structured prefixes (like "Sentence1:" and "Sentence2:" used in sentence pair tasks such as MRPC and RTE), replacing separator prefixes with conjunctions, ensuring proper sentence termination, and lowercasing. This normalization ensures the detection model receives clean, uniform input regardless of the upstream task's data formatting conventions.

Usage

Use this principle before feeding data into the DataSentinel detection model. It is called internally by `DataSentinelDetector.detect` and `DataSentinelDetector.query` to normalize input before constructing the known-answer prompt.

Theoretical Basis

Text normalization reduces spurious variation that is irrelevant to injection detection:

Pseudo-code Logic:

# Preprocessing steps
def preprocess(text):
    text = text.replace("Sentence1: ", "")   # Remove sentence pair prefixes
    text = text.replace("Sentence2: ", "and ")  # Replace with conjunction
    if not text.endswith("."):
        text += "."                              # Ensure trailing period
    text = text.lower()                          # Lowercase
    return text

Related Pages

Implemented By

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment