Multi-lingual Code Completion via Subtokenization

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing software development environments face challenges with code completion systems that fail to recognize out-of-vocabulary code elements, require excessive memory, take too long to generate candidate lists, or provide irrelevant suggestions.

Innovation Solution

A multi-lingual line-of-code completion system using a neural transformer model trained on a large unsupervised dataset of source code programs from various programming languages, which predicts the most likely candidates to complete a line of source code by encoding frequently-used elements as tokens and less frequent elements as subtokens.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Adaptability or versatility

If a traditional code completion system uses a large vocabulary to cover all possible code elements, then it can recognize more code elements, but it requires excessive memory and takes too long to generate candidate lists

Engineering Contradiction:
Improvecode element recognition capabilityVSAvoidvocabulary size
Core Design Contradiction:
Adaptability or versatilityVSQuantity of substance

Solution Approach 1:

The patent segments the code completion task into two parts: a small vocabulary of common code elements (tokens) and a mechanism to handle rare elements (out-of-vocabulary tokens) through subtokenization. This segmentation allows the system to maintain a manageable vocabulary size while still being able to represent and complete rare code elements by breaking them down into smaller subtokens, thus resolving the contradiction between comprehensive recognition capability and vocabulary size.

Inventive Principle:
Principle #1Segmentation

2Adaptability or versatility

If a code completion system uses a large vocabulary to cover all possible code elements, then it can recognize more code elements, but it increases memory requirements

Engineering Contradiction:
Improvecode element recognition capabilityVSAvoidmemory requirement
Core Design Contradiction:
Adaptability or versatilityVSWeight of stationary object

Solution Approach 1:

The patent applies segmentation by dividing the code vocabulary into frequent tokens and rare subtokens. This allows the system to store only the essential frequent tokens in the main vocabulary (reducing memory) while using subtokenization to handle rare elements on-demand, thus maintaining comprehensive recognition capability with reduced memory requirements.

Inventive Principle:
Principle #1Segmentation

3Reliability

If a code completion system generates a comprehensive list of candidates to ensure relevance, then it provides better completion suggestions, but it takes too long to generate the list

Engineering Contradiction:
Improvecompletion suggestion relevanceVSAvoidcandidate generation time
Core Design Contradiction:
ReliabilityVSLoss of time

Solution Approach 1:

The patent applies partial action by generating only the top-k most likely candidates rather than exhaustively listing all possible completions. The system uses the segmented vocabulary (tokens and subtokens) to efficiently compute and rank the most relevant candidates, providing sufficient relevance without the time cost of generating comprehensive lists of all possible code elements.

Inventive Principle:
Principle #16Partial or excessive action

Data Source

PatentUS12229533B2Multi-lingual line-of-code completion system
Publication Date: 2025.02.18 MICROSOFT TECHNOLOGY LICENSING LLC
  • US12229533B2 patent drawing
  • US12229533B2 patent drawing
  • US12229533B2 patent drawing

AI summary

A code completion tool uses a neural transformer model to generate candidate sequences to complete a line of source code. The neural transformer model is trained using a conditional language modeling objective on a large unsupervised dataset that includes source code programs written in several different programming languages. The neural transformer model is used within a beam search that predicts the most likely candidate sequences for a code snippet under development.