Multilingual Code Completion with Zero-Shot Transformer Inference

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing code completion systems are limited to recognizing a single programming language and struggle to predict code elements in unseen languages, leading to inefficiencies and errors.

Innovation Solution

A neural transformer model with attention is trained on multi-lingual datasets to predict code elements in unseen programming languages using unsupervised learning, employing decoder blocks with masked multi-head attention and model distillation to enhance accuracy.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Measurement precision

If a code completion system is designed to recognize a single programming language, then it can achieve high accuracy for that language, but it cannot predict code elements in unseen languages

Engineering Contradiction:
Improvecode prediction accuracyVSAvoidlanguage support capability
Core Design Contradiction:
Measurement precisionVSAdaptability or versatility

Solution Approach 1:

The patent applies universality by designing a code completion system that can handle multiple programming languages through a unified transformer architecture. The model is trained on multi-lingual datasets and uses language identification to route queries to appropriate language models, enabling it to predict code elements across diverse languages rather than being limited to a single language.

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

Solution Approach 2:

The patent segments the code completion task by dividing it into language-specific subtasks. A language identification component first determines the programming language, then routes the query to a specialized code completion model trained for that language. This segmentation allows each component to optimize for its specific function while the overall system maintains versatility across multiple languages.

Inventive Principle:
Principle #1Segmentation

2Device complexity

If a code completion system uses traditional methods, then it can operate with simpler architecture, but it struggles to learn patterns across diverse programming languages

Engineering Contradiction:
Improvesystem architecture simplicityVSAvoidmulti-language pattern recognition
Core Design Contradiction:
Device complexityVSAdaptability or versatility

Solution Approach 1:

The patent replaces traditional mechanical or rule-based code completion systems with a neural network-based transformer model. This substitution enables the system to learn complex patterns across diverse programming languages through training on multi-lingual datasets, rather than relying on predefined rules or simple algorithms that cannot generalize to unseen languages.

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

Solution Approach 2:

The patent changes the fundamental parameters of the code completion approach by using transformer architecture with self-attention mechanisms instead of traditional sequential processing. This allows the model to capture long-range dependencies and contextual relationships in code, improving its ability to predict code elements across different programming languages by learning from diverse training data.

Inventive Principle:
Principle #35Parameter changes

3Adaptability or versatility

If code completion models are trained on multiple programming languages, then they can generalize to unseen languages, but the model size and training complexity increase

Engineering Contradiction:
Improvezero-shot inference capabilityVSAvoidmodel size and training complexity
Core Design Contradiction:
Adaptability or versatilityVSDevice complexity

Solution Approach 1:

The patent segments the multi-language code completion task into language-specific models, each trained on a particular programming language. A language identification component determines which language is being used and routes the query to the appropriate specialized model. This segmentation allows each model to remain relatively small and focused while the overall system achieves zero-shot inference capability across multiple languages.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The patent introduces a language identification component as an intermediary between the user query and the code completion models. This mediator first determines the programming language of the input code, then routes the query to the appropriate language-specific model. This intermediary approach enables the system to handle multiple languages without requiring a single large model to learn all languages simultaneously, reducing overall training complexity.

Inventive Principle:
Principle #24Intermediary (Mediator)

Data Source

PatentEP4272070B1Multi-lingual code generation with zero-shot inference
Publication Date: 2025.08.20 MICROSOFT TECHNOLOGY LICENSING LLC
  • EP4272070B1 patent drawingFigure 1
  • EP4272070B1 patent drawingFigure 2
  • EP4272070B1 patent drawingFigure 3

AI summary

A neural transformer model with attention is trained to predict candidates to complete a line of source code with a zero-inference capability. The model is trained on an unsupervised training dataset that includes features from source code written in multiple programming languages. The features include a file-level context and a local context, where the file-level context includes a global context, a class context, a function context, and/or a method context for each class, function and/or method of the source code programs used in the training dataset. The local context includes method bodies, function bodies, and/or stand-alone code of main method routines. From these features, the model is able to learn to predict an ordered sequence of code elements that complete a line of source code in a programming language seen and not seen during training.