Large Model Code Generation Using Personalized Context

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing large models struggle to generate codes that meet the specific usage requirements of developers, as they often rely on general domain knowledge texts not included in the training corpus, leading to inaccurate code generation.

Innovation Solution

A method and apparatus for generating code based on a large model, which involves acquiring a descriptive text input by the user, searching for positive and negative codes based on user preferences, generating a second descriptive text, and inputting it into the large model to output a target code matching the requirement.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Adaptability or versatility

If general domain knowledge texts are used for code generation, then the large model can generate code based on common programming patterns, but the generated code cannot meet the specific usage requirements of individual developers

Engineering Contradiction:
Improvecode generation adaptabilityVSAvoidcode accuracy
Core Design Contradiction:
Adaptability or versatilityVSManufacturing precision

Solution Approach 1:

The patent applies local quality by transitioning from general domain knowledge to developer-specific knowledge. The system retrieves historical codes and descriptions specifically related to the current developer from a database, creating localized, personalized code generation based on individual developer patterns and preferences rather than using universal programming knowledge.

Inventive Principle:
Principle #3Local quality

Solution Approach 2:

The patent uses copying by retrieving and utilizing historical codes previously generated for the same developer. The system copies the coding style, patterns, and preferences from past developer outputs to generate new code, ensuring consistency with the developer's specific requirements and established workflows.

Inventive Principle:
Principle #26Copying

2Productivity

If the large model generates code without considering user preferences, then the code generation process is simple and fast, but the generated code does not align with developer-specific requirements

Engineering Contradiction:
Improvecode generation speedVSAvoidcode reliability
Core Design Contradiction:
ProductivityVSReliability

Solution Approach 1:

The patent applies preliminary action by pre-retrieving and storing historical codes and descriptions associated with each developer before the code generation process. This preliminary organization of developer-specific data enables the system to quickly access relevant information during code generation, maintaining speed while improving reliability through personalized context.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The patent uses an intermediary mechanism in the form of a database that stores and manages historical codes and descriptions. This intermediary component bridges the large model and developer preferences, allowing the model to access and incorporate developer-specific information without directly complexifying the generation process itself.

Inventive Principle:
Principle #24Intermediary (Mediator)

3Manufacturing precision

If the system stores and processes historical codes for each developer, then code generation can be personalized to match developer preferences, but the system complexity increases

Engineering Contradiction:
Improvecode precisionVSAvoidsystem complexity
Core Design Contradiction:
Manufacturing precisionVSDevice complexity

Solution Approach 1:

The patent applies universality by designing a single database structure that serves multiple functions: storing historical codes, storing descriptions, associating codes with developers, and enabling retrieval operations. This multi-functional database design achieves personalized code generation without proportionally increasing system complexity.

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

Data Source

PatentUS20250094139A1Method of generating code based on large model, electronic device, and storage medium
Publication Date: 2025.03.20 BEIJING BAIDU NETCOM SCI & TECH CO LTD
  • US20250094139A1 patent drawing
  • US20250094139A1 patent drawing
  • US20250094139A1 patent drawing

AI summary

A method of generating a code based on a large model, an electronic device and a storage medium are provided, which relate to the field of artificial intelligence technology, in particular to the fields of deep learning technology and large model technology. The method includes: acquiring a first descriptive text input by a user, where the first descriptive text is configured to characterize a code requirement; searching for a positive code and a negative code matching the first descriptive text, where each of the positive code and the negative code is determined based on a preference operation of the user for a historical code output by the large model; generating a second descriptive text according to the first descriptive text, the positive code, and the negative code; and inputting the second descriptive text into the large model to output a target code matching the code requirement.