Code Block Refactoring Using LLM Similarity Segmentation

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

The limitation of processing capability in large language models (LLMs) makes it difficult to achieve accurate refactoring results for large-scale software, leading to inefficiencies in software refactoring processes.

Innovation Solution

An information processing apparatus and method that utilizes a language model to extract groups of code blocks with similar descriptions, generating common code blocks and partial code blocks based on differences, thereby refining the refactoring process by narrowing down the processing target.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Productivity

If a language model processes large-scale software refactoring directly, then refactoring coverage is improved, but processing accuracy deteriorates due to capability limitations

Engineering Contradiction:
Improverefactoring coverageVSAvoidrefactoring accuracy
Core Design Contradiction:
ProductivityVSMeasurement precision

Solution Approach 1:

The patent divides the large-scale software refactoring task into two stages: first segmenting code blocks into groups based on similarity, then performing refactoring on each group separately. This segmentation allows the language model to process manageable portions with high accuracy while collectively covering large-scale software, resolving the contradiction between coverage and accuracy.

Inventive Principle:
Principle #1Segmentation

2Speed

If the language model processes all code blocks simultaneously, then processing speed is improved, but processing quality deteriorates due to overload

Engineering Contradiction:
Improverefactoring speedVSAvoidrefactoring quality
Core Design Contradiction:
SpeedVSReliability

Solution Approach 1:

By segmenting code blocks into similarity groups and processing them sequentially rather than simultaneously, the system maintains high processing quality while achieving efficient overall refactoring. The segmentation prevents model overload and ensures reliable results for each group.

Inventive Principle:
Principle #1Segmentation

3Measurement precision

If code blocks are processed individually, then processing precision is improved, but overall productivity deteriorates due to repeated work

Engineering Contradiction:
Improverefactoring precisionVSAvoidrefactoring efficiency
Core Design Contradiction:
Measurement precisionVSProductivity

Solution Approach 1:

The patent merges similar code blocks into groups based on similarity analysis, then performs refactoring once per group. This merging eliminates repeated processing of identical patterns across multiple code blocks, significantly improving efficiency while maintaining precision through the language model's accurate handling of each merged group.

Inventive Principle:
Principle #5Merging (Combining)

Data Source

PatentUS20250362905A1Information processing apparatus, method, and non-transitory computer-readable medium
Publication Date: 2025.11.27 NEC CORP
  • US20250362905A1 patent drawing
  • US20250362905A1 patent drawing
  • US20250362905A1 patent drawing

AI summary

An information processing apparatus comprises: at least one memory storing instructions; and at least one processor configured to execute the instructions to; extract, using a predetermined language model, a group of a plurality of code blocks including a similar description determined to have high similarity of feature information of a program by the language model from at least a part of a set of a plurality of programs included in predetermined software and generate, from the plurality of code blocks belonging to the group, using the language model, a common code block in which common processing based on the similar description is described and a plurality of partial code blocks corresponding to each code block based on a difference between each code block and the similar description.