Multimodal Transformer Method Completion for Unseen Vocabulary

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing code completion systems struggle with recognizing out-of-vocabulary code elements, require excessive memory, and generate irrelevant suggestions, leading to inefficiencies in software development.

Innovation Solution

A neural transformer model is trained using multi-modal learning to predict method bodies based on method signatures and natural language text, integrating source code and natural language to capture intent and relationships between elements, and is fine-tuned for sequence-to-sequence translation tasks.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Reliability

If traditional code completion systems are used, then they can provide basic autocomplete functionality, but they fail to recognize out-of-vocabulary code elements and generate irrelevant suggestions

Engineering Contradiction:
Improvecode completion accuracyVSAvoidvocabulary recognition capability
Core Design Contradiction:
ReliabilityVSAdaptability or versatility

Solution Approach 1:

The patent transforms the code completion approach by changing from traditional rule-based or statistical methods to a neural transformer model that processes code as sequences of tokens. This parameter change enables the system to handle out-of-vocabulary elements through subword tokenization and contextual understanding, significantly improving both accuracy and vocabulary adaptability

Inventive Principle:
Principle #35Parameter changes

Solution Approach 2:

The patent replaces traditional mechanical code completion mechanisms (keyword matching, template-based completion) with a neural network-based semantic understanding system. The transformer model uses attention mechanisms to comprehend code intent and generate contextually relevant completions, eliminating the vocabulary limitations of previous mechanical systems

Inventive Principle:
Principle #28Mechanics substitution (Replace mechanical system)

2Reliability

If comprehensive code analysis is performed to improve completion quality, then prediction accuracy improves, but system complexity and memory requirements increase

Engineering Contradiction:
Improvemethod body prediction accuracyVSAvoidneural model complexity
Core Design Contradiction:
ReliabilityVSDevice complexity

Solution Approach 1:

The patent segments the code completion task into distinct components: method signature processing, natural language description analysis, and method body generation. The transformer model processes these segments separately through attention mechanisms, allowing comprehensive analysis without overwhelming system complexity. Each segment can be optimized independently

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The neural transformer model serves multiple functions simultaneously: it performs semantic understanding, syntax validation, type inference, and code generation. This multi-functionality consolidates what would otherwise require multiple separate systems, managing complexity while maintaining comprehensive analysis capabilities

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

3Productivity

If real-time code completion is provided, then development speed increases, but the system must generate relevant suggestions quickly under time constraints

Engineering Contradiction:
Improvesoftware development speedVSAvoidcompletion generation time
Core Design Contradiction:
ProductivityVSLoss of time

Solution Approach 1:

The system performs preliminary processing by tokenizing code and pre-computing attention scores for visible code portions before the completion is actually needed. This allows the model to quickly generate completions based on pre-analyzed context, reducing real-time generation time while maintaining high relevance

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The code completion system updates suggestions periodically as the developer types, rather than continuously. The transformer model re-evaluates completions at key moments (after punctuation, method calls, or significant tokens), providing real-time assistance while minimizing computational overhead and generation time

Inventive Principle:
Principle #19Periodic action

Data Source

PatentUS12450034B2Neural method completion based on natural language and source code
Publication Date: 2025.10.21 MICROSOFT TECHNOLOGY LICENSING LLC
  • US12450034B2 patent drawing
  • US12450034B2 patent drawing
  • US12450034B2 patent drawing

AI summary

A code completion tool uses a neural transformer model with attention to generate candidate sequences to complete a method body of a method signature. The neural transformer model is trained with source code programs and natural language text. The neural transformer model learns the meaning of a method name, its corresponding method parameters and types from a large corpus of unsupervised dataset of source code methods and a supervised dataset of tasks including source code constructs in combination with natural language docstrings to infer a candidate sequence of subtokens that represent a method body for a particular method signature.