Code Fingerprinting Search for Similar Snippet Reuse

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Identifying and reusing similar code across large collections of programs and applications within an organization is difficult, leading to inefficiencies and increased code generation costs.

Innovation Solution

A system and method for fingerprinting code snippets, involving normalization, k-gram computation, hashing, and winnowing to generate fingerprints, which are used to search and rank similar code snippets, excluding sanctioned software like library and boilerplate code.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Difficulty of detecting and measuring

If code search is performed in large data stores without fingerprinting, then code discovery capability is limited, but system complexity and processing time increase significantly

Engineering Contradiction:
Improvecode discovery capabilityVSAvoidsystem complexity
Core Design Contradiction:
Difficulty of detecting and measuringVSDevice complexity

Solution Approach 1:

The code is segmented into k-grams (subsequences of tokens) to create fingerprints. This segmentation transforms the complex task of comparing entire code files into simpler comparisons of smaller fingerprint segments, enabling efficient code discovery without overwhelming system complexity

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

Fingerprints serve as an intermediary representation between the original code and the search mechanism. Instead of directly comparing large code stores, the system uses computed fingerprints as mediators to enable efficient similarity detection while reducing computational burden

Inventive Principle:
Principle #24Intermediary (Mediator)

2Measurement precision

If fingerprinting is applied to all code including library and boilerplate, then search completeness is high, but result quality deteriorates due to false positives

Engineering Contradiction:
Improvesearch accuracyVSAvoidcode volume to search
Core Design Contradiction:
Measurement precisionVSQuantity of substance

Solution Approach 1:

Sanctioned code (library code, boilerplate, and other excluded code) is extracted and removed from the search index. This extraction prevents these common code patterns from generating false positive matches, improving search accuracy by focusing only on original, organization-specific code

Inventive Principle:
Principle #2Taking out (Extraction)

Solution Approach 2:

Different quality standards are applied to different portions of code. Original code is indexed with full fingerprinting for accurate matching, while sanctioned code is excluded from indexing. This local differentiation ensures that search results reflect only meaningful, organization-specific code patterns

Inventive Principle:
Principle #3Local quality

3Measurement precision

If exact code matching is used, then precision is high, but adaptability to code variations decreases

Engineering Contradiction:
Improvematch precisionVSAvoidcode variation tolerance
Core Design Contradiction:
Measurement precisionVSAdaptability or versatility

Solution Approach 1:

The fingerprinting process transforms code by changing parameters such as tokenization granularity (k-gram size) and hashing functions. These parameter transformations enable the system to match code semantically rather than exactly, accommodating variations in naming conventions, formatting, and minor syntax differences while maintaining matching precision

Inventive Principle:
Principle #35Parameter changes

Data Source

PatentUS20250348288A1Entity search engine powered by copy-detection
Publication Date: 2025.11.13 PALANTIR TECHNOLOGIES INC
  • US20250348288A1 patent drawing
  • US20250348288A1 patent drawing
  • US20250348288A1 patent drawing

AI summary

Systems and methods for identifying associations between a code snippet query and stored computer code stored. The method can receive a code query identifying a code snippet to search for, determine a fingerprint of the query code snippet, and search the stored software using the fingerprint to identify software results of code similar to the query code snippet. The fingerprint can be determined by generating k-grams of the code snippet. The k-grams used for the search can be down-selected based on a winnowing process. The method can remove from the software results code that is associated with sanctioned software. The method can include coalescing the software results to produce a subset of the software results, generating a code search user interface comprising information indicative of the subset of software results, and causing presentation of the code search user interface and displaying the subset of software results.