Context-Aware Prompt Filtering for Domain-Specific LLM Safety

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing approaches to large language model (LLM) safety filtering struggle to accurately distinguish between legitimate inquiries and harmful content in sensitive domains like medicine, leading to potential misinformation and resource inefficiency.

Innovation Solution

A context-aware domain-specific content filtering system that uses a classifier to determine prompt relevance, extracts structured information using a domain ontology, and applies rules to evaluate and filter prompts before submitting them to the LLM, ensuring only relevant and safe queries are processed.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Object-affected harmful factors

If traditional pre-prompt filtering using keyword matching and safety classifiers is applied, then harmful content can be detected, but legitimate inquiries into harmful topics in sensitive domains cannot be distinguished

Engineering Contradiction:
Improveharmful content detectionVSAvoiddomain-specific legitimacy discrimination
Core Design Contradiction:
Object-affected harmful factorsVSAdaptability or versatility

Solution Approach 1:

The filtering system is segmented into multiple specialized components: a domain classifier to identify the knowledge domain, a safety classifier to detect harmful content, and a decision module to integrate both assessments. This segmentation allows the system to handle domain-specific legitimate inquiries separately from general harmful content, resolving the contradiction between detecting harmful factors and adapting to domain-specific contexts.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

A domain classifier acts as an intermediary between the input prompt and the safety classification process. This intermediary first determines the knowledge domain of the prompt, then routes it to appropriate evaluation criteria. This mediator enables the system to distinguish legitimate domain-specific inquiries from harmful content by considering domain context before applying safety filters.

Inventive Principle:
Principle #24Intermediary (Mediator)

2Ease of operation

If all prompts are submitted to the GAI model for processing, then no legitimate inquiries are rejected, but processing load and resource consumption increase

Engineering Contradiction:
Improveprompt processing completenessVSAvoidprocessing efficiency
Core Design Contradiction:
Ease of operationVSProductivity

Solution Approach 1:

The system performs preliminary classification and filtering actions before submitting prompts to the GAI model. The domain classifier and safety classifier evaluate prompts in advance, and the decision module pre-determines which prompts should be rejected. This preliminary action reduces the processing load on the GAI model by filtering out clearly harmful or off-domain prompts before they reach the resource-intensive generation stage.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The system extracts and processes only the necessary classification information from prompts using lightweight classifiers, separating this preliminary evaluation from the main GAI processing workflow. By taking out the filtering function and handling it separately with more efficient algorithms, the system reduces the overall processing load while maintaining complete evaluation of legitimate inquiries.

Inventive Principle:
Principle #2Taking out (Extraction)

3Measurement precision

If context-aware domain-specific filtering is implemented, then legitimate and harmful prompts can be distinguished, but system complexity increases

Engineering Contradiction:
Improvecontent classification accuracyVSAvoidfiltering system structure
Core Design Contradiction:
Measurement precisionVSDevice complexity

Solution Approach 1:

The complex filtering task is segmented into distinct functional modules: domain classification, safety classification, and decision-making. Each module has a specialized function and can be independently optimized or replaced. This segmentation achieves high measurement precision in content classification while managing system complexity through modular design, as each component remains relatively simple despite the overall system sophistication.

Inventive Principle:
Principle #1Segmentation

Data Source

PatentEP4722989A1Context-aware domain-specific content filtering
Publication Date: 2026.04.08 MICROSOFT TECHNOLOGY LICENSING LLC
  • EP4722989A1 patent drawingFigure 1A
  • EP4722989A1 patent drawingFigure 1B
  • EP4722989A1 patent drawingFigure 2

AI summary

Context-aware content filtering adapted for a knowledge domain is provided. In certain examples, a classification confidence score by a classifier indicates a level of confidence that a prompt from a user is associated with the knowledge domain. The classification confidence score is compared with a threshold. When the score is below a threshold, a violation notice is provided to the user without submitting the prompt to a generative artificial intelligence (GAI) model. When the classification confidence score is above the threshold, the prompt is further processed to determine, according to rules, whether the prompt should be submitted to the GAI model. In various examples, the rules are applied to contextual information, safety score information, and intent information derived from the prompt.