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.