LLM Code Assistant Leakage Monitoring and Prompt Mitigation

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

LLM-based code assistants introduce security vulnerabilities and expose sensitive data through membership inference attacks and data leakage, particularly during software development, with existing methods failing to adapt dynamically to coding changes.

Innovation Solution

A method using an LLM-based Code Reconstruction Model and a DRL agent to monitor and mitigate code leakage by reconstructing the original code from prompts and manipulating prompts to minimize exposure while maintaining suggestion relevance.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Productivity

If code snippets are transmitted to the code assistant model for real-time suggestions, then coding efficiency is improved, but code leakage and data exposure occur

Engineering Contradiction:
Improvecoding efficiencyVSAvoidcode leakage
Core Design Contradiction:
ProductivityVSObject-affected harmful factors

Solution Approach 1:

The patent introduces a code reconstruction model as an intermediary between the code assistant model and the developer's code. This intermediary component monitors and reconstructs code from transmitted snippets, enabling detection of leakage without eliminating the beneficial code completion functionality. The intermediary evaluates whether transmitted code segments can be reconstructed to reveal sensitive information.

Inventive Principle:
Principle #24Intermediary (Mediator)

Solution Approach 2:

The patent implements a feedback mechanism where the code reconstruction model continuously monitors code snippets transmitted to the assistant model and provides feedback about potential leakage. This feedback loop allows the system to identify when code transmission might expose sensitive information while maintaining normal operation when no leakage risk exists.

Inventive Principle:
Principle #23Feedback

2Measurement precision

If existing code reconstruction methods are used, then code leakage detection is possible, but they cannot adapt to dynamic coding changes in real-time

Engineering Contradiction:
Improvecode leakage detection accuracyVSAvoidadaptability to coding changes
Core Design Contradiction:
Measurement precisionVSAdaptability or versatility

Solution Approach 1:

The patent makes the code reconstruction model dynamic by training it on diverse code datasets during development. The model learns to adapt to different coding styles, languages, and patterns, enabling it to effectively reconstruct code regardless of how the developer writes or modifies code in real-time. This dynamic training approach allows the system to handle evolving coding scenarios.

Inventive Principle:
Principle #15Dynamics

3Reliability

If code snippets are monitored and reconstructed, then code leakage can be evaluated, but system complexity increases

Engineering Contradiction:
Improvesecurity evaluation capabilityVSAvoidsystem complexity
Core Design Contradiction:
ReliabilityVSDevice complexity

Solution Approach 1:

The patent introduces a code reconstruction model as an intermediary between the code assistant model and the developer's code. This intermediary component monitors and reconstructs code from transmitted snippets, enabling detection of leakage without eliminating the beneficial code completion functionality. The intermediary evaluates whether transmitted code segments can be reconstructed to reveal sensitive information.

Inventive Principle:
Principle #24Intermediary (Mediator)

4Loss of information

If prompts are manipulated to minimize leakage, then privacy is preserved, but suggestion relevance may be reduced

Engineering Contradiction:
Improveprivacy preservationVSAvoidsuggestion relevance
Core Design Contradiction:
Loss of informationVSReliability

Solution Approach 1:

The patent applies partial manipulation to prompts - only modifying the portions necessary to prevent leakage while preserving the essential coding intent. The DRL agent learns to make minimal necessary changes to prompt semantics, altering just enough to protect privacy while maintaining sufficient relevance for generating useful code suggestions.

Inventive Principle:
Principle #16Partial or excessive action

Solution Approach 2:

The patent changes parameters of the prompt (such as variable names, code structures, or descriptions) to reduce leakage risk while preserving the core coding task. The DRL agent optimizes these parameter changes to balance privacy protection with maintaining suggestion quality, ensuring manipulated prompts still generate relevant code completions.

Inventive Principle:
Principle #35Parameter changes

Data Source

PatentEP4586118A1A method for evaluating and mitigating code leakage by LLM-based code assistants
Publication Date: 2025.07.16 DEUTSCHE TELEKOM AG
  • EP4586118A1 patent drawingFigure 1
  • EP4586118A1 patent drawingFigure 2
  • EP4586118A1 patent drawingFigure 3

AI summary

A method for real-time evaluating code leakage during software code development when the developer is using a code assistant tool, comprising performing code leakage estimation by identifying and processing, using an LLM-based model, the most updated code segments as the segments evolve; and evaluating, using the LLM-based model, the extent to which a written code has been inadvertently revealed to one or more code assistant servers by reconstructing the original code from the requests sent to each code assistant server. A method for real-time mitigating code leakage during software code development process when the developer is using a code assistant tool, comprising mitigating code leakage during code writing process by manipulating, using an RL agent, prompts and data being sent to a code assistant service provided by one or more code assistant servers.