Semantic Code Embeddings for Non-Literal Plagiarism Detection
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Traditional methods for detecting copyrighted source code struggle to identify non-literal copies due to modifications like renaming variables or rearranging code blocks, are computationally intensive, and require direct access to source code, posing privacy and security risks.
Innovation Solution
A computer-automated system using semantic analysis techniques transforms source code into high-dimensional vectors for comparison via cosine similarity or L2 distance, operating without direct access to the full code and including a compression module for efficiency.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Measurement precision
If traditional text comparison or hash-based comparison methods are used, then exact copies or near-exact copies can be identified, but modifications such as renaming variables, altering formatting, or rearranging code blocks can easily evade detection
Solution Approach 1:
The patent transforms source code from its original textual form into semantic embeddings (vector representations) that capture the meaning and functionality of the code. This parameter transformation allows the system to compare code based on semantic similarity rather than literal text matching, enabling detection of non-literal copies where variables are renamed, formatting is altered, or code structure is rearranged while preserving functionality.
Solution Approach 2:
The patent replaces traditional mechanical text comparison mechanisms with semantic analysis using large language models. Instead of comparing characters, words, or hash values, the system uses neural network-based semantic embeddings to understand and compare the meaning of code segments, enabling detection of functionally equivalent code that has been obfuscated through various transformations.
2Measurement precision
If traditional text comparison methods are used on large codebases, then copyright infringement can be detected, but the process becomes computationally intensive and time-consuming
Solution Approach 1:
The patent extracts only the essential semantic information from source code by transforming it into compact vector embeddings. This extraction process removes redundant textual details (such as comments, whitespace, variable names) while preserving the core functional meaning, resulting in a more efficient representation that can be compared much faster than full text comparison while maintaining detection accuracy.
Solution Approach 2:
The patent changes the representation parameter of code from verbose text to compact semantic vectors. This parameter transformation reduces the dimensionality and complexity of the data being compared, enabling faster computational processing while preserving the ability to detect semantic similarity and potential copyright infringement.
3Measurement precision
If complete source code is accessed for comparison, then accurate plagiarism detection can be performed, but privacy and security risks increase due to potential data exposure
Solution Approach 1:
The patent extracts only the semantic essence of source code into vector embeddings without requiring access to or storage of the complete original code. This extraction approach allows plagiarism detection to be performed on compressed semantic representations, significantly reducing the risk of data exposure while maintaining detection accuracy. The full source code never needs to be transmitted or stored in the comparison system.
Solution Approach 2:
The patent introduces semantic embeddings as an intermediary between the original source code and the comparison process. Instead of directly comparing full source code texts, the system compares these intermediary vector representations that capture semantic meaning. This intermediary layer protects the original code from exposure while enabling accurate plagiarism detection through semantic similarity comparison.
Data Source
AI summary
One embodiment of the present invention relates to a computer-automated system and method for identifying copyrighted source code embedded within other source code files, utilizing advanced semantic analysis techniques. This embodiment of the invention addresses the challenge of detecting both literal and non-literal copies of copyrighted code, including instances where the code has been modified in non-semantic ways, such as through renaming variables, changing formatting, or rearranging code blocks. This embodiment creates semantic embeddings of source code using a large language model (LLM). Each segment of source code is transformed into a high-dimensional vector that captures its semantic essence, rather than its literal text. These vectors are then compared using sophisticated similarity metrics, such as cosine similarity or L2 distance, to determine the likelihood of copyright infringement. This embodiment can operate without direct access to the full source code, thereby enhancing privacy and security. Instead, the system works with embeddings that represent the semantic information of the code, significantly reducing the risk of data exposure. Additionally, this embodiment of the invention includes an optional compression module that further minimizes the data footprint by compressing the semantic vectors, enhancing the system's efficiency and scalability. This embodiment of the invention is particularly suited for use in environments where large volumes of code need to be analyzed quickly and accurately, such as in continuous integration/continuous deployment (CI/CD) pipelines. It provides a robust, scalable, and secure solution for managing copyright compliance in software development, offering significant improvements over traditional text-based or hash-based comparison methods.


