Cloud Code Generation Using Repository-Level Context

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Current code generation technologies primarily focus on line-level code completion and do not adequately consider repository-level context, leading to poor generation capability and user experience due to the lack of integration with logical structure diagrams and background knowledge.

Innovation Solution

A cloud service-based code generation method that obtains repository-level context information to generate executable code, incorporating logical structure diagrams and background knowledge, allowing for improved code generation capability and user experience.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Manufacturing precision

If line-level code completion technology is used, then code generation can be performed, but repository-level context is lost leading to poor generation capability

Engineering Contradiction:
Improvecode generation capabilityVSAvoidrepository-level context
Core Design Contradiction:
Manufacturing precisionVSLoss of information

Solution Approach 1:

The patent transitions from line-level code completion to repository-level context awareness by introducing a new dimension of context scope. The system retrieves and processes context information from multiple levels (repository, package, class, method) to generate code that is aware of the broader software architecture and existing code structure, thereby resolving the contradiction between simple line-level generation and comprehensive repository-level understanding.

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

Solution Approach 2:

The patent implements a nested context retrieval mechanism where context information is organized in hierarchical levels (repository → package → class → method). The system retrieves context from multiple nested levels simultaneously, allowing the code generation to consider both detailed local context and broader global context, thus preventing information loss while maintaining generation precision.

Inventive Principle:
Principle #7Nested doll (Nesting)

2Manufacturing precision

If repository-level context information is obtained, then code generation capability is improved, but system complexity increases

Engineering Contradiction:
Improvecode generation capabilityVSAvoidsystem complexity
Core Design Contradiction:
Manufacturing precisionVSDevice complexity

Solution Approach 1:

The patent segments the complex task of retrieving repository-level context into multiple independent steps: determining context scope, retrieving context information, and generating code. The context scope is further segmented into multiple levels (repository, package, class, method), each with its own retrieval mechanism. This segmentation reduces the complexity of handling the entire repository at once while maintaining comprehensive context awareness.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The system performs preliminary actions by pre-determining the context scope and pre-retrieving relevant context information before the actual code generation. The context scope is determined based on the code generation request, and context information is retrieved in advance, allowing the generation process to focus only on synthesizing the code rather than gathering all necessary context during generation, thus reducing overall system complexity.

Inventive Principle:
Principle #10Preliminary action

3Manufacturing precision

If more context information is retrieved, then generation effectiveness is improved, but processing time increases

Engineering Contradiction:
Improvegeneration effectivenessVSAvoidprocessing time
Core Design Contradiction:
Manufacturing precisionVSLoss of time

Solution Approach 1:

The patent applies partial action by retrieving context information from multiple levels (repository, package, class, method) selectively based on the code generation request. The system determines the appropriate context scope and retrieves only the necessary context information required for the generation task, avoiding unnecessary retrieval of the entire repository context. This balanced approach ensures sufficient context for effective generation while minimizing processing time through selective information gathering.

Inventive Principle:
Principle #16Partial or excessive action

Data Source

PatentUS20250272060A1Cloud Service-Based Code Generation Method and Apparatus
Publication Date: 2025.08.28 HUAWEI CLOUD COMPUTING TECHNOLOGIES CO LTD
  • US20250272060A1 patent drawing
  • US20250272060A1 patent drawing
  • US20250272060A1 patent drawing

AI summary

A cloud service-based code generation method includes receiving a code generation request, where the code generation request requests to generate first executable code for implementing a first method in a repository; obtaining, from information of the repository based on the code generation request, first context information needed for generating the first executable code; and generating the first executable code based on the first context information and the code generation request.