Grammar Mapping for Synthetic Code Training Data Generation

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Conventional large-scale language models require significant manual effort to generate training data for domain-specific programming languages with niche syntax and incomplete documentation, limiting their adaptability to new and evolving programming languages.

Innovation Solution

A many-to-many grammar mapping approach is used to automatically generate training data that maps code grammar to natural grammar, allowing language models to adapt to different code and natural grammar without manual data generation, enabling efficient training and fine-tuning for new programming languages.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Quantity of substance

If manual crowdsourcing is used to generate training data for DSLs, then training data can be obtained, but significant manual effort and time are required

Engineering Contradiction:
Improvetraining dataVSAvoidmanual effort
Core Design Contradiction:
Quantity of substanceVSLoss of time

Solution Approach 1:

The system enables self-service by allowing the grammar mapping framework to automatically generate training data without human intervention. The framework navigates the grammar mapping definition and generates code-natural language pairs autonomously, eliminating the need for manual crowdsourcing while maintaining data quality and quantity.

Inventive Principle:
Principle #25Self-service

Solution Approach 2:

The approach applies preliminary action by pre-defining grammar mappings between code languages and natural languages before training data generation is needed. These pre-established mappings enable rapid automatic generation of training data for new DSLs without requiring manual effort at the time of data generation.

Inventive Principle:
Principle #10Preliminary action

2Adaptability or versatility

If manual data generation is used for each new programming language, then training data can be created, but the process is not scalable to continuously developing languages

Engineering Contradiction:
Improveadaptability to new programming languagesVSAvoiddata generation efficiency
Core Design Contradiction:
Adaptability or versatilityVSProductivity

Solution Approach 1:

The grammar mapping framework provides universality by creating a general-purpose system that can generate training data for any programming language with a defined grammar. Instead of language-specific manual processes, the universal framework handles multiple DSLs through standardized grammar mapping, enabling both adaptability and high productivity.

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

Solution Approach 2:

The system leverages parameter changes by allowing the grammar mapping definition to be configured for different programming languages through parameter specification. When a new DSL is introduced, only the grammar parameters need to be updated, and the framework automatically adapts to generate appropriate training data, making the process both adaptable and efficient.

Inventive Principle:
Principle #35Parameter changes

3Reliability

If specialized model architecture and novel training techniques are used, then model performance improves, but system complexity increases

Engineering Contradiction:
Improvecode generation accuracyVSAvoidmodel architecture complexity
Core Design Contradiction:
ReliabilityVSDevice complexity

Solution Approach 1:

The grammar mapping definition serves as an intermediary that bridges code grammar and natural grammar. This intermediary structure provides a systematic framework for generating accurate training data, improving code generation reliability without requiring complex model architectures. The mapping framework handles the complexity of language translation at the data level rather than the model level.

Inventive Principle:
Principle #24Intermediary (Mediator)

Data Source

PatentUS12608181B2Generation of synthetic training data using grammar mapping
Publication Date: 2026.04.21 MICROSOFT TECHNOLOGY LICENSING LLC
  • US12608181B2 patent drawing
  • US12608181B2 patent drawing
  • US12608181B2 patent drawing

AI summary

The automatic generation of synthetic training data that can be used to train a language model to generate code examples following a code language based on a natural language input. Thus, new language models may be created, or existing language models may be fine-tuned, to adapt to automatically generate code without having to manually generate bulk quantities of training data. Rather, a many-to-many grammar mapping is navigated to generate training data. Specifically, the many-to-many grammar mapping maps code grammar to natural grammar. Then, each training data is generated by navigating the many-to-many grammar mapping definition to generate a mapping of a respective code expression to a respective natural language expression.