LLM Code Usage Monitoring Through Similarity-Based Risk Analysis

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

The use of large language models (LLMs) for generating programming code poses risks such as erroneous code, security vulnerabilities, and legal issues, leading some organizations to ban their usage despite the benefits they provide, as developers struggle to thoroughly review large code segments under deadlines.

Innovation Solution

A method and system to monitor and analyze code generated by LLMs, identifying and quantifying their contribution to a programmer's code, providing reports and actions based on similarity thresholds, and enabling risk assessment and management.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Productivity

If LLMs are used to generate programming code, then development time is significantly reduced and productivity is improved, but code quality deteriorates due to errors, bugs, and security vulnerabilities

Engineering Contradiction:
Improvedevelopment timeVSAvoidcode quality
Core Design Contradiction:
ProductivityVSReliability

Solution Approach 1:

The system performs preliminary analysis of code snippets before they are integrated into the main codebase. By detecting LLM-generated code patterns and characteristics in advance, the system can flag potential issues, security vulnerabilities, and quality problems before they cause harm, allowing developers to review and clean up the generated code.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The invention introduces an intermediary analysis layer between code generation and code integration. This intermediary system uses pattern recognition and similarity detection to identify LLM-generated code segments, then presents them for selective review and validation, acting as a mediator that maintains productivity benefits while enabling quality control.

Inventive Principle:
Principle #24Intermediary (Mediator)

2Reliability

If developers manually review all generated code, then code quality improves, but time consumption increases and productivity decreases

Engineering Contradiction:
Improvecode qualityVSAvoidtime consumption
Core Design Contradiction:
ReliabilityVSLoss of time

Solution Approach 1:

The system segments the code review process by automatically identifying and isolating only the LLM-generated portions of code that require attention. Instead of requiring developers to review entire codebases, the system segments the review task to focus only on the generated segments, reducing time consumption while maintaining quality control.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The invention applies local quality analysis by examining specific regions of code identified as LLM-generated, rather than uniformly reviewing all code. This allows developers to concentrate their review efforts on the most critical segments - those with potential issues - while accepting unreviewed segments if they pass automated checks, thereby reducing overall time consumption.

Inventive Principle:
Principle #3Local quality

3Reliability

If organizations ban LLM usage, then code quality and security are maintained, but development efficiency and productivity are lost

Engineering Contradiction:
Improvecode qualityVSAvoiddevelopment efficiency
Core Design Contradiction:
ReliabilityVSProductivity

Solution Approach 1:

The system implements feedback mechanisms that provide real-time information to developers about the quality and security characteristics of LLM-generated code. By feedback-looping analysis results back to developers, the system enables informed decisions about which generated code to accept, modify, or reject, maintaining both quality standards and development efficiency.

Inventive Principle:
Principle #23Feedback

Solution Approach 2:

The invention changes the parameters of code generation by detecting and analyzing specific characteristics of LLM-generated code patterns. By monitoring parameters such as code structure, complexity, and security markers, the system can adjust its behavior to identify high-quality generated code that meets organizational standards, allowing continued use without compromising quality.

Inventive Principle:
Principle #35Parameter changes

4Productivity

If automated code generation is used, then development speed increases, but detection of harmful code becomes more difficult

Engineering Contradiction:
Improvedevelopment speedVSAvoiddetection of harmful code
Core Design Contradiction:
ProductivityVSDifficulty of detecting and measuring

Solution Approach 1:

The system uses distinctive markers and visual differentiation to highlight LLM-generated code segments, making them visually distinguishable from manually written code. This 'color change' approach helps developers quickly identify generated portions that may contain harmful patterns, improving detection capability while maintaining the speed benefits of automated generation.

Inventive Principle:
Principle #32Color changes

Solution Approach 2:

The invention replaces manual mechanical code review with automated pattern recognition and similarity detection systems. By substituting human review mechanics with algorithmic analysis of code characteristics, the system can efficiently detect harmful patterns at scale, maintaining development speed while improving detection capability through computational methods.

Inventive Principle:
Principle #28Mechanics substitution (Replace mechanical system)

Data Source

PatentUS20250238631A1System and method for monitoring large language model usage
Publication Date: 2025.07.24 WHITESOURCE LTD
  • US20250238631A1 patent drawing
  • US20250238631A1 patent drawing
  • US20250238631A1 patent drawing

AI summary

A method, system and computer program product, the method comprising: obtaining a prompt provided to at least one large language model (LLM) for generating programming code; obtaining a code snippet generated by the at least one LLM in response to the prompt; obtaining at least one difference introduced to programmer's code; determining a similarity degree between the code snippet and the at least one difference; determining a usage degree for code containing the at least one difference, based on the similarity degree for the at least one difference; and subject to the usage degree exceeding a predetermined threshold, taking an action.