Code Block Search Using Package And Functionality Embeddings

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing semantic and neural code search techniques struggle with identifying relevant code blocks within the correct software package, often misidentifying due to domain mismatches, requiring precise queries, and facing scalability issues with large code block databases.

Innovation Solution

Code blocks are clustered by functionality using embeddings, generating package, functionality, and code block embeddings, which are then used to accurately identify relevant code blocks within the correct software package.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Measurement precision

If existing semantic and neural code search techniques are used, then code blocks can be identified, but accuracy deteriorates due to domain mismatches and package context loss

Engineering Contradiction:
Improvecode block identification accuracyVSAvoidsoftware package context information
Core Design Contradiction:
Measurement precisionVSLoss of information

Solution Approach 1:

The patent implements a hierarchical embedding structure where code block embeddings are nested within functionality cluster embeddings, which are in turn nested within software package embeddings. This nested structure preserves multiple levels of context (package-level, functionality-level, and code block-level) simultaneously, allowing the search system to maintain accurate package context information while identifying relevant code blocks.

Inventive Principle:
Principle #7Nested doll (Nesting)

Solution Approach 2:

The patent introduces a new dimensional structure by organizing code blocks into functionality clusters as an intermediate layer between individual code blocks and software packages. This adds a functionality dimension to the search space, enabling queries to match code blocks not only by syntax but also by functional semantics, thereby improving identification accuracy without losing package context.

Inventive Principle:
Principle #17Another dimension (Dimensionality change)

2Quantity of substance

If comprehensive code block databases are searched, then more code blocks can be found, but productivity deteriorates due to scalability issues

Engineering Contradiction:
Improvenumber of code blocks searchableVSAvoidsearch efficiency
Core Design Contradiction:
Quantity of substanceVSProductivity

Solution Approach 1:

The patent segments the large code block database into smaller functionality clusters grouped by software package. Instead of searching through all code blocks directly, the system first identifies relevant software packages using package embeddings, then searches only within those packages using functionality cluster embeddings. This segmentation dramatically reduces the search space while maintaining comprehensive coverage of relevant code blocks.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The patent performs preliminary organization of code blocks into functionality clusters and software package groupings before the actual search process. By pre-computing and storing hierarchical embeddings at the package and functionality levels, the system prepares the data structure in advance, enabling efficient filtering and reducing the computational burden during query execution.

Inventive Principle:
Principle #10Preliminary action

3Measurement precision

If precise queries are required for accurate results, then identification accuracy improves, but ease of operation deteriorates

Engineering Contradiction:
Improvecode block identification accuracyVSAvoidquery formulation simplicity
Core Design Contradiction:
Measurement precisionVSEase of operation

Solution Approach 1:

The patent creates a universal search system that handles multiple types of queries (functional requirements, domain-specific searches, package-level searches) through a single unified embedding-based interface. The hierarchical embedding structure allows the same search mechanism to work effectively whether the query is broad or specific, eliminating the need for users to learn different query formulations for different search scenarios.

Inventive Principle:
Principle #6Universality (Multi-functionality)

Solution Approach 2:

The patent transforms the query formulation parameters from requiring precise syntactic matching to utilizing semantic embeddings. By changing the search parameter from exact code pattern matching to vector-space similarity based on hierarchical embeddings, the system accepts natural language and diverse query formats while maintaining high identification accuracy through the semantic richness of the embedding representations.

Inventive Principle:
Principle #35Parameter changes

Data Source

PatentUS20260010352A1Identification of relevant code block within relevant software package for a query
Publication Date: 2026.01.08 MICRO FOCUS LLC
  • US20260010352A1 patent drawing
  • US20260010352A1 patent drawing
  • US20260010352A1 patent drawing

AI summary

A database stores, for each of a number of software packages, a software package embedding representing the software package. The database stores, for each software package, code block embeddings respectively representing code blocks of the software package. The database stores, for each software package, functionality embeddings respectively representing functionality clusters into which the code block embeddings representing the code blocks of the software package have been clustered. A query embedding representing a query is generated, and used to query the database to identify a relevant code block within a relevant software package for the query.